hook

package
v1.11.0-cni-plu...-ddfc3b1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var All = []Hook{Ingress, Egress, XDP}
View Source
var ProgramsMapParameters = maps.MapParameters{
	Type:       "prog_array",
	KeySize:    4,
	ValueSize:  4,
	MaxEntries: maxPrograms,
	Name:       "cali_progs",
	Version:    3,
}

Functions

func NewProgramsMap

func NewProgramsMap() maps.Map

func NewXDPProgramsMap

func NewXDPProgramsMap() maps.Map

Types

type AttachType

type AttachType struct {
	Hook       Hook
	Family     int
	Type       tcdefs.EndpointType
	LogLevel   string
	FIB        bool
	ToHostDrop bool
	DSR        bool
}

func ListAttachTypes

func ListAttachTypes() []AttachType

func (AttachType) DefaultPolicy

func (at AttachType) DefaultPolicy() DefPolicy

func (AttachType) ObjectFile

func (at AttachType) ObjectFile() string

type DefPolicy

type DefPolicy int
const (
	DefPolicyDeny  DefPolicy = -1
	DefPolicyNone  DefPolicy = 0
	DefPolicyAllow DefPolicy = 1
)

type Hook

type Hook int

Hook is the hook to which a BPF program should be attached. This is relative to the host namespace so workload PolDirnIngress policy is attached to the HookEgress.

const (
	Ingress Hook = iota
	Egress
	XDP
	Count

	Bad Hook = -1
)

func StringToHook

func StringToHook(s string) Hook

func (Hook) String

func (h Hook) String() string

type Layout

type Layout map[SubProg]int

Layout maps sub-programs of an object to their location in the ProgramsMap

func MergeLayouts

func MergeLayouts(layouts ...Layout) Layout

type ProgramsMap

type ProgramsMap struct {
	*maps.PinnedMap
	// contains filtered or unexported fields
}

func (*ProgramsMap) Count

func (pm *ProgramsMap) Count() int

Count returns how many slots are allocated.

func (*ProgramsMap) LoadObj

func (pm *ProgramsMap) LoadObj(at AttachType) (Layout, error)

func (*ProgramsMap) Programs

func (pm *ProgramsMap) Programs() map[AttachType]Layout

func (*ProgramsMap) ResetCount

func (pm *ProgramsMap) ResetCount()

ResetCount for unittesting only.

type SubProg

type SubProg int
const (
	SubProgTCMain SubProg = iota
	SubProgTCPolicy
	SubProgTCAllowed
	SubProgTCIcmp
	SubProgTCDrop
	SubProgTCHostCtConflict
	SubProgIcmpInnerNat
	SubProgNewFlow
	SubProgTCMainDebug

	SubProgXDPMain    = SubProgTCMain
	SubProgXDPPolicy  = SubProgTCPolicy
	SubProgXDPAllowed = SubProgTCAllowed
	SubProgXDPDrop    = SubProgTCDrop
)

Jump to

Keyboard shortcuts

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