22 releases (4 stable)
|1.1.2||Sep 16, 2020|
|1.0.0||Apr 1, 2020|
|0.9.13||Mar 4, 2020|
|0.9.7||Dec 13, 2019|
|0.1.1||Sep 26, 2018|
#11 in Unix APIs
450 downloads per month
Used in cargo-bpf
A Rust eBPF toolchain.
The RedBPF project is a collection of Rust libraries to work with eBPF programs. It includes:
redbpf-probes- an idiomatic Rust API to write programs that can be compiled to eBPF bytecode and executed by the linux in-kernel eBPF virtual machine.
redbpf-macros- companion crate to
redbpf-probeswhich provides procedural macros to reduce the amount of boilerplate needed to produce eBPF programs.
redbpf- a user space library that can be used to parse and load eBPF programs written using
cargo-bpf- a cargo subcommand for creating, developing and building eBPF programs in Rust using the RedBPF APIs.
The easiest way to get started is to install
cargo-bpf, see the
for more info.
directory also contains examples of using redbpf in real life.
To see how and what RedBPF can be used for, check out the ingraind project.
In order to build some of the code here, you will need the following:
- Linux 4.19+, with a build tree. The build tree is picked up from standard locations, or the
- LLVM 10
- The latest stable Rust compiler. We only promise to build with the latest stable and nightly compilers.
It's easiest to get started by installing
cargo-bpf using cargo.
cargo install cargo-bpf cargo bpf --help
If you would like to go the git way, clone this repository then make sure you sync the git submodules necessary to build redbpf:
git submodule sync git submodule update --init
Then install the dependencies for your distro before running the usual ritual.
cargo install --path cargo-bpf
Install the following dependencies:
apt-get install -y curl \ wget \ gnupg2 \ software-properties-common \ build-essential \ clang-10 \ llvm-10 \ libelf-dev \ linux-headers-$(uname -r) \ zlib1g \ ca-certificates
yum install -y clang-10.0.0 \ llvm-10.0.0 \ llvm-libs-10.0.0 \ llvm-devel-10.0.0 \ llvm-static-10.0.0 \ kernel \ kernel-devel \ elfutils-libelf-devel \ ca-certificates
This repository contains code from other software in the following directories, licensed under their own particular licenses:
bpf-sys/libelf/*: GPL2 + LGPL3
bpf-sys/bcc/*: Apache2, public domain
include/bpf_helpers.hLGPL2 + BSD-2
include/bpf_helper_defs.h: LGPL2 + BSD-2
bpf-sys/libbpf: LGPL2 + BSD-2
Where '+' means they are dual licensed.
RedBPF and its components, unless otherwise stated, are licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.