selftests/bpf: test_xdp_veth: Add XDP broadcast redirection tests
authorBastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Wed, 12 Feb 2025 11:11:12 +0000 (12:11 +0100)
committerMartin KaFai Lau <martin.lau@kernel.org>
Tue, 18 Feb 2025 21:56:34 +0000 (13:56 -0800)
commit1e7e6345429cd5dc2476d0d543bcf0daa0fab6bb
treef33e19989f5a39797b8c1a1218155c8a17335e64
parent09c8bb1fae150573d5fbb2e4c2cb8d5342eb52f6
selftests/bpf: test_xdp_veth: Add XDP broadcast redirection tests

XDP redirections with BPF_F_BROADCAST and BPF_F_EXCLUDE_INGRESS flags
are tested by test_xdp_redirect_multi.sh but not within the test_progs
framework.

Add a broadcast test case in test_xdp_veth.c to test them.
Use the same BPF programs than the one used by
test_xdp_redirect_multi.sh.
Use a BPF map to select the broadcast flags.
Use a BPF map with an entry per veth to check whether packets are
received or not

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-4-fd0d39fca6e6@bootlin.com
tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c
tools/testing/selftests/bpf/progs/xdp_redirect_map.c