Skip to content

Commit 0ee072f

Browse files
Phil Suttergregkh
authored andcommitted
netfilter: conntrack: Add and use nf_ct_set_auto_assign_helper_warned()
[ Upstream commit 31d0bb9 ] The function sets the pernet boolean to avoid the spurious warning from nf_ct_lookup_helper() when assigning conntrack helpers via nftables. Fixes: 1a64edf ("netfilter: nft_ct: add helper set support") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9b2bbf3 commit 0ee072f

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

include/net/netfilter/nf_conntrack_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,5 @@ void nf_nat_helper_unregister(struct nf_conntrack_nat_helper *nat);
177177
int nf_nat_helper_try_module_get(const char *name, u16 l3num,
178178
u8 protonum);
179179
void nf_nat_helper_put(struct nf_conntrack_helper *helper);
180+
void nf_ct_set_auto_assign_helper_warned(struct net *net);
180181
#endif /*_NF_CONNTRACK_HELPER_H*/

net/netfilter/nf_conntrack_helper.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,12 @@ static const struct nf_ct_ext_type helper_extend = {
556556
.id = NF_CT_EXT_HELPER,
557557
};
558558

559+
void nf_ct_set_auto_assign_helper_warned(struct net *net)
560+
{
561+
nf_ct_pernet(net)->auto_assign_helper_warned = true;
562+
}
563+
EXPORT_SYMBOL_GPL(nf_ct_set_auto_assign_helper_warned);
564+
559565
void nf_conntrack_helper_pernet_init(struct net *net)
560566
{
561567
struct nf_conntrack_net *cnet = nf_ct_pernet(net);

net/netfilter/nft_ct.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,9 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,
10401040
if (err < 0)
10411041
goto err_put_helper;
10421042

1043+
/* Avoid the bogus warning, helper will be assigned after CT init */
1044+
nf_ct_set_auto_assign_helper_warned(ctx->net);
1045+
10431046
return 0;
10441047

10451048
err_put_helper:

0 commit comments

Comments
 (0)