XDP REDIRECT(9)
β¨ xdp redirect β¨
Okay bestie, welcome to xdp redirect(9) from the Kernel API Manual β we're doing kernel networking today, and honestly? It's giving main-character energy π
.
So XDP_REDIRECT works by a three-step process, implemented in the functions below:
- The
bpf_redirectandbpf_redirect_maphelpers will lookup the target of the redirect and store it (along with some other metadata) in a per-CPUstruct bpf_redirect_infoπ. - When the program returns the
XDP_REDIRECTreturn code, the driver will callxdp_do_redirect, which will use the information instruct bpf_redirect_infoto actually enqueue the frame into a map type-specific bulk queue structure π. - Before exiting its NAPI poll loop, the driver will call
xdp_do_flush, which will flush all the different bulk queues, thus completing the redirect β¨.
β οΈ Important note, bestie:xdp_do_flushmust be called beforenapi_complete_donein the driver, as theXDP_REDIRECTlogic relies on being inside a single NAPI instance through to thexdp_do_flushcall for RCU protection of all in-kernel data structures π. Like, do not mess with that ordering, fr fr.
π SEE ALSO π
- Kernel file
./net/core/filter.c sk_filter_trim_cap(9)bpf_convert_filter(9)bpf_check_classic(9)sk_filter_release_rcu(9)sk_filter_release(9)bpf_prog_create(9)bpf_prog_create_from_user(9)sk_attach_filter(9)bpf_skb_meta_pointer(9)bpf_dynptr_from_skb_meta(9)bpf_xdp_pull_data(9)bpf_icmp_send(9)
π Cute little sign-off: this icon came from source ./net/core, dated October 2026, and it's filed under xdp redirect(9) β slay, go read those see-alsos π«Άπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms