From 0b21441160a39d7a8b3c3b5ed379202577f14152 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 15 2020 17:41:03 +0000 Subject: Apply patch 0034-nft-cache-Make-nft_rebuild_cache-respect-fake-cache.patch patch_name: 0034-nft-cache-Make-nft_rebuild_cache-respect-fake-cache.patch present_in_specfile: true location_in_specfile: 34 --- diff --git a/iptables/nft-cache.c b/iptables/nft-cache.c index bc6e7f7..9623b46 100644 --- a/iptables/nft-cache.c +++ b/iptables/nft-cache.c @@ -480,6 +480,7 @@ __nft_build_cache(struct nft_handle *h, enum nft_cache_level level, break; /* fall through */ case NFT_CL_RULES: + case NFT_CL_FAKE: break; } @@ -516,7 +517,7 @@ void nft_fake_cache(struct nft_handle *h) h->cache->table[type].chains = nftnl_chain_list_alloc(); } - h->cache_level = NFT_CL_RULES; + h->cache_level = NFT_CL_FAKE; mnl_genid_get(h, &h->nft_genid); } @@ -629,9 +630,13 @@ void nft_rebuild_cache(struct nft_handle *h) if (h->cache_level) __nft_flush_cache(h); - h->nft_genid = 0; - h->cache_level = NFT_CL_NONE; - __nft_build_cache(h, level, NULL, NULL, NULL); + if (level == NFT_CL_FAKE) { + nft_fake_cache(h); + } else { + h->nft_genid = 0; + h->cache_level = NFT_CL_NONE; + __nft_build_cache(h, level, NULL, NULL, NULL); + } } void nft_release_cache(struct nft_handle *h) diff --git a/iptables/nft.h b/iptables/nft.h index 5cf260a..2094b01 100644 --- a/iptables/nft.h +++ b/iptables/nft.h @@ -32,7 +32,8 @@ enum nft_cache_level { NFT_CL_TABLES, NFT_CL_CHAINS, NFT_CL_SETS, - NFT_CL_RULES + NFT_CL_RULES, + NFT_CL_FAKE /* must be last entry */ }; struct nft_cache {