Bug 1664829
Summary: | iptables-restore: -F and -Z on same table yields RULE_REPLACE error | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Eric Garver <egarver> | ||||
Component: | iptables | Assignee: | Phil Sutter <psutter> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Robin Hack <rhack> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 8.0 | CC: | iptables-maint-list, psutter, todoleza, wchadwic | ||||
Target Milestone: | rc | ||||||
Target Release: | 8.0 | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | iptables-1.8.2-6.el8 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2019-06-14 00:45:56 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Oddly, I cannot reproduce this inside of a namespace. Which explains why it wasn't caught by firewalld's testsuite. I'm bumping severity/priority, as this effectively breaks firewalld in the init namespace. # ip netns add foobar # ip netns exec foobar bash # sh /tmp/iptables-restore-flush-and-zero.sh ** no error ** [root@rhel8 ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain INPUT_direct (0 references) target prot opt source destination I can't reproduce the issue using upstream iptables and libnftnl on a RHEL8 machine, but I can reproduce it on my testing VM (with very recent upstream kernel) and RHEL8 iptables. Git bisect identified the following upstream commit fixed the problem: commit 947c51c95edbbf08d6b3c105177ac5cfa238aade Author: Phil Sutter <phil> Date: Thu Dec 20 16:09:12 2018 +0100 xtables: Implement per chain rule cache Use recently introduced support for rules inside chains in libnftnl to introduce a rule cache per chain instead of a global one. A tricky bit is to decide if cache should be updated or not. Previously, the global rule cache was populated just once and then reused unless being flushed completely (via call to flush_rule_cache() with NULL-pointer table argument). Resemble this behaviour by introducing a boolean indicating cache status and fetch rules for all chains when updating the chain cache in nft_chain_list_get(). Signed-off-by: Phil Sutter <phil> Signed-off-by: Pablo Neira Ayuso <pablo> This commit will be backported on behalf of bug 1647925, too. |
Created attachment 1519544 [details] reproducer When using -F and -Z on the same table you get a RULE_REPLACE error. Presumably this is due to the counter zero. Separately they are fine. # for I in `seq 20`; do sh /tmp/iptables-restore-flush-and-zero.sh || break; done iptables-restore v1.8.2 (nf_tables): line 3: RULE_REPLACE failed (No such file or directory): rule in chain INPUT # sed 's/-Z//' /tmp/iptables-restore-flush-and-zero.sh > /tmp/iptables-restore-flush.sh # for I in `seq 20`; do sh /tmp/iptables-restore-flush.sh || break; done *** no error ***