Skip to content

Commit

Permalink
ipset: fix set apply if IndividualCalls=yes
Browse files Browse the repository at this point in the history
Fixes: rhbz 1644834
Fixes: e6188ec ("FirewallIPSet: Support restore in apply_ipsets, use it in Firewall")
  • Loading branch information
erig0 committed Dec 11, 2018
1 parent cd97204 commit 4157393
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/firewall/core/fw_ipset.py
Expand Up @@ -125,7 +125,7 @@ def apply_ipsets(self):
raise FirewallError(errors.COMMAND_FAILED, msg)
else:
obj.applied = True
if "timeout" not in obj.options or \
if "timeout" in obj.options and \
obj.options["timeout"] != "0":
# no entries visible for ipsets with timeout
continue
Expand Down
43 changes: 43 additions & 0 deletions src/tests/regression/rhbz1601610.at
Expand Up @@ -57,5 +57,48 @@ FWD_CHECK([-q --permanent --ipset=foobar --remove-entry=10.1.1.0/22])
FWD_CHECK([--permanent --ipset=foobar --get-entries], 0, [
])

dnl rhbz 1644834
FWD_CHECK([-q --ipset=foobar --add-entry=10.1.0.0/16])
FWD_CHECK([-q --runtime-to-permanent])
FWD_RELOAD
m4_if(nftables, FIREWALL_BACKEND, [
NFT_LIST_SET([foobar], 0, [dnl
table inet firewalld {
set foobar {
type ipv4_addr
flags interval
elements = { 10.1.0.0/16, 10.2.0.0/22 }
}
}
])], [
IPSET_LIST_SET([foobar], 0, [dnl
Name: foobar
Type: hash:net
Members:
10.1.0.0/16
10.2.0.0/22
])])

dnl rhbz 1644834, again with IndividualCalls=yes
AT_CHECK([sed -i 's/^IndividualCalls.*/IndividualCalls=yes/' ./firewalld.conf])
FWD_RELOAD
m4_if(nftables, FIREWALL_BACKEND, [
NFT_LIST_SET([foobar], 0, [dnl
table inet firewalld {
set foobar {
type ipv4_addr
flags interval
elements = { 10.1.0.0/16, 10.2.0.0/22 }
}
}
])], [
IPSET_LIST_SET([foobar], 0, [dnl
Name: foobar
Type: hash:net
Members:
10.1.0.0/16
10.2.0.0/22
])])

FWD_END_TEST([-e '/ERROR: COMMAND_FAILED:.*already added.*/d'dnl
-e '/ERROR: COMMAND_FAILED:.*element.*exists/d'])

0 comments on commit 4157393

Please sign in to comment.