summaryrefslogtreecommitdiffstats
path: root/iptables/nft-cache.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2020-04-07 13:47:54 +0200
committerPhil Sutter <phil@nwl.cc>2020-05-11 14:28:28 +0200
commitb301f2ed198804015c4434f925c75e0bd224c4ef (patch)
treea7759ad8abf9f4c35e892f06d587c561f72fe0b3 /iptables/nft-cache.c
parentc63b7643bb433abdb55d934029eaa51451cb1b8c (diff)
nft: cache: Improve fake cache integration
With NFT_CL_FAKE being highest cache level while at the same time __nft_build_cache() treating it equal to NFT_CL_TABLES, no special handling for fake cache is required anymore. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft-cache.c')
-rw-r--r--iptables/nft-cache.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/iptables/nft-cache.c b/iptables/nft-cache.c
index e0c13870..2c6a1708 100644
--- a/iptables/nft-cache.c
+++ b/iptables/nft-cache.c
@@ -442,6 +442,8 @@ __nft_build_cache(struct nft_handle *h, enum nft_cache_level level,
if (h->cache_level >= NFT_CL_TABLES)
fetch_table_cache(h);
+ if (h->cache_level == NFT_CL_FAKE)
+ return;
if (h->cache_level >= NFT_CL_CHAINS)
fetch_chain_cache(h, t, chain);
if (h->cache_level >= NFT_CL_SETS)
@@ -450,15 +452,6 @@ __nft_build_cache(struct nft_handle *h, enum nft_cache_level level,
fetch_rule_cache(h, t);
}
-void nft_fake_cache(struct nft_handle *h)
-{
- fetch_table_cache(h);
-
- h->cache_level = NFT_CL_FAKE;
- h->cache_init = true;
- mnl_genid_get(h, &h->nft_genid);
-}
-
static void __nft_flush_cache(struct nft_handle *h)
{
if (!h->cache_index) {
@@ -570,10 +563,7 @@ void nft_rebuild_cache(struct nft_handle *h)
h->cache_init = false;
}
- if (h->cache_level == NFT_CL_FAKE)
- nft_fake_cache(h);
- else
- __nft_build_cache(h, h->cache_level, NULL, NULL, NULL);
+ __nft_build_cache(h, h->cache_level, NULL, NULL, NULL);
}
void nft_cache_build(struct nft_handle *h)