Skip to content

generic-ebpf/generic-ebpf

Repository files navigation

generic-ebpf

Generic eBPF runtime. It (currently) consists of three components

  1. ebpf: Portable interpreter, JIT compiler, and ebpf subsystems (e.g. map) library, works in both of userspace and kernel.
  2. ebpf_dev: Character device for loading ebpf program or other related objects (e.g. map) into kernel. Alternative of Linux bpf(2).
  3. libgbpf: A library which implements abstraction layer for interacting with various eBPF systems and eBPF ELF parser. Currently supports ebpf_dev and Linux's native eBPF (experimental) as backends.

Current support status

ebpf ebpf_dev
FreeBSD Kernel Yes Yes
FreeBSD User Yes -
Linux Kernel Yes Yes
Linux User Yes -
MacOSX User Yes -

Build

$ make

After compilation, you will see at least one of below

  • ebpf.ko: Kernel module for ebpf library
  • ebpf-dev.ko: Kernel module for ebpf character device
  • libebpf.so: User space library for ebpf
  • libgbpf.a: Library for interacting with various eBPF systems

Please load or link them.

Running tests

Tests for user space library

// Install Python packages
$ pip install -r requirements.txt

// After make
$ make check

Tests for kernel

// After make
# make load
# make check-kern

Example Applications

Enhansing eBPF programmability to VALE (a.k.a. mSwitch) a very fast and modular software switch.

Dependencies

  • libelf (for libgbpf)
  • Concurrency Kit (for userspace targets)
  • Google Test (for testing)

Concurrency Kit and Google Test are contained to this repository. You don't have to install them by yourself.