1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Built-in redirect-all XDP program.
//!
//! Hand-written 5-instruction `bpf_redirect_map(&xsks_map,
//! ctx->rx_queue_index, XDP_PASS)` program. Pre-compiled to BPF ELF
//! bytecode and vendored in `programs/redirect_all.bpf.o`. See
//! `programs/README.md` for regeneration instructions.
use Ebpf;
use crateError;
use ;
/// The vendored compiled program. Regenerate via `xdp-tools/`.
const REDIRECT_ALL_BYTECODE: & = include_bytes!;
/// Symbol name of the program inside the compiled object.
const PROGRAM_NAME: &str = "xdp_sock_prog";
/// Map name inside the compiled object.
const MAP_NAME: &str = "xsks_map";
/// Load the built-in redirect-all XDP program. The program contains
/// an embedded `BPF_MAP_TYPE_XSKMAP` named `xsks_map` of capacity
/// `max_queues`.
///
/// After this returns, call [`XdpProgram::attach`] to attach to an
/// interface, then [`XdpProgram::register`] (or its alias methods on
/// [`super::XdpAttachment`]) to register AF_XDP sockets on the map.