Categorygithub.com/DataDog/ebpf
modulepackage
0.0.0-20220301203322-3fc9ab3b8daf
Repository: https://github.com/datadog/ebpf.git
Documentation: pkg.go.dev

# README

eBPF

NOTE: This is a fork from cilium/ebpf that adds a declarative manager on top to manage the lifecycle of eBPF objects.

Current status

Work is underway to convert this library to wrap the upstream library, rather than forking.

Requirements

Useful resources

# Packages

Package asm is an assembler for eBPF bytecode.
No description provided by the author
Package perf allows interacting with Linux perf_events.

# Functions

CurrentKernelVersion returns the current kernel version in LINUX_VERSION_CODE format (see KernelVersionFromReleaseString()).
KernelVersionFromReleaseString converts a release string with format 4.4.2[-1] to a kernel version number in LINUX_VERSION_CODE format.
LoadCollection parses an object file and converts it to a collection.
LoadCollectionSpec parses an ELF file into a CollectionSpec.
LoadCollectionSpecFromReader parses an ELF file into a CollectionSpec.
LoadPinnedMap load a Map from a BPF file.
LoadPinnedMapExplicit loads a map with explicit parameters.
LoadPinnedProgram loads a Program from a BPF file.
LoadPinnedProgramExplicit loads a program with explicit parameters.
MapGetNextID returns the ID of the next eBPF map.
NewCollection creates a Collection from a specification.
NewCollectionWithOptions creates a Collection from a specification.
NewMap creates a new Map.
NewMapFromFD creates a map from a raw fd.
NewMapFromID returns the map for a given id.
NewProgram creates a new Program.
NewProgramFromFD creates a program from a raw fd.
NewProgramFromID returns the program for a given id.
NewProgramWithOptions creates a new Program.
ProgramGetNextID returns the ID of the next eBPF program.
SanitizeName replaces all invalid characters in name.

# Constants

Array is an array map.
ArrayOfMaps - Each item in the array is another map.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
AttachNone is an alias for AttachCGroupInetIngress for readability reasons.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
CGroupArray - This is a very niche structure used to help SKBInCGroup determine if an skb is from a socket belonging to a specific cgroup.
CGroupDevice program.
CGroupSKB program.
CGroupSock program.
CGroupSockAddr program.
CGroupSockopt program.
CGroupStorage - Special map for CGroups.
CGroupSysctl program.
CPUMap - Specialized map to store references to CPUs.
DefaultVerifierLogSize is the default number of bytes allocated for the verifier log.
DevMap - Specialized map to store references to network devices.
DevMapHash - Hash-based indexing scheme for references to network devices.
FlowDissector program.
Hash is a hash map.
HashOfMaps - Each item in the hash map is another map.
Kprobe program.
LircMode2 program.
LPMTrie - This is an implementation of Longest-Prefix-Match Trie structure.
LRUCPUHash - This is NOT like PerCPUHash, this structure is shared among the CPUs, it has more to do with including the CPU id with the LRU calculation so that if a particular CPU is using a value over-and-over again, then it will be saved, but if a value is being retrieved a lot but sparsely across CPUs it is not as important, basically giving weight to CPU locality over overall usage.
LRUHash - This allows you to create a small hash structure that will purge the least recently used items rather than thow an error when you run out of memory.
LWTIn program.
LWTOut program.
LWTSeg6Local program.
LWTXmit program.
PerCPUArray - This data structure is useful for people who have high performance network needs and can reconcile adds at the end of some cycle, so that hashes can be lock free without the use of XAdd, which can be costly.
PerCPUCGroupStorage - Special per CPU map for CGroups.
PerCPUHash - This data structure is useful for people who have high performance network needs and can reconcile adds at the end of some cycle, so that hashes can be lock free without the use of XAdd, which can be costly.
PerfEvent program.
PerfEventArray - A perf event array is used in conjunction with PerfEventRead and PerfEventOutput calls, to read the raw bpf_perf_data from the registers.
ProgramArray - A program array map is a special kind of array map whose map values contain only file descriptors referring to other eBPF programs.
Queue - FIFO storage for BPF programs.
RawTracepoint program.
RawTracepointWritable program.
ReusePortSockArray - Specialized map to store references to sockets that can be reused.
SchedACT routing control shaper.
SchedCLS traffic control shaper.
SkMsg program.
SkReuseport program.
SkSKB program.
SkStorage - Specialized map for local storage at SK for BPF programs.
SocketFilter socket or seccomp filter.
SockHash - Specialized hash to store references to sockets.
SockMap - Specialized map to store references to sockets.
SockOps program.
Stack - LIFO storage for BPF programs.
StackTrace - This holds whole user and kernel stack traces, it can be retrieved with GetStackID.
TracePoint program.
Tracing program.
All the various map types that can be created.
Unrecognized program type.
UpdateAny creates a new element or update an existing one.
UpdateExist updates an existing element.
UpdateNoExist creates a new element.
XDP program.
XSKMap - Specialized map for XDP programs to store references to open sockets.

# Variables

Errors returned by Map and MapIterator methods.
Errors returned by Map and MapIterator methods.
Errors returned by Map and MapIterator methods.
Generic errors returned by BPF syscalls.
ErrNotSupported is returned whenever the kernel doesn't support a feature.

# Structs

Collection is a collection of Programs and Maps associated with their symbols.
CollectionOptions control loading a collection into the kernel.
CollectionSpec describes a collection.
Map represents a Map file descriptor.
MapABI are the attributes of a Map which are available across all supported kernels.
MapIterator iterates a Map.
MapKV is used to initialize the contents of a Map.
MapSpec defines a Map.
Program represents BPF program loaded into the kernel.
ProgramABI are the attributes of a Program which are available across all supported kernels.
ProgramOptions control loading a program into the kernel.
ProgramSpec defines a Program.

# Type aliases

AttachFlags of the eBPF program used in BPF_PROG_ATTACH command.
AttachType of the eBPF program, needed to differentiate allowed context accesses in some newer program types like CGroupSockAddr.
MapID represents the unique ID of an eBPF map.
MapType indicates the type map structure that will be initialized in the kernel.
MapUpdateFlags controls the behaviour of the Map.Update call.
ProgramID represents the unique ID of an eBPF program.
ProgramType of the eBPF program.