From f9feca7d4029ed5af9e392cab3db93a5db0aa33f Mon Sep 17 00:00:00 2001 From: Arturo Borrero Date: Thu, 14 Apr 2016 09:58:56 +0200 Subject: tests/shell: add testcases for Netfilter bug #965 Testscases for Netfilter bug #965: * add rule at position * insert rule at position * replace rule with given handle * delete rule with given handle * don't allow to delete rules with position keyword Netfilter Bugzilla: http://bugzilla.netfilter.org/show_bug.cgi?id=965 Signed-off-by: Arturo Borrero Gonzalez Signed-off-by: Pablo Neira Ayuso --- .../testcases/rule_management/0002insertposition_0 | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 tests/shell/testcases/rule_management/0002insertposition_0 (limited to 'tests/shell/testcases/rule_management/0002insertposition_0') diff --git a/tests/shell/testcases/rule_management/0002insertposition_0 b/tests/shell/testcases/rule_management/0002insertposition_0 new file mode 100755 index 00000000..cf8a568d --- /dev/null +++ b/tests/shell/testcases/rule_management/0002insertposition_0 @@ -0,0 +1,27 @@ +#!/bin/bash + +# tests for Netfilter bug #965 and the related fix +# (regarding rule management with a given position/handle spec) + +set -e +$NFT add table t +$NFT add chain t c +$NFT add rule t c accept # should have handle 2 +$NFT add rule t c accept # should have handle 3 +$NFT insert rule t c position 2 drop + +EXPECTED="table ip t { + chain c { + drop + accept + accept + } +}" + +GET="$($NFT list ruleset)" + +if [ "$EXPECTED" != "$GET" ] ; then + DIFF="$(which diff)" + [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi -- cgit v1.2.3