]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
netfilter: conntrack: Add and use nf_ct_set_auto_assign_helper_warned()
authorPhil Sutter <phil@nwl.cc>
Wed, 2 Mar 2022 21:02:55 +0000 (22:02 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:39:15 +0000 (14:39 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 31d0bb9763efad30377505f3467f958d1ebe1e3d ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0ee072f91326d4a616098fb55c9e0e8e6a399642)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
include/net/netfilter/nf_conntrack_helper.h
net/netfilter/nf_conntrack_helper.c
net/netfilter/nft_ct.c

index 37f0fbefb060f3dd9773978991fe131e80dadf97..9939c366f720d4d3596c50c14214207493160bff 100644 (file)
@@ -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*/
index ae4488a13c70cb9196ae0d7f0117fafb7c602389..ceb38a7b37cb7950b88e5905916fd01204e67b45 100644 (file)
@@ -556,6 +556,12 @@ static const struct nf_ct_ext_type helper_extend = {
        .id     = NF_CT_EXT_HELPER,
 };
 
+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);
index 99b1de14ff7eeac09ffb809f2270cd325ea04848..54ecb9fbf2de69816012dc105351de8c7e559022 100644 (file)
@@ -1040,6 +1040,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: