]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
netfilter: nf_tables: pass context to object destroy indirection
authorPablo Neira Ayuso <pablo@netfilter.org>
Sat, 2 Jun 2018 21:38:46 +0000 (23:38 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 2 Jun 2018 22:02:06 +0000 (00:02 +0200)
The new connlimit object needs this to properly deal with conntrack
dependencies.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c
net/netfilter/nft_counter.c
net/netfilter/nft_ct.c

index 435c32d8a9959a5bb3f3be80980e1a1fee9a670f..81ec070582b6a5e8c4ac3be92238c158158613f6 100644 (file)
@@ -1070,7 +1070,8 @@ struct nft_object_ops {
        int                             (*init)(const struct nft_ctx *ctx,
                                                const struct nlattr *const tb[],
                                                struct nft_object *obj);
-       void                            (*destroy)(struct nft_object *obj);
+       void                            (*destroy)(const struct nft_ctx *ctx,
+                                                  struct nft_object *obj);
        int                             (*dump)(struct sk_buff *skb,
                                                struct nft_object *obj,
                                                bool reset);
index c785bc5a66f149aabf74cbb35b0af3c4db352b11..177658f4007e9c4b8c596698f6dedf775f1d3ed0 100644 (file)
@@ -4787,7 +4787,7 @@ err3:
        kfree(obj->name);
 err2:
        if (obj->ops->destroy)
-               obj->ops->destroy(obj);
+               obj->ops->destroy(&ctx, obj);
        kfree(obj);
 err1:
        module_put(type->owner);
@@ -4997,10 +4997,10 @@ err:
        return err;
 }
 
-static void nft_obj_destroy(struct nft_object *obj)
+static void nft_obj_destroy(const struct nft_ctx *ctx, struct nft_object *obj)
 {
        if (obj->ops->destroy)
-               obj->ops->destroy(obj);
+               obj->ops->destroy(ctx, obj);
 
        module_put(obj->ops->type->owner);
        kfree(obj->name);
@@ -6003,7 +6003,7 @@ static void nft_commit_release(struct nft_trans *trans)
                                           nft_trans_elem(trans).priv);
                break;
        case NFT_MSG_DELOBJ:
-               nft_obj_destroy(nft_trans_obj(trans));
+               nft_obj_destroy(&trans->ctx, nft_trans_obj(trans));
                break;
        case NFT_MSG_DELFLOWTABLE:
                nf_tables_flowtable_destroy(nft_trans_flowtable(trans));
@@ -6328,7 +6328,7 @@ static void nf_tables_abort_release(struct nft_trans *trans)
                                     nft_trans_elem(trans).priv, true);
                break;
        case NFT_MSG_NEWOBJ:
-               nft_obj_destroy(nft_trans_obj(trans));
+               nft_obj_destroy(&trans->ctx, nft_trans_obj(trans));
                break;
        case NFT_MSG_NEWFLOWTABLE:
                nf_tables_flowtable_destroy(nft_trans_flowtable(trans));
@@ -7022,7 +7022,7 @@ static void __nft_release_tables(struct net *net)
                list_for_each_entry_safe(obj, ne, &table->objects, list) {
                        list_del(&obj->list);
                        table->use--;
-                       nft_obj_destroy(obj);
+                       nft_obj_destroy(&ctx, obj);
                }
                list_for_each_entry_safe(chain, nc, &table->chains, list) {
                        ctx.chain = chain;
index eefe3b4099252f573ef3c7cbd9acafd273f9ea82..e59a74d6b7d6a16222d94c2fb7eb965966aa3b8a 100644 (file)
@@ -96,7 +96,8 @@ static void nft_counter_do_destroy(struct nft_counter_percpu_priv *priv)
        free_percpu(priv->counter);
 }
 
-static void nft_counter_obj_destroy(struct nft_object *obj)
+static void nft_counter_obj_destroy(const struct nft_ctx *ctx,
+                                   struct nft_object *obj)
 {
        struct nft_counter_percpu_priv *priv = nft_obj_data(obj);
 
index ea737fd789e871d025faf27e6324feb89c930b83..f8b19eacfa0cdd2a312bcea670086cb6475047cd 100644 (file)
@@ -826,7 +826,8 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,
        return 0;
 }
 
-static void nft_ct_helper_obj_destroy(struct nft_object *obj)
+static void nft_ct_helper_obj_destroy(const struct nft_ctx *ctx,
+                                     struct nft_object *obj)
 {
        struct nft_ct_helper_obj *priv = nft_obj_data(obj);