summaryrefslogtreecommitdiffstats
path: root/iptables/tests/shell/testcases/ipt-restore/0009-table-name-comment_0
blob: e96140758a99d21ad3b01143c65abc5b706da2b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

# when restoring a ruleset, *tables-restore prefixes each rule with
# '-t <tablename>' so standard rule parsing routines may be used. This means
# that it has to detect and reject rules which already contain a table option.

families="ip ip6"
[[ $(basename $XT_MULTI) == xtables-nft-multi ]] && families+=" eb"

for fam in $families; do
	$XT_MULTI ${fam}tables-restore <<EOF
*filter
-t nat -A FORWARD -j ACCEPT
COMMIT
EOF
	[[ $? != 0 ]] || {
		echo "${fam}tables-restore did not fail when it should have"
		exit 1
	}

	$XT_MULTI ${fam}tables-restore <<EOF
*filter
-A FORWARD -j ACCEPT
COMMIT
EOF
	[[ $? == 0 ]] || {
		echo "${fam}tables-restore failed when it should not have"
		exit 1
	}
done