summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/rule_management/0004replace_0
diff options
context:
space:
mode:
Diffstat (limited to 'tests/shell/testcases/rule_management/0004replace_0')
-rwxr-xr-xtests/shell/testcases/rule_management/0004replace_024
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/shell/testcases/rule_management/0004replace_0 b/tests/shell/testcases/rule_management/0004replace_0
new file mode 100755
index 00000000..6a4b9495
--- /dev/null
+++ b/tests/shell/testcases/rule_management/0004replace_0
@@ -0,0 +1,24 @@
+#!/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 replace rule t c handle 2 drop
+
+EXPECTED="table ip t {
+ chain c {
+ drop
+ }
+}"
+
+GET="$($NFT list ruleset)"
+
+if [ "$EXPECTED" != "$GET" ] ; then
+ DIFF="$(which diff)"
+ [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
+ exit 1
+fi