diff options
author | Florian Westphal <fw@strlen.de> | 2020-02-26 13:15:54 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2020-02-26 13:26:02 +0100 |
commit | 8ab720e343af35366f02dc0b9bac102eeedcdbad (patch) | |
tree | 0327d077360b538ead07828b8579b9e65b3780bf /tests/shell/testcases | |
parent | 92d90e56bd7df6f82ed2c71b781b8e8a189b9413 (diff) |
tests: update nat_addr_port with typeof+concat maps
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/shell/testcases')
-rw-r--r-- | tests/shell/testcases/maps/dumps/nat_addr_port.nft | 40 | ||||
-rwxr-xr-x | tests/shell/testcases/maps/nat_addr_port | 40 |
2 files changed, 80 insertions, 0 deletions
diff --git a/tests/shell/testcases/maps/dumps/nat_addr_port.nft b/tests/shell/testcases/maps/dumps/nat_addr_port.nft index 210cab7f..89c3bd14 100644 --- a/tests/shell/testcases/maps/dumps/nat_addr_port.nft +++ b/tests/shell/testcases/maps/dumps/nat_addr_port.nft @@ -1,4 +1,12 @@ table ip ipfoo { + map t1 { + typeof numgen inc mod 2 : ip daddr + } + + map t2 { + typeof numgen inc mod 2 : ip daddr . tcp dport + } + map x { type ipv4_addr : ipv4_addr } @@ -21,9 +29,19 @@ table ip ipfoo { ip saddr 10.1.1.2 tcp dport 42 dnat to 10.2.3.4:4242 meta l4proto tcp dnat ip addr . port to ip saddr map @y dnat ip addr . port to ip saddr . tcp dport map @z + dnat to numgen inc mod 2 map @t1 + meta l4proto tcp dnat ip addr . port to numgen inc mod 2 map @t2 } } table ip6 ip6foo { + map t1 { + typeof numgen inc mod 2 : ip6 daddr + } + + map t2 { + typeof numgen inc mod 2 : ip6 daddr . tcp dport + } + map x { type ipv6_addr : ipv6_addr } @@ -44,9 +62,27 @@ table ip6 ip6foo { ip6 saddr dead::2 tcp dport 42 dnat to [c0::1a]:4242 meta l4proto tcp dnat ip6 addr . port to ip6 saddr map @y dnat ip6 addr . port to ip6 saddr . tcp dport map @z + dnat to numgen inc mod 2 map @t1 + meta l4proto tcp dnat ip6 addr . port to numgen inc mod 2 map @t2 } } table inet inetfoo { + map t1v4 { + typeof numgen inc mod 2 : ip daddr + } + + map t2v4 { + typeof numgen inc mod 2 : ip daddr . tcp dport + } + + map t1v6 { + typeof numgen inc mod 2 : ip6 daddr + } + + map t2v6 { + typeof numgen inc mod 2 : ip6 daddr . tcp dport + } + map x4 { type ipv4_addr : ipv4_addr } @@ -80,10 +116,14 @@ table inet inetfoo { ip saddr 10.1.1.2 tcp dport 42 dnat ip to 10.2.3.4:4242 meta l4proto tcp meta nfproto ipv4 dnat ip addr . port to ip saddr map @y4 meta nfproto ipv4 dnat ip addr . port to ip saddr . tcp dport map @z4 + dnat ip to numgen inc mod 2 map @t1v4 + meta l4proto tcp dnat ip addr . port to numgen inc mod 2 map @t2v4 dnat ip6 to ip6 daddr map @x6 ip6 saddr dead::1 dnat ip6 to feed::1 ip6 saddr dead::2 tcp dport 42 dnat ip6 to [c0::1a]:4242 meta l4proto tcp meta nfproto ipv6 dnat ip6 addr . port to ip6 saddr map @y6 meta nfproto ipv6 dnat ip6 addr . port to ip6 saddr . tcp dport map @z6 + dnat ip6 to numgen inc mod 2 map @t1v6 + meta l4proto tcp dnat ip6 addr . port to numgen inc mod 2 map @t2v6 } } diff --git a/tests/shell/testcases/maps/nat_addr_port b/tests/shell/testcases/maps/nat_addr_port index a8d970e5..2804d48c 100755 --- a/tests/shell/testcases/maps/nat_addr_port +++ b/tests/shell/testcases/maps/nat_addr_port @@ -3,6 +3,14 @@ # skeleton $NFT -f /dev/stdin <<EOF || exit 1 table ip ipfoo { + map t1 { + typeof numgen inc mod 2 : ip daddr; + } + + map t2 { + typeof numgen inc mod 2 : ip daddr . tcp dport + } + map x { type ipv4_addr : ipv4_addr } @@ -23,6 +31,8 @@ table ip ipfoo { ip saddr 10.1.1.2 tcp dport 42 dnat to 10.2.3.4:4242 meta l4proto tcp dnat ip addr . port to ip saddr map @y meta l4proto tcp dnat ip addr . port to ip saddr . tcp dport map @z + dnat ip to numgen inc mod 2 map @t1 + meta l4proto tcp dnat ip addr . port to numgen inc mod 2 map @t2 } } EOF @@ -36,6 +46,14 @@ $NFT add rule 'ip ipfoo c dnat to ip daddr map @y' && exit 1 # skeleton 6 $NFT -f /dev/stdin <<EOF || exit 1 table ip6 ip6foo { + map t1 { + typeof numgen inc mod 2 : ip6 daddr; + } + + map t2 { + typeof numgen inc mod 2 : ip6 daddr . tcp dport + } + map x { type ipv6_addr : ipv6_addr } @@ -54,6 +72,8 @@ table ip6 ip6foo { ip6 saddr dead::2 tcp dport 42 dnat to [c0::1a]:4242 meta l4proto tcp dnat ip6 addr . port to ip6 saddr map @y meta l4proto tcp dnat ip6 addr . port to ip6 saddr . tcp dport map @z + dnat ip6 to numgen inc mod 2 map @t1 + meta l4proto tcp dnat ip6 addr . port to numgen inc mod 2 map @t2 } } EOF @@ -67,6 +87,22 @@ $NFT add rule 'ip6 ip6foo c dnat to ip daddr map @y' && exit 1 # skeleton inet $NFT -f /dev/stdin <<EOF || exit 1 table inet inetfoo { + map t1v4 { + typeof numgen inc mod 2 : ip daddr + } + + map t2v4 { + typeof numgen inc mod 2 : ip daddr . tcp dport; + } + + map t1v6 { + typeof numgen inc mod 2 : ip6 daddr; + } + + map t2v6 { + typeof numgen inc mod 2 : ip6 daddr . tcp dport + } + map x4 { type ipv4_addr : ipv4_addr } @@ -95,11 +131,15 @@ table inet inetfoo { ip saddr 10.1.1.2 tcp dport 42 dnat to 10.2.3.4:4242 meta l4proto tcp dnat ip addr . port to ip saddr map @y4 meta l4proto tcp dnat ip addr . port to ip saddr . tcp dport map @z4 + dnat ip to numgen inc mod 2 map @t1v4 + meta l4proto tcp dnat ip addr . port to numgen inc mod 2 map @t2v4 dnat ip6 to ip6 daddr map @x6 ip6 saddr dead::1 dnat to feed::1 ip6 saddr dead::2 tcp dport 42 dnat to [c0::1a]:4242 meta l4proto tcp dnat ip6 addr . port to ip6 saddr map @y6 meta l4proto tcp dnat ip6 addr . port to ip6 saddr . tcp dport map @z6 + dnat ip6 to numgen inc mod 2 map @t1v6 + meta l4proto tcp dnat ip6 addr . port to numgen inc mod 2 map @t2v6 } } EOF |