summaryrefslogtreecommitdiffstats
path: root/iptables/tests/shell/testcases/ipt-restore/0001load-specific-table_0
blob: ce3bef3a88355f4d044655c91b942affe97f8c4f (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
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

RET=0
tmpfile=""

set -x

clean_tempfile()
{
	if [ -n "${tmpfile}" ]; then
		rm -f "${tmpfile}"
	fi
}

trap clean_tempfile EXIT

tmpfile=$(mktemp) || exit 1

do_simple()
{
	iptables="${1}"
	table="${2}"
	dumpfile="$(dirname "${0}")/dumps/${iptables}.dump"

	"$XT_MULTI" "${iptables}-restore" --table="${table}" <"${dumpfile}"; rv=$?

	if [ "${rv}" -ne 0 ]; then
		RET=1
	fi
}

do_simple "iptables" "filter"
do_simple "iptables" "mangle"
do_simple "iptables" "raw"
do_simple "iptables" "nat"
do_simple "ip6tables" "filter"
do_simple "ip6tables" "mangle"
do_simple "ip6tables" "raw"
do_simple "ip6tables" "nat"

exit "${RET}"