connector

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 24 Imported by: 6

Documentation

Overview

Package connector is responsible for the datapath specific plumbing to connect an endpoint to the network

Index

Constants

View Source
const (
	ModeUnspec   = Mode("")
	ModeAuto     = Mode(dpoption.DatapathModeAuto)
	ModeVeth     = Mode(dpoption.DatapathModeVeth)
	ModeNetkit   = Mode(dpoption.DatapathModeNetkit)
	ModeNetkitL2 = Mode(dpoption.DatapathModeNetkitL2)
)
View Source
const (
	// ContainerInterfacePrefix is the container's internal interface name prefix.
	ContainerInterfacePrefix = "cilium"
)
View Source
const (
	// HostInterfacePrefix is the Host interface prefix.
	HostInterfacePrefix = "lxc"
)

Variables

View Source
var Cell = cell.Module(
	"connector",
	"Datapath connector configuration mutator",

	cell.Provide(newConnectorConfig),
)

Functions

func CniAltName added in v1.18.11

func CniAltName(ifName string) string

CniAltName returns the altname for this `ifName`

func DeleteLinkPair added in v1.20.0

func DeleteLinkPair(cfg LinkConfig) error

func DisableRpFilter

func DisableRpFilter(sysctl sysctl.Sysctl, ifName string) error

DisableRpFilter tries to disable rpfilter on specified interface

func Endpoint2IfName

func Endpoint2IfName(endpointID string) string

Endpoint2IfName returns the host interface name for the given endpointID.

func Endpoint2TempIfName

func Endpoint2TempIfName(endpointID string) string

Endpoint2TempIfName returns the temporary interface name for the given endpointID.

func IPv4Gateway

func IPv4Gateway(addr *models.NodeAddressing) string

IPv4Gateway returns the IPv4 gateway address for endpoints.

func IPv4Routes

func IPv4Routes(addr *models.NodeAddressing, linkMTU int) ([]route.Route, error)

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

func IPv6Routes(addr *models.NodeAddressing, linkMTU int) ([]route.Route, error)

IPv6Routes returns IPv6 routes to be installed in endpoint's networking namespace.

func IsCiliumManagedLink(link netlink.Link) bool

IsCiliumManagedLink returns true if the link was created by Cilium, identified by the presence of the CniAltName(ifname) altname attribute.

func NewLinkPair added in v1.20.0

func NewLinkPair(
	log *slog.Logger,
	mode Mode,
	cfg LinkConfig,
	sysctl sysctl.Sysctl,
) (*linkPair, error)

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.

Types

type Config added in v1.20.0

type Config interface {
	Reinitialize() error
	GetPodDeviceHeadroom() uint16
	GetPodDeviceTailroom() uint16
	GetConfiguredMode() Mode
	GetOperationalMode() Mode
	NewLinkPair(cfg LinkConfig, sysctl sysctl.Sysctl) (LinkPair, error)
	GetLinkCompatibility(ifName string) (Mode, bool, error)
}

type LinkConfig added in v1.18.0

type LinkConfig struct {
	// EndpointID defines the container ID to which we are creating a new
	// linkpair. Set this if you want the connector to generate interface
	// names itself. Otherwise, set HostIfName and PeerIfName.
	EndpointID string

	// HostIfName defines the interface name as seen in the host namespace.
	HostIfName string

	// PeerIfName defines the interface name as seen in the container namespace.
	PeerIfName string

	// PeerNamespace defines the namespace the peer link should be moved into.
	PeerNamespace *netns.NetNS

	GROIPv6MaxSize int
	GSOIPv6MaxSize int

	GROIPv4MaxSize int
	GSOIPv4MaxSize int

	DeviceMTU      int
	DeviceHeadroom uint16
	DeviceTailroom uint16
}

LinkConfig contains the GRO/GSO, MTU values and buffer margins to be configured on both sides of the created veth or netkit pair.

type LinkPair added in v1.20.0

type LinkPair interface {
	GetHostLink() netlink.Link
	GetPeerLink() netlink.Link
	GetMode() Mode
	Delete() error
}

type Mode added in v1.20.0

type Mode string

func ModeByName added in v1.20.0

func ModeByName(mode string) Mode

func (Mode) IsLayer2 added in v1.20.0

func (mode Mode) IsLayer2() bool

func (Mode) IsNetkit added in v1.20.0

func (mode Mode) IsNetkit() bool

func (Mode) IsVeth added in v1.20.0

func (mode Mode) IsVeth() bool

func (Mode) String added in v1.20.0

func (mode Mode) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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