aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2024-12-02 17:01:42 +0000
committerKristof Provost <kp@FreeBSD.org>2024-12-17 10:07:17 +0000
commit27fca15016a90f0d044176ba5f8f5b0fa91469ba (patch)
treee2c8428f748b08d8c6d4b422b521c51c0ac2b2d5
parent1df79d81343dc7683a234708e1852a8e368dbed2 (diff)
pf tests: validate ToS translation with nat64
Sponsored by: Rubicon Communications, LLC ("Netgate")
-rw-r--r--tests/sys/netpfil/pf/nat64.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh
index 9e91e95570c1..c1202dfee2e8 100644
--- a/tests/sys/netpfil/pf/nat64.sh
+++ b/tests/sys/netpfil/pf/nat64.sh
@@ -203,6 +203,38 @@ sctp_cleanup()
pft_cleanup
}
+atf_test_case "tos" "cleanup"
+tos_head()
+{
+ atf_set descr 'ToS translation test'
+ atf_set require.user root
+}
+
+tos_body()
+{
+ nat64_setup
+
+ # Ensure we can distinguish ToS on the destination
+ jexec dst pfctl -e
+ pft_set_rules dst \
+ "pass" \
+ "block in inet tos 8"
+
+ atf_check -s exit:0 -o ignore \
+ ping6 -c 1 -z 4 64:ff9b::192.0.2.2
+ atf_check -s exit:2 -o ignore \
+ ping6 -c 1 -z 8 64:ff9b::192.0.2.2
+ atf_check -s exit:0 -o ignore \
+ ping6 -c 1 -z 16 64:ff9b::192.0.2.2
+
+ jexec dst pfctl -sr -vv
+}
+
+tos_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "icmp_echo"
@@ -210,4 +242,5 @@ atf_init_test_cases()
atf_add_test_case "tcp"
atf_add_test_case "udp"
atf_add_test_case "sctp"
+ atf_add_test_case "tos"
}