xdptool

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BPF_MAP_TYPE_UNSPEC = iota
	BPF_MAP_TYPE_HASH
	BPF_MAP_TYPE_ARRAY
	BPF_MAP_TYPE_PROG_ARRAY
	BPF_MAP_TYPE_PERF_EVENT_ARRAY
	BPF_MAP_TYPE_PERCPU_HASH
	BPF_MAP_TYPE_PERCPU_ARRAY
	BPF_MAP_TYPE_STACK_TRACE
	BPF_MAP_TYPE_CGROUP_ARRAY
	BPF_MAP_TYPE_LRU_HASH
	BPF_MAP_TYPE_LRU_PERCPU_HASH
	BPF_MAP_TYPE_LPM_TRIE
	BPF_MAP_TYPE_ARRAY_OF_MAPS
	BPF_MAP_TYPE_HASH_OF_MAPS
	BPF_MAP_TYPE_DEVMAP
	BPF_MAP_TYPE_SOCKMAP
	BPF_MAP_TYPE_CPUMAP
	BPF_MAP_TYPE_XSKMAP
	BPF_MAP_TYPE_SOCKHASH
	BPF_MAP_TYPE_CGROUP_STORAGE
	BPF_MAP_TYPE_REUSEPORT_SOCKARRAY
)

See https://github.com/cilium/cilium/blob/master/pkg/bpf/bpf.go BPF map type constants. Must match enum bpf_map_type from linux/bpf.h

View Source
const (
	BPF_MAP_CREATE = iota
	BPF_MAP_LOOKUP_ELEM
	BPF_MAP_UPDATE_ELEM
	BPF_MAP_DELETE_ELEM
	BPF_MAP_GET_NEXT_KEY
	BPF_PROG_LOAD
	BPF_OBJ_PIN
	BPF_OBJ_GET
	BPF_PROG_ATTACH
	BPF_PROG_DETACH
	BPF_PROG_TEST_RUN
	BPF_PROG_GET_NEXT_ID
	BPF_MAP_GET_NEXT_ID
	BPF_PROG_GET_FD_BY_ID
	BPF_MAP_GET_FD_BY_ID
	BPF_OBJ_GET_INFO_BY_FD
	BPF_PROG_QUERY
	BPF_RAW_TRACEPOINT_OPEN
	BPF_BTF_LOAD
	BPF_BTF_GET_FD_BY_ID
	BPF_TASK_FD_QUERY
)

BPF syscall command constants. Must match enum bpf_cmd from linux/bpf.h

View Source
const (
	BPF_ANY = iota
	BPF_NOEXIST
	BPF_EXIST
)

Flags for BPF_MAP_UPDATE_ELEM. Must match values from linux/bpf.h

View Source
const (
	BPF_F_NO_PREALLOC   = 1 << 0
	BPF_F_NO_COMMON_LRU = 1 << 1
	BPF_F_NUMA_NODE     = 1 << 2
)

Flags for BPF_MAP_CREATE. Must match values from linux/bpf.h

View Source
const BpfFsPath = "/sys/fs/bpf"

Variables

View Source
var (
	PossibleCpus int
)

Functions

func Attach

func Attach(prog *ebpf.Program, device string) error

func CreateLPMtrieKey

func CreateLPMtrieKey(s string) *net.IPNet

func CreateMap

func CreateMap(mapType int, keySize, valueSize, maxEntries, flags, innerID uint32) (int, error)

func DeleteElement

func DeleteElement(fd int, key unsafe.Pointer) error

DeleteElement deletes the map element with the given key.

func Detach

func Detach(device string) error

func GetNextKey

func GetNextKey(fd int, key, nextKey unsafe.Pointer) error

GetNextKey stores, in nextKey, the next key after the key of the map in fd.

func LoadElf

func LoadElf(filepath string) (*ebpf.Collection, error)

func LookupElement

func LookupElement(fd int, key, value unsafe.Pointer) error

func ObjGet

func ObjGet(pathname string) (int, error)

ObjGet reads the pathname and returns the map's fd read.

func ObjPin

func ObjPin(fd int, pathname string) error

ObjPin stores the map's fd in pathname.

func PossibleCpuInit

func PossibleCpuInit()

func UpdateElement

func UpdateElement(fd int, key, value unsafe.Pointer, flags uint64) error

Types

type Fd

type Fd struct{ Fd uint32 }

Fd represents HASH_OF_MAPS value.

Jump to

Keyboard shortcuts

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