* [PATCH] netfilter: bpf_link: avoid unused-function warning
@ 2023-08-01 15:02 Arnd Bergmann
2023-08-01 15:20 ` Daniel Xu
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2023-08-01 15:02 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal
Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexei Starovoitov, Daniel Xu, netfilter-devel,
coreteam, netdev, linux-kernel, bpf
From: Arnd Bergmann <arnd@arndb.de>
The newly added function is unused in some random configurations:
net/netfilter/nf_bpf_link.c:32:1: error: 'get_proto_defrag_hook' defined but not used [-Werror=unused-function]
32 | get_proto_defrag_hook(struct bpf_nf_link *link,
| ^~~~~~~~~~~~~~~~~~~~~
Change the preprocessor conditionals to if() checks that the
compiler can understand to avoid the warning.
Fixes: 91721c2d02d3a ("netfilter: bpf: Support BPF_F_NETFILTER_IP_DEFRAG in netfilter link")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
net/netfilter/nf_bpf_link.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/nf_bpf_link.c b/net/netfilter/nf_bpf_link.c
index 8fe594bbc7e24..6028fd4c1ab4c 100644
--- a/net/netfilter/nf_bpf_link.c
+++ b/net/netfilter/nf_bpf_link.c
@@ -74,24 +74,26 @@ static int bpf_nf_enable_defrag(struct bpf_nf_link *link)
const struct nf_defrag_hook __maybe_unused *hook;
switch (link->hook_ops.pf) {
-#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4)
case NFPROTO_IPV4:
+ if (!IS_ENABLED(CONFIG_NF_DEFRAG_IPV4))
+ return -EAFNOSUPPORT;
+
hook = get_proto_defrag_hook(link, nf_defrag_v4_hook, "nf_defrag_ipv4");
if (IS_ERR(hook))
return PTR_ERR(hook);
link->defrag_hook = hook;
return 0;
-#endif
-#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
case NFPROTO_IPV6:
+ if (!IS_ENABLED(CONFIG_NF_DEFRAG_IPV6))
+ return -EAFNOSUPPORT;
+
hook = get_proto_defrag_hook(link, nf_defrag_v6_hook, "nf_defrag_ipv6");
if (IS_ERR(hook))
return PTR_ERR(hook);
link->defrag_hook = hook;
return 0;
-#endif
default:
return -EAFNOSUPPORT;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: bpf_link: avoid unused-function warning
2023-08-01 15:02 [PATCH] netfilter: bpf_link: avoid unused-function warning Arnd Bergmann
@ 2023-08-01 15:20 ` Daniel Xu
2023-08-01 17:27 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Xu @ 2023-08-01 15:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
Arnd Bergmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexei Starovoitov, netfilter-devel, coreteam,
netdev, linux-kernel, bpf
Hi Arnd,
On Tue, Aug 01, 2023 at 05:02:41PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly added function is unused in some random configurations:
>
> net/netfilter/nf_bpf_link.c:32:1: error: 'get_proto_defrag_hook' defined but not used [-Werror=unused-function]
> 32 | get_proto_defrag_hook(struct bpf_nf_link *link,
> | ^~~~~~~~~~~~~~~~~~~~~
>
This was fixed in 81584c23f249 ("netfilter: bpf: Only define get_proto_defrag_hook() if necessary").
Thanks,
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: bpf_link: avoid unused-function warning
2023-08-01 15:20 ` Daniel Xu
@ 2023-08-01 17:27 ` Arnd Bergmann
2023-08-01 19:29 ` Daniel Xu
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2023-08-01 17:27 UTC (permalink / raw)
To: Daniel Xu, Arnd Bergmann
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, netfilter-devel, coreteam, Netdev,
linux-kernel, bpf
On Tue, Aug 1, 2023, at 17:20, Daniel Xu wrote:
> Hi Arnd,
>
> On Tue, Aug 01, 2023 at 05:02:41PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> The newly added function is unused in some random configurations:
>>
>> net/netfilter/nf_bpf_link.c:32:1: error: 'get_proto_defrag_hook' defined but not used [-Werror=unused-function]
>> 32 | get_proto_defrag_hook(struct bpf_nf_link *link,
>> | ^~~~~~~~~~~~~~~~~~~~~
>>
>
> This was fixed in 81584c23f249 ("netfilter: bpf: Only define
> get_proto_defrag_hook() if necessary").
Ok, I guess this will be in tomorrow's linux-next then, right?
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: bpf_link: avoid unused-function warning
2023-08-01 17:27 ` Arnd Bergmann
@ 2023-08-01 19:29 ` Daniel Xu
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Xu @ 2023-08-01 19:29 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Pablo Neira Ayuso, Jozsef Kadlecsik,
Florian Westphal, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexei Starovoitov, netfilter-devel, coreteam,
Netdev, linux-kernel, bpf
On Tue, Aug 01, 2023 at 07:27:33PM +0200, Arnd Bergmann wrote:
> On Tue, Aug 1, 2023, at 17:20, Daniel Xu wrote:
> > Hi Arnd,
> >
> > On Tue, Aug 01, 2023 at 05:02:41PM +0200, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> The newly added function is unused in some random configurations:
> >>
> >> net/netfilter/nf_bpf_link.c:32:1: error: 'get_proto_defrag_hook' defined but not used [-Werror=unused-function]
> >> 32 | get_proto_defrag_hook(struct bpf_nf_link *link,
> >> | ^~~~~~~~~~~~~~~~~~~~~
> >>
> >
> > This was fixed in 81584c23f249 ("netfilter: bpf: Only define
> > get_proto_defrag_hook() if necessary").
>
> Ok, I guess this will be in tomorrow's linux-next then, right?
>
> Arnd
I'm not too familiar with the linux-next process, but chatgpt is telling
me it should be.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-01 19:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01 15:02 [PATCH] netfilter: bpf_link: avoid unused-function warning Arnd Bergmann
2023-08-01 15:20 ` Daniel Xu
2023-08-01 17:27 ` Arnd Bergmann
2023-08-01 19:29 ` Daniel Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).