]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf: use the same udp and tcp headers in tests under test_progs
authorAlexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Wed, 20 Nov 2024 07:43:21 +0000 (08:43 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 2 Dec 2024 16:41:17 +0000 (08:41 -0800)
commita2f482c34a52176ae89d143979bbc9e7a72857c8
tree11f983d13ad244669c7f1c64e564bba37351a01c
parent752fddc0501c540214875b26bde2538f0a831811
selftests/bpf: use the same udp and tcp headers in tests under test_progs

Trying to add udp-dedicated helpers in network_helpers involves
including some udp header, which makes multiple test_progs tests build
fail:

In file included from ./progs/test_cls_redirect.h:13,
                 from [...]/prog_tests/cls_redirect.c:15:
[...]/usr/include/linux/udp.h:23:8: error: redefinition of ‘struct udphdr’
   23 | struct udphdr {
      |        ^~~~~~
In file included from ./network_helpers.h:17,
                 from [...]/prog_tests/cls_redirect.c:13:
[...]/usr/include/netinet/udp.h:55:8: note: originally defined here
   55 | struct udphdr
      |        ^~~~~~

This error is due to struct udphdr being defined in both <linux/udp.h>
and <netinet/udp.h>.

Use only <netinet/udp.h> in every test. While at it, perform the same
for tcp.h. For some tests, the change needs to be done in the eBPF
program part as well, because of some headers sharing between both
sides.

Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://lore.kernel.org/r/20241120-flow_dissector-v3-11-45b46494f937@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/network_helpers.c
tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c
tools/testing/selftests/bpf/prog_tests/xdp_flowtable.c
tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
tools/testing/selftests/bpf/progs/test_cls_redirect.c
tools/testing/selftests/bpf/progs/test_cls_redirect.h
tools/testing/selftests/bpf/progs/test_cls_redirect_dynptr.c
tools/testing/selftests/bpf/xdp_hw_metadata.c