Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.
/ filter2xdp Public archive

Compile and load PCAP filter expression as XDP BPF program

License

Notifications You must be signed in to change notification settings

tklauser/filter2xdp

Repository files navigation

filter2xdp

filter2xdp will take a pcap/tcpdump filter expression, compile it to classical BPF (cBPF) using libpcap, convert it to extended BPF (eBPF) and load it as an XDP BPF program. By default, the XDP program will only pass packets to the Linux network stack which match the filter expression. If the XDP program is loaded using the --invert option, the filter is reversed and the program will drop all packets matching the filter expression.

Note: This is work in progress and not working yet as intended (i.e. no valid XDP eBPF programs are generated). However, Feedback, suggestions and patches are already welcome!

Usage

Usage: filter2xdp [OPTIONS...] -i <dev> FILTER
Options:
  -i/--interface <dev>  Network device (required)
  -n/--invert           Invert filter, drop matching packets
  -v/--verbose          Verbose mode
  -h/--help             Show this help message

Prerequisites

  • Linux Kernel 4.8+
  • libpcap (development library and headers)

License

filter2xdp is subject to the GPL, version 2.

Please see the COPYING file for the full license text.

Resources

Releases

No releases published

Packages

No packages published