From 45a84088ecbdd7403de849e169fe2f57f34a8bf1 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 29 Apr 2021 22:09:15 +0200 Subject: cache: add hashtable cache for object This patch adds a hashtable for object lookups. This patch also splits table->objs in two: - Sets that reside in the cache are stored in the new tables->cache_obj and tables->cache_obj_ht. - Set that defined via command line / ruleset file reside in tables->obj. Sets in the cache (already in the kernel) are not placed in the table->objs list. By keeping separated lists, objs defined via command line / ruleset file can be added to cache. Signed-off-by: Pablo Neira Ayuso --- include/rule.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include/rule.h') diff --git a/include/rule.h b/include/rule.h index b238c85b..f264bc8a 100644 --- a/include/rule.h +++ b/include/rule.h @@ -157,6 +157,7 @@ struct table { struct scope scope; struct cache chain_cache; struct cache set_cache; + struct cache obj_cache; struct list_head chains; struct list_head sets; struct list_head objs; @@ -484,6 +485,7 @@ struct secmark { */ struct obj { struct list_head list; + struct cache_item cache; struct location location; struct handle handle; uint32_t type; @@ -504,9 +506,6 @@ struct obj { struct obj *obj_alloc(const struct location *loc); extern struct obj *obj_get(struct obj *obj); void obj_free(struct obj *obj); -void obj_add_hash(struct obj *obj, struct table *table); -struct obj *obj_lookup(const struct table *table, const char *name, - uint32_t type); struct obj *obj_lookup_fuzzy(const char *obj_name, const struct nft_cache *cache, const struct table **t); -- cgit v1.2.3