summaryrefslogtreecommitdiffstats
path: root/include/cache.h
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2021-11-09 10:44:46 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2021-11-11 10:55:29 +0100
commitdffc0e109ed4780c6d79c52fb5be8cda2d63fc6b (patch)
tree6e70f590d1b7d6b4606e9b11e0254743a0c0235e /include/cache.h
parent88e53b5dac2b55905dbf86d7def2fee51bf2a8dd (diff)
cache: do not populate cache if it is going to be flushed
Skip set element netlink dump if set is flushed, this speeds up set flush + add element operation in a batch file for an existing set. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/cache.h')
-rw-r--r--include/cache.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/cache.h b/include/cache.h
index 7d61701a..cdf1f4fb 100644
--- a/include/cache.h
+++ b/include/cache.h
@@ -38,11 +38,24 @@ enum cache_level_flags {
NFT_CACHE_FLUSHED = (1 << 31),
};
+struct nft_filter_obj {
+ struct list_head list;
+ uint32_t family;
+ const char *table;
+ const char *set;
+};
+
+#define NFT_CACHE_HSIZE 8192
+
struct nft_cache_filter {
struct {
const char *table;
const char *set;
} list;
+
+ struct {
+ struct list_head head;
+ } obj[NFT_CACHE_HSIZE];
};
struct nft_cache;
@@ -66,7 +79,8 @@ static inline uint32_t djb_hash(const char *key)
return hash;
}
-#define NFT_CACHE_HSIZE 8192
+struct nft_cache_filter *nft_cache_filter_init(void);
+void nft_cache_filter_fini(struct nft_cache_filter *filter);
struct table;
struct chain;