XDP/eBPF console utility and library (with custom loader) for gNB-UPF GTP encapsulation.
- Golang >= 1.21.4 (not yet tested with prior versions)
- Linux >= 5.19.0 (not yet tested with prior versions)
Clone the repo:
git clone https://github.com/Rotchamar/xdp_gtp
Build main executable:
cd ./cmd/xdp_gtp
go build
The executable file /cmd/xdp_gtp/xdp_gtp
will be used to start the application.
XDP_GTP includes several flags to adapt to different scenarios, information on these is accessible through the -h
flag:
Usage of ./xdp_gtp:
-c value
A,B,C -> A: Client IP addr | B: TEID | C: UPF IP addr
-i string
A,B -> A: Interface where XDP client-facing program is to be attached | B: Interface where XDP UPF-facing program is to be attached
(if not supplied, both will be attached to the same interface) (default "enp0s3")
-m string
XDP attach mode (generic|driver|offload) (default "generic")
In this scenario, we will deploy two clients in different networks that are to communicate with each other through a dummy 5G network (AGF to UPF). For simplicity's sake, the control plane will be disregarded and, therefore, not implemented. The resulting architecture is as follows:
- Client A:
sudo ip route add default via 10.0.1.1
- Client B:
sudo ip route add default via 10.0.2.1
- AGF/UPF A:
sudo ./cmd/xdp_gtp/xdp_gtp -i eth0,eth1 -c 10.0.1.10,1,10.0.100.20
- AGF/UPF B:
sudo ./cmd/xdp_gtp/xdp_gtp -i eth0,eth1 -c 10.0.2.10,1,10.0.100.10
If VMs 2 and 3's support XDP in driver or hardware offload mode, use -m driver
or -m offload
for better performance.
Use tools such as ping or iperf to test the conectivity between Clients A and B and benchmark the performance.
Taking into consideration the ease of use of this application, the pre-compiled eBPF bytecode and generated Go helper functions are provided in the repository, removing the need for users to compile and generate these elements by themselves. To provide more advanced users the possibility of making changes to the XDP/eBPF code, the following instructions for Ubuntu 22.04LTS are presented.
sudo apt install clang llvm libelf-dev libbpf-dev libc6-dev-i386
This step makes use of Cilium's bpf2go
program which is called with go generate
.
cd ./xdpgtp
go generate
- Roberto Chamorro - Initial work - Rotchamar
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details