Subject: Re: [PATCH] netfilter: extend CONFIG_NF_CONNTRACK compile time checks

From: Florian Westphal <[email-masked]>
Date: Tue, 11 Jan 2022 15:28:58 +0100

Tom Rix <[email-masked]> wrote:
> 
> On 1/11/22 1:46 AM, Pablo Neira Ayuso wrote:
> > Hi,
> > 
> > On Sat, Dec 25, 2021 at 09:37:44AM -0800, [email-masked] wrote:
> > > From: Tom Rix <[email-masked]>
> > > 
> > > Extends
> > > commit 83ace77f5117 ("netfilter: ctnetlink: remove get_ct indirection")
> > > 
> > > Add some compile time checks by following the ct and ctinfo variables
> > > that are only set when CONFIG_NF_CONNTRACK is enabled.
> > > 
> > > In nfulnl_log_packet(), ct is only set when CONFIG_NF_CONNTRACK
> > > is enabled. ct's later use in __build_packet_message() is only
> > > meaningful when CONFIG_NF_CONNTRACK is enabled, so add a check.
> > > 
> > > In nfqnl_build_packet_message(), ct and ctinfo are only set when
> > > CONFIG_NF_CONNTRACK is enabled.  Add a check for their decl and use.
> > > 
> > > nfqnl_ct_parse() is a static function, move the check to the whole
> > > function.
> > > 
> > > In nfqa_parse_bridge(), ct and ctinfo are only set by the only
> > > call to nfqnl_ct_parse(), so add a check for their decl and use.
> > > 
> > > Consistently initialize ctinfo to 0.
> > Are compile warning being trigger without this patch, maybe with
> > CONFIG_NF_CONNTRACK=n?
> 
> No compiler warnings, this was found by visual inspection.
> 
> Robot says to entend more, so I want to make sure a human is also
> interested.

I hoped compiler was able to remove that without aid of preprocessor :/