diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2015-12-11 11:10:35 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-12-18 13:59:41 +0100 |
commit | e5590a688fd1d46f1722afe6aec3b7c74fd6d883 (patch) | |
tree | 3e27dca12b015173e0de20f455c3315a06872ae0 /tests | |
parent | 914d089d3721b9812563704823cbae67973e038d (diff) |
tests/shell: add test case for cache bug
This testcase for sets catch a cache bug.
By the time of this commit this test is failing, so the test suite shows:
% sudo ./run-tests.sh
I: using nft binary /usr/local/sbin/nft
I: [OK] ./testcases/maps/anonymous_snat_map_0
I: [OK] ./testcases/maps/named_snat_map_0
W: [FAILED] ./testcases/sets/cache_handling_0
I: [OK] ./testcases/optionals/comments_0
I: [OK] ./testcases/optionals/comments_handles_monitor_0
I: [OK] ./testcases/optionals/handles_1
I: [OK] ./testcases/optionals/handles_0
I: [OK] ./testcases/optionals/comments_handles_0
I: results: [OK] 7 [FAILED] 1 [TOTAL] 8
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/shell/testcases/sets/cache_handling_0 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/shell/testcases/sets/cache_handling_0 b/tests/shell/testcases/sets/cache_handling_0 new file mode 100755 index 00000000..c79e0139 --- /dev/null +++ b/tests/shell/testcases/sets/cache_handling_0 @@ -0,0 +1,35 @@ +#!/bin/bash + +MKTEMP=$(which mktemp) +if [ -x $MKTEMP ] ; then + tmpfile=$(${MKTEMP}) +else + tmpfile=$(/tmp/${RANDOM}) +fi + +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile" EXIT # cleanup if aborted + +echo " +table inet test { + set test { + type ipv4_addr + elements = { 1.1.1.1} + } + + chain test { + ip saddr @test counter accept + ip daddr { 2.2.2.2} counter accept + } +}" > $tmpfile + +set -e + +$NFT -f $tmpfile +$NFT delete rule inet test test handle 2 +$NFT delete set inet test test +$NFT -f $tmpfile |