aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2024-11-07 08:48:37 +0000
committerKristof Provost <kp@FreeBSD.org>2024-12-17 10:07:14 +0000
commita43589dcbf8b973f46d251e5841b122f0a3c6244 (patch)
tree32dc7f931eeaea29027d5a5f50bd163cb8d25449
parent7e309356b009e9b7136614150aaa3790334146ba (diff)
pf tests: add an SCTP test case for nat64
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D47794
-rw-r--r--tests/sys/netpfil/pf/nat64.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh
index 1f87e7a1853b..3e04dc6e7bc0 100644
--- a/tests/sys/netpfil/pf/nat64.sh
+++ b/tests/sys/netpfil/pf/nat64.sh
@@ -141,9 +141,43 @@ udp_cleanup()
pft_cleanup
}
+atf_test_case "sctp" "cleanup"
+sctp_head()
+{
+ atf_set descr 'SCTP NAT64 test'
+ atf_set require.user root
+}
+
+sctp_body()
+{
+ nat64_setup
+ if ! kldstat -q -m sctp; then
+ atf_skip "This test requires SCTP"
+ fi
+
+ echo "foo" | jexec dst nc --sctp -N -l 1234 &
+
+ # Sanity check & delay for nc startup
+ atf_check -s exit:0 -o ignore \
+ ping6 -c 1 64:ff9b::192.0.2.2
+
+ rcv=$(echo bar | nc --sctp -w 3 -6 64:ff9b::c000:202 1234)
+ if [ "${rcv}" != "foo" ];
+ then
+ echo "rcv=${rcv}"
+ atf_fail "Failed to connect to SCTP server"
+ fi
+}
+
+sctp_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "icmp_echo"
atf_add_test_case "tcp"
atf_add_test_case "udp"
+ atf_add_test_case "sctp"
}