git: e128e988a26a - main - pf tests: check packet reassembly with nat64

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 17 Dec 2024 10:08:06 UTC
The branch main has been updated by kp:

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

commit e128e988a26a2c439da6920a5d5839b961542285
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-11-20 16:26:55 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-12-17 10:07:16 +0000

    pf tests: check packet reassembly with nat64
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D47805
---
 tests/sys/netpfil/pf/nat64.sh | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh
index 0ae2c0399daf..9e91e95570c1 100644
--- a/tests/sys/netpfil/pf/nat64.sh
+++ b/tests/sys/netpfil/pf/nat64.sh
@@ -52,6 +52,7 @@ nat64_setup()
 
 	jexec rtr pfctl -e
 	pft_set_rules rtr \
+	    "set reassemble yes" \
 	    "set state-policy if-bound" \
 	    "pass in on ${epair}b inet6 from any to 64:ff9b::/96 af-to inet from (${epair_link}a)"
 }
@@ -82,6 +83,33 @@ icmp_echo_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "fragmentation" "cleanup"
+fragmentation_head()
+{
+	atf_set descr 'Test fragmented packets'
+	atf_set require.user root
+}
+
+fragmentation_body()
+{
+	nat64_setup
+
+	atf_check -s exit:0 -o ignore \
+	    ping6 -c 1 -s 1280 64:ff9b::192.0.2.2
+
+	atf_check -s exit:0 \
+	    -o match:'3 packets transmitted, 3 packets received, 0.0% packet loss' \
+	    ping6 -c 3 -s 2000 64:ff9b::192.0.2.2
+	atf_check -s exit:0 \
+	    -o match:'3 packets transmitted, 3 packets received, 0.0% packet loss' \
+	    ping6 -c 3 -s 10000 -b 20000 64:ff9b::192.0.2.2
+}
+
+fragmentation_cleanup()
+{
+	pft_cleanup
+}
+
 atf_test_case "tcp" "cleanup"
 tcp_head()
 {
@@ -178,6 +206,7 @@ sctp_cleanup()
 atf_init_test_cases()
 {
 	atf_add_test_case "icmp_echo"
+	atf_add_test_case "fragmentation"
 	atf_add_test_case "tcp"
 	atf_add_test_case "udp"
 	atf_add_test_case "sctp"