netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Melnychenko <a.melnychenko@vyos.io>
To: netfilter-devel@vger.kernel.org, fw@strlen.de
Subject: [PATCH v2 2/2] tests: shell: Added SNAT/DNAT only cases for nat_ftp
Date: Tue, 28 Oct 2025 17:56:07 +0100	[thread overview]
Message-ID: <20251028165607.1074310-3-a.melnychenko@vyos.io> (raw)
In-Reply-To: <20251028165607.1074310-1-a.melnychenko@vyos.io>

Added cases for SNAT or DNAT only for active and passive modes.

Signed-off-by: Andrii Melnychenko <a.melnychenko@vyos.io>
---
 tests/shell/testcases/packetpath/nat_ftp | 32 ++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/shell/testcases/packetpath/nat_ftp b/tests/shell/testcases/packetpath/nat_ftp
index bc116f6e..97161025 100755
--- a/tests/shell/testcases/packetpath/nat_ftp
+++ b/tests/shell/testcases/packetpath/nat_ftp
@@ -144,6 +144,18 @@ reload_ruleset()
 	load_snat
 }
 
+reload_ruleset_dnat_only()
+{
+	reload_ruleset_base
+	load_dnat
+}
+
+reload_ruleset_snat_only()
+{
+	reload_ruleset_base
+	load_snat
+}
+
 dd if=/dev/urandom of="$INFILE" bs=4096 count=1 2>/dev/null
 chmod 755 $INFILE
 assert_pass "Prepare the file for FTP transmission"
@@ -190,9 +202,29 @@ reload_ruleset
 test_case "Passive mode" [${ip_rc}]:2121 ${ip_rs}
 
 
+# test passive mode DNAT only
+reload_ruleset_dnat_only
+test_case "Passive mode DNAT only" [${ip_rc}]:2121 ${ip_cr}
+
+
+# test passive mode SNAT only
+reload_ruleset_snat_only
+test_case "Passive mode SNAT only" [${ip_sr}]:21 ${ip_rs}
+
+
 # test active mode
 reload_ruleset
 test_case "Active mode" [${ip_rc}]:2121 ${ip_rs} "-P -"
 
+
+# test active mode DNAT only
+reload_ruleset_dnat_only
+test_case "Active mode DNAT only" [${ip_rc}]:2121 ${ip_cr} "-P -"
+
+
+# test active mode SNAT only
+reload_ruleset_snat_only
+test_case "Active mode SNAT only" [${ip_sr}]:21 ${ip_rs} "-P -"
+
 # trap calls cleanup
 exit 0
-- 
2.43.0


      parent reply	other threads:[~2025-10-28 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 16:56 [PATCH v2 0/2] tests: shell: nat_ftp SNAT/DNAT only testcases Andrii Melnychenko
2025-10-28 16:56 ` [PATCH v2 1/2] tests: shell: Refactored nat_ftp, added rulesets and testcase functions Andrii Melnychenko
2025-10-29 17:43   ` Phil Sutter
2025-10-28 16:56 ` Andrii Melnychenko [this message]

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=20251028165607.1074310-3-a.melnychenko@vyos.io \
    --to=a.melnychenko@vyos.io \
    --cc=fw@strlen.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).