Documentation ¶
Overview ¶
Package probes provides BPF features checks based on bpftool.
Index ¶
- Variables
- func HaveBoundedLoops() error
- func HaveLargeInstructionLimit() error
- func HaveMapType(mt ebpf.MapType) error
- func HaveProgramHelper(pt ebpf.ProgramType, helper asm.BuiltinFunc) error
- func HaveProgramType(pt ebpf.ProgramType) error
- func HaveV2ISA() error
- func HaveV3ISA() error
- type Features
- type KernelParam
- type MapTypes
- type ProbeManager
- func (p *ProbeManager) CreateHeadersFile() error
- func (p *ProbeManager) GetOptionalConfig() map[KernelParam]kernelOption
- func (p *ProbeManager) GetRequiredConfig() map[KernelParam]kernelOption
- func (p *ProbeManager) KernelConfigAvailable() bool
- func (*ProbeManager) Probe() Features
- 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 ¶
func HaveBoundedLoops ¶
func HaveBoundedLoops() error
HaveBoundedLoops is a wrapper around features.HaveBoundedLoops() to check if the kernel supports bounded loops in BPF programs. On unexpected probe results this function will terminate with log.Fatal().
func HaveLargeInstructionLimit ¶
func HaveLargeInstructionLimit() error
HaveLargeInstructionLimit is a wrapper around features.HaveLargeInstructions() to check if the kernel supports the 1 Million instruction limit. On unexpected probe results this function will terminate with log.Fatal().
func HaveMapType ¶ added in v1.13.0
HaveMapType is a wrapper around features.HaveMapType() to check if a certain BPF map type is supported by the kernel. On unexpected probe results this function will terminate with log.Fatal().
func HaveProgramHelper ¶
func HaveProgramHelper(pt ebpf.ProgramType, helper asm.BuiltinFunc) error
HaveProgramHelper is a wrapper around features.HaveProgramHelper() to check if a certain BPF program/helper copmbination is supported by the kernel. On unexpected probe results this function will terminate with log.Fatal().
func HaveProgramType ¶ added in v1.13.0
func HaveProgramType(pt ebpf.ProgramType) error
HaveProgramType is a wrapper around features.HaveProgramType() to check if a certain BPF program type is supported by the kernel. On unexpected probe results this function will terminate with log.Fatal().
Types ¶
type Features ¶
type Features struct { SystemConfig `json:"system_config"` MapTypes `json:"map_types"` }
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 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) GetOptionalConfig ¶
func (p *ProbeManager) GetOptionalConfig() map[KernelParam]kernelOption
GetOptionalConfig performs a check of *optional* kernel configuration options. It returns a map indicating which optional/non-mandatory kernel parameters are enabled. GetOptionalConfig is being used by CLI "cilium kernel-check".
func (*ProbeManager) GetRequiredConfig ¶
func (p *ProbeManager) GetRequiredConfig() map[KernelParam]kernelOption
GetRequiredConfig performs a check of mandatory kernel configuration options. It returns a map indicating which required kernel parameters are enabled - and which are not. GetRequiredConfig is being used by CLI "cilium kernel-check".
func (*ProbeManager) KernelConfigAvailable ¶
func (p *ProbeManager) KernelConfigAvailable() bool
KernelConfigAvailable checks if the Kernel Config is available on the system or not.
func (*ProbeManager) Probe ¶
func (*ProbeManager) Probe() Features
Probe probes the underlying kernel for 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.