netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 4/4] evaluate: use stmt_evaluate_arg() in all cases
Date: Mon, 12 Jan 2015 13:30:06 +0000	[thread overview]
Message-ID: <1421069406-10276-4-git-send-email-kaber@trash.net> (raw)
In-Reply-To: <1421069406-10276-1-git-send-email-kaber@trash.net>

When using a symbolic vmap expression, we fail to verify that the map
actually contains verdicts.

Use stmt_evaluate_arg() everywhere to fix this.

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 src/evaluate.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 90c87d0..a3484c6 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1135,8 +1135,7 @@ static int stmt_evaluate_arg(struct eval_ctx *ctx, struct stmt *stmt,
 
 static int stmt_evaluate_verdict(struct eval_ctx *ctx, struct stmt *stmt)
 {
-	expr_set_context(&ctx->ectx, &verdict_type, 0);
-	if (expr_evaluate(ctx, &stmt->expr) < 0)
+	if (stmt_evaluate_arg(ctx, stmt, &verdict_type, 0, &stmt->expr) < 0)
 		return -1;
 
 	switch (stmt->expr->ops->type) {
@@ -1625,8 +1624,8 @@ static int stmt_evaluate_redir(struct eval_ctx *ctx, struct stmt *stmt)
 static int stmt_evaluate_queue(struct eval_ctx *ctx, struct stmt *stmt)
 {
 	if (stmt->queue.queue != NULL) {
-		expr_set_context(&ctx->ectx, &integer_type, 16);
-		if (expr_evaluate(ctx, &stmt->queue.queue) < 0)
+		if (stmt_evaluate_arg(ctx, stmt, &integer_type, 16,
+				      &stmt->queue.queue) < 0)
 			return -1;
 		if (!expr_is_constant(stmt->queue.queue))
 			return expr_error(ctx->msgs, stmt->queue.queue,
-- 
2.1.0


      parent reply	other threads:[~2015-01-12 13:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 13:30 [PATCH 1/4] evaluate: verify named map is actually a map Patrick McHardy
2015-01-12 13:30 ` [PATCH 2/4] evaluate: properly set datatype of map expression Patrick McHardy
2015-01-12 13:30 ` [PATCH 3/4] evaluate: check that map expressions' datatype matches mappings Patrick McHardy
2015-01-12 13:30 ` Patrick McHardy [this message]

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=1421069406-10276-4-git-send-email-kaber@trash.net \
    --to=kaber@trash.net \
    --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).