From f15639bdac71dfe3534d274b14047d224088b15c Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Fri, 29 Jun 2018 19:14:18 +0200 Subject: tests: add script that mimics firewalld startup Mimic firewalld startup, i.e. "iptables-restore -n" use. First script is normal startup, second script restores ruleset, then re-runs first one (i.e., with existing rules rather than non-existent tables). Signed-off-by: Florian Westphal --- .../testcases/firewalld-restore/0001-firewalld_0 | 251 +++++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100755 iptables/tests/shell/testcases/firewalld-restore/0001-firewalld_0 (limited to 'iptables/tests/shell/testcases/firewalld-restore/0001-firewalld_0') diff --git a/iptables/tests/shell/testcases/firewalld-restore/0001-firewalld_0 b/iptables/tests/shell/testcases/firewalld-restore/0001-firewalld_0 new file mode 100755 index 00000000..8bf0c2c6 --- /dev/null +++ b/iptables/tests/shell/testcases/firewalld-restore/0001-firewalld_0 @@ -0,0 +1,251 @@ +#!/bin/sh + +$XT_MULTI iptables -w -L -n > /dev/null || exit 1 +$XT_MULTI iptables -w2 -L -n > /dev/null || exit 1 + +echo -n '#foo' | $XT_MULTI iptables-restore -w || exit 1 + +# table probing +for table in security raw mangle nat filter;do + $XT_MULTI iptables -w2 -t $table -L -n > /dev/null +done + +$XT_MULTI iptables -w2 -p icmp --help | grep -q 'Valid ICMP Types' || exit 1 + +cat <> "$tmpfile" +done + +case "$XT_MULTI" in +*/xtables-nft-multi) + # nft-multi displays chain names in different order, work around this for now + tmpfile2=$(mktemp) + sort "$tmpfile" > "$tmpfile2" + sort $(dirname "$0")/dumps/ipt-save-completed.txt > "$tmpfile" + diff -u $tmpfile $tmpfile2 + RET=$? + rm -f "$tmpfile2" + ;; +*) + diff -u $tmpfile $(dirname "$0")/dumps/ipt-save-completed.txt + RET=$? + ;; +esac + +rm -f "$tmpfile" + +exit $RET -- cgit v1.2.3