Blame SOURCES/0025-tests-shell-Test-F-in-dump-files.patch

fc8f74
From dd98af599516806e2eb3e1186d0ad52ce7c6b4b5 Mon Sep 17 00:00:00 2001
fc8f74
From: Phil Sutter <phil@nwl.cc>
fc8f74
Date: Tue, 21 Apr 2020 14:10:53 +0200
fc8f74
Subject: [PATCH] tests: shell: Test -F in dump files
fc8f74
fc8f74
While not really useful, iptables-nft-restore shouldn't segfault either.
fc8f74
This tests the problem described in nfbz#1407.
fc8f74
fc8f74
Signed-off-by: Phil Sutter <phil@nwl.cc>
fc8f74
(cherry picked from commit f2ace0cdf25a5911ac84015829d65d6050a5e82d)
fc8f74
Signed-off-by: Phil Sutter <psutter@redhat.com>
fc8f74
---
fc8f74
 .../tests/shell/testcases/ipt-restore/0012-dash-F_0  | 12 ++++++++++++
fc8f74
 1 file changed, 12 insertions(+)
fc8f74
 create mode 100755 iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0
fc8f74
fc8f74
diff --git a/iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0 b/iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0
fc8f74
new file mode 100755
fc8f74
index 0000000000000..fd82afa1bc8ce
fc8f74
--- /dev/null
fc8f74
+++ b/iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0
fc8f74
@@ -0,0 +1,12 @@
fc8f74
+#!/bin/bash -e
fc8f74
+
fc8f74
+# make sure -F lines don't cause segfaults
fc8f74
+
fc8f74
+RULESET='*nat
fc8f74
+-F PREROUTING
fc8f74
+-A PREROUTING -j ACCEPT
fc8f74
+-F PREROUTING
fc8f74
+COMMIT'
fc8f74
+
fc8f74
+echo -e "$RULESET" | $XT_MULTI iptables-restore
fc8f74
+echo -e "$RULESET" | $XT_MULTI iptables-restore -n
fc8f74
-- 
fc8f74
2.27.0
fc8f74