diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-04-29 22:23:05 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-05-02 23:30:35 +0200 |
commit | 5ec5c706d993a68502801433c3bb2bcbb078efff (patch) | |
tree | b8ee369020eade4690b1ebc78144737ba4864dee /src/libnftables.c | |
parent | 29b332e906eea98b4e1299c0da931874ef8e08db (diff) |
cache: add hashtable cache for table
Add a hashtable for fast table lookups.
Tables that reside in the cache use the table->cache_hlist and
table->cache_list heads.
Table that are created from command line / ruleset are also added
to the cache.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/libnftables.c')
-rw-r--r-- | src/libnftables.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libnftables.c b/src/libnftables.c index 56c51a61..e080eb03 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -105,6 +105,7 @@ static void nft_init(struct nft_ctx *ctx) static void nft_exit(struct nft_ctx *ctx) { + cache_free(&ctx->cache.table_cache); expr_handler_exit(); ct_label_table_exit(ctx); realm_table_rt_exit(ctx); @@ -166,7 +167,7 @@ struct nft_ctx *nft_ctx_new(uint32_t flags) ctx->state = xzalloc(sizeof(struct parser_state)); nft_ctx_add_include_path(ctx, DEFAULT_INCLUDE_PATH); ctx->parser_max_errors = 10; - init_list_head(&ctx->cache.list); + cache_init(&ctx->cache.table_cache); ctx->top_scope = scope_alloc(); ctx->flags = flags; ctx->output.output_fp = stdout; |