selectors

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionTypePost       = 0
	ActionTypeFollowFd   = 1
	ActionTypeSigKill    = 2
	ActionTypeUnfollowFd = 3
	ActionTypeOverride   = 4
	ActionTypeCopyFd     = 5
	ActionTypeGetUrl     = 6
	ActionTypeDnsLookup  = 7
)

Variables

This section is empty.

Functions

func AdvanceSelectorLength

func AdvanceSelectorLength(k *KernelSelectorState) uint32

func ArgSelectorValue

func ArgSelectorValue(v string) ([]byte, uint32)

func ArgTypeToString

func ArgTypeToString(t uint32) string

func GetDnsFQDNs

func GetDnsFQDNs(spec *v1alpha1.KProbeSpec) []string

func GetUrls

func GetUrls(spec *v1alpha1.KProbeSpec) []string

func HasOverride

func HasOverride(spec *v1alpha1.KProbeSpec) bool

func InitKernelSelectors

func InitKernelSelectors(selectors []v1alpha1.KProbeSelector, args []v1alpha1.KProbeArg) ([4096]byte, error)

The byte array storing the selector configuration has the following format array := [N][S1_off][S2_off]...[SN_off][S1][S2][...][SN]

N: is the number of selectors (u32)
Sx_off: is the relative offset of  selector x (diff of Sx to Sx_off)
Sx: holds the data for the selector

Each selector x starts with its length in bytes, and then stores a number of sections for the different matchers. Each section will typically starts with its length in bytes.

Sx := [length]

[matchPIDs]
[matchNamespaces]
[matchCapabilities]
[matchNamespaceChanges]
[matchCapabilityChanges]
[matchBinaries]
[matchArgs]
[matchActions]

matchPIDs := [length][PID1][PID2]...[PIDn] matchNamespaces := [length][NSx][NSy]...[NSn] matchCapabilities := [length][CAx][CAy]...[CAn] matchNamespaceChanges := [length][NCx][NCy]...[NCn] matchCapabilityChanges := [length][CAx][CAy]...[CAn] matchBinaries := [length][op][Index]...[Index] matchArgs := [length][ARGx][ARGy]...[ARGn] PIDn := [op][flags][nValues][v1]...[vn] Argn := [index][op][valueGen] NSn := namespace[op][valueInt] NCn := [op][valueInt] CAn := [type][op][namespacecap][valueInt] valueGen := [type][len][v] valueInt := [len][v]

For some examples, see kernel_test.go

func MatchActionSigKill

func MatchActionSigKill(spec interface{}) bool

func WriteSelectorByteArray

func WriteSelectorByteArray(k *KernelSelectorState, b []byte, size uint32)

func WriteSelectorInt32

func WriteSelectorInt32(k *KernelSelectorState, v int32)

func WriteSelectorInt64

func WriteSelectorInt64(k *KernelSelectorState, v int64)

func WriteSelectorLength

func WriteSelectorLength(k *KernelSelectorState, loff uint32)

func WriteSelectorUint32

func WriteSelectorUint32(k *KernelSelectorState, v uint32)

func WriteSelectorUint64

func WriteSelectorUint64(k *KernelSelectorState, v uint64)

Types

type KernelSelectorState

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

func InitKernelSelectorState

func InitKernelSelectorState(selectors []v1alpha1.KProbeSelector, args []v1alpha1.KProbeArg) (*KernelSelectorState, error)

func (*KernelSelectorState) Buffer

func (k *KernelSelectorState) Buffer() [4096]byte

func (*KernelSelectorState) ValueMaps

func (k *KernelSelectorState) ValueMaps() []map[[8]byte]struct{}

Jump to

Keyboard shortcuts

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