A small test suite of eBPF programs running at the XDP level for testing the basics of a XDP-capable driver.
This was written as part of the final project evaluation of the Advanced Operating Systems course at Politecnico di Milano, a.y. 2023/2024. The other part of the project is an initial implementation of XDP support for the OpenNIC driver, which can be found on my colleagues fork.
- Simple program loading
simple
eBPF application
XDP_PASS
ing andXDP_DROP
ping packetspass_drop
eBPF application
- Echoing back packets with
XDP_TX
tx
eBPF program
- Redirecting packets with
XDP_REDIRECT
redirect_iface
eBPF program
Plus other helpers (udp_log
and lib/helpers.bash
).
After you made sure that all submodules have been initialized, in the root of
the project run make
, run the program you need and check the output of the
kernel debug trace/tcpdump/whatever you are using.
Topologies can be emulated by creating veth
interfaces using the helper shell
functions available in lib/helpers.bash
.
All eBPF applications take at least one argument, the interface to attach to, and should be run as root.
Heavy inspiration taken from the eBPF laboratories of the Network Computing course (code here) and the project I did for the same course.
Ideas about what to test have been taken from this presentation from RedHat about adding XDP support to a driver.