]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
set: allow non-constant implicit set declarations
authorPatrick McHardy <kaber@trash.net>
Wed, 27 Apr 2016 11:29:45 +0000 (12:29 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 13 May 2016 16:54:33 +0000 (18:54 +0200)
Currently all implicitly declared sets are marked as constant. The flow
statement needs to implicitly declare non-constant sets, so instead of
unconditionally marking the set as constant, only do so if the declaring
expression is itself a constant set.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c

index 3afb8eade7372ace7ac13b057755f5e62a99a906..c5f87a1950f80555bccbd6b6c0bb1e79dd3da79b 100644 (file)
@@ -96,7 +96,7 @@ static struct expr *implicit_set_declaration(struct eval_ctx *ctx,
        struct handle h;
 
        set = set_alloc(&expr->location);
-       set->flags      = SET_F_CONSTANT | SET_F_ANONYMOUS | expr->set_flags;
+       set->flags      = SET_F_ANONYMOUS | expr->set_flags;
        set->handle.set = xstrdup(set->flags & SET_F_MAP ? "map%d" : "set%d");
        set->keytype    = keytype;
        set->keylen     = keylen;
@@ -1075,6 +1075,8 @@ static int expr_evaluate_set(struct eval_ctx *ctx, struct expr **expr)
                        set->set_flags |= SET_F_INTERVAL;
        }
 
+       set->set_flags |= SET_F_CONSTANT;
+
        set->dtype = ctx->ectx.dtype;
        set->len   = ctx->ectx.len;
        set->flags |= EXPR_F_CONSTANT;