Documentation ¶
Overview ¶
Package connector is responsible for the datapath specific plumbing to connect an endpoint to the network
Index ¶
- func CreateAndSetupIpvlanSlave(id string, slaveIfName string, netNs ns.NetNS, mtu int, masterDev int, ...) (int, error)
- func CreateIpvlanSlave(id string, mtu, masterDev int, mode string, ep *models.EndpointChangeRequest) (*netlink.IPVlan, *netlink.Link, string, error)
- func DeriveEndpointFrom(hostDevice, containerID string, pid int) (*models.EndpointChangeRequest, error)
- func DisableRpFilter(ifName string) error
- func Endpoint2IfName(endpointID string) string
- func Endpoint2TempIfName(endpointID string) string
- func Endpoint2TempRandIfName() string
- func GetNetInfoFromPID(pid int) (int, string, net.IP, error)
- func GetVethInfo(nodeIfName string, parentIdx int, netNSMac string, ...) error
- func IPv4Gateway(addr *models.NodeAddressing) string
- func IPv4Routes(addr *models.NodeAddressing, linkMTU int) ([]route.Route, error)
- func IPv6Gateway(addr *models.NodeAddressing) string
- func IPv6Routes(addr *models.NodeAddressing, linkMTU int) ([]route.Route, error)
- func SetupIpvlanInRemoteNs(netNs ns.NetNS, srcIfName, dstIfName string) (int, int, error)
- func SetupVeth(id string, mtu int, ep *models.EndpointChangeRequest) (*netlink.Veth, *netlink.Link, string, error)
- func SetupVethRemoteNs(netNs ns.NetNS, srcIfName, dstIfName string) (int, int, error)
- func SetupVethWithNames(lxcIfName, tmpIfName string, mtu int, ep *models.EndpointChangeRequest) (*netlink.Veth, *netlink.Link, error)
- func SufficientAddressing(addr *models.NodeAddressing) error
- func WriteSysConfig(fileName, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAndSetupIpvlanSlave ¶
func CreateAndSetupIpvlanSlave(id string, slaveIfName string, netNs ns.NetNS, mtu int, masterDev int, mode string, ep *models.EndpointChangeRequest) (int, error)
CreateAndSetupIpvlanSlave creates an ipvlan slave device for the given master device, moves it to the given network namespace, and finally initializes it (see SetupIpvlanInRemoteNs).
func CreateIpvlanSlave ¶
func CreateIpvlanSlave(id string, mtu, masterDev int, mode string, ep *models.EndpointChangeRequest) (*netlink.IPVlan, *netlink.Link, string, error)
CreateIpvlanSlave creates an ipvlan slave in L3 based on the master device.
func DeriveEndpointFrom ¶
func DeriveEndpointFrom(hostDevice, containerID string, pid int) (*models.EndpointChangeRequest, error)
func DisableRpFilter ¶ added in v1.6.0
DisableRpFilter tries to disable rpfilter on specified interface
func Endpoint2IfName ¶
Endpoint2IfName returns the host interface name for the given endpointID.
func Endpoint2TempIfName ¶
Endpoint2TempIfName returns the temporary interface name for the given endpointID.
func Endpoint2TempRandIfName ¶
func Endpoint2TempRandIfName() string
Endpoint2TempRandIfName returns a random, temporary interface name for the given endpointID. This is similar to Endpoint2TempIfName() but uses a random string instead of endpoint ID.
func GetNetInfoFromPID ¶
GetNetInfoFromPID returns the index of the interface parent, the MAC address and IP address of the first interface that contains an IP address with global scope.
func GetVethInfo ¶
func GetVethInfo(nodeIfName string, parentIdx int, netNSMac string, ep *models.EndpointChangeRequest) error
GetVethInfo populates the given endpoint with the arguments provided where * nodeIfName - Node Interface Name * parentIdx - Interface Index of the container veth pair in the host side. * netNSMac - MAC address of the veth pair in the container side.
func IPv4Gateway ¶
func IPv4Gateway(addr *models.NodeAddressing) string
IPv4Gateway returns the IPv4 gateway address for endpoints.
func IPv4Routes ¶
IPv4Routes returns IPv4 routes to be installed in endpoint's networking namespace.
func IPv6Gateway ¶
func IPv6Gateway(addr *models.NodeAddressing) string
IPv6Gateway returns the IPv6 gateway address for endpoints.
func IPv6Routes ¶
IPv6Routes returns IPv6 routes to be installed in endpoint's networking namespace.
func SetupIpvlanInRemoteNs ¶
SetupIpvlanInRemoteNs creates a tail call map, renames the netdevice inside the target netns and attaches a BPF program to it on egress path which then jumps into the tail call map index 0.
NB: Do not close the returned mapFd before it has been pinned. Otherwise, the map will be destroyed.
func SetupVeth ¶
func SetupVeth(id string, mtu int, ep *models.EndpointChangeRequest) (*netlink.Veth, *netlink.Link, string, error)
SetupVeth sets up the net interface, the temporary interface and fills up some endpoint fields such as LXCMAC, NodeMac, IfIndex and IfName. Returns a pointer for the created veth, a pointer for the temporary link, the name of the temporary link and error if something fails.
func SetupVethRemoteNs ¶
SetupVethRemoteNs renames the netdevice in the target namespace to the provided dstIfName.
func SetupVethWithNames ¶
func SetupVethWithNames(lxcIfName, tmpIfName string, mtu int, ep *models.EndpointChangeRequest) (*netlink.Veth, *netlink.Link, error)
SetupVethWithNames sets up the net interface, the temporary interface and fills up some endpoint fields such as LXCMAC, NodeMac, IfIndex and IfName. Returns a pointer for the created veth, a pointer for the temporary link, the name of the temporary link and error if something fails.
func SufficientAddressing ¶
func SufficientAddressing(addr *models.NodeAddressing) error
SufficientAddressing returns an error if the provided NodeAddressing does not provide sufficient information to derive all IPAM required settings.
func WriteSysConfig ¶
WriteSysConfig tries to emulate a sysctl call by writing directly to the given fileName the given value.
Types ¶
This section is empty.