loader

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 66 Imported by: 21

Documentation

Overview

Package loader provides accessors to compilation and BPF load routines necessary for creating datapath objects and attaching them to links.

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"loader",
	"Loader",

	cell.Provide(NewLoader),
	cell.Provide(NewCompilationLock),
)
View Source
var (
	StandardCFlags = []string{"-O2", "--target=bpf", "-std=gnu99",
		"-nostdinc",
		"-ftrap-function=__undefined_trap",
		"-Wall", "-Wextra", "-Werror", "-Wshadow",
		"-Wno-address-of-packed-member",
		"-Wno-unknown-warning-option",
		"-Wno-gnu-variable-sized-type-not-at-end",
		"-Wimplicit-int-conversion",
		"-Wenum-conversion",
		"-Wimplicit-fallthrough"}
)

Functions

func DetachXDP added in v1.15.0

func DetachXDP(ifaceName string, bpffsBase, progName string) error

DetachXDP removes an XDP program from a network interface. On kernels before 4.15, always removes the XDP program regardless of progName.

bpffsBase is typically /sys/fs/bpf/cilium, but can be overridden to a tempdir during tests.

func DeviceHasSKBProgramLoaded added in v1.16.0

func DeviceHasSKBProgramLoaded(device string, checkEgress bool) (bool, error)

DeviceHasSKBProgramLoaded returns true if the given device has a tc(x) program attached.

If checkEgress is true, returns true if there's both an ingress and egress program attached.

func NewCompilationLock added in v1.16.0

func NewCompilationLock() types.CompilationLock

func NewLoader

func NewLoader(p Params) datapath.Loader

NewLoader returns a new loader.

Types

type FilterSetter added in v1.19.0

type FilterSetter func(af uint8, addr net.IP, port uint16) error

func LoadSockTerm added in v1.19.0

func LoadSockTerm(l *slog.Logger, sockRevNat4, sockRevNat6 *bpf.Map) (*bpfgen.SockTermPrograms, FilterSetter, error)

LoadSockTerm loads the cil_sock_udp_destroy_v4, cil_sock_tcp_destroy_v4, cil_sock_tcp_destroy_v6, and cil_sock_udp_destroy_v6 programs. It returns a handle to the programs and a function that sets the socket filter.

type Params added in v1.16.0

type Params struct {
	cell.In

	JobGroup           job.Group
	Logger             *slog.Logger
	Sysctl             sysctl.Sysctl
	Prefilter          datapath.PreFilter
	CompilationLock    datapath.CompilationLock
	ConfigWriter       datapath.ConfigWriter
	NodeConfigNotifier *manager.NodeConfigNotifier
	RouteManager       *routeReconciler.DesiredRouteManager
	DB                 *statedb.DB
	Devices            statedb.Table[*tables.Device]
	EPRestorer         promise.Promise[endpointstate.Restorer]
	BIGTCPConfig       *bigtcp.Configuration

	// Force map initialisation before loader. You should not use these otherwise.
	// Some of the entries in this slice may be nil.
	BpfMaps []bpf.BpfMap `group:"bpf-maps"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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