From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: phil@nwl.cc, fw@strlen.de
Subject: [PATCH nft 4/5] rule: skip cache population from do_command_monitor()
Date: Mon, 17 Jun 2019 14:25:17 +0200 [thread overview]
Message-ID: <20190617122518.10486-4-pablo@netfilter.org> (raw)
In-Reply-To: <20190617122518.10486-1-pablo@netfilter.org>
nft_evaluate() already populates the cache before running the monitor
command. Remove this code.
Fixes: 7df42800cf89 ("src: single cache_update() call to build cache before evaluation")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/rule.c | 32 --------------------------------
1 file changed, 32 deletions(-)
diff --git a/src/rule.c b/src/rule.c
index 782253b81589..732de2874877 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -2414,8 +2414,6 @@ static bool need_cache(const struct cmd *cmd)
static int do_command_monitor(struct netlink_ctx *ctx, struct cmd *cmd)
{
- struct table *t;
- struct set *s;
struct netlink_mon_handler monhandler = {
.monitor_flags = cmd->monitor->flags,
.format = cmd->monitor->format,
@@ -2429,36 +2427,6 @@ static int do_command_monitor(struct netlink_ctx *ctx, struct cmd *cmd)
monhandler.format = NFTNL_OUTPUT_JSON;
monhandler.cache_needed = need_cache(cmd);
- if (monhandler.cache_needed) {
- struct rule *rule, *nrule;
- struct chain *chain;
- int ret;
-
- list_for_each_entry(t, &ctx->nft->cache.list, list) {
- list_for_each_entry(s, &t->sets, list)
- s->init = set_expr_alloc(&cmd->location, s);
-
- if (!(cmd->monitor->flags & (1 << NFT_MSG_TRACE)))
- continue;
-
- /* When tracing we'd like to translate the rule handle
- * we receive in the trace messages to the actual rule
- * struct to print that out. Populate rule cache now.
- */
- ret = netlink_list_table(ctx, &t->handle);
-
- if (ret != 0)
- /* Shouldn't happen and doesn't break things
- * too badly
- */
- continue;
-
- list_for_each_entry_safe(rule, nrule, &ctx->list, list) {
- chain = chain_lookup(t, &rule->handle);
- list_move_tail(&rule->list, &chain->rules);
- }
- }
- }
return netlink_monitor(&monhandler, ctx->nft->nf_sock);
}
--
2.11.0
next prev parent reply other threads:[~2019-06-17 12:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 12:25 [PATCH nft 1/5] src: remove useless parameter from cache_flush() Pablo Neira Ayuso
2019-06-17 12:25 ` [PATCH nft 2/5] tests: shell: cannot use handle for non-existing rule in kernel Pablo Neira Ayuso
2019-06-17 16:00 ` Phil Sutter
2019-06-17 16:06 ` Pablo Neira Ayuso
2019-06-17 16:29 ` Phil Sutter
2019-06-17 12:25 ` [PATCH nft 3/5] src: add cache level flags Pablo Neira Ayuso
2019-06-17 15:57 ` Phil Sutter
2019-06-17 16:11 ` Phil Sutter
2019-06-17 16:28 ` Pablo Neira Ayuso
2019-06-17 16:45 ` Phil Sutter
2019-06-17 17:24 ` Pablo Neira Ayuso
2019-06-17 17:28 ` Phil Sutter
2019-06-17 17:33 ` Pablo Neira Ayuso
2019-06-17 20:37 ` Phil Sutter
2019-06-17 12:25 ` Pablo Neira Ayuso [this message]
2019-06-17 12:25 ` [PATCH nft 5/5] netlink: remove netlink_list_table() 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=20190617122518.10486-4-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 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.