selftests/bpf: test_xdp_veth: Add XDP program on egress test
authorBastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Wed, 12 Feb 2025 11:11:13 +0000 (12:11 +0100)
committerMartin KaFai Lau <martin.lau@kernel.org>
Tue, 18 Feb 2025 21:56:34 +0000 (13:56 -0800)
commita93bfd824d95b6f9109c1c185715c46725f54c91
tree6695d5bc4448c59576e6b7ceca6f0cb2c2cdb9cd
parent1e7e6345429cd5dc2476d0d543bcf0daa0fab6bb
selftests/bpf: test_xdp_veth: Add XDP program on egress test

XDP programs loaded on egress is tested by test_xdp_redirect_multi.sh
but not by the test_progs framework.

Add a test case in test_xdp_veth.c to test the XDP program on egress.
Use the same BPF program than test_xdp_redirect_multi.sh that replaces
the source MAC address by one provided through a BPF map.
Use a BPF program that stores the source MAC of received packets in a
map to check the test results.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250212-redirect-multi-v5-5-fd0d39fca6e6@bootlin.com
tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c
tools/testing/selftests/bpf/progs/xdp_redirect_map.c