summaryrefslogtreecommitdiffstats
path: root/iptables/tests/shell/testcases/ipt-restore
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2023-07-21 19:40:30 +0200
committerPhil Sutter <phil@nwl.cc>2023-07-28 11:50:59 +0200
commit4a2b2008fdf4df980433f99a6d8f2003f2005296 (patch)
treee7d603f7a276e1dd977f3a2c5ddc773c8c6918c2 /iptables/tests/shell/testcases/ipt-restore
parenta2532c966659f386781a5757e0a1f42cb1d81573 (diff)
*tables-restore: Enforce correct counters syntax if present
If '--counters' option was not given, restore parsers would ignore anything following the policy word. Make them more strict, rejecting anything in that spot which does not look like counter values even if not restoring counters. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/tests/shell/testcases/ipt-restore')
-rwxr-xr-xiptables/tests/shell/testcases/ipt-restore/0008-restore-counters_07
1 files changed, 7 insertions, 0 deletions
diff --git a/iptables/tests/shell/testcases/ipt-restore/0008-restore-counters_0 b/iptables/tests/shell/testcases/ipt-restore/0008-restore-counters_0
index 5ac70682..854768c9 100755
--- a/iptables/tests/shell/testcases/ipt-restore/0008-restore-counters_0
+++ b/iptables/tests/shell/testcases/ipt-restore/0008-restore-counters_0
@@ -20,3 +20,10 @@ EXPECT=":foo - [0:0]
$XT_MULTI iptables-restore --counters <<< "$DUMP"
diff -u -Z <(echo -e "$EXPECT") <($XT_MULTI iptables-save --counters | grep foo)
+
+# if present, counters must be in proper format
+! $XT_MULTI iptables-restore <<EOF
+*filter
+:FORWARD ACCEPT bar
+COMMIT
+EOF