]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/py: extend masquerade to cover ports too
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 3 Mar 2016 19:07:07 +0000 (20:07 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 3 Mar 2016 19:09:00 +0000 (20:09 +0100)
Tests new masquerade port range support (available since 4.6-rc).

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/py/ip/masquerade.t
tests/py/ip/masquerade.t.payload
tests/py/ip6/masquerade.t
tests/py/ip6/masquerade.t.payload.ip6

index 0bb49a689b5620a2bb0002e0d5e5d10a24b78cf7..cee6e0e8ffb3afa4775fdd521b3288510559e231 100644 (file)
@@ -15,6 +15,10 @@ udp dport 53 masquerade persistent,random,fully-random;ok;udp dport 53 masquerad
 udp dport 53 masquerade persistent,fully-random;ok;udp dport 53 masquerade fully-random,persistent
 udp dport 53 masquerade persistent,fully-random,random;ok;udp dport 53 masquerade random,fully-random,persistent
 
+# using ports
+ip protocol 6 masquerade to :1024;ok
+ip protocol 6 masquerade to :1024-2048;ok
+
 # masquerade is a terminal statement
 tcp dport 22 masquerade counter packets 0 bytes 0 accept;fail
 tcp sport 22 masquerade accept;fail
index 9390f0cffbc2b170d3902627113742d7e3d2600a..2479c8c9fe60bf5cc84ff6c3ea5b43bea6461467 100644 (file)
@@ -125,3 +125,18 @@ ip test-ip4 postrouting
   [ lookup reg 1 set map%d dreg 0 ]
   [ masq ]
 
+# ip protocol 6 masquerade to :1024
+ip test-ip4 postrouting
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ immediate reg 1 0x00000004 ]
+  [ masq proto_min reg 1 proto_max reg 0 ]
+
+# ip protocol 6 masquerade to :1024-2048
+ip test-ip4 postrouting
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ immediate reg 1 0x00000004 ]
+  [ immediate reg 2 0x00000008 ]
+  [ masq proto_min reg 1 proto_max reg 2 ]
+
index 8040280ebc259a4b2f8e8953be7df64594fa7da2..d36ff76bdcfeb7ee6b28e5f27c32e72bc0e772fc 100644 (file)
@@ -15,6 +15,10 @@ udp dport 53 masquerade persistent,random,fully-random;ok;udp dport 53 masquerad
 udp dport 53 masquerade persistent,fully-random;ok;udp dport 53 masquerade fully-random,persistent
 udp dport 53 masquerade persistent,fully-random,random;ok;udp dport 53 masquerade random,fully-random,persistent
 
+# using ports
+meta l4proto 6 masquerade to :1024;ok
+meta l4proto 6 masquerade to :1024-2048;ok
+
 # masquerade is a terminal statement
 tcp dport 22 masquerade counter packets 0 bytes 0 accept;fail
 tcp sport 22 masquerade accept;fail
index 2e8bf95992a9ebfbf5aa6c2abf1f345cd67240ef..778e709edd2d23b5d734c717b42c3cbe87514d6e 100644 (file)
@@ -125,3 +125,18 @@ ip6 test-ip6 postrouting
   [ lookup reg 1 set map%d dreg 0 ]
   [ masq ]
 
+# meta l4proto 6 masquerade to :1024
+ip6 test-ip6 postrouting
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ immediate reg 1 0x00000004 ]
+  [ masq proto_min reg 1 proto_max reg 0 ]
+
+# meta l4proto 6 masquerade to :1024-2048
+ip6 test-ip6 postrouting
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ immediate reg 1 0x00000004 ]
+  [ immediate reg 2 0x00000008 ]
+  [ masq proto_min reg 1 proto_max reg 2 ]
+