From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: fw@strlen.de, phil@nwl.cc
Subject: [PATCH nft,v2] cache: do not populate the cache in case of flush ruleset command
Date: Fri, 14 Jun 2019 14:36:30 +0200 [thread overview]
Message-ID: <20190614123630.17341-1-pablo@netfilter.org> (raw)
__CMD_FLUSH_RULESET is a dummy definition that used to skip the netlink
dump to populate the cache. This patch is a workaround until we have a
better infrastructure to track the state of the cache objects.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
v2: check for __CMD_FLUSH_RULESET before dumping tables via netlink.
include/rule.h | 1 +
src/cache.c | 3 +++
src/rule.c | 3 +++
3 files changed, 7 insertions(+)
diff --git a/include/rule.h b/include/rule.h
index dd9df9ec6dd8..b41825d000d6 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -462,6 +462,7 @@ enum cmd_ops {
CMD_EXPORT,
CMD_MONITOR,
CMD_DESCRIBE,
+ __CMD_FLUSH_RULESET,
};
/**
diff --git a/src/cache.c b/src/cache.c
index 532ef425906a..d7153f6f6b8f 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -54,6 +54,9 @@ static unsigned int evaluate_cache_flush(struct cmd *cmd)
unsigned int completeness = CMD_INVALID;
switch (cmd->obj) {
+ case CMD_OBJ_RULESET:
+ completeness = __CMD_FLUSH_RULESET;
+ break;
case CMD_OBJ_SET:
case CMD_OBJ_MAP:
case CMD_OBJ_METER:
diff --git a/src/rule.c b/src/rule.c
index 8de5aa62b94f..0c0fd07ec70c 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -210,6 +210,9 @@ static int cache_init(struct netlink_ctx *ctx, enum cmd_ops cmd)
};
int ret;
+ if (cmd == __CMD_FLUSH_RULESET)
+ return 0;
+
ret = cache_init_tables(ctx, &handle, &ctx->nft->cache);
if (ret < 0)
return ret;
--
2.11.0
next reply other threads:[~2019-06-14 12:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 12:36 Pablo Neira Ayuso [this message]
2019-06-14 12:54 ` [PATCH nft,v2] cache: do not populate the cache in case of flush ruleset command Phil Sutter
2019-06-14 12:59 ` Pablo Neira Ayuso
2019-06-14 13:04 ` Pablo Neira Ayuso
2019-06-14 13:41 ` Phil Sutter
2019-06-17 13:07 ` 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=20190614123630.17341-1-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
/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).