Documentation ¶
Index ¶
- Variables
- func CleanUpProgramsAndPins()
- func ConfigureProgram(m *libbpf.Map, iface string, globalData *libbpf.TcGlobalData) error
- func EnsureQdisc(ifaceName string) error
- func ExecTC(args ...string) (out string, err error)
- func HasQdisc(ifaceName string) (bool, error)
- func ProgFilename(ipVer int, epType EndpointType, toOrFrom ToOrFromEp, ...) string
- func RemoveQdisc(ifaceName string) error
- func SectionName(endpointType EndpointType, fromOrTo ToOrFromEp) string
- func UpdateJumpMap(obj *libbpf.Obj, progs []int, hasPolicyProg, hasHostConflictProg bool) error
- type AttachPoint
- func (ap *AttachPoint) AlreadyAttached(object string) (int, bool)
- func (ap *AttachPoint) AttachProgram() (int, error)
- func (ap *AttachPoint) Config() string
- func (ap *AttachPoint) ConfigureProgram(m *libbpf.Map) error
- func (ap *AttachPoint) DetachProgram() error
- func (ap *AttachPoint) FileName(ipVer int) string
- func (ap *AttachPoint) HookName() bpf.Hook
- func (ap *AttachPoint) IfaceName() string
- func (ap *AttachPoint) IsAttached() (bool, error)
- func (ap *AttachPoint) JumpMapFDMapKey() string
- func (ap *AttachPoint) Log() *log.Entry
- func (ap *AttachPoint) ProgramID() (int, error)
- func (ap *AttachPoint) ProgramName() string
- type EndpointType
- type ToOrFromEp
Constants ¶
This section is empty.
Variables ¶
var ErrDeviceNotFound = errors.New("device not found")
var ErrInterrupted = errors.New("dump interrupted")
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 EnsureQdisc ¶
EnsureQdisc makes sure that qdisc is attached to the given interface
func ProgFilename ¶
func ProgFilename(ipVer int, epType EndpointType, toOrFrom ToOrFromEp, epToHostDrop, fib, dsr bool, logLevel string, btf bool) string
func RemoveQdisc ¶
RemoveQdisc makes sure that there is no qdisc attached to the given interface
func SectionName ¶
func SectionName(endpointType EndpointType, fromOrTo ToOrFromEp) string
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" )