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

#1986 in Procedural macros

Download history 67/week @ 2022-12-02 110/week @ 2022-12-09 46/week @ 2022-12-16 107/week @ 2022-12-23 49/week @ 2022-12-30 69/week @ 2023-01-06 91/week @ 2023-01-13 136/week @ 2023-01-20 86/week @ 2023-01-27 93/week @ 2023-02-03 109/week @ 2023-02-10 152/week @ 2023-02-17 85/week @ 2023-02-24 101/week @ 2023-03-03 58/week @ 2023-03-10 110/week @ 2023-03-17

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

MIT/Apache

30KB
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–1.5MB
~33K SLoC