diff options
author | Florian Westphal <fw@strlen.de> | 2018-06-27 23:35:21 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-06-27 23:44:04 +0200 |
commit | dcf452936a9dc6e7a8d01e5593d6950fd87db46c (patch) | |
tree | f97d5db72726eb453f6543189ee57c86d46811cf /iptables/tests/shell/testcases/ipt-save/0002load-fedora27-firewalld_0 | |
parent | f23abd53fd7bcc5aab8e2e5fc17fdef0e7b6aeda (diff) |
tests: add firewalld default ruleset from fedora 27
The ipv4 version has bogus counters so this can also check
save/restore -c option.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/tests/shell/testcases/ipt-save/0002load-fedora27-firewalld_0')
-rwxr-xr-x | iptables/tests/shell/testcases/ipt-save/0002load-fedora27-firewalld_0 | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/iptables/tests/shell/testcases/ipt-save/0002load-fedora27-firewalld_0 b/iptables/tests/shell/testcases/ipt-save/0002load-fedora27-firewalld_0 new file mode 100755 index 00000000..2ab08b7c --- /dev/null +++ b/iptables/tests/shell/testcases/ipt-save/0002load-fedora27-firewalld_0 @@ -0,0 +1,59 @@ +#!/bin/bash + +RET=0 +tmpfile="" + +clean_tmpfile() +{ + if [ ! -z "$tmpfile" ];then + rm -f "$tmpfile" + fi +} + +trap clean_tmpfile EXIT + +do_diff() +{ + A="$1" + B="$2" + + AT=$(mktemp) + grep -v "^#" "$A" > "$AT" + + diff -u "$AT" "$B" + x=$? + rm -f "$AT" + + return $x +} + +tmpfile=$(mktemp) || exit 1 +do_simple() +{ + iptables="$1" + dumpfile="$2" + opt="$3" + + $XT_MULTI ${iptables}-restore $opt < "$dumpfile" + if [ $? -ne 0 ]; then + echo "$XT_MULTI ${iptables}-restore $opt $dumpfile failed" 1>&2 + exit 1 + fi + + :> "$tmpfile" + + for table in mangle raw filter; do + $XT_MULTI ${iptables}-save -t $table $opt | grep -v "^#" >> "$tmpfile" + done + + do_diff $dumpfile "$tmpfile" + + if [ $? -ne 0 ]; then + RET=1 + fi +} +# fedora27-iptables dump contains chain counters to test counter restore/save +do_simple "iptables" $(dirname "$0")/dumps/fedora27-iptables "-c" +do_simple "ip6tables" $(dirname "$0")/dumps/fedora27-ip6tables + +exit $RET |