* [PATCH] netfilter: bpf: add missing declaration for bpf_ct_set_nat_info
@ 2026-02-03 8:43 Sun Jian
2026-02-03 12:56 ` Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: Sun Jian @ 2026-02-03 8:43 UTC (permalink / raw)
To: Pablo Neira Ayuso, Florian Westphal
Cc: Phil Sutter, Simon Horman, netfilter-devel, netdev, bpf,
linux-kernel, 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?
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.
Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
---
include/net/netfilter/nf_conntrack_bpf.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/net/netfilter/nf_conntrack_bpf.h b/include/net/netfilter/nf_conntrack_bpf.h
index 2d0da478c8e0..25b51fa783c8 100644
--- a/include/net/netfilter/nf_conntrack_bpf.h
+++ b/include/net/netfilter/nf_conntrack_bpf.h
@@ -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
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] netfilter: bpf: add missing declaration for bpf_ct_set_nat_info
2026-02-03 8:43 [PATCH] netfilter: bpf: add missing declaration for bpf_ct_set_nat_info Sun Jian
@ 2026-02-03 12:56 ` Florian Westphal
2026-02-03 13:05 ` sun jian
0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2026-02-03 12:56 UTC (permalink / raw)
To: Sun Jian
Cc: Pablo Neira Ayuso, Phil Sutter, Simon Horman, netfilter-devel,
netdev, bpf, linux-kernel
Sun Jian <sun.jian.kdev@gmail.com> wrote:
> 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.
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] netfilter: bpf: add missing declaration for bpf_ct_set_nat_info
2026-02-03 12:56 ` Florian Westphal
@ 2026-02-03 13:05 ` sun jian
0 siblings, 0 replies; 3+ messages in thread
From: sun jian @ 2026-02-03 13:05 UTC (permalink / raw)
To: Florian Westphal
Cc: Pablo Neira Ayuso, Phil Sutter, Simon Horman, netfilter-devel,
netdev, bpf, linux-kernel
On Tue, Feb 3, 2026 at 8:56 PM Florian Westphal <fw@strlen.de> wrote:
>
> Sun Jian <sun.jian.kdev@gmail.com> wrote:
> > 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.
>
> 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.
Sorry, I'll drop this patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-03 13:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 8:43 [PATCH] netfilter: bpf: add missing declaration for bpf_ct_set_nat_info Sun Jian
2026-02-03 12:56 ` Florian Westphal
2026-02-03 13:05 ` sun jian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox