Blame SOURCES/0023-fix-ipset-flush-the-set-if-IndividiualCalls-yes.patch

8072fb
From 4a94fcfa0450b653c579118678da409b0f449259 Mon Sep 17 00:00:00 2001
8072fb
From: Eric Garver <eric@garver.life>
8072fb
Date: Tue, 12 May 2020 09:34:12 -0400
8072fb
Subject: [PATCH 23/45] fix(ipset): flush the set if IndividiualCalls=yes
8072fb
8072fb
Make sure we flush the set when creating. Otherwise a pre-existing set
8072fb
may have stale entries.
8072fb
8072fb
Fixes: 81d784f8c856 ("test: ipset: verify clean up on exit/reload")
8072fb
(cherry picked from commit fab381045990f1c994d60c3f7c5813c576e60af1)
8072fb
(cherry picked from commit a512e55190210ecba57f0ccfda88d39ac3151d13)
8072fb
---
8072fb
 src/firewall/core/fw_ipset.py | 5 +++++
8072fb
 1 file changed, 5 insertions(+)
8072fb
8072fb
diff --git a/src/firewall/core/fw_ipset.py b/src/firewall/core/fw_ipset.py
8072fb
index 68f016ba2222..90b24c6264c0 100644
8072fb
--- a/src/firewall/core/fw_ipset.py
8072fb
+++ b/src/firewall/core/fw_ipset.py
8072fb
@@ -117,6 +117,11 @@ class FirewallIPSet(object):
8072fb
                         # no entries visible for ipsets with timeout
8072fb
                         continue
8072fb
 
8072fb
+                try:
8072fb
+                    backend.set_flush(obj.name)
8072fb
+                except Exception as msg:
8072fb
+                    raise FirewallError(errors.COMMAND_FAILED, msg)
8072fb
+
8072fb
                 for entry in obj.entries:
8072fb
                     try:
8072fb
                         backend.set_add(obj.name, entry)
8072fb
-- 
8072fb
2.27.0
8072fb