Re: [PATCH bpf-next v3 11/14] selftests/bpf: use the same udp and tcp headers in tests under test_progs

From: Stanislav Fomichev
Date: Wed Nov 20 2024 - 11:36:22 EST


On 11/20, Alexis Lothoré (eBPF Foundation) wrote:
> 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@xxxxxxxxxxx>

Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>