summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2022-01-20 22:19:32 +0530
committerAndrii Nakryiko <andrii@kernel.org>2022-01-20 14:34:50 -0800
commit1058b6a78db21e3f503362ac4719b3d83b3dd745 (patch)
tree4bc65ac6cca2eab3ca533b8671667ef8d7f1a1a4 /tools
parent8c0be0631d81e48f77d0ebf0534c86e32bef5f89 (diff)
selftests/bpf: Do not fail build if CONFIG_NF_CONNTRACK=m/n
Some users have complained that selftests fail to build when CONFIG_NF_CONNTRACK=m. It would be useful to allow building as long as it is set to module or built-in, even though in case of building as module, user would need to load it before running the selftest. Note that this also allows building selftest when CONFIG_NF_CONNTRACK is disabled. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20220120164932.2798544-1-memxor@gmail.com
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/progs/test_bpf_nf.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_bpf_nf.c b/tools/testing/selftests/bpf/progs/test_bpf_nf.c
index 6f131c993c0b..f00a9731930e 100644
--- a/tools/testing/selftests/bpf/progs/test_bpf_nf.c
+++ b/tools/testing/selftests/bpf/progs/test_bpf_nf.c
@@ -17,18 +17,27 @@ int test_enonet_netns_id = 0;
int test_enoent_lookup = 0;
int test_eafnosupport = 0;
+struct nf_conn;
+
+struct bpf_ct_opts___local {
+ s32 netns_id;
+ s32 error;
+ u8 l4proto;
+ u8 reserved[3];
+} __attribute__((preserve_access_index));
+
struct nf_conn *bpf_xdp_ct_lookup(struct xdp_md *, struct bpf_sock_tuple *, u32,
- struct bpf_ct_opts *, u32) __ksym;
+ struct bpf_ct_opts___local *, u32) __ksym;
struct nf_conn *bpf_skb_ct_lookup(struct __sk_buff *, struct bpf_sock_tuple *, u32,
- struct bpf_ct_opts *, u32) __ksym;
+ struct bpf_ct_opts___local *, u32) __ksym;
void bpf_ct_release(struct nf_conn *) __ksym;
static __always_inline void
nf_ct_test(struct nf_conn *(*func)(void *, struct bpf_sock_tuple *, u32,
- struct bpf_ct_opts *, u32),
+ struct bpf_ct_opts___local *, u32),
void *ctx)
{
- struct bpf_ct_opts opts_def = { .l4proto = IPPROTO_TCP, .netns_id = -1 };
+ struct bpf_ct_opts___local opts_def = { .l4proto = IPPROTO_TCP, .netns_id = -1 };
struct bpf_sock_tuple bpf_tuple;
struct nf_conn *ct;