ebpf

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 16 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 uint64  `json:"run_count"`
	ProgramDuration float64 `json:"duration"`
}

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
	// contains filtered or unexported fields
}

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) DeleteUrr added in v0.7.0

func (bpfObjects *BpfObjects) DeleteUrr(internalId uint32) (UrrInfo, error)

func (*BpfObjects) GetFar

func (bpfObjects *BpfObjects) GetFar(internalId uint32) (FarInfo, error)

func (*BpfObjects) GetNextFAR added in v0.7.1

func (bpfObjects *BpfObjects) GetNextFAR() (uint32, error)

func (*BpfObjects) GetNextQER added in v0.7.1

func (bpfObjects *BpfObjects) GetNextQER() (uint32, error)

func (*BpfObjects) GetNextURR added in v0.7.1

func (bpfObjects *BpfObjects) GetNextURR() (uint32, error)

func (*BpfObjects) GetUrr

func (bpfObjects *BpfObjects) GetUrr(internalId uint32) (UrrInfo, 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) NewUrr added in v0.7.0

func (bpfObjects *BpfObjects) NewUrr(urrInfo UrrInfo) (uint32, error)

func (*BpfObjects) PutDownlinkPdrIp6

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

func (*BpfObjects) ReleaseFAR added in v0.7.1

func (bpfObjects *BpfObjects) ReleaseFAR(farId uint32)

func (*BpfObjects) ReleaseQER added in v0.7.1

func (bpfObjects *BpfObjects) ReleaseQER(qerId uint32)

func (*BpfObjects) ReleaseURR added in v0.7.1

func (bpfObjects *BpfObjects) ReleaseURR(urrId uint32)

func (*BpfObjects) ResizeAllMaps

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

func (*BpfObjects) SetFarMapSize added in v0.7.2

func (bpfObjects *BpfObjects) SetFarMapSize(farMapSize uint32)

func (*BpfObjects) SetPdrMapSize added in v0.7.2

func (bpfObjects *BpfObjects) SetPdrMapSize(pdrMapSize uint32)

func (*BpfObjects) SetQerMapSize added in v0.7.2

func (bpfObjects *BpfObjects) SetQerMapSize(qerMapSize uint32)

func (*BpfObjects) SetUrrMapSize added in v0.7.2

func (bpfObjects *BpfObjects) SetUrrMapSize(urrMapSize uint32)

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

func (*BpfObjects) UpdateUrr added in v0.7.0

func (bpfObjects *BpfObjects) UpdateUrr(internalId uint32, urrInfo UrrInfo) error

type FarInfo

type FarInfo struct {
	Action                uint8
	OuterHeaderCreation   uint8
	Teid                  uint32
	RemoteIP              uint32
	Trigger               uint8 // trigger for applying the FAR // todo maxim: change to ringbuffer
	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
	PutDownlinkPdrIp6(ipv6 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
	UpdateDownlinkPdrIp6(ipv6 net.IP, pdrInfo PdrInfo) error
	DeleteDownlinkPdrIp6(ipv6 net.IP) error
	NewFar(farInfo FarInfo) (uint32, error)
	GetFar(internalId uint32) (FarInfo, 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
	NewUrr(urrInfo UrrInfo) (uint32, error)
	UpdateUrr(internalId uint32, urrInfo UrrInfo) error
	GetUrr(internalId uint32) (UrrInfo, error)
	DeleteUrr(internalId uint32) (UrrInfo, 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
	Urr1Id             uint32
	Urr2Id             uint32
	SdfFilter          []SdfFilter
	TraceFlag          bool
	NotifyFlag         bool
	NRFlag             bool
}

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
	Dscp         uint8
	MaxBitrateUL uint64
	MaxBitrateDL 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 uint64 `json:"max_bitrate_ul"`
	MaxBitrateDL uint64 `json:"max_bitrate_dl"`
}

func ListQerMapContents

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

type SdfEvent

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

func (*SdfEvent) String

func (e *SdfEvent) String() string

func (*SdfEvent) UnmarshalIPv4

func (e *SdfEvent) UnmarshalIPv4(buffer []byte)

func (*SdfEvent) UnmarshalIPv6

func (e *SdfEvent) UnmarshalIPv6(buffer []byte)

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 SdfFlowNotification

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

func (*SdfFlowNotification) GetSdfFilter

func (n *SdfFlowNotification) GetSdfFilter() string

func (*SdfFlowNotification) GetURRID

func (n *SdfFlowNotification) GetURRID() uint32

type SdfNotifyListener

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

func NewSdfNotifyListener

func NewSdfNotifyListener(eventMap *ebpf.Map) (*SdfNotifyListener, error)

func (*SdfNotifyListener) Close

func (l *SdfNotifyListener) Close()

func (*SdfNotifyListener) GetNotificationChannel

func (l *SdfNotifyListener) GetNotificationChannel() <-chan SdfFlowNotification

func (*SdfNotifyListener) ReadEventLoop

func (l *SdfNotifyListener) ReadEventLoop()

func (*SdfNotifyListener) ReadEventOnce

func (l *SdfNotifyListener) ReadEventOnce() (*SdfFlowNotification, error)

func (*SdfNotifyListener) SetNonblocked

func (l *SdfNotifyListener) SetNonblocked()

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)

func (*UpfCounters) Delta added in v0.7.0

func (current *UpfCounters) Delta(new UpfCounters) UpfCounters

type UpfStatistic

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

type UpfXdpActionStatistic

type UpfXdpActionStatistic struct {
	BpfObjects *BpfObjects
	// contains filtered or unexported fields
}

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) GetUpfExtStat added in v0.7.0

func (stat *UpfXdpActionStatistic) GetUpfExtStat() UpfCounters

Getters for the upf_ext_stat (upf_counters)

func (*UpfXdpActionStatistic) GetUpfExtStatDelta added in v0.7.0

func (stat *UpfXdpActionStatistic) GetUpfExtStatDelta() UpfCounters

Getters for the upf_ext_stat (upf_counters)

func (*UpfXdpActionStatistic) GetUpfRouteStat added in v0.7.2

func (stat *UpfXdpActionStatistic) GetUpfRouteStat() IpEntrypointRouteStat

Getters for the upf_route_stat (route_stat)

func (*UpfXdpActionStatistic) GetUpfRouteStatDelta added in v0.7.2

func (stat *UpfXdpActionStatistic) GetUpfRouteStatDelta() IpEntrypointRouteStat

Getters for the upf_route_stat (route_stat)

type UrrInfo added in v0.7.0

type UrrInfo struct {
	UplinkVolume    uint64
	DownlinkVolume  uint64
	VolumeThreshold uint64
	TimeThreshold   float64
}

TODO: add required fields and implement methods

Jump to

Keyboard shortcuts

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