tc

package
v0.0.0-...-21cfbab Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeviceNotFound = errors.New("device not found")
View Source
var ErrInterrupted = errors.New("dump interrupted")
View Source
var ErrNoTC = errors.New("no TC program attached")

Functions

func CleanUpProgramsAndPins

func CleanUpProgramsAndPins()

CleanUpProgramsAndPins makes a best effort to remove all our TC BPF programs.

func ConfigureProgram

func ConfigureProgram(m *libbpf.Map, iface string, globalData *libbpf.TcGlobalData) error

func EnsureQdisc

func EnsureQdisc(ifaceName string) error

EnsureQdisc makes sure that qdisc is attached to the given interface

func ExecTC

func ExecTC(args ...string) (out string, err error)

func HasQdisc

func HasQdisc(ifaceName string) (bool, error)

func ProgFilename

func ProgFilename(ipVer int, epType EndpointType, toOrFrom ToOrFromEp, epToHostDrop, fib, dsr bool, logLevel string, btf bool) string

func RemoveQdisc

func RemoveQdisc(ifaceName string) error

RemoveQdisc makes sure that there is no qdisc attached to the given interface

func SectionName

func SectionName(endpointType EndpointType, fromOrTo ToOrFromEp) string

func UpdateJumpMap

func UpdateJumpMap(obj *libbpf.Obj, progs []int, hasPolicyProg, hasHostConflictProg bool) error

Types

type AttachPoint

type AttachPoint struct {
	Type                 EndpointType
	ToOrFrom             ToOrFromEp
	Hook                 bpf.Hook
	Iface                string
	LogLevel             string
	HostIP               net.IP
	HostTunnelIP         net.IP
	IntfIP               net.IP
	FIB                  bool
	ToHostDrop           bool
	DSR                  bool
	DSROptoutCIDRs       bool
	TunnelMTU            uint16
	VXLANPort            uint16
	WgPort               uint16
	ExtToServiceConnmark uint32
	PSNATStart           uint16
	PSNATEnd             uint16
	IPv6Enabled          bool
	RPFEnforceOption     uint8
	NATin                uint32
	NATout               uint32
}

func (*AttachPoint) AlreadyAttached

func (ap *AttachPoint) AlreadyAttached(object string) (int, bool)

func (*AttachPoint) AttachProgram

func (ap *AttachPoint) AttachProgram() (int, error)

AttachProgram attaches a BPF program from a file to the TC attach point

func (*AttachPoint) Config

func (ap *AttachPoint) Config() string

func (*AttachPoint) ConfigureProgram

func (ap *AttachPoint) ConfigureProgram(m *libbpf.Map) error

func (*AttachPoint) DetachProgram

func (ap *AttachPoint) DetachProgram() error

func (*AttachPoint) FileName

func (ap *AttachPoint) FileName(ipVer int) string

FileName return the file the AttachPoint will load the program from

func (*AttachPoint) HookName

func (ap *AttachPoint) HookName() bpf.Hook

func (*AttachPoint) IfaceName

func (ap *AttachPoint) IfaceName() string

func (*AttachPoint) IsAttached

func (ap *AttachPoint) IsAttached() (bool, error)

func (*AttachPoint) JumpMapFDMapKey

func (ap *AttachPoint) JumpMapFDMapKey() string

Return a key that uniquely identifies this attach point, amongst all of the possible attach points associated with a single given interface.

func (*AttachPoint) Log

func (ap *AttachPoint) Log() *log.Entry

func (*AttachPoint) ProgramID

func (ap *AttachPoint) ProgramID() (int, error)

TODO: we should try to not get the program ID via 'tc' binary and rather we should use libbpf to obtain it.

func (*AttachPoint) ProgramName

func (ap *AttachPoint) ProgramName() string

ProgramName returns the name of the program associated with this AttachPoint

type EndpointType

type EndpointType string
const (
	EpTypeWorkload EndpointType = "workload"
	EpTypeHost     EndpointType = "host"
	EpTypeTunnel   EndpointType = "tunnel"
	EpTypeL3Device EndpointType = "l3dev"
	EpTypeNAT      EndpointType = "nat"
	EpTypeLO       EndpointType = "lo"
)

type ToOrFromEp

type ToOrFromEp string
const (
	FromEp ToOrFromEp = "from"
	ToEp   ToOrFromEp = "to"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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