Giter Club home page Giter Club logo

bpfd's Introduction

bpfd

A system daemon for managing eBPF programs.

Why bpfd?

bpfd seeks to solve the following problems:

  • To allow multiple XDP programs to share the same interface
  • To give administrators control over who can load programs and to allow them to define rules for ordering of networking eBPF programs
  • To allow programs to be loaded automatically at system launch time
  • To simplify the packaging and loading of eBPF-based infrastructure software (i.e Kubernetes CNI plugins)

How does it work?

bpfd is built using Aya an eBPF library written in Rust. It offers two ways of interaction:

  • bpfctl: a command line tool
  • using GRPC

It is expected that humans will use bpfctl whereas other applications on the system wishing to load programs using bpfd will use the GRPC. This allows for API bindings to be generated in any language supported by protocol buffers. We are initially targeting Go and Rust. See tutorial.md for some examples of starting bpfd, managing logs, and using bpfctl.

In order to allow the attachment of multiple XDP programs to the same interface, we have implemented the libxdp multiprog protocol. Offering this in bpfd allows for XDP applications whose loader was not using libxdp to benefit from this. We are also hoping to find a way for applications linked with libxdp to use bpfd instead if it's in use in the system.

Development Environment Setup

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
export PATH="$HOME/.cargo/bin:$PATH"
rustup toolchain install nightly -c rustfmt,clippy,rust-src
  • LLVM 11 or later (Linux package managers should provide a recent enough release)
sudo dnf install llvm-devel clang-devel
cargo install bpf-linker
sudo dnf install protobuf-compiler
git clone https://github.com/libbpf/libbpf --branch v0.8.0

Building bpfd

To just test with the latest bpfd, containerized image are stored in quay.io/bpfd (see image-build.md). To build with local changes, use the following commands.

If eBPF code has changed:

$ cargo xtask build-ebpf --libbpf-dir /path/to/libbpf

If protobuf files have changed:

$ cargo xtask build-proto

To build bpfd and bpfctl:

$ cargo build

Usage

Run the following script to generate certs in the default directories, /etc/bpfd/certs/ and /etc/bpfctl/certs/ (see configuration.md for configuring non-default values):

sudo ./scripts/setup.sh init

Load a sample XDP Program:

$ cargo build
$ sudo ./target/debug/bpfd&
$ sudo ./target/debug/bpfctl load /path/to/xdp/program -p xdp -i wlp2s0 --priority 50 -s "pass"

See tutorial.md for some examples of starting bpfd, managing logs, and using bpfctl.

License

bpfd-ebpf

Code in this crate is distributed under the terms of the GNU General Public License, Version 2 or the BSD 2 Clause license, at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the GPL-2 license, shall be dual licensed as above, without any additional terms or conditions.

bpfd, bpfd-common

Rust code in all other crates is distributed under the terms of either the MIT license or the Apache License (version 2.0), at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

The bpfd crate also contains eBPF code that is distributed under the terms of the GNU General Public License, Version 2 or the BSD 2 Clause license, at your option. It is packaged, in object form, inside the bpfd binary.

bpfd's People

Contributors

dave-tucker avatar dependabot[bot] avatar billy99 avatar nerdalert avatar anfredette avatar kot-begemot-uk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.