2025-10-27 16:01:24 +00:00
2025-10-28 09:18:45 +00:00
2025-10-28 09:36:31 +00:00

l3-forwarding-xdp

L3/L4 XDP-based forwarding system for BIRD and Linux routers for achieving line-speed forwarding.

This project implements Layer 3 (IP) and Layer 4 (TCP/UDP) packet forwarding using eBPF and XDP (eXpress Data Path). It leverages the high-performance capabilities of XDP for efficient packet processing in the Linux kernel with bird or FRR.

Note: xdp-tools is highly recommended for loading and managing the XDP program.

Installation

Install the necessary dependencies using apt:

apt update
apt install clang llvm libbpf-dev libelf-dev pkg-config make git bpftool xdp-tools

Compilation

Compile the eBPF program from the source code:

clang -O2 -g -Wall -target bpf -D__BPF_TRACING__  -I /usr/src/linux-headers-$(uname -r)/include   -c main.c -o main.o

This will generate the object file main.o which contains the compiled eBPF code.

Usage

Attach to the Interface

Load the XDP program onto a network interface (e.g., eth0):

xdp-loader load eth0 ./main.o

Check the status of loaded XDP programs:

xdp-loader status

Monitoring and Debugging

Use bpftool to inspect maps and statistics:

bpftool map show

These commands will display information about the eBPF maps used in the program, such as flow statistics.

Unloading the Program

To unload the XDP program from the interface:

xdp-loader unload eth0
Description
L3-L4 xdp based forwarding / offloading for archiving line rates with linux based routers
Readme Apache-2.0 126 KiB
Languages
C 100%