config

package
v1.18.7 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package config contains objects used to configure the eBPF datapath.

Index

Constants

View Source
const ConstantPrefix = "__config_"

ConstantPrefix is the prefix used to declare configuration constants in the datapath's BPF C code. Must match the prefix used by the CONFIG macro in static_data.h.

View Source
const Section = ".rodata.config"

Section is the ELF section used to store configuration variables for the Cilium datapath. Must match the section used by the CONFIG macro in static_data.h.

View Source
const TagName = "config"

TagName is the name of the struct tag used to annotate configuration fields.

Variables

This section is empty.

Functions

func StructToMap

func StructToMap(obj any) (map[string]any, error)

StructToMap converts an instance of a Go struct generated by [varsToStruct] into a map of configuration values to be passed to LoadCollection.

Only struct members with a `config` tag are included. The tag value is used as the key in the map, and the map value is the runtime value of the member.

Types

type BPFHost

type BPFHost struct {
	// MTU of the device the bpf program is attached to (default: MTU set in
	// node_config.h by agent).
	DeviceMTU uint16 `config:"device_mtu"`
	// Length of the Ethernet header on this device. May be set to zero on L2-less
	// devices. (default __ETH_HLEN).
	EthHeaderLength uint8 `config:"eth_header_length"`
	// Ifindex of the interface the bpf program is attached to.
	InterfaceIfindex uint32 `config:"interface_ifindex"`
	// MAC address of the interface the bpf program is attached to.
	InterfaceMAC [8]byte `config:"interface_mac"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade [4]byte `config:"nat_ipv4_masquerade"`
	// Masquerade address for IPv6 traffic.
	NATIPv6Masquerade [16]byte `config:"nat_ipv6_masquerade"`
	// Pull security context from IP cache.
	SecctxFromIPCache bool `config:"secctx_from_ipcache"`
	// The endpoint's security label.
	SecurityLabel uint32 `config:"security_label"`

	Node
}

BPFHost is a configuration struct for a Cilium datapath object. Warning: do not instantiate directly! Always use NewBPFHost to ensure the default values configured in the ELF are honored.

func NewBPFHost

func NewBPFHost(node Node) *BPFHost

type BPFLXC

type BPFLXC struct {
	// MTU of the device the bpf program is attached to (default: MTU set in
	// node_config.h by agent).
	DeviceMTU uint16 `config:"device_mtu"`
	// The endpoint's security ID.
	EndpointID uint16 `config:"endpoint_id"`
	// The endpoint's IPv4 address.
	EndpointIPv4 [4]byte `config:"endpoint_ipv4"`
	// The endpoint's IPv6 address.
	EndpointIPv6 [16]byte `config:"endpoint_ipv6"`
	// The endpoint's network namespace cookie.
	EndpointNetNSCookie uint64 `config:"endpoint_netns_cookie"`
	// Ifindex of the interface the bpf program is attached to.
	InterfaceIfindex uint32 `config:"interface_ifindex"`
	// MAC address of the interface the bpf program is attached to.
	InterfaceMAC [8]byte `config:"interface_mac"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade [4]byte `config:"nat_ipv4_masquerade"`
	// Masquerade address for IPv6 traffic.
	NATIPv6Masquerade [16]byte `config:"nat_ipv6_masquerade"`
	// The log level for policy verdicts in workload endpoints.
	PolicyVerdictLogFilter uint32 `config:"policy_verdict_log_filter"`
	// Pull security context from IP cache.
	SecctxFromIPCache bool `config:"secctx_from_ipcache"`
	// The endpoint's security label.
	SecurityLabel uint32 `config:"security_label"`

	Node
}

BPFLXC is a configuration struct for a Cilium datapath object. Warning: do not instantiate directly! Always use NewBPFLXC to ensure the default values configured in the ELF are honored.

func NewBPFLXC

func NewBPFLXC(node Node) *BPFLXC

type BPFNetwork

type BPFNetwork struct {
	Node
}

BPFNetwork is a configuration struct for a Cilium datapath object. Warning: do not instantiate directly! Always use NewBPFNetwork to ensure the default values configured in the ELF are honored.

func NewBPFNetwork

func NewBPFNetwork(node Node) *BPFNetwork

type BPFOverlay

type BPFOverlay struct {
	// MTU of the device the bpf program is attached to (default: MTU set in
	// node_config.h by agent).
	DeviceMTU uint16 `config:"device_mtu"`
	// Ifindex of the interface the bpf program is attached to.
	InterfaceIfindex uint32 `config:"interface_ifindex"`
	// MAC address of the interface the bpf program is attached to.
	InterfaceMAC [8]byte `config:"interface_mac"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade [4]byte `config:"nat_ipv4_masquerade"`
	// Masquerade address for IPv6 traffic.
	NATIPv6Masquerade [16]byte `config:"nat_ipv6_masquerade"`
	// Pull security context from IP cache.
	SecctxFromIPCache bool `config:"secctx_from_ipcache"`

	Node
}

BPFOverlay is a configuration struct for a Cilium datapath object. Warning: do not instantiate directly! Always use NewBPFOverlay to ensure the default values configured in the ELF are honored.

func NewBPFOverlay

func NewBPFOverlay(node Node) *BPFOverlay

type BPFWireguard

type BPFWireguard struct {
	// MTU of the device the bpf program is attached to (default: MTU set in
	// node_config.h by agent).
	DeviceMTU uint16 `config:"device_mtu"`
	// Ifindex of the interface the bpf program is attached to.
	InterfaceIfindex uint32 `config:"interface_ifindex"`
	// MAC address of the interface the bpf program is attached to.
	InterfaceMAC [8]byte `config:"interface_mac"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade [4]byte `config:"nat_ipv4_masquerade"`
	// Masquerade address for IPv6 traffic.
	NATIPv6Masquerade [16]byte `config:"nat_ipv6_masquerade"`
	// Pull security context from IP cache.
	SecctxFromIPCache bool `config:"secctx_from_ipcache"`

	Node
}

BPFWireguard is a configuration struct for a Cilium datapath object. Warning: do not instantiate directly! Always use NewBPFWireguard to ensure the default values configured in the ELF are honored.

func NewBPFWireguard

func NewBPFWireguard(node Node) *BPFWireguard

type BPFXDP

type BPFXDP struct {
	// MTU of the device the bpf program is attached to (default: MTU set in
	// node_config.h by agent).
	DeviceMTU uint16 `config:"device_mtu"`
	// Ifindex of the interface the bpf program is attached to.
	InterfaceIfindex uint32 `config:"interface_ifindex"`
	// MAC address of the interface the bpf program is attached to.
	InterfaceMAC [8]byte `config:"interface_mac"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade [4]byte `config:"nat_ipv4_masquerade"`
	// Masquerade address for IPv6 traffic.
	NATIPv6Masquerade [16]byte `config:"nat_ipv6_masquerade"`
	// Pull security context from IP cache.
	SecctxFromIPCache bool `config:"secctx_from_ipcache"`

	Node
}

BPFXDP is a configuration struct for a Cilium datapath object. Warning: do not instantiate directly! Always use NewBPFXDP to ensure the default values configured in the ELF are honored.

func NewBPFXDP

func NewBPFXDP(node Node) *BPFXDP

type Node

type Node struct {
	// Internal IPv6 router address assigned to the cilium_host interface.
	RouterIPv6 [16]byte `config:"router_ipv6"`
	// IPv4 source address used for SNAT when a Pod talks to itself over a Service.
	ServiceLoopbackIPv4 [4]byte `config:"service_loopback_ipv4"`
	// Length of payload to capture when tracing native packets.
	TracePayloadLen uint32 `config:"trace_payload_len"`
	// Length of payload to capture when tracing overlay packets.
	TracePayloadLenOverlay uint32 `config:"trace_payload_len_overlay"`
}

Node is a configuration struct for a Cilium datapath object. Warning: do not instantiate directly! Always use NewNode to ensure the default values configured in the ELF are honored.

func NewNode

func NewNode() *Node

Jump to

Keyboard shortcuts

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