Documentation ¶
Overview ¶
Package probes provides BPF features checks based on bpftool.
Index ¶
- Variables
- type Features
- type KernelParam
- type MapTypes
- type Misc
- type ProbeManager
- func (p *ProbeManager) CreateHeadersFile() error
- func (p *ProbeManager) GetHelpers(prog string) map[string]struct{}
- func (p *ProbeManager) GetMapTypes() *MapTypes
- func (p *ProbeManager) GetMisc() *Misc
- func (p *ProbeManager) SystemConfigProbes() error
- func (p *ProbeManager) SystemKernelHz() (int, error)
- type SystemConfig
Constants ¶
This section is empty.
Variables ¶
var ErrKernelConfigNotFound = errors.New("Kernel Config file not found")
ErrKernelConfigNotFound is the error returned if the kernel config is unavailable to the cilium agent.
Functions ¶
This section is empty.
Types ¶
type Features ¶
type Features struct { SystemConfig `json:"system_config"` MapTypes `json:"map_types"` Helpers map[string][]string `json:"helpers"` Misc `json:"misc"` }
Features contains BPF feature checks returned by bpftool.
type KernelParam ¶
type KernelParam string
KernelParam is a type based on string which represents CONFIG_* kernel parameters which usually have values "y", "n" or "m".
func (KernelParam) Enabled ¶
func (kp KernelParam) Enabled() bool
Enabled checks whether the kernel parameter is enabled.
func (KernelParam) Module ¶
func (kp KernelParam) Module() bool
Module checks whether the kernel parameter is enabled as a module.
type MapTypes ¶
type MapTypes struct { HaveHashMapType bool `json:"have_hash_map_type"` HaveArrayMapType bool `json:"have_array_map_type"` HaveProgArrayMapType bool `json:"have_prog_array_map_type"` HavePerfEventArrayMapType bool `json:"have_perf_event_array_map_type"` HavePercpuHashMapType bool `json:"have_percpu_hash_map_type"` HavePercpuArrayMapType bool `json:"have_percpu_array_map_type"` HaveStackTraceMapType bool `json:"have_stack_trace_map_type"` HaveCgroupArrayMapType bool `json:"have_cgroup_array_map_type"` HaveLruHashMapType bool `json:"have_lru_hash_map_type"` HaveLruPercpuHashMapType bool `json:"have_lru_percpu_hash_map_type"` HaveLpmTrieMapType bool `json:"have_lpm_trie_map_type"` HaveArrayOfMapsMapType bool `json:"have_array_of_maps_map_type"` HaveHashOfMapsMapType bool `json:"have_hash_of_maps_map_type"` HaveDevmapMapType bool `json:"have_devmap_map_type"` HaveSockmapMapType bool `json:"have_sockmap_map_type"` HaveCpumapMapType bool `json:"have_cpumap_map_type"` HaveXskmapMapType bool `json:"have_xskmap_map_type"` HaveSockhashMapType bool `json:"have_sockhash_map_type"` HaveCgroupStorageMapType bool `json:"have_cgroup_storage_map_type"` HaveReuseportSockarrayMapType bool `json:"have_reuseport_sockarray_map_type"` HavePercpuCgroupStorageMapType bool `json:"have_percpu_cgroup_storage_map_type"` HaveQueueMapType bool `json:"have_queue_map_type"` HaveStackMapType bool `json:"have_stack_map_type"` }
MapTypes contains bools indicating which types of BPF maps the currently running kernel supports.
type Misc ¶ added in v1.8.9
type Misc struct {
HaveLargeInsnLimit bool `json:"have_large_insn_limit"`
}
Misc contains bools exposing miscellaneous eBPF features.
type ProbeManager ¶
type ProbeManager struct {
// contains filtered or unexported fields
}
ProbeManager is a manager of BPF feature checks.
func NewProbeManager ¶
func NewProbeManager() *ProbeManager
NewProbeManager returns a new instance of ProbeManager - a manager of BPF feature checks.
func (*ProbeManager) CreateHeadersFile ¶ added in v1.8.0
func (p *ProbeManager) CreateHeadersFile() error
CreateHeadersFile creates a C header file with macros indicating which BPF features are available in the kernel.
func (*ProbeManager) GetHelpers ¶ added in v1.7.0
func (p *ProbeManager) GetHelpers(prog string) map[string]struct{}
GetHelpers returns information about available BPF helpers for the given program type. If program type is not found, returns nil.
func (*ProbeManager) GetMapTypes ¶ added in v1.7.0
func (p *ProbeManager) GetMapTypes() *MapTypes
GetMapTypes returns information about supported BPF map types.
func (*ProbeManager) GetMisc ¶ added in v1.8.9
func (p *ProbeManager) GetMisc() *Misc
GetMisc returns information about miscellaneous eBPF features.
func (*ProbeManager) SystemConfigProbes ¶
func (p *ProbeManager) SystemConfigProbes() error
SystemConfigProbes performs a check of kernel configuration parameters. It returns an error when parameters required by Cilium are not enabled. It logs warnings when optional parameters are not enabled.
func (*ProbeManager) SystemKernelHz ¶ added in v1.8.0
func (p *ProbeManager) SystemKernelHz() (int, error)
SystemKernelHz returns the HZ value that the kernel has been configured with.
type SystemConfig ¶
type SystemConfig struct { UnprivilegedBpfDisabled int `json:"unprivileged_bpf_disabled"` BpfJitEnable int `json:"bpf_jit_enable"` BpfJitHarden int `json:"bpf_jit_harden"` BpfJitKallsyms int `json:"bpf_jit_kallsyms"` BpfJitLimit int `json:"bpf_jit_limit"` ConfigBpf KernelParam `json:"CONFIG_BPF"` ConfigBpfSyscall KernelParam `json:"CONFIG_BPF_SYSCALL"` ConfigHaveEbpfJit KernelParam `json:"CONFIG_HAVE_EBPF_JIT"` ConfigBpfJit KernelParam `json:"CONFIG_BPF_JIT"` ConfigBpfJitAlwaysOn KernelParam `json:"CONFIG_BPF_JIT_ALWAYS_ON"` ConfigCgroups KernelParam `json:"CONFIG_CGROUPS"` ConfigCgroupBpf KernelParam `json:"CONFIG_CGROUP_BPF"` ConfigCgroupNetClassID KernelParam `json:"CONFIG_CGROUP_NET_CLASSID"` ConfigSockCgroupData KernelParam `json:"CONFIG_SOCK_CGROUP_DATA"` ConfigBpfEvents KernelParam `json:"CONFIG_BPF_EVENTS"` ConfigKprobeEvents KernelParam `json:"CONFIG_KPROBE_EVENTS"` ConfigUprobeEvents KernelParam `json:"CONFIG_UPROBE_EVENTS"` ConfigTracing KernelParam `json:"CONFIG_TRACING"` ConfigFtraceSyscalls KernelParam `json:"CONFIG_FTRACE_SYSCALLS"` ConfigFunctionErrorInjection KernelParam `json:"CONFIG_FUNCTION_ERROR_INJECTION"` ConfigBpfKprobeOverride KernelParam `json:"CONFIG_BPF_KPROBE_OVERRIDE"` ConfigNet KernelParam `json:"CONFIG_NET"` ConfigXdpSockets KernelParam `json:"CONFIG_XDP_SOCKETS"` ConfigLwtunnelBpf KernelParam `json:"CONFIG_LWTUNNEL_BPF"` ConfigNetActBpf KernelParam `json:"CONFIG_NET_ACT_BPF"` ConfigNetClsBpf KernelParam `json:"CONFIG_NET_CLS_BPF"` ConfigNetClsAct KernelParam `json:"CONFIG_NET_CLS_ACT"` ConfigNetSchIngress KernelParam `json:"CONFIG_NET_SCH_INGRESS"` ConfigXfrm KernelParam `json:"CONFIG_XFRM"` ConfigIPRouteClassID KernelParam `json:"CONFIG_IP_ROUTE_CLASSID"` ConfigIPv6Seg6Bpf KernelParam `json:"CONFIG_IPV6_SEG6_BPF"` ConfigBpfLircMode2 KernelParam `json:"CONFIG_BPF_LIRC_MODE2"` ConfigBpfStreamParser KernelParam `json:"CONFIG_BPF_STREAM_PARSER"` ConfigNetfilterXtMatchBpf KernelParam `json:"CONFIG_NETFILTER_XT_MATCH_BPF"` ConfigBpfilter KernelParam `json:"CONFIG_BPFILTER"` ConfigBpfilterUmh KernelParam `json:"CONFIG_BPFILTER_UMH"` ConfigTestBpf KernelParam `json:"CONFIG_TEST_BPF"` ConfigKernelHz KernelParam `json:"CONFIG_HZ"` }
SystemConfig contains kernel configuration and sysctl parameters related to BPF functionality.