]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: shell: Test -F in dump files
authorPhil Sutter <phil@nwl.cc>
Tue, 21 Apr 2020 12:10:53 +0000 (14:10 +0200)
committerPhil Sutter <phil@nwl.cc>
Thu, 23 Apr 2020 10:54:57 +0000 (12:54 +0200)
While not really useful, iptables-nft-restore shouldn't segfault either.
This tests the problem described in nfbz#1407.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0 [new file with mode: 0755]

diff --git a/iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0 b/iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0
new file mode 100755 (executable)
index 0000000..fd82afa
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+
+# make sure -F lines don't cause segfaults
+
+RULESET='*nat
+-F PREROUTING
+-A PREROUTING -j ACCEPT
+-F PREROUTING
+COMMIT'
+
+echo -e "$RULESET" | $XT_MULTI iptables-restore
+echo -e "$RULESET" | $XT_MULTI iptables-restore -n