]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: extend catchall tests for maps
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 15 Dec 2021 22:51:10 +0000 (23:51 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 15 Dec 2021 22:51:46 +0000 (23:51 +0100)
Add a few tests for the catchall features and maps.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/sets/0064map_catchall_0
tests/shell/testcases/sets/dumps/0064map_catchall_0.nft

index 6f2a7c6f02499298daa28dd19be679c8baacab15..436851604e34555eee9cd3222d2c3b2b9b91e65d 100755 (executable)
@@ -17,3 +17,8 @@ RULESET="table ip x {
 $NFT -f - <<< $RULESET
 $NFT delete element x y { \* : 192.168.0.3 }
 $NFT add element x y { \* : 192.168.0.4 }
+
+$NFT add chain x y
+$NFT add rule x y snat to ip saddr map @z
+$NFT 'add rule x y snat to ip saddr map { 10.141.0.0/24 : 192.168.0.2, * : 192.168.0.3 }'
+$NFT 'add rule x y snat to ip saddr . ip daddr map { 10.141.0.0/24 . 10.0.0.0/8 : 192.168.0.2, 192.168.9.0/24 . 192.168.10.0/24 : 192.168.0.4, * : 192.168.0.3 }'
index 286683a05df9df1043d27c7977b0f28d1a033cd4..890ed2aab080f127f1a9a4d9afa7b1cb4c005b18 100644 (file)
@@ -9,4 +9,10 @@ table ip x {
                flags interval
                elements = { 10.141.0.0/24 : 192.168.0.2, * : 192.168.0.3 }
        }
+
+       chain y {
+               snat to ip saddr map @z
+               snat to ip saddr map { 10.141.0.0/24 : 192.168.0.2, * : 192.168.0.3 }
+               snat to ip saddr . ip daddr map { 10.141.0.0/24 . 10.0.0.0/8 : 192.168.0.2, 192.168.9.0/24 . 192.168.10.0/24 : 192.168.0.4, * : 192.168.0.3 }
+       }
 }