bugzilla-daemon at netfilter.org
2018-Jul-13 17:47 UTC
[Bug 1271] New: iptables-restore may double-lock when using --table
https://bugzilla.netfilter.org/show_bug.cgi?id=1271 Bug ID: 1271 Summary: iptables-restore may double-lock when using --table Product: iptables Version: 1.6.x Hardware: x86_64 OS: Fedora Status: NEW Severity: minor Priority: P5 Component: iptables-restore Assignee: netfilter-buglog at lists.netfilter.org Reporter: contact+netfilter at jgoguen.ca Created attachment 541 --> https://bugzilla.netfilter.org/attachment.cgi?id=541&action=edit Path to free the lock when skipping a table Currently, when running `iptables-restore --table=X`, where `X` is not the first table in the rules dump, the restore will fail when parsing the second table: - a lock is acquird when parsing the first table name - the table name does not match the parameter to `--table` so processing continues until the next table - when processing the next table a lock is acquired, which fails because a lock is already held This will release the lock as soon as it's decided the current table won't be used. With existing code: # 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 # iptables-restore <iptables.dump Another app is currently holding the xtables lock. Perhaps you want to use the -w option? # 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 With the change from the attached patch: # 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 # iptables-restore <iptables.dump # iptables -L Chain INPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere Chain FORWARD (policy DROP) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination REJECT tcp -- anywhere anywhere tcp dpt:netbios-ns reject-with icmp-port-unreachable REJECT udp -- anywhere anywhere udp dpt:netbios-ns reject-with icmp-port-unreachable And the test suite: # ./iptables/tests/shell/run-tests.sh I: [OK] ././iptables/tests/shell/testcases/chain/0001duplicate_1 I: [OK] ././iptables/tests/shell/testcases/chain/0002newchain_0 I: [OK] ././iptables/tests/shell/testcases/chain/0003rename_1 I: [OK] ././iptables/tests/shell/testcases/ebtables/0001-ebtables- basic_0 I: [OK] ././iptables/tests/shell/testcases/firewalld-restore/0001- firewalld_0 I: [OK] ././iptables/tests/shell/testcases/firewalld-restore/0002- firewalld-restart_0 I: [OK] ././iptables/tests/shell/testcases/ipt-restore/0001load- specific-table_0 I: [OK] ././iptables/tests/shell/testcases/ipt-save/0001load- dumps_0 I: [OK] ././iptables/tests/shell/testcases/ipt-save/0002load- fedora27-firewalld_0 I: legacy results: [OK] 9 [FAILED] 0 [TOTAL] 9 I: [OK] ././iptables/tests/shell/testcases/chain/0001duplicate_1 I: [OK] ././iptables/tests/shell/testcases/chain/0002newchain_0 I: [OK] ././iptables/tests/shell/testcases/chain/0003rename_1 I: [OK] ././iptables/tests/shell/testcases/ebtables/0001-ebtables- basic_0 I: [OK] ././iptables/tests/shell/testcases/firewalld-restore/0001- firewalld_0 I: [OK] ././iptables/tests/shell/testcases/firewalld-restore/0002- firewalld-restart_0 I: [OK] ././iptables/tests/shell/testcases/ipt-restore/0001load- specific-table_0 I: [OK] ././iptables/tests/shell/testcases/ipt-save/0001load- dumps_0 I: [OK] ././iptables/tests/shell/testcases/ipt-save/0002load- fedora27-firewalld_0 I: nft results: [OK] 9 [FAILED] 0 [TOTAL] 9 I: combined results: [OK] 18 [FAILED] 0 [TOTAL] 18 -- You are receiving this mail because: You are watching all bug changes. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.netfilter.org/pipermail/netfilter-buglog/attachments/20180713/c8fea00a/attachment.html>
bugzilla-daemon at netfilter.org
2018-Jul-13 17:48 UTC
[Bug 1271] iptables-restore may double-lock when using --table
https://bugzilla.netfilter.org/show_bug.cgi?id=1271 --- Comment #1 from contact+netfilter at jgoguen.ca --- Created attachment 542 --> https://bugzilla.netfilter.org/attachment.cgi?id=542&action=edit Dump file used for testing iptables-restore -- You are receiving this mail because: You are watching all bug changes. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.netfilter.org/pipermail/netfilter-buglog/attachments/20180713/b888e3a9/attachment.html>
bugzilla-daemon at netfilter.org
2018-Jul-13 17:49 UTC
[Bug 1271] iptables-restore may double-lock when using --table
https://bugzilla.netfilter.org/show_bug.cgi?id=1271 --- Comment #2 from contact+netfilter at jgoguen.ca --- Created attachment 543 --> https://bugzilla.netfilter.org/attachment.cgi?id=543&action=edit Dump file used for testing ip6tables-restore -- You are receiving this mail because: You are watching all bug changes. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.netfilter.org/pipermail/netfilter-buglog/attachments/20180713/2eda6f90/attachment.html>
bugzilla-daemon at netfilter.org
2018-Jul-27 20:08 UTC
[Bug 1271] iptables-restore may double-lock when using --table
https://bugzilla.netfilter.org/show_bug.cgi?id=1271 contact+netfilter at jgoguen.ca changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from contact+netfilter at jgoguen.ca --- Merged according to https://marc.info/?l=netfilter-devel&m=153261050527770 -- You are receiving this mail because: You are watching all bug changes. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.netfilter.org/pipermail/netfilter-buglog/attachments/20180727/cfa2b556/attachment.html>