Blame SOURCES/0023-nft-cache-Reset-genid-when-rebuilding-cache.patch

e8e25e
From 3b98024d952d265d50078c5b7ad04c9c65373733 Mon Sep 17 00:00:00 2001
e8e25e
From: Phil Sutter <psutter@redhat.com>
e8e25e
Date: Fri, 29 May 2020 19:33:22 +0200
e8e25e
Subject: [PATCH] nft: cache: Reset genid when rebuilding cache
e8e25e
e8e25e
This is required in order to avoid a cache rebuild loop if
e8e25e
iptables-nft-restore is called with '--test' parameter and a dump
e8e25e
containing more than a single table.
e8e25e
e8e25e
If non-zero, __nft_build_cache() never updates genid and therefore the
e8e25e
incorrect genid (caused by increment in nft_action()) is never
e8e25e
corrected.
e8e25e
e8e25e
This is a RHEL-only fix, upstream rewrote the whole cache logic which
e8e25e
implicitly resolved this problem.
e8e25e
e8e25e
Fixes: 200bc39965149 ("nft: cache: Fix iptables-save segfault under stress")
e8e25e
Signed-off-by: Phil Sutter <psutter@redhat.com>
e8e25e
---
e8e25e
 iptables/nft-cache.c | 1 +
e8e25e
 1 file changed, 1 insertion(+)
e8e25e
e8e25e
diff --git a/iptables/nft-cache.c b/iptables/nft-cache.c
e8e25e
index 07265b7795e4f..bc6e7f7eaebfb 100644
e8e25e
--- a/iptables/nft-cache.c
e8e25e
+++ b/iptables/nft-cache.c
e8e25e
@@ -629,6 +629,7 @@ void nft_rebuild_cache(struct nft_handle *h)
e8e25e
 	if (h->cache_level)
e8e25e
 		__nft_flush_cache(h);
e8e25e
 
e8e25e
+	h->nft_genid = 0;
e8e25e
 	h->cache_level = NFT_CL_NONE;
e8e25e
 	__nft_build_cache(h, level, NULL, NULL, NULL);
e8e25e
 }
e8e25e
-- 
e8e25e
2.26.2
e8e25e