]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: add set to the cache
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 15 Apr 2021 12:00:16 +0000 (14:00 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 2 May 2021 21:30:35 +0000 (23:30 +0200)
If the cache does not contain the set that is defined in this batch, add
it to the cache. This allows for references to this new set in the same
batch.

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

index 8f35ca5935bc70b0f41ff851c6a3d30cec53e0ee..02115101fec36c321c8d0c392a4ca3be3bf55be1 100644 (file)
@@ -3754,6 +3754,10 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set)
        if (table == NULL)
                return table_not_found(ctx);
 
+       if (!(set->flags & NFT_SET_ANONYMOUS) &&
+           !set_cache_find(table, set->handle.set.name))
+               set_cache_add(set_get(set), table);
+
        if (!(set->flags & NFT_SET_INTERVAL) && set->automerge)
                return set_error(ctx, set, "auto-merge only works with interval sets");