Skip to content

Commit 224a876

Browse files
Tom RixFlorian Westphal
authored andcommitted
netfilter: conntrack: define variables exp_nat_nla_policy and any_addr with CONFIG_NF_NAT
gcc with W=1 and ! CONFIG_NF_NAT net/netfilter/nf_conntrack_netlink.c:3463:32: error: ‘exp_nat_nla_policy’ defined but not used [-Werror=unused-const-variable=] 3463 | static const struct nla_policy exp_nat_nla_policy[CTA_EXPECT_NAT_MAX+1] = { | ^~~~~~~~~~~~~~~~~~ net/netfilter/nf_conntrack_netlink.c:2979:33: error: ‘any_addr’ defined but not used [-Werror=unused-const-variable=] 2979 | static const union nf_inet_addr any_addr; | ^~~~~~~~ These variables use is controlled by CONFIG_NF_NAT, so should their definitions. Signed-off-by: Tom Rix <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent ab87603 commit 224a876

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/netfilter/nf_conntrack_netlink.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,7 +2976,9 @@ static int ctnetlink_exp_dump_mask(struct sk_buff *skb,
29762976
return -1;
29772977
}
29782978

2979+
#if IS_ENABLED(CONFIG_NF_NAT)
29792980
static const union nf_inet_addr any_addr;
2981+
#endif
29802982

29812983
static __be32 nf_expect_get_id(const struct nf_conntrack_expect *exp)
29822984
{
@@ -3460,10 +3462,12 @@ ctnetlink_change_expect(struct nf_conntrack_expect *x,
34603462
return 0;
34613463
}
34623464

3465+
#if IS_ENABLED(CONFIG_NF_NAT)
34633466
static const struct nla_policy exp_nat_nla_policy[CTA_EXPECT_NAT_MAX+1] = {
34643467
[CTA_EXPECT_NAT_DIR] = { .type = NLA_U32 },
34653468
[CTA_EXPECT_NAT_TUPLE] = { .type = NLA_NESTED },
34663469
};
3470+
#endif
34673471

34683472
static int
34693473
ctnetlink_parse_expect_nat(const struct nlattr *attr,

0 commit comments

Comments
 (0)