All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft,v3 6/9] tests: py: concatenation, netmap and nat mappings
Date: Tue, 28 Apr 2020 17:41:17 +0200	[thread overview]
Message-ID: <20200428154120.20061-7-pablo@netfilter.org> (raw)
In-Reply-To: <20200428154120.20061-1-pablo@netfilter.org>

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 tests/py/ip/snat.t         |  4 ++++
 tests/py/ip/snat.t.payload | 27 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/tests/py/ip/snat.t b/tests/py/ip/snat.t
index 7281bf5fa7e0..c6e8a8e68f9d 100644
--- a/tests/py/ip/snat.t
+++ b/tests/py/ip/snat.t
@@ -8,3 +8,7 @@ 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 != 23-34 snat to 192.168.3.2;ok
+
+snat ip addr . port to ip saddr map { 10.141.11.4 : 192.168.2.3 . 80 };ok
+snat ip interval to ip saddr map { 10.141.11.4 : 192.168.2.2-192.168.2.4 };ok
+snat ip prefix to ip saddr map { 10.141.11.0/24 : 192.168.2.0/24 };ok
diff --git a/tests/py/ip/snat.t.payload b/tests/py/ip/snat.t.payload
index 789933ffd650..22befe155dde 100644
--- a/tests/py/ip/snat.t.payload
+++ b/tests/py/ip/snat.t.payload
@@ -60,3 +60,30 @@ ip test-ip4 postrouting
   [ immediate reg 1 0x0203a8c0 ]
   [ nat snat ip addr_min reg 1 addr_max reg 0 ]
 
+# snat ip addr . port to ip saddr map { 10.141.11.4 : 192.168.2.3 . 80 }
+__map%d test-ip4 b size 1
+__map%d test-ip4 0
+	element 040b8d0a  : 0302a8c0 00005000 0 [end]
+ip 
+  [ payload load 4b @ network header + 12 => reg 1 ]
+  [ lookup reg 1 set __map%d dreg 1 ]
+  [ nat snat ip addr_min reg 1 addr_max reg 0 proto_min reg 9 proto_max reg 0 ]
+
+# snat ip interval to ip saddr map { 10.141.11.4 : 192.168.2.2-192.168.2.4 }
+__map%d test-ip4 b size 1
+__map%d test-ip4 0
+	element 040b8d0a  : 0202a8c0 0402a8c0 0 [end]
+ip 
+  [ payload load 4b @ network header + 12 => reg 1 ]
+  [ lookup reg 1 set __map%d dreg 1 ]
+  [ nat snat ip addr_min reg 1 addr_max reg 9 ]
+
+# snat ip prefix to ip saddr map { 10.141.11.0/24 : 192.168.2.0/24 }
+__map%d test-ip4 f size 3
+__map%d test-ip4 0
+	element 00000000  : 1 [end]	element 000b8d0a  : 0002a8c0 ff02a8c0 0 [end]	element 000c8d0a  : 1 [end]
+ip 
+  [ payload load 4b @ network header + 12 => reg 1 ]
+  [ lookup reg 1 set __map%d dreg 1 ]
+  [ nat snat ip addr_min reg 1 addr_max reg 9 flags 0x40 ]
+
-- 
2.20.1


  parent reply	other threads:[~2020-04-28 15:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 15:41 [PATCH nft,v3 0/9] netmap support for nft Pablo Neira Ayuso
2020-04-28 15:41 ` [PATCH nft,v3 1/9] src: NAT support for intervals in maps Pablo Neira Ayuso
2020-04-28 15:41 ` [PATCH nft,v3 2/9] include: resync nf_nat.h kernel header Pablo Neira Ayuso
2020-04-28 15:41 ` [PATCH nft,v3 3/9] src: add netmap support Pablo Neira Ayuso
2020-04-28 15:41 ` [PATCH nft,v3 4/9] src: add STMT_NAT_F_CONCAT flag and use it Pablo Neira Ayuso
2020-04-28 15:41 ` [PATCH nft,v3 5/9] evaluate: fix crash when handling concatenation without map Pablo Neira Ayuso
2020-04-28 15:41 ` Pablo Neira Ayuso [this message]
2020-04-28 15:41 ` [PATCH nft,v3 7/9] mnl: restore --debug=netlink output with sets Pablo Neira Ayuso
2020-04-28 15:41 ` [PATCH nft,v3 8/9] tests: py: remove range test with service names Pablo Neira Ayuso
2020-04-28 15:41 ` [PATCH nft,v3 9/9] tests: shell: add NAT mappings tests Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428154120.20061-7-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.