Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2024 13:04:25 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3f9a6e0b85d4 - main - pf tests: dummynet + nat fragmentation test
Message-ID:  <202401151304.40FD4PLl074939@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=3f9a6e0b85d418b49b3a3b859b9992e407cb66d5

commit 3f9a6e0b85d418b49b3a3b859b9992e407cb66d5
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-01-12 16:09:52 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-01-15 13:02:02 +0000

    pf tests: dummynet + nat fragmentation test
    
    Ensure that we do the right thing when we reassemble fragmented packet
    and send it through a dummynet pipe.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/fragmentation_pass.sh | 48 ++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/tests/sys/netpfil/pf/fragmentation_pass.sh b/tests/sys/netpfil/pf/fragmentation_pass.sh
index 737977bfd9cf..d505accba5f2 100644
--- a/tests/sys/netpfil/pf/fragmentation_pass.sh
+++ b/tests/sys/netpfil/pf/fragmentation_pass.sh
@@ -506,6 +506,53 @@ dummynet_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "dummynet_nat" "cleanup"
+dummynet_nat_head()
+{
+	atf_set descr 'Test dummynet on NATed fragmented traffic'
+	atf_set require.user root
+}
+
+dummynet_nat_body()
+{
+	pft_init
+	dummynet_init
+
+	epair_one=$(vnet_mkepair)
+	ifconfig ${epair_one}a 192.0.2.1/24 up
+
+	epair_two=$(vnet_mkepair)
+
+	vnet_mkjail alcatraz ${epair_one}b ${epair_two}a
+	jexec alcatraz ifconfig ${epair_one}b 192.0.2.2/24 up
+	jexec alcatraz ifconfig ${epair_two}a 198.51.100.1/24 up
+	jexec alcatraz sysctl net.inet.ip.forwarding=1
+
+	vnet_mkjail singsing ${epair_two}b
+	jexec singsing ifconfig ${epair_two}b 198.51.100.2/24 up
+	jexec singsing route add default 198.51.100.1
+
+	route add 198.51.100.0/24 192.0.2.2
+
+	jexec alcatraz dnctl pipe 1 config bw 1600Byte/s
+	jexec alcatraz dnctl pipe 2 config bw 1700Byte/s
+
+	jexec alcatraz pfctl -e
+	pft_set_rules alcatraz \
+		"set reassemble yes" \
+		"nat on ${epair_two}a from 192.0.2.0/24 -> (${epair_two}a)" \
+		"block in" \
+		"pass in inet proto icmp all icmp-type echoreq dnpipe (1, 2)"
+
+	atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2
+	atf_check -s exit:0 -o ignore ping -c 1 -s 2000 198.51.100.2
+}
+
+dummynet_nat_cleanup()
+{
+	pft_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "too_many_fragments"
@@ -518,4 +565,5 @@ atf_init_test_cases()
 	atf_add_test_case "no_df"
 	atf_add_test_case "reassemble_slowpath"
 	atf_add_test_case "dummynet"
+	atf_add_test_case "dummynet_nat"
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401151304.40FD4PLl074939>