|
|
8ff5ad |
From eeba2cd956485d3059dabf86a7ad8dd59ee682dd Mon Sep 17 00:00:00 2001
|
|
|
8ff5ad |
From: Phil Sutter <psutter@redhat.com>
|
|
|
8ff5ad |
Date: Fri, 4 Feb 2022 14:18:44 +0100
|
|
|
8ff5ad |
Subject: [PATCH] tests: py: add dnat to port without defining destination
|
|
|
8ff5ad |
address
|
|
|
8ff5ad |
|
|
|
8ff5ad |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2030773
|
|
|
8ff5ad |
Upstream Status: nftables commit 0f27e258b37a5
|
|
|
8ff5ad |
Conflicts: Context changes due to missing commit ae1d822630e6d
|
|
|
8ff5ad |
("src: context tracking for multiple transport protocols")
|
|
|
8ff5ad |
|
|
|
8ff5ad |
commit 0f27e258b37a592233d6ad5381cd1fae65e57514
|
|
|
8ff5ad |
Author: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
8ff5ad |
Date: Thu Jul 22 17:43:56 2021 +0200
|
|
|
8ff5ad |
|
|
|
8ff5ad |
tests: py: add dnat to port without defining destination address
|
|
|
8ff5ad |
|
|
|
8ff5ad |
Add a test to cover dnat to port without destination address.
|
|
|
8ff5ad |
|
|
|
8ff5ad |
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1428
|
|
|
8ff5ad |
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
8ff5ad |
---
|
|
|
8ff5ad |
tests/py/inet/dnat.t | 1 +
|
|
|
8ff5ad |
tests/py/inet/dnat.t.json | 20 ++++++++++++++++++++
|
|
|
8ff5ad |
tests/py/inet/dnat.t.payload | 8 ++++++++
|
|
|
8ff5ad |
3 files changed, 29 insertions(+)
|
|
|
8ff5ad |
|
|
|
8ff5ad |
diff --git a/tests/py/inet/dnat.t b/tests/py/inet/dnat.t
|
|
|
8ff5ad |
index fcdf943..6beceda 100644
|
|
|
8ff5ad |
--- a/tests/py/inet/dnat.t
|
|
|
8ff5ad |
+++ b/tests/py/inet/dnat.t
|
|
|
8ff5ad |
@@ -6,6 +6,7 @@ iifname "foo" tcp dport 80 redirect to :8080;ok
|
|
|
8ff5ad |
|
|
|
8ff5ad |
iifname "eth0" tcp dport 443 dnat ip to 192.168.3.2;ok
|
|
|
8ff5ad |
iifname "eth0" tcp dport 443 dnat ip6 to [dead::beef]:4443;ok
|
|
|
8ff5ad |
+meta l4proto tcp dnat to :80;ok;meta l4proto 6 dnat to :80
|
|
|
8ff5ad |
|
|
|
8ff5ad |
dnat ip to ct mark map { 0x00000014 : 1.2.3.4};ok
|
|
|
8ff5ad |
dnat ip to ct mark . ip daddr map { 0x00000014 . 1.1.1.1 : 1.2.3.4};ok
|
|
|
8ff5ad |
diff --git a/tests/py/inet/dnat.t.json b/tests/py/inet/dnat.t.json
|
|
|
8ff5ad |
index ac6dac6..f88e9cf 100644
|
|
|
8ff5ad |
--- a/tests/py/inet/dnat.t.json
|
|
|
8ff5ad |
+++ b/tests/py/inet/dnat.t.json
|
|
|
8ff5ad |
@@ -164,3 +164,23 @@
|
|
|
8ff5ad |
}
|
|
|
8ff5ad |
]
|
|
|
8ff5ad |
|
|
|
8ff5ad |
+# meta l4proto tcp dnat to :80
|
|
|
8ff5ad |
+[
|
|
|
8ff5ad |
+ {
|
|
|
8ff5ad |
+ "match": {
|
|
|
8ff5ad |
+ "left": {
|
|
|
8ff5ad |
+ "meta": {
|
|
|
8ff5ad |
+ "key": "l4proto"
|
|
|
8ff5ad |
+ }
|
|
|
8ff5ad |
+ },
|
|
|
8ff5ad |
+ "op": "==",
|
|
|
8ff5ad |
+ "right": 6
|
|
|
8ff5ad |
+ }
|
|
|
8ff5ad |
+ },
|
|
|
8ff5ad |
+ {
|
|
|
8ff5ad |
+ "dnat": {
|
|
|
8ff5ad |
+ "port": 80
|
|
|
8ff5ad |
+ }
|
|
|
8ff5ad |
+ }
|
|
|
8ff5ad |
+]
|
|
|
8ff5ad |
+
|
|
|
8ff5ad |
diff --git a/tests/py/inet/dnat.t.payload b/tests/py/inet/dnat.t.payload
|
|
|
8ff5ad |
index b81caf7..6d8569d 100644
|
|
|
8ff5ad |
--- a/tests/py/inet/dnat.t.payload
|
|
|
8ff5ad |
+++ b/tests/py/inet/dnat.t.payload
|
|
|
8ff5ad |
@@ -52,3 +52,11 @@ inet test-inet prerouting
|
|
|
8ff5ad |
[ payload load 4b @ network header + 16 => reg 9 ]
|
|
|
8ff5ad |
[ lookup reg 1 set __map%d dreg 1 ]
|
|
|
8ff5ad |
[ nat dnat ip addr_min reg 1 addr_max reg 0 ]
|
|
|
8ff5ad |
+
|
|
|
8ff5ad |
+# meta l4proto tcp dnat to :80
|
|
|
8ff5ad |
+inet
|
|
|
8ff5ad |
+ [ meta load l4proto => reg 1 ]
|
|
|
8ff5ad |
+ [ cmp eq reg 1 0x00000006 ]
|
|
|
8ff5ad |
+ [ immediate reg 1 0x00005000 ]
|
|
|
8ff5ad |
+ [ nat dnat inet proto_min reg 1 flags 0x2 ]
|
|
|
8ff5ad |
+
|
|
|
8ff5ad |
--
|
|
|
8ff5ad |
2.31.1
|
|
|
8ff5ad |
|