git: 7e309356b009 - main - pf tests: add a UDP test case for nat64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 Dec 2024 10:07:53 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=7e309356b009e9b7136614150aaa3790334146ba
commit 7e309356b009e9b7136614150aaa3790334146ba
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-10-30 13:19:49 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-12-17 10:07:14 +0000
pf tests: add a UDP test case for nat64
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D47793
---
tests/sys/netpfil/pf/nat64.sh | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh
index 4c365be0d309..1f87e7a1853b 100644
--- a/tests/sys/netpfil/pf/nat64.sh
+++ b/tests/sys/netpfil/pf/nat64.sh
@@ -111,8 +111,39 @@ tcp_cleanup()
pft_cleanup
}
+atf_test_case "udp" "cleanup"
+udp_head()
+{
+ atf_set descr 'UDP NAT64 test'
+ atf_set require.user root
+}
+
+udp_body()
+{
+ nat64_setup
+
+ echo "foo" | jexec dst nc -u -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 -w 3 -6 -u 64:ff9b::c000:202 1234)
+ if [ "${rcv}" != "foo" ];
+ then
+ echo "rcv=${rcv}"
+ atf_fail "Failed to connect to UDP server"
+ fi
+}
+
+udp_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "icmp_echo"
atf_add_test_case "tcp"
+ atf_add_test_case "udp"
}