I have a test case using eBPF which sets up a 'ping' between 2 namespaces. My eBPF program intercepts the first packet of a flow, sends it to user space, where it is used to construct a map so that subsequent packets of the flow pass directly from the receiving eth to the kernel where the ping reply is generated. The first packet is then fed in to an eBPF transmit queue where I am expecting it to go to the kernel and generate a ping reply, but in fact I see no further trace of this packet; not in 'tcpdump' on the interfaces, and not in 'pwru'. Can anyone tell me what I am doing wrong ?
My test case is here https://github.com/tjcw/bpf-examples/tree/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter ; the run script for it is here https://github.com/tjcw/bpf-examples/blob/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter/ping-namespace-direct-with-dummy/run.sh .
The log of the run (including formatted tcpdumps) is here https://github.com/tjcw/bpf-examples/blob/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter/ping-namespace-direct-with-dummy/runlog.txt and the log from pwru
is here https://github.com/tjcw/bpf-examples/blob/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter/ping-namespace-direct-with-dummy/pwru.txt .
I am running under Ubuntu 22.04 completely updated.
Apologies, the run log above doesn't have tcpdump output. Here https://github.com/tjcw/bpf-examples/blob/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter/ping-namespace-direct-with-dummy/run2.txt is what I intended to post, with tcpdumps.
I have added a UDP test in directory https://github.com/tjcw/bpf-examples/tree/tjcw-send-first-packet-debug-20221212.1400/AF_XDP-filter ( see files udp-sender-count.c and udp-receiver.c , and run scripts and log files in directory udp-namespace-direct-with-dummy ) . This test case shows the first packet being redirected to user space and then being lost, and the second packet getting through to the udp listener.