ebpf

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAllObjects

func CloseAllObjects(closers ...io.Closer) error

func Copy16Ip added in v0.5.0

func Copy16Ip[T ~[]byte](arr T) [16]byte

func LoadAllObjects

func LoadAllObjects(opts *ebpf.CollectionOptions, loaders ...Loader) error

func ResizeEbpfMap

func ResizeEbpfMap(eMap **ebpf.Map, eProg *ebpf.Program, newSize uint32) error

Types

type BpfMapProgArrayMember

type BpfMapProgArrayMember struct {
	ProgramId              uint32 `json:"id"`
	ProgramRef             uint32 `json:"fd"`
	ProgramName            string `json:"name"`
	ProgramRunCount        uint32 `json:"run_count"`
	ProgramRunCountEnabled bool   `json:"run_count_enabled"`
	ProgramDuration        uint32 `json:"duration"`
	ProgramDurationEnabled bool   `json:"duration_enabled"`
}

https://man7.org/linux/man-pages/man2/bpf.2.html A program array map is a special kind of array map whose map values contain only file descriptors referring to other eBPF programs. Thus, both the key_size and value_size must be exactly four bytes.

func ListMapProgArrayContents

func ListMapProgArrayContents(m *ebpf.Map) ([]BpfMapProgArrayMember, error)

type BpfObjects

type BpfObjects struct {
	IpEntrypointObjects

	FarIdTracker *IdTracker
	QerIdTracker *IdTracker
}

func NewBpfObjects

func NewBpfObjects() *BpfObjects

func (*BpfObjects) Close

func (bpfObjects *BpfObjects) Close() error

func (*BpfObjects) DeleteDownlinkPdrIp6

func (bpfObjects *BpfObjects) DeleteDownlinkPdrIp6(ipv6 net.IP) error

func (*BpfObjects) DeleteFar

func (bpfObjects *BpfObjects) DeleteFar(intenalId uint32) error
func (bpfObjects *BpfObjects) DeletePdrDownlink(ipv4 net.IP) error
func (bpfObjects *BpfObjects) DeletePdrUplink(teid uint32) error

func (*BpfObjects) DeleteQer

func (bpfObjects *BpfObjects) DeleteQer(internalId uint32) error

func (*BpfObjects) Load

func (bpfObjects *BpfObjects) Load() error

func (*BpfObjects) NewFar

func (bpfObjects *BpfObjects) NewFar(farInfo FarInfo) (uint32, error)

func (*BpfObjects) NewQer

func (bpfObjects *BpfObjects) NewQer(qerInfo QerInfo) (uint32, error)

func (*BpfObjects) PutDownlinkPdrIp6

func (bpfObjects *BpfObjects) PutDownlinkPdrIp6(ipv6 net.IP, pdrInfo PdrInfo) error
func (bpfObjects *BpfObjects) PutPdrDownlink(ipv4 net.IP, pdrInfo PdrInfo) error
func (bpfObjects *BpfObjects) PutPdrUplink(teid uint32, pdrInfo PdrInfo) error

func (*BpfObjects) ResizeAllMaps

func (bpfObjects *BpfObjects) ResizeAllMaps(qerMapSize uint32, farMapSize uint32, pdrMapSize uint32) error

func (*BpfObjects) UpdateDownlinkPdrIp6

func (bpfObjects *BpfObjects) UpdateDownlinkPdrIp6(ipv6 net.IP, pdrInfo PdrInfo) error

func (*BpfObjects) UpdateFar

func (bpfObjects *BpfObjects) UpdateFar(internalId uint32, farInfo FarInfo) error
func (bpfObjects *BpfObjects) UpdatePdrDownlink(ipv4 net.IP, pdrInfo PdrInfo) error
func (bpfObjects *BpfObjects) UpdatePdrUplink(teid uint32, pdrInfo PdrInfo) error

func (*BpfObjects) UpdateQer

func (bpfObjects *BpfObjects) UpdateQer(internalId uint32, qerInfo QerInfo) error

type FarInfo

type FarInfo struct {
	Action                uint8
	OuterHeaderCreation   uint8
	Teid                  uint32
	RemoteIP              uint32
	LocalIP               uint32
	TransportLevelMarking uint16
}

func (FarInfo) MarshalJSON

func (f FarInfo) MarshalJSON() ([]byte, error)

type ForwardingPlaneController

type ForwardingPlaneController interface {
	PutPdrUplink(teid uint32, pdrInfo PdrInfo) error
	PutPdrDownlink(ipv4 net.IP, pdrInfo PdrInfo) error
	UpdatePdrUplink(teid uint32, pdrInfo PdrInfo) error
	UpdatePdrDownlink(ipv4 net.IP, pdrInfo PdrInfo) error
	DeletePdrUplink(teid uint32) error
	DeletePdrDownlink(ipv4 net.IP) error
	PutDownlinkPdrIp6(ipv6 net.IP, pdrInfo PdrInfo) error
	UpdateDownlinkPdrIp6(ipv6 net.IP, pdrInfo PdrInfo) error
	DeleteDownlinkPdrIp6(ipv6 net.IP) error
	NewFar(farInfo FarInfo) (uint32, error)
	UpdateFar(internalId uint32, farInfo FarInfo) error
	DeleteFar(internalId uint32) error
	NewQer(qerInfo QerInfo) (uint32, error)
	UpdateQer(internalId uint32, qerInfo QerInfo) error
	DeleteQer(internalId uint32) error
}

type IdTracker

type IdTracker struct {
	// contains filtered or unexported fields
}

func NewIdTracker

func NewIdTracker(size uint32) *IdTracker

func (*IdTracker) GetNext

func (t *IdTracker) GetNext() (next uint32, err error)

func (*IdTracker) Release

func (t *IdTracker) Release(id uint32)

type IpWMask added in v0.5.0

type IpWMask struct {
	Type uint8 // 0: any, 1: ip4, 2: ip6
	Ip   net.IP
	Mask net.IPMask
}

type Loader

type Loader struct {
	LoaderFunc
	// contains filtered or unexported fields
}

type LoaderFunc

type LoaderFunc func(obj interface{}, opts *ebpf.CollectionOptions) error

type PdrInfo

type PdrInfo struct {
	OuterHeaderRemoval uint8
	FarId              uint32
	QerId              uint32
	SdfFilter          *SdfFilter
}

type PortRange added in v0.5.0

type PortRange struct {
	LowerBound uint16
	UpperBound uint16
}

type QerInfo

type QerInfo struct {
	GateStatusUL uint8
	GateStatusDL uint8
	Qfi          uint8
	MaxBitrateUL uint32
	MaxBitrateDL uint32
	StartUL      uint64
	StartDL      uint64
}

type QerMapElement

type QerMapElement struct {
	Id           uint32 `json:"id"`
	GateStatusUL uint8  `json:"gate_status_ul"`
	GateStatusDL uint8  `json:"gate_status_dl"`
	Qfi          uint8  `json:"qfi"`
	MaxBitrateUL uint32 `json:"max_bitrate_ul"`
	MaxBitrateDL uint32 `json:"max_bitrate_dl"`
}

func ListQerMapContents

func ListQerMapContents(m *ebpf.Map) ([]QerMapElement, error)

type SdfFilter added in v0.5.0

type SdfFilter struct {
	Protocol     uint8 // 0: icmp, 1: ip, 2: tcp, 3: udp, 4: icmp6
	SrcAddress   IpWMask
	SrcPortRange PortRange
	DstAddress   IpWMask
	DstPortRange PortRange
}

func (*SdfFilter) String added in v0.5.0

func (sdfFilter *SdfFilter) String() string

type UpfCounters

type UpfCounters struct {
	RxArp      uint64
	RxIcmp     uint64
	RxIcmp6    uint64
	RxIp4      uint64
	RxIp6      uint64
	RxTcp      uint64
	RxUdp      uint64
	RxOther    uint64
	RxGtpEcho  uint64
	RxGtpPdu   uint64
	RxGtpOther uint64
	RxGtpUnexp uint64
}

func (*UpfCounters) Add

func (current *UpfCounters) Add(new UpfCounters)

type UpfStatistic

type UpfStatistic struct {
	Counters UpfCounters
	XdpStats [5]uint64
}

type UpfXdpActionStatistic

type UpfXdpActionStatistic struct {
	BpfObjects *BpfObjects
}

func (*UpfXdpActionStatistic) GetAborted

func (stat *UpfXdpActionStatistic) GetAborted() uint64

func (*UpfXdpActionStatistic) GetDrop

func (stat *UpfXdpActionStatistic) GetDrop() uint64

func (*UpfXdpActionStatistic) GetPass

func (stat *UpfXdpActionStatistic) GetPass() uint64

func (*UpfXdpActionStatistic) GetRedirect

func (stat *UpfXdpActionStatistic) GetRedirect() uint64

func (*UpfXdpActionStatistic) GetTx

func (stat *UpfXdpActionStatistic) GetTx() uint64

func (*UpfXdpActionStatistic) GetUpfExtStatField

func (stat *UpfXdpActionStatistic) GetUpfExtStatField() UpfCounters

Getters for the upf_ext_stat (upf_counters) #TODO: Do not retrieve the whole struct each time.

Jump to

Keyboard shortcuts

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