]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: replace variable expression by the value expression
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 21 Jul 2020 16:09:28 +0000 (18:09 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 22 Jul 2020 09:47:08 +0000 (11:47 +0200)
The variable expression provides the binding between the variable
dereference and the value expression. Replace the variable expression by
the real value expression after the evaluation.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c

index 3e94e04790d077df8b2c58e9bd4e4aceafe970c2..9290c6ff39ef4caeb5e67dd3f3a90b6cc33671c4 100644 (file)
@@ -2013,10 +2013,13 @@ static int expr_evaluate_variable(struct eval_ctx *ctx, struct expr **exprp)
 {
        struct expr *new = expr_clone((*exprp)->sym->expr);
 
+       if (expr_evaluate(ctx, &new) < 0)
+               return -1;
+
        expr_free(*exprp);
        *exprp = new;
 
-       return expr_evaluate(ctx, exprp);
+       return 0;
 }
 
 static int expr_evaluate_xfrm(struct eval_ctx *ctx, struct expr **exprp)