linux

package
v1.21.0-pre.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 69 Imported by: 5

Documentation

Overview

Package linux implements the Linux specific datapath implementation

Index

Constants

This section is empty.

Variables

View Source
var BackendNeighborSyncCell = cell.Module(
	"backend-neighbor-sync",
	"Synchronizes backends to Linux neighbors table",

	cell.Invoke(registerBackendNeighborSync),
)

BackendNeighborSyncCell watches Table[*loadbalancer.Backend] and inserts/deletes the forwardable IP entries for each backend address.

This is needed by XDP program to be able to resolve the hardware address of the backend as it cannot use the neighbor sub-system to resolve it on-demand.

View Source
var DevicesControllerCell = cell.Module(
	"devices-controller",
	"Synchronizes the device route and neighbor tables with the kernel",

	cell.ProvidePrivate(
		tables.NewDeviceTable,
		tables.NewRouteTable,
		tables.NewNeighborTable,
	),

	cell.Provide(
		newDevicesController,
	),
	cell.Config(DevicesConfig{}),

	cell.Invoke(func(*devicesController) {}),
)

DevicesControllerCell registers a controller that subscribes to network devices and routes via netlink and populates the devices, routes and neighbors.

Functions

func CheckRequirements added in v1.16.0

func CheckRequirements(log *slog.Logger) error

CheckRequirements checks that minimum kernel requirements are met for configuring the BPF datapath.

func NewNodeHandler

func NewNodeHandler(
	lifecycle cell.Lifecycle,
	log *slog.Logger,
	tunnelConfig dpTunnel.Config,
	nodeMap nodemap.MapV2,
	nodeConfigNotifier *manager.NodeConfigNotifier,
	kprCfg kpr.KPRConfig,
	ipsecAgent ipsecTypes.Agent,
	localNodeStore *node.LocalNodeStore,
	nodePolicy *NodePolicy,
	params reconciler.Params,
	nodes statedb.Table[*node.Node],
	health cell.Health,
	daemonConfig *option.DaemonConfig,
) node.IDHandler

NewNodeHandler constructs the Linux node datapath and provides node ID lookups.

func NodeDeviceNameWithDefaultRoute

func NodeDeviceNameWithDefaultRoute(logger *slog.Logger) (string, error)

NodeDeviceNameWithDefaultRoute returns the node's device name which handles the default route in the current namespace

func NodeEnsureLocalRoutingRule

func NodeEnsureLocalRoutingRule() error

NodeEnsureLocalRoutingRule moves the kernel's default '0: from all lookup local' ip rule up to priority 100 to create space for Cilium to install rules with a lower pref (meaning a higher priority).

Cilium's 'new' rule is always installed before removing the default one with pref 0 to avoid breaking local packet delivery.

func RegisterNodeReconciler

func RegisterNodeReconciler(writer *node.Writer)

RegisterNodeReconciler declares the Linux datapath as a required node reconciler during Hive construction.

Types

type DatapathConfiguration

type DatapathConfiguration struct {
	// HostDevice is the name of the device to be used to access the host.
	HostDevice string

	// TunnelDevice is the name of the tunnel device (if any).
	TunnelDevice string
}

DatapathConfiguration is the static configuration of the datapath. The configuration cannot change throughout the lifetime of a datapath object.

type DevicesConfig

type DevicesConfig struct {
	// Devices is the user-specified devices to use. This can be
	// either concrete devices ("eth0,eth1"), or a wildcard "eth+".
	// If empty the devices are auto-detected according to rules defined
	// by isSelectedDevice().
	Devices []string
	// ForceDeviceDetection forces the auto-detection of devices,
	// even if user-specific devices are explicitly listed.
	ForceDeviceDetection bool
}

func (DevicesConfig) Flags added in v1.16.0

func (c DevicesConfig) Flags(flags *pflag.FlagSet)
type NeighLink struct {
	Name string `json:"link-name"`
}

NeighLink contains the details of a NeighLink

type NodePolicy

type NodePolicy struct {
	// contains filtered or unexported fields
}

NodePolicy controls policy decisions made while reconciling Linux node datapath state. Policy overrides must be installed during Hive construction, before the Linux node reconciler starts.

func NewNodePolicy

func NewNodePolicy(lifecycle cell.Lifecycle) *NodePolicy

NewNodePolicy constructs the Linux node reconciliation policy and seals it when the Hive lifecycle starts.

func (*NodePolicy) EnableEncapsulation

func (p *NodePolicy) EnableEncapsulation(n *nodeTypes.Node, defaultValue bool) bool

EnableEncapsulation returns the per-node encapsulation decision. The caller supplies the current datapath configuration as the default because it may change after the policy has been constructed.

func (*NodePolicy) SetEnableEncapsulation

func (p *NodePolicy) SetEnableEncapsulation(fn func(*nodeTypes.Node) bool)

SetEnableEncapsulation overrides the per-node encapsulation decision.

func (*NodePolicy) Start

func (p *NodePolicy) Start(cell.HookContext) error

Start implements cell.HookInterface.

func (*NodePolicy) Stop

Stop implements cell.HookInterface.

Directories

Path Synopsis
Package bandwidth provides efficient EDT-based rate-limiting.
Package bandwidth provides efficient EDT-based rate-limiting.
Package bigtcp provides helpers to probe and enable BIG TCP for the Linux datapath
Package bigtcp provides helpers to probe and enable BIG TCP for the Linux datapath
Package ipsec provides the Linux datapath specific abstraction and useful helpers to manage IPSec via Linux xfrm.
Package ipsec provides the Linux datapath specific abstraction and useful helpers to manage IPSec via Linux xfrm.
Package linux_defaults provides the Linux datapath defaults
Package linux_defaults provides the Linux datapath defaults
Package probes provides BPF features checks based on bpftool.
Package probes provides BPF features checks based on bpftool.
Package route provides the Cilium specific abstraction and useful helpers to manage network routes
Package route provides the Cilium specific abstraction and useful helpers to manage network routes
Package sysctl allows to change kernel parameters at runtime.
Package sysctl allows to change kernel parameters at runtime.
Package utime converts between time.Time and Unix Epoch time in 512ns time unit.
Package utime converts between time.Time and Unix Epoch time in 512ns time unit.

Jump to

Keyboard shortcuts

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