26 releases (11 stable)
2.3.0 | Jan 9, 2022 |
---|---|
2.2.0 | Nov 17, 2021 |
2.1.0 | Oct 29, 2021 |
1.3.0 | Dec 7, 2020 |
0.9.4 | Nov 6, 2019 |
#78 in #ebpf
50 downloads per month
Used in 3 crates
(2 directly)
31KB
458 lines
Procedural macros to help writing eBPF programs using the redbpf-probes
crate.
Overview
redbpf-macros
is part of the redbpf
project. Together with
redbpf-probes
, it provides an idiomatic Rust API to
write programs that can be compiled to eBPF bytecode and executed by the linux
in-kernel eBPF virtual machine.
To streamline the process of working with eBPF programs even further, redbpf
also provides cargo-bpf
- a cargo subcommand to simplify
creating and building eBPF programs.
Example
#![no_std]
#![no_main]
use redbpf_probes::xdp::prelude::*;
// configure kernel version compatibility and license
program!(0xFFFFFFFE, "GPL");
#[xdp]
fn example_xdp_probe(ctx: XdpContext) -> XdpResult {
// do something here
Ok(XdpAction::Pass)
}
Dependencies
~1.4–2MB
~46K SLoC