cd polka-eBPF/
$ chmod +x *.sh
cd polka-eBPF/
sudo python3 topo_2h-eBPF.py
mininet> h1 ping h2
mininet> h2 ping h1
Source codes encap_map-h x .c and decap.c codes, respectively using tc anchored in the egress, and xdp.
To compile encap using maps (encap_map-h x .c), a targeted compilation is required, which becomes:
sudo clang -O2 -g -target bpf -D__TARGET_ARCH_x86 -c encap_map.c -o encap_map.o
And, to compile encap using maps (decap.c), a targeted compilation is required, which becomes:
sudo clang -O2 -target bpf -c decap.c -o decap.o
0A 00 02 02 -> IP Address in hex 48 82 03 80 00 00 00 00 00 00 -> Polka key in hex
h1 bpftool map update name ip_key_map key hex 0A 00 02 02 value hex 48 82 03 80 00 00 00 00 00 00
h1 bpftool map dump name ip_key_map
h1 bpftool map delete name ip_key_map_h1 key hex 0A 00 02 02
_ Note: In a Mininet emulation, it is necessary to create, for each host, a separate eBPF object file (e.g., encap_map_h1.o for h1-eth0, encap_map_h2.o for h2-eth0). For each object, a distinct map must also be created — for example, ip_key_map_h1 for h1-eth0 (encap_map_h1.o) and ip_key_map_h2 for h2-eth0 (encap_map_h2.o). This is required because the namespaces of h1 and h2 share the same maps; therefore, by using different names, each host/interface maintains its own independent map table. _
