config

package
v1.18.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 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"`
	// Pull security context from IP cache.
	HostSecctxFromIPCache uint32 `config:"host_secctx_from_ipcache"`
	// Ifindex of the interface the bpf program is attached to.
	InterfaceIfindex uint32 `config:"interface_ifindex"`
	// First 32 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC1 uint32 `config:"interface_mac_1"`
	// Latter 16 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC2 uint16 `config:"interface_mac_2"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade uint32 `config:"nat_ipv4_masquerade"`
	// First half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade1 uint64 `config:"nat_ipv6_masquerade_1"`
	// Second half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade2 uint64 `config:"nat_ipv6_masquerade_2"`
	// The endpoint's security label.
	SecurityLabel uint32 `config:"security_label"`
}

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() *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 uint32 `config:"endpoint_ipv4"`
	// The endpoint's first 64 bits of the IPv6 address.
	EndpointIPv61 uint64 `config:"endpoint_ipv6_1"`
	// The endpoint's second 64 bits of the IPv6 address.
	EndpointIPv62 uint64 `config:"endpoint_ipv6_2"`
	// 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"`
	// First 32 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC1 uint32 `config:"interface_mac_1"`
	// Latter 16 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC2 uint16 `config:"interface_mac_2"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade uint32 `config:"nat_ipv4_masquerade"`
	// First half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade1 uint64 `config:"nat_ipv6_masquerade_1"`
	// Second half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade2 uint64 `config:"nat_ipv6_masquerade_2"`
	// The log level for policy verdicts in workload endpoints.
	PolicyVerdictLogFilter uint32 `config:"policy_verdict_log_filter"`
	// The endpoint's security label.
	SecurityLabel uint32 `config:"security_label"`
}

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() *BPFLXC

type BPFNetwork

type BPFNetwork struct {
}

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() *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"`
	// First 32 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC1 uint32 `config:"interface_mac_1"`
	// Latter 16 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC2 uint16 `config:"interface_mac_2"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade uint32 `config:"nat_ipv4_masquerade"`
	// First half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade1 uint64 `config:"nat_ipv6_masquerade_1"`
	// Second half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade2 uint64 `config:"nat_ipv6_masquerade_2"`
}

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() *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"`
	// First 32 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC1 uint32 `config:"interface_mac_1"`
	// Latter 16 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC2 uint16 `config:"interface_mac_2"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade uint32 `config:"nat_ipv4_masquerade"`
	// First half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade1 uint64 `config:"nat_ipv6_masquerade_1"`
	// Second half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade2 uint64 `config:"nat_ipv6_masquerade_2"`
}

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() *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"`
	// First 32 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC1 uint32 `config:"interface_mac_1"`
	// Latter 16 bits of the MAC address of the interface the bpf program is
	// attached to.
	InterfaceMAC2 uint16 `config:"interface_mac_2"`
	// Masquerade address for IPv4 traffic.
	NATIPv4Masquerade uint32 `config:"nat_ipv4_masquerade"`
	// First half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade1 uint64 `config:"nat_ipv6_masquerade_1"`
	// Second half of the masquerade address for IPv6 traffic.
	NATIPv6Masquerade2 uint64 `config:"nat_ipv6_masquerade_2"`
}

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() *BPFXDP

Jump to

Keyboard shortcuts

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