linuxrouting

package
v1.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ip net.IP) error

Delete removes the ingress and egress rules that control traffic for endpoints. Note that the routes within these rules are not deleted as they can be reused when another endpoint is created on the same node. The reason for this is that ENI devices under-the-hood are simply network interfaces and all network interfaces have an ifindex. This index is then used as the table ID when these rules are created. The routes are created inside a table with this ID, and because this table ID equals the ENI ifindex, it's stable to rely on and therefore can be reused.

Types

type RoutingInfo

type RoutingInfo struct {
	// IPv4Gateway is the gateway where outbound/egress traffic is directed.
	IPv4Gateway net.IP

	// IPv4CIDRs is a list of CIDRs which the ENI device has access to. In most
	// cases, it'll at least contain the CIDR of the IPv4Gateway IP address.
	IPv4CIDRs []net.IPNet

	// MasterIfMAC is the MAC address of the master interface that egress
	// traffic is directed to. This is the MAC of the ENI itself which
	// corresponds to the IPv4Gateway IP addr.
	MasterIfMAC mac.MAC
}

RoutingInfo represents information that's required to enable connectivity via the local rule and route tables while in ENI mode. The information in this struct is used to create rules and routes which direct traffic out of the ENI devices (egress).

This struct is mostly derived from the `ipam.AllocationResult` as the information comes from IPAM.

func NewRoutingInfo

func NewRoutingInfo(gateway string, cidrs []string, mac string) (*RoutingInfo, error)

NewRoutingInfo creates a new RoutingInfo struct, from data that will be parsed and validated. Note, this code assumes IPv4 values because ENI + IPv4 is the only supported path currently.

func (*RoutingInfo) Configure

func (info *RoutingInfo) Configure(ip net.IP, mtu int, masq bool) error

Configure sets up the rules and routes needed when running in ENI mode. These rules and routes direct egress traffic out of the ENI device and ingress traffic back to the endpoint (`ip`).

ip: The endpoint IP address to direct traffic out / from ENI device. info: The ENI device routing info used to create rules and routes. mtu: The ENI device MTU. masq: Whether masquerading is enabled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL