ebpf

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const ATTACH_RESULT_FMT = "\rAttaching program (total: %d, succeeded: %d)"
View Source
const KprobeBPFProg = "/tmp/vrftrace_kprobe.bpf.o"
View Source
const NL_ATTR_VR_MESSAGE_PROTOCOL = 1
View Source
const SANDESH_REQUEST = 1
View Source
const ULLONG_MAX = 0xffffffffffffffff

Variables

This section is empty.

Functions

func DumpVrInterfaces

func DumpVrInterfaces() (*[]VrouterIface, error)

func GetBpfError

func GetBpfError(p *C.struct_btf) error

* libbpf pointer into a stderr code (or 0 if the pointer is valid)

func InitKprobe

func InitKprobe(btf_file string, args SymbolDbArgs) (*bpf.PerfBuffer, error)

func IsVrouterKmodLoaded

func IsVrouterKmodLoaded() bool

check if vrouter.ko is loaded on the system from /proc/module. See: How to find information about the kernel modules installed on the system https://access.redhat.com/solutions/4246821

Types

type BTF

type BTF struct {
	Btf *C.struct_btf
}

func LoadVmlinuxBtf

func LoadVmlinuxBtf() (*BTF, error)

* Probe few well-known locations for vmlinux kernel image and try to load BTF * data out of it to use for target BTF.

func ParseRaw

func ParseRaw(path string) (*BTF, error)

* libbpf API to parse BTF data from file.

func (*BTF) BtfFuncProto

func (vmlinux_btf *BTF) BtfFuncProto(btf_type *BTFType, id int) BtfFuncProto

* Resolve function proto from the BTF

func (*BTF) BtfTypeById

func (vmlinux_btf *BTF) BtfTypeById(id int) *BTFType

* Get btf_type by id

func (*BTF) LoadModuleBTF

func (vmlinux_btf *BTF) LoadModuleBTF(module string) error

* used to load module BTF, overrides with loaded BTF

type BTFKind

type BTFKind uint16
const (
	BTF_KIND_UNKN       BTFKind = iota /* Unknown	*/
	BTF_KIND_INT                       /* Integer	*/
	BTF_KIND_PTR                       /* Pointer	*/
	BTF_KIND_ARRAY                     /* Array	*/
	BTF_KIND_STRUCT                    /* Struct	*/
	BTF_KIND_UNION                     /* Union	*/
	BTF_KIND_ENUM                      /* Enumeration	*/
	BTF_KIND_FWD                       /* Forward	*/
	BTF_KIND_TYPEDEF                   /* Typedef	*/
	BTF_KIND_VOLATILE                  /* Volatile	*/
	BTF_KIND_CONST                     /* Const	*/
	BTF_KIND_RESTRICT                  /* Restrict	*/
	BTF_KIND_FUNC                      /* Function	*/
	BTF_KIND_FUNC_PROTO                /* Function Proto	*/
	BTF_KIND_VAR                       /* Variable	*/
	BTF_KIND_DATASEC                   /* Section	*/
	BTF_KIND_FLOAT                     /* Floating point	*/
	BTF_KIND_DECL_TAG                  /* Decl Tag */
	BTF_KIND_TYPE_TAG                  /* Type Tag */

	NR_BTF_KINDS
	BTF_KIND_MAX = NR_BTF_KINDS - 1
)

func (BTFKind) String

func (kind BTFKind) String() string

type BTFType

type BTFType struct {
	NameOff uint32
	/* "info" bits arrangement
	 * bits  0-15: vlen (e.g. # of struct's members)
	 * bits 16-23: unused
	 * bits 24-27: kind (e.g. int, ptr, array...etc)
	 * bits 28-30: unused
	 * bit     31: kind_flag, currently used by
	 *             struct, union and fwd
	 */
	Info uint32
	/* "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
	* FUNC, FUNC_PROTO, VAR, DECL_TAG and TYPE_TAG.
	* "type" is a type_id referring to another type.
	 */
	Type uint32

	// kind of this BTF type
	Kind string
	// Name of this BTF type
	Name string
	// contains filtered or unexported fields
}

func (*BTFType) IsArray

func (t *BTFType) IsArray() bool

func (*BTFType) IsComposite

func (t *BTFType) IsComposite() bool

func (*BTFType) IsConst

func (t *BTFType) IsConst() bool

func (*BTFType) IsDataSec

func (t *BTFType) IsDataSec() bool

func (*BTFType) IsDeclTag

func (t *BTFType) IsDeclTag() bool

func (*BTFType) IsEnum

func (t *BTFType) IsEnum() bool

func (*BTFType) IsFloat

func (t *BTFType) IsFloat() bool

func (*BTFType) IsFunc

func (t *BTFType) IsFunc() bool

func (*BTFType) IsFuncProto

func (t *BTFType) IsFuncProto() bool

func (*BTFType) IsFwd

func (t *BTFType) IsFwd() bool

func (*BTFType) IsInt

func (t *BTFType) IsInt() bool

func (*BTFType) IsMod

func (t *BTFType) IsMod() bool

func (*BTFType) IsPtr

func (t *BTFType) IsPtr() bool

func (*BTFType) IsRestrict

func (t *BTFType) IsRestrict() bool

func (*BTFType) IsStruct

func (t *BTFType) IsStruct() bool

func (*BTFType) IsTypeTag

func (t *BTFType) IsTypeTag() bool

func (*BTFType) IsTypedef

func (t *BTFType) IsTypedef() bool

func (*BTFType) IsUnion

func (t *BTFType) IsUnion() bool

func (*BTFType) IsVar

func (t *BTFType) IsVar() bool

func (*BTFType) IsVoid

func (t *BTFType) IsVoid() bool

func (*BTFType) IsVolatile

func (t *BTFType) IsVolatile() bool

type BtfFuncProto

type BtfFuncProto struct {
	/*
	 * name of the function
	 */
	Name string

	/*
	 * Arguments of the function
	 */
	Vargs []string
}

type KprobePerfEvent

type KprobePerfEvent struct {
	PacketId    uint64
	Tstamp      uint64
	Faddr       uint64
	Fname       string
	ProcessorId uint32
	IsReturn    bool
}

type PlatformInfo

type PlatformInfo struct {
	OsDist                string
	OsID                  string
	OsVersion             string
	KernelVersion         string
	IsDebugInfoBtfEnabled bool
}

func GetPlatformInfo

func GetPlatformInfo() (*PlatformInfo, error)

type Sandesh

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

Sandesh protocol and transport

func (*Sandesh) SendVifDumpRequest

func (sandesh *Sandesh) SendVifDumpRequest() ([]byte, error)

send vr_interface_req with dump_op to vrouter kernel

type SymbolDb

type SymbolDb struct {
	AvailFunc map[string]bool
	FuncAddr  map[uint64]string
	Pos2Func  map[string]map[string]int
}

func InitSymbolDb

func InitSymbolDb(args *SymbolDbArgs) (*SymbolDb, error)

func (*SymbolDb) CountPos2Func

func (symsdb *SymbolDb) CountPos2Func() int

func (*SymbolDb) FindSymByFaddr

func (symsdb *SymbolDb) FindSymByFaddr(faddr uint64) (string, error)

func (*SymbolDb) IsAvailFilter

func (symsdb *SymbolDb) IsAvailFilter(fname string) bool

func (*SymbolDb) PopulateAvailableFunctions

func (symsdb *SymbolDb) PopulateAvailableFunctions() error

func (*SymbolDb) PopulateKallSyms

func (symsdb *SymbolDb) PopulateKallSyms() error

func (*SymbolDb) PopulatePos2Func

func (symsdb *SymbolDb) PopulatePos2Func(args *SymbolDbArgs) error

type SymbolDbArgs

type SymbolDbArgs struct {
	Btf map[string][]string
}

type VrfraceKprobeSpec

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

type VrouterIface

type VrouterIface struct {
	Type  int32
	Idx   int32
	OsIdx int32
	Name  string
}

vrouter interface

Jump to

Keyboard shortcuts

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