我的 eBPF 数据包要去哪里?

我的 eBPF 数据包要去哪里?

我有一个使用 eBPF 的测试用例,它在两个命名空间之间设置了“ping”。我的 eBPF 程序拦截流的第一个数据包,将其发送到用户空间,在那里它用于构建映射,以便流的后续数据包直接从接收 eth 传递到内核,在那里生成 ping 回复。然后,第一个数据包被输入到 eBPF 传输队列中,我期望它进入内核并生成 ping 回复,但实际上我没有看到这个数据包的进一步踪迹;在接口上的“tcpdump”中没有,在“pwru”中也没有。有人能告诉我我做错了什么吗?

我的测试用例在这里https://github.com/tjcw/bpf-examples/tree/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter;它的运行脚本在这里https://github.com/tjcw/bpf-examples/blob/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter/ping-namespace-direct-with-dummy/run.sh

运行日志(包括格式化的 tcpdump)在此处https://github.com/tjcw/bpf-examples/blob/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter/ping-namespace-direct-with-dummy/runlog.txt以及来自pwru这里https://github.com/tjcw/bpf-examples/blob/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter/ping-namespace-direct-with-dummy/pwru.txt

我在完全更新的 Ubuntu 22.04 下运行。

抱歉,上面的运行日志没有 tcpdump 输出。这里https://github.com/tjcw/bpf-examples/blob/tjcw-send-first-packet-debug-20221210.1121/AF_XDP-filter/ping-namespace-direct-with-dummy/run2.txt是我打算使用 tcpdumps 发布的内容。

我在目录中添加了一个 UDP 测试https://github.com/tjcw/bpf-examples/tree/tjcw-send-first-packet-debug-20221212.1400/AF_XDP-filter(参见文件 udp-sender-count.c 和 udp-receiver.c,以及目录 udp-namespace-direct-with-dummy 中的运行脚本和日志文件)。此测试用例显示第一个数据包被重定向到用户空间然后丢失,第二个数据包到达 udp 侦听器。

答案1

相关内容