ebpf

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BpfFSPath = "/run/kuma/bpf"
View Source
const CgroupPath = "/sys/fs/cgroup"
View Source
const LocalPodIPSPinnedMapPathRelativeToBPFFS = "/local_pod_ips"

LocalPodIPSPinnedMapPathRelativeToBPFFS is a path where the local_pod_ips map is pinned, it's hardcoded as "{BPFFS_path}/tc/globals/local_pod_ips" because merbridge is hard-coding it as well, and we don't want to allot to change it by mistake

View Source
const MaxItemLen = 10

MaxItemLen is the maximal amount of items like ports or IP ranges to include or/and exclude. It's currently hardcoded to 10 as merbridge during creation of this map is assigning hardcoded 244 bytes for map values:

Cidr:        8 bytes
  Cidr.Net:  4 bytes
  Cidr.Mask: 1 byte
  pad:       3 bytes

PodConfig:                                  244 bytes
  PodConfig.StatusPort:                       2 bytes
  pad:                                        2 bytes
  PodConfig.ExcludeOutRanges (10x Cidr):     80 bytes
  PodConfig.IncludeOutRanges (10x Cidr):     80 bytes
  PodConfig.IncludeInPorts   (10x 2 bytes):  20 bytes
  PodConfig.IncludeOutPorts  (10x 2 bytes):  20 bytes
  PodConfig.ExcludeInPorts   (10x 2 bytes):  20 bytes
  PodConfig.ExcludeOutPorts  (10x 2 bytes):  20 bytes

todo (bartsmykla): merbridge flagged this constant to be changed, so if

it will be changed, we have to update it
View Source
const NetNSPodIPSPinnedMapPathRelativeToBPFFS = "/netns_pod_ips"

Variables

This section is empty.

Functions

func GetFileInode added in v0.7.0

func GetFileInode(path string) (uint64, error)

func InitBPFFSMaybe

func InitBPFFSMaybe(fsPath string) error

func LoadAndAttachEbpfPrograms

func LoadAndAttachEbpfPrograms(programs []*Program, cfg config.Config) error

func Setup

func Setup(cfg config.Config) (string, error)

Types

type Cidr

type Cidr struct {
	Net  uint32 // network order
	Mask uint8
	// contains filtered or unexported fields
}

type PodConfig

type PodConfig struct {
	StatusPort uint16

	ExcludeOutRanges [MaxItemLen]Cidr
	IncludeOutRanges [MaxItemLen]Cidr
	IncludeInPorts   [MaxItemLen]uint16
	IncludeOutPorts  [MaxItemLen]uint16
	ExcludeInPorts   [MaxItemLen]uint16
	ExcludeOutPorts  [MaxItemLen]uint16
	// contains filtered or unexported fields
}

type Program

type Program struct {
	Name  string
	Flags func(verbose bool) ([]string, error)
}

Jump to

Keyboard shortcuts

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