netfilter: conntrack: Add and use nf_ct_set_auto_assign_helper_warned()
Subsystems (2)
Phil Sutter
reviewerPATCH 1/1 netfilter: conntrack: Add and use nf_ct_set_auto_assign_helper_warned()
The function sets the pernet boolean to avoid the spurious warning from nf_ct_lookup_helper() when assigning conntrack helpers via nftables.
--- include/net/netfilter/nf_conntrack_helper.h | 1 + net/netfilter/nf_conntrack_helper.c | 6 ++++++ net/netfilter/nft_ct.c | 3 +++ 3 files changed, 10 insertions(+)
include/net/netfilter/nf_conntrack_helper.h +1 -0
@@ -177,4 +177,5 @@ void nf_nat_helper_unregister(struct nf_conntrack_nat_helper *nat);int nf_nat_helper_try_module_get (const char *name,u16 l3num,u8 protonum);void nf_nat_helper_put (struct nf_conntrack_helper *helper); +void nf_ct_set_auto_assign_helper_warned (struct net *net);#endif /*_NF_CONNTRACK_HELPER_H*/
net/netfilter/nf_conntrack_helper.c +6 -0
@@ -550,6 +550,12 @@ void nf_nat_helper_unregister(struct nf_conntrack_nat_helper *nat) }EXPORT_SYMBOL_GPL (nf_nat_helper_unregister); +void nf_ct_set_auto_assign_helper_warned (struct net *net) +{ +nf_ct_pernet (net)->auto_assign_helper_warned = true; +} +EXPORT_SYMBOL_GPL (nf_ct_set_auto_assign_helper_warned); +void nf_conntrack_helper_pernet_init (struct net *net) {struct nf_conntrack_net *cnet =nf_ct_pernet (net);
net/netfilter/nft_ct.c +3 -0
@@ -1041,6 +1041,9 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,if (err <0 ) goto err_put_helper; +/* Avoid the bogus warning, helper will be assigned after CT init */ +nf_ct_set_auto_assign_helper_warned (ctx->net); +return 0 ; err_put_helper:
Signature · 1 line
2.34.1
Pablo Neira Ayuso
maintainerHi Phil,
Quoted 2 lines · Phil Sutter
The function sets the pernet boolean to avoid the spurious warning from
nf_ct_lookup_helper()when assigning conntrack helpers via nftables.
I'm going to apply this alternative patch, based on yours. No need to expose a symbol to access the pernet area. I have also added the Fixes: tag.
Thanks.
From 292d6870c88cf855f1ccc72975974a50edd80720 Mon Sep 17 00:00:00 2001
From: Phil Sutter <[email protected]>
Date: Wed, 2 Mar 2022 22:02:55 +0100
Subject: [PATCH] netfilter: nft_ct: spurious warning when assigning conntrack
helpers
The function sets the pernet boolean to avoid the spurious warning from nf_ct_lookup_helper() when assigning conntrack helpers via nftables.
--- net/netfilter/nft_ct.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/nft_ct.c +3 -0
@@ -1041,6 +1041,9 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,if (err <0 ) goto err_put_helper; +/* Avoid the bogus warning, helper will be assigned after CT init */ +nf_ct_pernet (ctx->net)->auto_assign_helper_warned = true; +return 0 ; err_put_helper:
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerQuoted 8 lines · Pablo Neira Ayuso
Hi Phil,
Quoted 2 lines · Phil Sutter
The function sets the pernet boolean to avoid the spurious warning from
nf_ct_lookup_helper()when assigning conntrack helpers via nftables.I'm going to apply this alternative patch, based on yours. No need to expose a symbol to access the pernet area. I have also added the Fixes: tag.
Scratch this, I'll take your patch as is. The symbol is indeed needed.
Thanks.