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