bpf: Move nf_conn extern declarations to filter.h
authorDaniel Xu <dxu@dxuuu.xyz>
Tue, 20 Sep 2022 14:15:24 +0000 (08:15 -0600)
committerMartin KaFai Lau <martin.lau@kernel.org>
Tue, 20 Sep 2022 21:41:35 +0000 (14:41 -0700)
We're seeing the following new warnings on netdev/build_32bit and
netdev/build_allmodconfig_warn CI jobs:

    ../net/core/filter.c:8608:1: warning: symbol
    'nf_conn_btf_access_lock' was not declared. Should it be static?
    ../net/core/filter.c:8611:5: warning: symbol 'nfct_bsa' was not
    declared. Should it be static?

Fix by ensuring extern declaration is present while compiling filter.o.

Fixes: 864b656f82cc ("bpf: Add support for writing to nf_conn:mark")
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Link: https://lore.kernel.org/r/2bd2e0283df36d8a4119605878edb1838d144174.1663683114.git.dxu@dxuuu.xyz
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
include/linux/filter.h
include/net/netfilter/nf_conntrack_bpf.h
net/netfilter/nf_conntrack_bpf.c

index 75335432fcbcae5614c7bff59baa33be0e357b80..98e28126c24b36f47de1ca60b18610a2b58c4c80 100644 (file)
@@ -567,6 +567,12 @@ struct sk_filter {
 
 DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
 
+extern struct mutex nf_conn_btf_access_lock;
+extern int (*nfct_btf_struct_access)(struct bpf_verifier_log *log, const struct btf *btf,
+                                    const struct btf_type *t, int off, int size,
+                                    enum bpf_access_type atype, u32 *next_btf_id,
+                                    enum bpf_type_flag *flag);
+
 typedef unsigned int (*bpf_dispatcher_fn)(const void *ctx,
                                          const struct bpf_insn *insnsi,
                                          unsigned int (*bpf_func)(const void *,
index 1199d4f8e01919c4a52a20af8b7a8b9e36f2f2df..c8b80add1142575746bbf9c00d6ba266853a9c6c 100644 (file)
@@ -4,7 +4,6 @@
 #define _NF_CONNTRACK_BPF_H
 
 #include <linux/kconfig.h>
-#include <linux/mutex.h>
 
 #if (IS_BUILTIN(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) || \
     (IS_MODULE(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES))
 extern int register_nf_conntrack_bpf(void);
 extern void cleanup_nf_conntrack_bpf(void);
 
-extern struct mutex nf_conn_btf_access_lock;
-extern int (*nfct_btf_struct_access)(struct bpf_verifier_log *log, const struct btf *btf,
-                                    const struct btf_type *t, int off, int size,
-                                    enum bpf_access_type atype, u32 *next_btf_id,
-                                    enum bpf_type_flag *flag);
-
 #else
 
 static inline int register_nf_conntrack_bpf(void)
index 29c4efb3da5e56ecc19b76b02025cb5a280cbfce..67df64283aef9709f8532dee0d3271bb122cabbc 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/bpf_verifier.h>
 #include <linux/bpf.h>
 #include <linux/btf.h>
+#include <linux/filter.h>
 #include <linux/mutex.h>
 #include <linux/types.h>
 #include <linux/btf_ids.h>