* [PATCH] netfilter: conditionally use ct and ctinfo
@ 2022-03-05 18:08 trix
2022-03-07 12:46 ` Florian Westphal
0 siblings, 1 reply; 4+ messages in thread
From: trix @ 2022-03-05 18:08 UTC (permalink / raw)
To: pablo, kadlec, fw, davem, kuba
Cc: netfilter-devel, coreteam, netdev, linux-kernel, Tom Rix
From: Tom Rix <trix@redhat.com>
The setting ct and ctinfo are controlled by
CONF_NF_CONNTRACK. So their use should also
be controlled.
Signed-off-by: Tom Rix <trix@redhat.com>
---
net/netfilter/nfnetlink_log.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index d97eb280cb2e8..141e0ebf4bc23 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -629,9 +629,11 @@ __build_packet_message(struct nfnl_log_net *log,
htonl(atomic_inc_return(&log->global_seq))))
goto nla_put_failure;
+#if IS_ENABLED(CONFIG_NF_CONNTRACK)
if (ct && nfnl_ct->build(inst->skb, ct, ctinfo,
NFULA_CT, NFULA_CT_INFO) < 0)
goto nla_put_failure;
+#endif
if ((pf == NFPROTO_NETDEV || pf == NFPROTO_BRIDGE) &&
nfulnl_put_bridge(inst, skb) < 0)
--
2.26.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: conditionally use ct and ctinfo
2022-03-05 18:08 [PATCH] netfilter: conditionally use ct and ctinfo trix
@ 2022-03-07 12:46 ` Florian Westphal
2022-03-07 13:39 ` Tom Rix
0 siblings, 1 reply; 4+ messages in thread
From: Florian Westphal @ 2022-03-07 12:46 UTC (permalink / raw)
To: trix
Cc: pablo, kadlec, fw, davem, kuba, netfilter-devel, coreteam, netdev,
linux-kernel
trix@redhat.com <trix@redhat.com> wrote:
> From: Tom Rix <trix@redhat.com>
>
> The setting ct and ctinfo are controlled by
> CONF_NF_CONNTRACK. So their use should also
> be controlled.
Any reason for this change?
We try to avoid ifdef where possible, unless it avoids a compiler
warning/build/linker issue.
This doesn't change generated code for me (NF_CONNTRACK=n) either.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: conditionally use ct and ctinfo
2022-03-07 12:46 ` Florian Westphal
@ 2022-03-07 13:39 ` Tom Rix
2022-03-07 21:54 ` Florian Westphal
0 siblings, 1 reply; 4+ messages in thread
From: Tom Rix @ 2022-03-07 13:39 UTC (permalink / raw)
To: Florian Westphal
Cc: pablo, kadlec, davem, kuba, netfilter-devel, coreteam, netdev,
linux-kernel
On 3/7/22 4:46 AM, Florian Westphal wrote:
> trix@redhat.com <trix@redhat.com> wrote:
>> From: Tom Rix <trix@redhat.com>
>>
>> The setting ct and ctinfo are controlled by
>> CONF_NF_CONNTRACK. So their use should also
>> be controlled.
> Any reason for this change?
Define and use are connected. Doing something to one without doing
something to the other doesn't make sense.
Could removing the CONF_NF_CONNTRACK be done for the define side ?
Tom
> We try to avoid ifdef where possible, unless it avoids a compiler
> warning/build/linker issue.
>
> This doesn't change generated code for me (NF_CONNTRACK=n) either.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: conditionally use ct and ctinfo
2022-03-07 13:39 ` Tom Rix
@ 2022-03-07 21:54 ` Florian Westphal
0 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2022-03-07 21:54 UTC (permalink / raw)
To: Tom Rix
Cc: Florian Westphal, pablo, kadlec, davem, kuba, netfilter-devel,
coreteam, netdev, linux-kernel
Tom Rix <trix@redhat.com> wrote:
>
> On 3/7/22 4:46 AM, Florian Westphal wrote:
> > trix@redhat.com <trix@redhat.com> wrote:
> > > From: Tom Rix <trix@redhat.com>
> > >
> > > The setting ct and ctinfo are controlled by
> > > CONF_NF_CONNTRACK. So their use should also
> > > be controlled.
> > Any reason for this change?
>
> Define and use are connected. Doing something to one without doing something
> to the other doesn't make sense.
We often rely on compiler to remove branches that always evaluate to
false, just like in this case.
> Could removing the CONF_NF_CONNTRACK be done for the define side ?
Doubt it. Looking at git history it avoids build breakage.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-07 21:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-05 18:08 [PATCH] netfilter: conditionally use ct and ctinfo trix
2022-03-07 12:46 ` Florian Westphal
2022-03-07 13:39 ` Tom Rix
2022-03-07 21:54 ` Florian Westphal
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).