All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 2/4] evaluate: properly set datatype of map expression
Date: Mon, 12 Jan 2015 13:30:04 +0000	[thread overview]
Message-ID: <1421069406-10276-2-git-send-email-kaber@trash.net> (raw)
In-Reply-To: <1421069406-10276-1-git-send-email-kaber@trash.net>

The datatype of the map expression is the datatype of the mappings.

# nft add map filter test { type ipv4_addr : inet_service; }
# nft filter output mark set ip daddr map @test

Before:

<cmdline>:1:24-41: Error: datatype mismatch: expected packet mark, expression has type IPv4 address
filter output mark set ip daddr map @test
              ~~~~~~~~~^^^^^^^^^^^^^^^^^^

After:

<cmdline>:1:24-41: Error: datatype mismatch: expected packet mark, expression has type internet network service
filter output mark set ip daddr map @test
              ~~~~~~~~~^^^^^^^^^^^^^^^^^^

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 src/evaluate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 651465a..2067a01 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -748,7 +748,7 @@ static int expr_evaluate_map(struct eval_ctx *ctx, struct expr **expr)
 		    map->mappings->ops->name);
 	}
 
-	map->dtype = ctx->ectx.dtype;
+	map->dtype = map->mappings->set->datatype;
 	map->flags |= EXPR_F_CONSTANT;
 
 	/* Data for range lookups needs to be in big endian order */
-- 
2.1.0


  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 ` Patrick McHardy [this message]
2015-01-12 13:30 ` [PATCH 3/4] evaluate: check that map expressions' datatype matches mappings Patrick McHardy
2015-01-12 13:30 ` [PATCH 4/4] evaluate: use stmt_evaluate_arg() in all cases Patrick McHardy

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-2-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 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.