The branch main has been updated by kp:

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

commit 3f9a6e0b85d418b49b3a3b859b9992e407cb66d5
Author:     Kristof Provost <[email protected]>
AuthorDate: 2024-01-12 16:09:52 +0000
Commit:     Kristof Provost <[email protected]>
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"
 }

Reply via email to