All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] evaluate: verify named map is actually a map
@ 2015-01-12 13:30 Patrick McHardy
  2015-01-12 13:30 ` [PATCH 2/4] evaluate: properly set datatype of map expression Patrick McHardy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Patrick McHardy @ 2015-01-12 13:30 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

# nft add set filter test { type ipv4_addr; }
# nft filter input ip daddr vmap @test

Before:

<cmdline>:0:0-32: Error: Could not process rule: Invalid argument
filter input ip daddr vmap @test
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

After:

<cmdline>:1:28-32: Error: Expression is not a map
filter input ip daddr vmap @test
                           ^^^^^

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

diff --git a/src/evaluate.c b/src/evaluate.c
index d24d4cc..651465a 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -738,7 +738,8 @@ static int expr_evaluate_map(struct eval_ctx *ctx, struct expr **expr)
 	case EXPR_SYMBOL:
 		if (expr_evaluate(ctx, &map->mappings) < 0)
 			return -1;
-		if (map->mappings->ops->type != EXPR_SET_REF)
+		if (map->mappings->ops->type != EXPR_SET_REF ||
+		    !(map->mappings->set->flags & NFT_SET_MAP))
 			return expr_error(ctx->msgs, map->mappings,
 					  "Expression is not a map");
 		break;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-12 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 4/4] evaluate: use stmt_evaluate_arg() in all cases Patrick McHardy

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.