netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elise Lennion <elise.lennion@gmail.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH nft v3 3/6] evaluate: Evaluate table name before reset stateful objects in a table
Date: Thu, 26 Jan 2017 15:14:30 -0200	[thread overview]
Message-ID: <20170126171430.GA7941@lennorien.com> (raw)

Reseting stateful objects in a single table is already implemented and
cmd_evaluate_reset() now tests for the table name.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
---

 v3: Created on v3.

 src/evaluate.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index dab7cfc..ed41bd8 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2974,13 +2974,14 @@ static int cmd_evaluate_reset(struct eval_ctx *ctx, struct cmd *cmd)
 	switch (cmd->obj) {
 	case CMD_OBJ_COUNTER:
 	case CMD_OBJ_QUOTA:
+	case CMD_OBJ_COUNTERS:
+	case CMD_OBJ_QUOTAS:
+		if (cmd->handle.table == NULL)
+			return 0;
 		if (table_lookup(&cmd->handle) == NULL)
 			return cmd_error(ctx, "Could not process rule: Table '%s' does not exist",
 					 cmd->handle.table);
 		return 0;
-	case CMD_OBJ_COUNTERS:
-	case CMD_OBJ_QUOTAS:
-		return 0;
 	default:
 		BUG("invalid command object type %u\n", cmd->obj);
 	}
-- 
2.7.4


                 reply	other threads:[~2017-01-26 17:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170126171430.GA7941@lennorien.com \
    --to=elise.lennion@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).