All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 16/18] evaluate: remove set from cache on delete set command
Date: Fri, 30 Apr 2021 01:42:53 +0200	[thread overview]
Message-ID: <20210429234255.16840-17-pablo@netfilter.org> (raw)
In-Reply-To: <20210429234255.16840-1-pablo@netfilter.org>

Update the cache to remove this set from the evaluation phase.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/evaluate.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/evaluate.c b/src/evaluate.c
index 49d47d0b4f34..19bf73878181 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -4389,12 +4389,36 @@ static void chain_del_cache(struct eval_ctx *ctx, struct cmd *cmd)
 	chain_free(chain);
 }
 
+static void set_del_cache(struct eval_ctx *ctx, struct cmd *cmd)
+{
+	struct table *table;
+	struct set *set;
+
+	if (!cmd->handle.set.name)
+		return;
+
+	table = table_cache_find(&ctx->nft->cache.table_cache,
+				 cmd->handle.table.name,
+				 cmd->handle.family);
+	if (!table)
+		return;
+
+	set = set_cache_find(table, cmd->handle.set.name);
+	if (!set)
+		return;
+
+	set_cache_del(set);
+	set_free(set);
+}
+
 static int cmd_evaluate_delete(struct eval_ctx *ctx, struct cmd *cmd)
 {
 	switch (cmd->obj) {
 	case CMD_OBJ_ELEMENTS:
 		return setelem_evaluate(ctx, cmd);
 	case CMD_OBJ_SET:
+		set_del_cache(ctx, cmd);
+		return 0;
 	case CMD_OBJ_RULE:
 		return 0;
 	case CMD_OBJ_CHAIN:
-- 
2.20.1


  parent reply	other threads:[~2021-04-29 23:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 23:42 [PATCH nft 00/18] cache updates,v2 Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 01/18] tests: shell: remove missing modules Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 02/18] src: unbreak deletion by table handle Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 03/18] rule: skip fuzzy lookup for unexisting 64-bit handle Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 04/18] src: pass chain name to chain_cache_find() Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 05/18] src: consolidate nft_cache infrastructure Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 06/18] src: consolidate object cache infrastructure Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 07/18] cache: add hashtable cache for object Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 08/18] cache: add hashtable cache for flowtable Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 09/18] cache: add set_cache_del() and use it Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 10/18] evaluate: add set to the cache Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 11/18] evaluate: add flowtable " Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 12/18] cache: missing table cache for several policy objects Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 13/18] evaluate: add object to the cache Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 14/18] cache: add hashtable cache for table Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 15/18] evaluate: remove chain from cache on delete chain command Pablo Neira Ayuso
2021-04-29 23:42 ` Pablo Neira Ayuso [this message]
2021-04-29 23:42 ` [PATCH nft 17/18] evaluate: remove flowtable from cache on delete flowtable command Pablo Neira Ayuso
2021-04-29 23:42 ` [PATCH nft 18/18] evaluate: remove object from cache on delete object command 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=20210429234255.16840-17-pablo@netfilter.org \
    --to=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.