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
Subject: [PATCH 01/26] netfilter: nf_tables: move nft_expr_clone() to nf_tables_api.c
Date: Mon, 30 Mar 2020 02:36:43 +0200	[thread overview]
Message-ID: <20200330003708.54017-2-pablo@netfilter.org> (raw)
In-Reply-To: <20200330003708.54017-1-pablo@netfilter.org>

Move the nft_expr_clone() helper function to the core.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/net/netfilter/nf_tables.h |  1 +
 net/netfilter/nf_tables_api.c     | 18 ++++++++++++++++++
 net/netfilter/nft_dynset.c        | 17 -----------------
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 5d80e09f8148..af2ed70d7eed 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -846,6 +846,7 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)
 	return (void *)expr->data;
 }
 
+int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src);
 void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr);
 int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
 		  const struct nft_expr *expr);
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index f92fb6003745..4f6245e7988e 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2557,6 +2557,24 @@ static struct nft_expr *nft_expr_init(const struct nft_ctx *ctx,
 	return ERR_PTR(err);
 }
 
+int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src)
+{
+	int err;
+
+	if (src->ops->clone) {
+		dst->ops = src->ops;
+		err = src->ops->clone(dst, src);
+		if (err < 0)
+			return err;
+	} else {
+		memcpy(dst, src, src->ops->size);
+	}
+
+	__module_get(src->ops->type->owner);
+
+	return 0;
+}
+
 void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr)
 {
 	nf_tables_expr_destroy(ctx, expr);
diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c
index 46ab28ec4b53..d1b64c8de585 100644
--- a/net/netfilter/nft_dynset.c
+++ b/net/netfilter/nft_dynset.c
@@ -24,23 +24,6 @@ struct nft_dynset {
 	struct nft_set_binding		binding;
 };
 
-static int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src)
-{
-	int err;
-
-	if (src->ops->clone) {
-		dst->ops = src->ops;
-		err = src->ops->clone(dst, src);
-		if (err < 0)
-			return err;
-	} else {
-		memcpy(dst, src, src->ops->size);
-	}
-
-	__module_get(src->ops->type->owner);
-	return 0;
-}
-
 static void *nft_dynset_new(struct nft_set *set, const struct nft_expr *expr,
 			    struct nft_regs *regs)
 {
-- 
2.11.0


  reply	other threads:[~2020-03-30  0:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  0:36 [PATCH 00/26] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2020-03-30  0:36 ` Pablo Neira Ayuso [this message]
2020-03-30  0:36 ` [PATCH 02/26] netfilter: nf_tables: pass context to nft_set_destroy() Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 03/26] netfilter: nf_tables: allow to specify stateful expression in set definition Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 04/26] netfilter: nf_tables: fix double-free on set expression from the error path Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 05/26] netfilter: nf_tables: add nft_set_elem_expr_destroy() and use it Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 06/26] netfilter: flowtable: fix NULL pointer dereference in tunnel offload support Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 07/26] netfilter: ctnetlink: Add missing annotation for ctnetlink_parse_nat_setup() Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 08/26] netfilter: conntrack: Add missing annotations for nf_conntrack_all_lock() and nf_conntrack_all_unlock() Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 09/26] ipvs: optimize tunnel dumps for icmp errors Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 10/26] netfilter: conntrack: export nf_ct_acct_update() Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 11/26] netfilter: nf_tables: add enum nft_flowtable_flags to uapi Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 12/26] netfilter: flowtable: add counter support Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 13/26] netfilter: flowtable: Fix incorrect tc_setup_type type Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 14/26] netfilter: nf_tables: silence a RCU-list warning in nft_table_lookup() Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 15/26] netfilter: flowtable: Use rw sem as flow block lock Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 16/26] netfilter: flowtable: Use work entry per offload command Pablo Neira Ayuso
2020-03-30  0:36 ` [PATCH 17/26] netfilter: nf_queue: make nf_queue_entry_release_refs static Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 18/26] netfilter: nf_queue: place bridge physports into queue_entry struct Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 19/26] netfilter: nf_queue: do not release refcouts until nf_reinject is done Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 20/26] netfilter: nf_queue: prefer nf_queue_entry_free Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 21/26] netfilter: ctnetlink: be more strict when NF_CONNTRACK_MARK is not set Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 22/26] netfilter: nft_set_bitmap: initialize set element extension in lookups Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 23/26] netfilter: nft_dynset: validate set expression definition Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 24/26] netfilter: nf_tables: skip set types that do not support for expressions Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 25/26] netfilter: conntrack: add nf_ct_acct_add() Pablo Neira Ayuso
2020-03-30  0:37 ` [PATCH 26/26] netfilter: flowtable: add counter support in HW offload Pablo Neira Ayuso
2020-03-30 17:48 ` [PATCH 00/26] Netfilter/IPVS updates for net-next David Miller
2020-03-30 17:51   ` David Miller

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=20200330003708.54017-2-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --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).