0001load-specific-table_0 636 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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"

25
	"$XT_MULTI" "${iptables}-restore" --table="${table}" "${dumpfile}"; rv=$?
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

	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}"