packages/nftables/0001-Revert-cache-recycle-existing-cache-with-incremental.patch

52 lines
1.4 KiB
Diff

From dc3e9eec4b74082bb5787077b391de904ee4ddc2 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Fri, 19 Jul 2024 14:19:28 +0200
Subject: [PATCH 1/1] Revert "cache: recycle existing cache with incremental
updates"
This reverts commit e791dbe109b6dd891a63a4236df5dc29d7a4b863.
---
src/cache.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/src/cache.c b/src/cache.c
index 4b797ec7..e88cbae2 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1184,21 +1184,9 @@ static bool nft_cache_needs_refresh(struct nft_cache *cache, unsigned int flags)
(flags & NFT_CACHE_REFRESH);
}
-static bool nft_cache_is_updated(struct nft_cache *cache, unsigned int flags,
- uint16_t genid)
+static bool nft_cache_is_updated(struct nft_cache *cache, uint16_t genid)
{
- if (!genid)
- return false;
-
- if (genid == cache->genid)
- return true;
-
- if (genid == cache->genid + 1) {
- cache->genid++;
- return true;
- }
-
- return false;
+ return genid && genid == cache->genid;
}
bool nft_cache_needs_update(struct nft_cache *cache)
@@ -1223,7 +1211,7 @@ replay:
genid = mnl_genid_get(&ctx);
if (!nft_cache_needs_refresh(cache, flags) &&
nft_cache_is_complete(cache, flags) &&
- nft_cache_is_updated(cache, flags, genid))
+ nft_cache_is_updated(cache, genid))
return 0;
if (cache->genid)
--
2.45.2