bpf-ninja🥷 is a tool that can capture packets before they are processed by XDP/TC/cgroup, while minimizing the impact on existing XDP programs.
// readme
bpf-ninja
[!NOTE] This project was renamed from xdp-ninja (July 2026): the tool has outgrown XDP — it also observes tc-bpf programs, and more BPF hook points are planned. GitHub redirects the old repository URL, but the Go module path changed to
github.com/takehaya/bpf-ninja, sogo install/ imports need the new path. Environment variables are nowBPF_NINJA_*(the oldXDP_NINJA_*names are no longer read).
bpf-ninja captures packets at BPF hook points — XDP, tc-bpf, cgroup-skb, and netfilter, with more planned. tcpdump runs below XDP and can’t show what XDP or tc-bpf did to the packet, and cBPF filters can’t walk into VXLAN / GTP / MPLS / SRv6 inner headers. Attach via fentry/fexit to a running XDP without modifying it, or --mode xdp for standalone capture on a netdev. Filters use the built-in DSL by default — chains like eth/ipv4/udp/vxlan/eth/ipv4/tcp. Plain tcpdump syntax via cbpfc is still accepted via --cbpf, kept for backwards compatibility and planned to retire once the DSL surface stabilises. Output is pcap (pcapng) to stdout.🥷
Install
# One-liner (downloads pre-built binary from GitHub…