netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org
Subject: [PATCH net-next 02/19] netfilter: conntrack: Add and use nf_ct_set_auto_assign_helper_warned()
Date: Mon, 21 Mar 2022 13:30:35 +0100	[thread overview]
Message-ID: <20220321123052.70553-3-pablo@netfilter.org> (raw)
In-Reply-To: <20220321123052.70553-1-pablo@netfilter.org>

From: Phil Sutter <phil@nwl.cc>

The function sets the pernet boolean to avoid the spurious warning from
nf_ct_lookup_helper() when assigning conntrack helpers via nftables.

Fixes: 1a64edf54f55 ("netfilter: nft_ct: add helper set support")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 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(+)

diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 37f0fbefb060..9939c366f720 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -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*/
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index a97ddb1497aa..8dec42ec603e 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -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);
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
index 5adf8bb628a8..9c7472af9e4a 100644
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -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:
-- 
2.30.2


  parent reply	other threads:[~2022-03-21 12:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 12:30 [PATCH net-next 00/19] Netfilter updates for net-next Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 01/19] netfilter: conntrack: revisit gc autotuning Pablo Neira Ayuso
2022-03-21 13:20   ` patchwork-bot+netdevbpf
2022-03-21 12:30 ` Pablo Neira Ayuso [this message]
2022-03-21 12:30 ` [PATCH net-next 03/19] netfilter: nf_tables: do not reduce read-only expressions Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 04/19] netfilter: nf_tables: cancel tracking for clobbered destination registers Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 05/19] netfilter: nft_ct: track register operations Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 06/19] netfilter: nft_lookup: only cancel tracking for clobbered dregs Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 07/19] netfilter: nft_meta: extend reduce support to bridge family Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 08/19] netfilter: nft_numgen: cancel register tracking Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 09/19] netfilter: nft_osf: track register operations Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 10/19] netfilter: nft_hash: " Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 11/19] netfilter: nft_immediate: cancel register tracking for data destination register Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 12/19] netfilter: nft_socket: track register operations Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 13/19] netfilter: nft_xfrm: " Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 14/19] netfilter: nft_tunnel: " Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 15/19] netfilter: nft_fib: add reduce support Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 16/19] netfilter: nft_exthdr: " Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 17/19] netfilter: nf_nat_h323: eliminate anonymous module_init & module_exit Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 18/19] netfilter: flowtable: remove redundant field in flow_offload_work struct Pablo Neira Ayuso
2022-03-21 12:30 ` [PATCH net-next 19/19] netfilter: flowtable: pass flowtable to nf_flow_table_iterate() Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220321123052.70553-3-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).