tests: shell: Improve ipt-restore/0001load-specific-table_0 a bit
Phil Sutter
reviewerPATCH 1/3 tests: shell: Improve ipt-restore/0001load-specific-table_0 a bit
Instead of reading from stdin, pass dump file as regular parameter. This way dump file name occurs in 'bash -x' output which helps finding out where things fail.
Signed-off-by Phil Sutter <[email protected]>
--- .../tests/shell/testcases/ipt-restore/0001load-specific-table_0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
iptables/tests/shell/testcases/ipt-restore/0001load-specific-table_0 +1 -1
@@ -22,7 +22,7 @@ do_simple() table="${2}" dumpfile="$(dirname "${0}")/dumps/${iptables}.dump" - "$XT_MULTI" "${iptables}-restore" --table="${table}" <"${dumpfile}"; rv=$? + "$XT_MULTI" "${iptables}-restore" --table="${table}" "${dumpfile}"; rv=$? if [ "${rv}" -ne 0 ]; then RET=1
Signature · 1 line
2.25.1
Phil Sutter
reviewerPATCH 2/3 tests: shell: Extend ipt-restore/0004-restore-race_0
Add a second table to dump/restore. This triggers failures after reverting c550c81fd373e ("nft: cache: Fix nft_release_cache() under stress"), hence acts as a reproducer for the bug fixed by that commit as well.
Signed-off-by Phil Sutter <[email protected]>
--- .../tests/shell/testcases/ipt-restore/0004-restore-race_0 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
iptables/tests/shell/testcases/ipt-restore/0004-restore-race_0 +2 -3
@@ -45,8 +45,7 @@ get_target() make_dummy_rules() { - - echo "*filter" + echo "*${1:-filter}" echo ":INPUT ACCEPT [0:0]" echo ":FORWARD ACCEPT [0:0]" echo ":OUTPUT ACCEPT [0:0]"
@@ -74,7 +73,7 @@ make_dummy_rules() tmpfile=$(mktemp) || exit 1 dumpfile=$(mktemp) || exit 1 -make_dummy_rules > $dumpfile +(make_dummy_rules; make_dummy_rules security) > $dumpfile $XT_MULTI iptables-restore -w < $dumpfile LINES1=$(wc -l < $dumpfile) $XT_MULTI iptables-save | grep -v '^#' > $dumpfile
Signature · 1 line
2.25.1
Phil Sutter
reviewerPATCH 3/3 tests: shell: Test -F in dump files
In reply to Phil SutterWhile not really useful, iptables-nft-restore shouldn't segfault either. This tests the problem described in nfbz#1407.
Signed-off-by Phil Sutter <[email protected]>
--- .../tests/shell/testcases/ipt-restore/0012-dash-F_0 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0
iptables/tests/shell/testcases/ipt-restore/0012-dash-F_0 new file +12 -0
@@ -0,0 +1,12 @@ +#!/bin/bash -e + +# make sure -F lines don't cause segfaults + +RULESET='*nat +-F PREROUTING +-A PREROUTING -j ACCEPT +-F PREROUTING +COMMIT' + +echo -e "$RULESET" | $XT_MULTI iptables-restore +echo -e "$RULESET" | $XT_MULTI iptables-restore -n
Signature · 1 line
2.25.1