From 850f0a56b6ad625d6c5d8ba28ec4f55ec02ff2a7 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 28 Jul 2016 20:03:53 +0200 Subject: src: add 'to' for snat and dnat This is extra syntaxtic sugar to get this consistent with other statements such as redirect, masquerade, dup and fwd that indicates where to go. Existing syntax is still preserved, but the listing shows the one including 'to'. Signed-off-by: Pablo Neira Ayuso --- tests/py/ip/dnat.t | 16 ++++++++-------- tests/py/ip/dnat.t.payload.ip | 12 ++++++------ tests/py/ip/snat.t | 12 ++++++------ tests/py/ip/snat.t.payload | 8 ++++---- tests/py/ip6/dnat.t | 4 ++-- tests/py/ip6/dnat.t.payload.ip6 | 4 ++-- tests/py/ip6/snat.t | 4 ++-- tests/py/ip6/snat.t.payload.ip6 | 4 ++-- 8 files changed, 32 insertions(+), 32 deletions(-) (limited to 'tests') diff --git a/tests/py/ip/dnat.t b/tests/py/ip/dnat.t index 28e658d3..d1ffdd71 100644 --- a/tests/py/ip/dnat.t +++ b/tests/py/ip/dnat.t @@ -2,15 +2,15 @@ *ip;test-ip4;prerouting -iifname "eth0" tcp dport 80-90 dnat 192.168.3.2;ok -iifname "eth0" tcp dport != 80-90 dnat 192.168.3.2;ok -iifname "eth0" tcp dport {80, 90, 23} dnat 192.168.3.2;ok -- iifname "eth0" tcp dport != {80, 90, 23} dnat 192.168.3.2;ok -- iifname "eth0" tcp dport != {80, 90, 23} dnat 192.168.3.2;ok +iifname "eth0" tcp dport 80-90 dnat to 192.168.3.2;ok +iifname "eth0" tcp dport != 80-90 dnat to 192.168.3.2;ok +iifname "eth0" tcp dport {80, 90, 23} dnat to 192.168.3.2;ok +- iifname "eth0" tcp dport != {80, 90, 23} dnat to 192.168.3.2;ok +- iifname "eth0" tcp dport != {80, 90, 23} dnat to 192.168.3.2;ok # BUG: invalid expression type set # nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. -iifname "eth0" tcp dport != 23-34 dnat 192.168.3.2;ok +iifname "eth0" tcp dport != 23-34 dnat to 192.168.3.2;ok -dnat ct mark map { 0x00000014 : 1.2.3.4};ok -dnat ct mark . ip daddr map { 0x00000014 . 1.1.1.1 : 1.2.3.4};ok +dnat to ct mark map { 0x00000014 : 1.2.3.4};ok +dnat to ct mark . ip daddr map { 0x00000014 . 1.1.1.1 : 1.2.3.4};ok diff --git a/tests/py/ip/dnat.t.payload.ip b/tests/py/ip/dnat.t.payload.ip index bf972c6c..be382da3 100644 --- a/tests/py/ip/dnat.t.payload.ip +++ b/tests/py/ip/dnat.t.payload.ip @@ -1,4 +1,4 @@ -# iifname "eth0" tcp dport 80-90 dnat 192.168.3.2 +# iifname "eth0" tcp dport 80-90 dnat to 192.168.3.2 ip test-ip4 prerouting [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ] @@ -10,7 +10,7 @@ ip test-ip4 prerouting [ immediate reg 1 0x0203a8c0 ] [ nat dnat ip addr_min reg 1 addr_max reg 0 ] -# iifname "eth0" tcp dport != 80-90 dnat 192.168.3.2 +# iifname "eth0" tcp dport != 80-90 dnat to 192.168.3.2 ip test-ip4 prerouting [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ] @@ -22,7 +22,7 @@ ip test-ip4 prerouting [ immediate reg 1 0x0203a8c0 ] [ nat dnat ip addr_min reg 1 addr_max reg 0 ] -# iifname "eth0" tcp dport {80, 90, 23} dnat 192.168.3.2 +# iifname "eth0" tcp dport {80, 90, 23} dnat to 192.168.3.2 __set%d test-ip4 3 __set%d test-ip4 0 element 00005000 : 0 [end] element 00005a00 : 0 [end] element 00001700 : 0 [end] @@ -36,7 +36,7 @@ ip test-ip4 prerouting [ immediate reg 1 0x0203a8c0 ] [ nat dnat ip addr_min reg 1 addr_max reg 0 ] -# iifname "eth0" tcp dport != 23-34 dnat 192.168.3.2 +# iifname "eth0" tcp dport != 23-34 dnat to 192.168.3.2 ip test-ip4 prerouting [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ] @@ -48,7 +48,7 @@ ip test-ip4 prerouting [ immediate reg 1 0x0203a8c0 ] [ nat dnat ip addr_min reg 1 addr_max reg 0 ] -# dnat ct mark map { 0x00000014 : 1.2.3.4} +# dnat to ct mark map { 0x00000014 : 1.2.3.4} __map%d test-ip4 b __map%d test-ip4 0 element 00000014 : 04030201 0 [end] @@ -57,7 +57,7 @@ ip test-ip4 prerouting [ lookup reg 1 set __map%d dreg 1 ] [ nat dnat ip addr_min reg 1 addr_max reg 0 ] -# dnat ct mark . ip daddr map { 0x00000014 . 1.1.1.1 : 1.2.3.4} +# dnat to ct mark . ip daddr map { 0x00000014 . 1.1.1.1 : 1.2.3.4} __map%d test-ip4 b __map%d test-ip4 0 element 00000014 01010101 : 04030201 0 [end] diff --git a/tests/py/ip/snat.t b/tests/py/ip/snat.t index a8469a35..ec2df8c0 100644 --- a/tests/py/ip/snat.t +++ b/tests/py/ip/snat.t @@ -2,12 +2,12 @@ *ip;test-ip4;postrouting -iifname "eth0" tcp dport 80-90 snat 192.168.3.2;ok -iifname "eth0" tcp dport != 80-90 snat 192.168.3.2;ok -iifname "eth0" tcp dport {80, 90, 23} snat 192.168.3.2;ok -- iifname "eth0" tcp dport != {80, 90, 23} snat 192.168.3.2;ok -- iifname "eth0" tcp dport != {80, 90, 23} snat 192.168.3.2;ok +iifname "eth0" tcp dport 80-90 snat to 192.168.3.2;ok +iifname "eth0" tcp dport != 80-90 snat to 192.168.3.2;ok +iifname "eth0" tcp dport {80, 90, 23} snat to 192.168.3.2;ok +- iifname "eth0" tcp dport != {80, 90, 23} snat to 192.168.3.2;ok +- iifname "eth0" tcp dport != {80, 90, 23} snat to 192.168.3.2;ok # BUG: invalid expression type set # nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. -iifname "eth0" tcp dport != 23-34 snat 192.168.3.2;ok +iifname "eth0" tcp dport != 23-34 snat to 192.168.3.2;ok diff --git a/tests/py/ip/snat.t.payload b/tests/py/ip/snat.t.payload index cbea641f..bef97a85 100644 --- a/tests/py/ip/snat.t.payload +++ b/tests/py/ip/snat.t.payload @@ -1,4 +1,4 @@ -# iifname "eth0" tcp dport 80-90 snat 192.168.3.2 +# iifname "eth0" tcp dport 80-90 snat to 192.168.3.2 ip test-ip4 postrouting [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ] @@ -10,7 +10,7 @@ ip test-ip4 postrouting [ immediate reg 1 0x0203a8c0 ] [ nat snat ip addr_min reg 1 addr_max reg 0 ] -# iifname "eth0" tcp dport != 80-90 snat 192.168.3.2 +# iifname "eth0" tcp dport != 80-90 snat to 192.168.3.2 ip test-ip4 postrouting [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ] @@ -22,7 +22,7 @@ ip test-ip4 postrouting [ immediate reg 1 0x0203a8c0 ] [ nat snat ip addr_min reg 1 addr_max reg 0 ] -# iifname "eth0" tcp dport {80, 90, 23} snat 192.168.3.2 +# iifname "eth0" tcp dport {80, 90, 23} snat to 192.168.3.2 __set%d test-ip4 3 __set%d test-ip4 0 element 00005000 : 0 [end] element 00005a00 : 0 [end] element 00001700 : 0 [end] @@ -36,7 +36,7 @@ ip test-ip4 postrouting [ immediate reg 1 0x0203a8c0 ] [ nat snat ip addr_min reg 1 addr_max reg 0 ] -# iifname "eth0" tcp dport != 23-34 snat 192.168.3.2 +# iifname "eth0" tcp dport != 23-34 snat to 192.168.3.2 ip test-ip4 postrouting [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ] diff --git a/tests/py/ip6/dnat.t b/tests/py/ip6/dnat.t index b061f2f6..b256e018 100644 --- a/tests/py/ip6/dnat.t +++ b/tests/py/ip6/dnat.t @@ -2,5 +2,5 @@ *ip6;test-ip6;prerouting -tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:::80-100;ok -tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:: :100;ok;tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:::100 +tcp dport 80-90 dnat to 2001:838:35f:1::-2001:838:35f:2:::80-100;ok +tcp dport 80-90 dnat to 2001:838:35f:1::-2001:838:35f:2:: :100;ok;tcp dport 80-90 dnat to 2001:838:35f:1::-2001:838:35f:2:::100 diff --git a/tests/py/ip6/dnat.t.payload.ip6 b/tests/py/ip6/dnat.t.payload.ip6 index 13c7a0e3..494ade39 100644 --- a/tests/py/ip6/dnat.t.payload.ip6 +++ b/tests/py/ip6/dnat.t.payload.ip6 @@ -1,4 +1,4 @@ -# tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:::80-100 +# tcp dport 80-90 dnat to 2001:838:35f:1::-2001:838:35f:2:::80-100 ip6 test-ip6 prerouting [ payload load 1b @ network header + 6 => reg 1 ] [ cmp eq reg 1 0x00000006 ] @@ -11,7 +11,7 @@ ip6 test-ip6 prerouting [ immediate reg 4 0x00006400 ] [ nat dnat ip6 addr_min reg 1 addr_max reg 2 proto_min reg 3 proto_max reg 4 ] -# tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:: :100 +# tcp dport 80-90 dnat to 2001:838:35f:1::-2001:838:35f:2:: :100 ip6 test-ip6 prerouting [ payload load 1b @ network header + 6 => reg 1 ] [ cmp eq reg 1 0x00000006 ] diff --git a/tests/py/ip6/snat.t b/tests/py/ip6/snat.t index dec8dffa..b85d9af9 100644 --- a/tests/py/ip6/snat.t +++ b/tests/py/ip6/snat.t @@ -2,5 +2,5 @@ *ip6;test-ip6;postrouting -tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:: :80-100;ok;tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:::80-100 -tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:::100;ok +tcp dport 80-90 snat to 2001:838:35f:1::-2001:838:35f:2:: :80-100;ok;tcp dport 80-90 snat to 2001:838:35f:1::-2001:838:35f:2:::80-100 +tcp dport 80-90 snat to 2001:838:35f:1::-2001:838:35f:2:::100;ok diff --git a/tests/py/ip6/snat.t.payload.ip6 b/tests/py/ip6/snat.t.payload.ip6 index 486bbb8b..fbc99c1a 100644 --- a/tests/py/ip6/snat.t.payload.ip6 +++ b/tests/py/ip6/snat.t.payload.ip6 @@ -1,4 +1,4 @@ -# tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:: :80-100 +# tcp dport 80-90 snat to 2001:838:35f:1::-2001:838:35f:2:: :80-100 ip6 test-ip6 postrouting [ payload load 1b @ network header + 6 => reg 1 ] [ cmp eq reg 1 0x00000006 ] @@ -11,7 +11,7 @@ ip6 test-ip6 postrouting [ immediate reg 4 0x00006400 ] [ nat snat ip6 addr_min reg 1 addr_max reg 2 proto_min reg 3 proto_max reg 4 ] -# tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:::100 +# tcp dport 80-90 snat to 2001:838:35f:1::-2001:838:35f:2:::100 ip6 test-ip6 postrouting [ payload load 1b @ network header + 6 => reg 1 ] [ cmp eq reg 1 0x00000006 ] -- cgit v1.2.3