]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: add test case for inserting element into verdict map
authorLiping Zhang <zlpnobody@gmail.com>
Tue, 8 Nov 2016 15:06:37 +0000 (23:06 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 4 Dec 2016 20:24:48 +0000 (21:24 +0100)
"dalegaard@gmail.com" reports that when inserting an element into a
verdict map, kernel crash will happen. Now add this test case so we
can avoid future regressions fail.

Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Acked-by: Arturo Borrero Gonzalez <arturo@debian.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/sets/0008create_verdict_map_0 [new file with mode: 0755]

diff --git a/tests/shell/testcases/sets/0008create_verdict_map_0 b/tests/shell/testcases/sets/0008create_verdict_map_0
new file mode 100755 (executable)
index 0000000..8ebb450
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+tmpfile=$(mktemp)
+if [ ! -w $tmpfile ] ; then
+       echo "Failed to create tmp file" >&2
+       exit 0
+fi
+
+trap "rm -rf $tmpfile" EXIT # cleanup if aborted
+
+echo "
+table ip t {
+       map sourcemap {
+               type ipv4_addr : verdict;
+       }
+       chain postrouting {
+               ip saddr vmap @sourcemap accept
+       }
+}
+add chain t c
+add element t sourcemap { 100.123.10.2 : jump c }
+" > $tmpfile
+
+set -e
+$NFT -f $tmpfile