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>
This commit is contained in:
committed by
Alexei Starovoitov
parent
752fddc050
commit
a2f482c34a
@@ -21,7 +21,7 @@
|
||||
#include <linux/limits.h>
|
||||
|
||||
#include <linux/ip.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <net/if.h>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <test_progs.h>
|
||||
#include "cgroup_helpers.h"
|
||||
|
||||
#include <linux/tcp.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <linux/netlink.h>
|
||||
#include "sockopt_sk.skel.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "network_helpers.h"
|
||||
#include <linux/if_bonding.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <uapi/linux/netdev.h>
|
||||
|
||||
#include "xdp_dummy.skel.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <linux/if_link.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <bpf/bpf_endian.h>
|
||||
#include <uapi/linux/netdev.h>
|
||||
#include "test_xdp_do_redirect.skel.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <network_helpers.h>
|
||||
#include <bpf/btf.h>
|
||||
#include <linux/if_link.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <linux/errqueue.h>
|
||||
#include <linux/if_link.h>
|
||||
#include <linux/net_tstamp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <sys/mman.h>
|
||||
#include <net/if.h>
|
||||
#include <poll.h>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/pkt_cls.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_endian.h>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
/* offsetof() is used in static asserts, and the libbpf-redefined CO-RE
|
||||
* friendly version breaks compilation for older clang versions <= 15
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/pkt_cls.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_endian.h>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <linux/errqueue.h>
|
||||
#include <linux/if_link.h>
|
||||
#include <linux/net_tstamp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/if_xdp.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
Reference in New Issue
Block a user