diff options
author | Florian Westphal <fw@strlen.de> | 2023-06-19 22:43:02 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-06-20 21:44:50 +0200 |
commit | 75217cb7bb78e22fc9317116353149def8a306e9 (patch) | |
tree | cd8897073e6de94f3f1aa0fcbf4eeabc150bf84a /tests | |
parent | e5bf0485ff1ba0f2ff2fb3b03cfed1f98953dc1b (diff) |
evaluate: do not abort when prefix map has non-map element
Before:
nft: evaluate.c:1849: __mapping_expr_expand: Assertion `i->etype == EXPR_MAPPING' failed.
after:
Error: expected mapping, not set element
snat ip prefix to ip saddr map { 10.141.11.0/24 : 192.168.2.0/24, 10.141.12.1 }
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/shell/testcases/bogons/assert_failures | 12 | ||||
-rw-r--r-- | tests/shell/testcases/bogons/nft-f/nat_prefix_map_with_set_element_assert | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/shell/testcases/bogons/assert_failures b/tests/shell/testcases/bogons/assert_failures new file mode 100755 index 00000000..79099427 --- /dev/null +++ b/tests/shell/testcases/bogons/assert_failures @@ -0,0 +1,12 @@ +#!/bin/bash + +dir=$(dirname $0)/nft-f/ + +for f in $dir/*; do + $NFT --check -f "$f" + + if [ $? -ne 1 ]; then + echo "Bogus input file $f did not cause expected error code" 1>&2 + exit 111 + fi +done diff --git a/tests/shell/testcases/bogons/nft-f/nat_prefix_map_with_set_element_assert b/tests/shell/testcases/bogons/nft-f/nat_prefix_map_with_set_element_assert new file mode 100644 index 00000000..18c7edd1 --- /dev/null +++ b/tests/shell/testcases/bogons/nft-f/nat_prefix_map_with_set_element_assert @@ -0,0 +1,7 @@ +table ip x { + chain y { + type nat hook postrouting priority srcnat; policy accept; + snat ip prefix to ip saddr map { 10.141.11.0/24 : 192.168.2.0/24, 10.141.12.1 } + } +} + |