Hello, I'm totally newbie.I want to try some examples under the samples/bpf of the kernel tree using the virtio_net driver in kvm, in order to get familiar with the XDP. However, it seems to me that for kernels newer than linux-4.15, the xdp2 and xdp_tx_tunnel are not working in the case of virtio_net.
Can somebody help me out to make them working? 1) For linux-4.11.12, linux-4.12.14, and linux-4.14.31, xdp2 and xdp_tx_tunnel are working. [xdp2] 10.0.0.27# ./xdp2 2 (or ./xdp -N 2) 10.0.0.254# hping3 10.0.0.27 -p 5000 -2 10.0.0.254# tcpdump -nei kbr0 udp port 500006:18:37.677070 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2982 > 10.0.0.27.5000: UDP, length 0 06:18:37.677265 52:54:00:11:00:1b > 2e:c9:83:fb:5b:f3, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2982 > 10.0.0.27.5000: UDP, length 0
I can see the UDP packets with MAC addresses swapped. [xdp_tx_tunnel] 10.0.0.254# telnet 10.1.2.1 80 10.0.0.27# ./xdp_tx_iptunnel -i 2 -a 10.1.2.1 -p 80 -s 10.0.0.27 -d 10.0.0.24 -m 52:54:00:11:00:18 10.0.0.24# tcpdump -nei any proto 422:08:20.510354 In 52:54:00:11:00:1b ethertype IPv4 (0x0800), length 96: 10.0.0.27 > 10.0.0.24: 10.0.0.254.60826 > 10.1.2.1.80: Flags [S], seq 3224377720, win 29200, options [mss 1460,sackOK,TS val 217801953 ecr 0,nop,wscale 7], length 0 (ipip-proto-4)
I can see the encapsulated SYN packet that is forwarded by the 10.0.0.27. 2) For linux-4.15, linux-4.15.5, linux-4.15.13 and linux-4.16.1, xdp2 and xdp_tx_tunnel are NOT working. [xdp2] 10.0.0.27# ./xdp2 -N 2 10.0.0.254# hping3 10.0.0.27 -p 5000 -2 10.0.0.254# tcpdump -nei br0 udp port 500006:45:34.810046 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2346 > 10.0.0.27.5000: UDP, length 0 06:45:35.810176 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2347 > 10.0.0.27.5000: UDP, length 0
Only the outgoing packets can be seen. [xdp_tx_tunnel] 10.0.0.254# telnet 10.1.2.1 80 10.0.0.27# ./xdp_tx_iptunnel -i 2 -a 10.1.2.1 -p 80 -s 10.0.0.27 -d 10.0.0.24 -m 52:54:00:11:00:18 10.0.0.24# tcpdump -nei any proto 4 I can NOT see the encapsulated SYN packet that is forwarded by the 10.0.0.27. -- Sincerely, Takahashi Kimitoshi