diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-07-03 13:15:48 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-08-18 01:13:35 +0200 |
commit | 100cfb99175ed6f7307ff71fd78443c8dea35a08 (patch) | |
tree | 8eb41aa32b7ab4f09f45905bc04412eaf718308e /src | |
parent | 05834a0fa84ee461b798308d57ffa1888c05d728 (diff) |
src: add set declaration to cache
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/evaluate.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index d5817f9b..8c161953 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -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) |