]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: stmt_evaluate_map() needs right hand side evaluation too
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 25 Oct 2018 17:35:10 +0000 (19:35 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 25 Oct 2018 18:14:53 +0000 (20:14 +0200)
The data side of the mapping that is dynamically generated needs to be
evaluated as well.

Fixes: 0e90798e9812 ("src: simplify map statement")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c

index dbeedc959347c339defd5a425dfa4d937eb29626..d023f47a8eed70bb8575b70cd1a40b7c9bd3dca3 100644 (file)
@@ -2773,12 +2773,20 @@ static int stmt_evaluate_map(struct eval_ctx *ctx, struct stmt *stmt)
        if (stmt->map.key->comment != NULL)
                return expr_error(ctx->msgs, stmt->map.key,
                                  "Key expression comments are not supported");
+
+       if (stmt_evaluate_arg(ctx, stmt,
+                             stmt->map.set->set->datatype,
+                             stmt->map.set->set->datalen,
+                             stmt->map.set->set->datatype->byteorder,
+                             &stmt->map.data->key) < 0)
+               return -1;
        if (expr_is_constant(stmt->map.data))
                return expr_error(ctx->msgs, stmt->map.data,
                                  "Data expression can not be constant");
        if (stmt->map.data->comment != NULL)
                return expr_error(ctx->msgs, stmt->map.data,
                                  "Data expression comments are not supported");
+
        if (stmt->map.stmt) {
                if (stmt_evaluate(ctx, stmt->map.stmt) < 0)
                        return -1;