42-xdp-loadbalancer: fix various bugs which prevented the example from working (#175)

* added stub XDP_PASS for receiving veth

* added tcp csum to prevent packet dropping

* sticky backend select (hash over connection tuple)

---------

Co-authored-by: Benibr <1274814+benibr@users.noreply.github.com>
This commit is contained in:
Benibr
2025-07-23 04:14:42 +00:00
committed by GitHub
parent 5821feb8c5
commit 1a2744ff49
3 changed files with 63 additions and 2 deletions

View File

@@ -445,8 +445,11 @@ sudo ./teardown.sh
### Running the Load Balancer
To run the XDP load balancer, execute the following command, specifying the interface and backends' IP and MAC addresses:
To make XDP work with veth interfaces we need to add a stub eBPF program to the other end of the pair.
```console
clang -target bpf -o stub.bpf.o -c stub.bpf.c
sudo ip l set dev veth7 xdp obj ./stub.bpf.o sec .xdp # stub XDP_PASS on the receiving interface
sudo ip netns exec lb ./xdp_lb veth6 10.0.0.2 de:ad:be:ef:00:02 10.0.0.3 de:ad:be:ef:00:03
```