netfilter: conditionally use ct and ctinfo
Subsystems (3)
PATCH 1/1 netfilter: conditionally use ct and ctinfo
From: Tom Rix <[email protected]>
The setting ct and ctinfo are controlled byCONF_NF_CONNTRACK. So their use should also
be controlled.
--- net/netfilter/nfnetlink_log.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nfnetlink_log.c +2 -0
@@ -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 )
Signature · 1 line
2.26.3
Florian Westphal
maintainerQuoted 5 lines · [email protected] <[email protected]> wrote:
From: Tom Rix <[email protected]>
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.
Quoted 7 lines · Florian Westphal
Quoted 5 lines · [email protected] <[email protected]> wrote:
From: Tom Rix <[email protected]>
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
Quoted 5 lines
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.
Florian Westphal
maintainerQuoted 5 lines · Tom Rix
Quoted 3 lines · Florian Westphal
Quoted 2 lines · [email protected] <[email protected]> wrote:
From: Tom Rix <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
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.
Quoted 1 line
Could removing the
CONF_NF_CONNTRACKbe done for the define side ?
Doubt it. Looking at git history it avoids build breakage.