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

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