Skip to contentSkip to conversation

netfilter: bpf: add missing declaration for bpf_ct_set_nat_info

PATCH In review Sun Jian 2 participants 3 messages Feb 3

Subsystems (4)
lore
Share & tools
lore

Sun Jian

author
#0 lore raw

PATCH 1/1 netfilter: bpf: add missing declaration for bpf_ct_set_nat_info

When building with Sparse (C=2), the following warning is reported:

net/netfilter/nf_nat_bpf.c:31:17: warning: symbol 'bpf_ct_set_nat_info'
was not declared. Should it be static?

This function is a BPF kfunc and must remain non-static to be visible to the BPF verifier via BTF. However, it lacks a proper declaration in the header file, which triggers the sparse warning.

Fix this by adding the missing declaration in include/net/netfilter/nf_conntrack_bpf.h inside the CONFIG_NF_NAT conditional block.

---
 include/net/netfilter/nf_conntrack_bpf.h | 3 +++
 1 file changed, 3 insertions(+)
include/net/netfilter/nf_conntrack_bpf.h +3 -0
index 2d0da478c8e0..25b51fa783c8 100644
@@ -33,6 +33,9 @@ static inline void cleanup_nf_conntrack_bpf(void)
     (IS_MODULE(CONFIG_NF_NAT) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES))
 
 extern int register_nf_nat_bpf(void);
+int bpf_ct_set_nat_info(struct nf_conn___init *nfct,
+			union nf_inet_addr *addr, int port,
+			enum nf_nat_manip_type manip);
 
 #else
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 5 lines · Sun Jian

When building with Sparse (C=2), the following warning is reported:

net/netfilter/nf_nat_bpf.c:31:17: warning: symbol 'bpf_ct_set_nat_info'
was not declared. Should it be static?

Quoted 7 lines

This function is a BPF kfunc and must remain non-static to be visible to the BPF verifier via BTF. However, it lacks a proper declaration in the header file, which triggers the sparse warning.

Fix this by adding the missing declaration in include/net/netfilter/nf_conntrack_bpf.h inside the CONFIG_NF_NAT conditional block.

Didn't Alexei tell you to not send more fixes like this?

https://lore.kernel.org/netfilter-devel/CAADnVQ+j8Q5+2KSsaddj3nmU1EkuRAt8XwM=zcSrfQfY+A1PsA@mail.gmail.com/

"No. Ignore the warning. Sparse is incorrect.
We have hundreds of such bogus warnings. Do NOT attempt to send more patches to "fix" them."

I'm not applying patches when a subsystem maintainer already said no.

author
#2 lore raw
Quoted 17 lines · Florian Westphal
Quoted 5 lines · Sun Jian

When building with Sparse (C=2), the following warning is reported:

net/netfilter/nf_nat_bpf.c:31:17: warning: symbol 'bpf_ct_set_nat_info'
was not declared. Should it be static?

Quoted 7 lines

This function is a BPF kfunc and must remain non-static to be visible to the BPF verifier via BTF. However, it lacks a proper declaration in the header file, which triggers the sparse warning.

Fix this by adding the missing declaration in include/net/netfilter/nf_conntrack_bpf.h inside the CONFIG_NF_NAT conditional block.

Didn't Alexei tell you to not send more fixes like this?

Quoted 8 lines

https://lore.kernel.org/netfilter-devel/CAADnVQ+j8Q5+2KSsaddj3nmU1EkuRAt8XwM=zcSrfQfY+A1PsA@mail.gmail.com/

"No. Ignore the warning. Sparse is incorrect.
We have hundreds of such bogus warnings. Do NOT attempt to send more patches to "fix" them."

I'm not applying patches when a subsystem maintainer already said no.

Sorry, I'll drop this patch.