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

#79 in #bpf

Download history 26/week @ 2024-07-28 13/week @ 2024-08-04 27/week @ 2024-08-11 8/week @ 2024-08-18 14/week @ 2024-08-25 13/week @ 2024-09-01 23/week @ 2024-09-08 21/week @ 2024-09-15 52/week @ 2024-09-22 58/week @ 2024-09-29 10/week @ 2024-10-06 16/week @ 2024-10-13 13/week @ 2024-10-20 37/week @ 2024-10-27 41/week @ 2024-11-03 17/week @ 2024-11-10

109 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

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.6–2.2MB
~49K SLoC