c8bceb
From bcde371c52738a8be5981d87b2fc17ca1f3456ec Mon Sep 17 00:00:00 2001
c8bceb
From: Eric Garver <e@erig.me>
c8bceb
Date: Tue, 11 Dec 2018 11:32:54 -0500
c8bceb
Subject: [PATCH 08/23] ipset: fix set apply if IndividualCalls=yes
c8bceb
c8bceb
Fixes: rhbz 1644834
c8bceb
Fixes: e6188ec98ff4 ("FirewallIPSet: Support restore in apply_ipsets, use it in Firewall")
c8bceb
(cherry picked from commit 4157393136bbaff53e812029376b2a0a5113cedb)
c8bceb
---
c8bceb
 src/firewall/core/fw_ipset.py       |  2 +-
c8bceb
 src/tests/regression/rhbz1601610.at | 43 +++++++++++++++++++++++++++++
c8bceb
 2 files changed, 44 insertions(+), 1 deletion(-)
c8bceb
c8bceb
diff --git a/src/firewall/core/fw_ipset.py b/src/firewall/core/fw_ipset.py
c8bceb
index b06a60d027a6..54ace39ea6e1 100644
c8bceb
--- a/src/firewall/core/fw_ipset.py
c8bceb
+++ b/src/firewall/core/fw_ipset.py
c8bceb
@@ -125,7 +125,7 @@ class FirewallIPSet(object):
c8bceb
                         raise FirewallError(errors.COMMAND_FAILED, msg)
c8bceb
                     else:
c8bceb
                         obj.applied = True
c8bceb
-                        if "timeout" not in obj.options or \
c8bceb
+                        if "timeout" in obj.options and \
c8bceb
                            obj.options["timeout"] != "0":
c8bceb
                             # no entries visible for ipsets with timeout
c8bceb
                             continue
c8bceb
diff --git a/src/tests/regression/rhbz1601610.at b/src/tests/regression/rhbz1601610.at
c8bceb
index 0676bb82e31c..5ba0cee44be0 100644
c8bceb
--- a/src/tests/regression/rhbz1601610.at
c8bceb
+++ b/src/tests/regression/rhbz1601610.at
c8bceb
@@ -57,5 +57,48 @@ FWD_CHECK([-q --permanent --ipset=foobar --remove-entry=10.1.1.0/22])
c8bceb
 FWD_CHECK([--permanent --ipset=foobar --get-entries], 0, [
c8bceb
 ])
c8bceb
 
c8bceb
+dnl rhbz 1644834
c8bceb
+FWD_CHECK([-q --ipset=foobar --add-entry=10.1.0.0/16])
c8bceb
+FWD_CHECK([-q --runtime-to-permanent])
c8bceb
+FWD_RELOAD
c8bceb
+m4_if(nftables, FIREWALL_BACKEND, [
c8bceb
+NFT_LIST_SET([foobar], 0, [dnl
c8bceb
+table inet firewalld {
c8bceb
+set foobar {
c8bceb
+type ipv4_addr
c8bceb
+flags interval
c8bceb
+elements = { 10.1.0.0/16, 10.2.0.0/22 }
c8bceb
+}
c8bceb
+}
c8bceb
+])], [
c8bceb
+IPSET_LIST_SET([foobar], 0, [dnl
c8bceb
+Name: foobar
c8bceb
+Type: hash:net
c8bceb
+Members:
c8bceb
+10.1.0.0/16
c8bceb
+10.2.0.0/22
c8bceb
+])])
c8bceb
+
c8bceb
+dnl rhbz 1644834, again with IndividualCalls=yes
c8bceb
+AT_CHECK([sed -i 's/^IndividualCalls.*/IndividualCalls=yes/' ./firewalld.conf])
c8bceb
+FWD_RELOAD
c8bceb
+m4_if(nftables, FIREWALL_BACKEND, [
c8bceb
+NFT_LIST_SET([foobar], 0, [dnl
c8bceb
+table inet firewalld {
c8bceb
+set foobar {
c8bceb
+type ipv4_addr
c8bceb
+flags interval
c8bceb
+elements = { 10.1.0.0/16, 10.2.0.0/22 }
c8bceb
+}
c8bceb
+}
c8bceb
+])], [
c8bceb
+IPSET_LIST_SET([foobar], 0, [dnl
c8bceb
+Name: foobar
c8bceb
+Type: hash:net
c8bceb
+Members:
c8bceb
+10.1.0.0/16
c8bceb
+10.2.0.0/22
c8bceb
+])])
c8bceb
+
c8bceb
 FWD_END_TEST([-e '/ERROR: COMMAND_FAILED:.*already added.*/d'dnl
c8bceb
               -e '/ERROR: COMMAND_FAILED:.*element.*exists/d'])
c8bceb
-- 
c8bceb
2.20.1
c8bceb