]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: add set declaration to cache
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 3 Jul 2015 11:15:48 +0000 (13:15 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 17 Aug 2015 23:13:35 +0000 (01:13 +0200)
This patch adds set objects to the cache if they don't exist in the kernel, so
they can be referenced from this batch. This occurs from the evaluation step.

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

index d5817f9bb324d1db1ebaaf620e7546936f138ce6..8c161953da952a95e2651162a628802c7eedc6a7 100644 (file)
@@ -1736,8 +1736,17 @@ static int setelem_evaluate(struct eval_ctx *ctx, struct expr **expr)
 
 static int set_evaluate(struct eval_ctx *ctx, struct set *set)
 {
+       struct table *table;
        const char *type;
 
+       table = table_lookup(&ctx->cmd->handle);
+       if (table == NULL)
+               return cmd_error(ctx, "Could not process rule: Table '%s' does not exist",
+                                ctx->cmd->handle.table);
+
+       if (set_lookup(table, set->handle.set) == NULL)
+               set_add_hash(set_get(set), table);
+
        type = set->flags & SET_F_MAP ? "map" : "set";
 
        if (set->keytype == NULL)