]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: fix concat expressions as map arguments
authorPatrick McHardy <kaber@trash.net>
Wed, 2 Jul 2014 07:42:30 +0000 (09:42 +0200)
committerPatrick McHardy <kaber@trash.net>
Thu, 10 Jul 2014 10:21:50 +0000 (12:21 +0200)
The type in the evaluation context needs to be reset to avoid treating
the concatenation as a right hand side relational expression.

# nft filter output mark set ip daddr . tcp dport map { 192.168.0.1 . 22 : 1 }
<cmdline>:1:24-43: Error: datatype mismatch, expected packet mark, expression has type concatenation of (IPv4 address, internet network service)
filter output mark set ip daddr . tcp dport map { 192.168.0.1 . 22 : 1 }
                       ^^^^^^^^^^^^^^^^^^^^

Signed-off-by: Patrick McHardy <kaber@trash.net>
src/evaluate.c

index 2330bbb2af29b98a7fc081167f96541ac14a788e..e05473a982092d0403f3c2f1049f6e530b4187b7 100644 (file)
@@ -703,6 +703,7 @@ static int expr_evaluate_map(struct eval_ctx *ctx, struct expr **expr)
        struct expr_ctx ectx = ctx->ectx;
        struct expr *map = *expr, *mappings;
 
+       expr_set_context(&ctx->ectx, NULL, 0);
        if (expr_evaluate(ctx, &map->map) < 0)
                return -1;
        if (expr_is_constant(map->map))