icmp6.sh (b9f0dbc3d006e0b904ee4275d54459f4edd65bb8) icmp6.sh (34063cb714602972b6d985ad747fc8f66a8daae1)
1#
2# SPDX-License-Identifier: BSD-2-Clause
3#
4# Copyright (c) 2024 Rubicon Communications, LLC (Netgate)
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 69 unchanged lines hidden (view full) ---

78 jexec alcatraz pfctl -sr -vv
79}
80
81zero_id_cleanup()
82{
83 pft_cleanup
84}
85
1#
2# SPDX-License-Identifier: BSD-2-Clause
3#
4# Copyright (c) 2024 Rubicon Communications, LLC (Netgate)
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 69 unchanged lines hidden (view full) ---

78 jexec alcatraz pfctl -sr -vv
79}
80
81zero_id_cleanup()
82{
83 pft_cleanup
84}
85
86atf_test_case "ttl_exceeded" "cleanup"
87ttl_exceeded_head()
88{
89 atf_set descr 'Test that we correctly translate TTL exceeded back'
90 atf_set require.user root
91}
92
93ttl_exceeded_body()
94{
95 pft_init
96
97 epair_srv=$(vnet_mkepair)
98 epair_int=$(vnet_mkepair)
99 epair_cl=$(vnet_mkepair)
100
101 vnet_mkjail srv ${epair_srv}a
102 jexec srv ifconfig ${epair_srv}a inet6 2001:db8:1::1/64 no_dad up
103 jexec srv route add -6 default 2001:db8:1::2
104
105 vnet_mkjail int ${epair_srv}b ${epair_int}a
106 jexec int sysctl net.inet6.ip6.forwarding=1
107 jexec int ifconfig ${epair_srv}b inet6 2001:db8:1::2/64 no_dad up
108 jexec int ifconfig ${epair_int}a inet6 2001:db8:2::2/64 no_dad up
109
110 vnet_mkjail nat ${epair_int}b ${epair_cl}b
111 jexec nat ifconfig ${epair_int}b inet6 2001:db8:2::1 no_dad up
112 jexec nat ifconfig ${epair_cl}b inet6 2001:db8:3::2/64 no_dad up
113 jexec nat sysctl net.inet6.ip6.forwarding=1
114 jexec nat route add -6 default 2001:db8:2::2
115
116 vnet_mkjail cl ${epair_cl}a
117 jexec cl ifconfig ${epair_cl}a inet6 2001:db8:3::1/64 no_dad up
118 jexec cl route add -6 default 2001:db8:3::2
119
120 jexec nat pfctl -e
121 pft_set_rules nat \
122 "nat on ${epair_int}b from 2001:db8:3::/64 -> (${epair_int}b:0)" \
123 "pass"
124
125 # Sanity checks
126 atf_check -s exit:0 -o ignore \
127 jexec cl ping -c 1 2001:db8:3::2
128 atf_check -s exit:0 -o ignore \
129 jexec cl ping -c 1 2001:db8:2::1
130 atf_check -s exit:0 -o ignore \
131 jexec cl ping -c 1 2001:db8:2::2
132 atf_check -s exit:0 -o ignore \
133 jexec cl ping -c 1 2001:db8:1::1
134
135 echo "UDP"
136 atf_check -s exit:0 -e ignore -o match:".*2001:db8:2::2.*" \
137 jexec cl traceroute6 2001:db8:1::1
138 jexec nat pfctl -Fs
139
140 echo "ICMP"
141 atf_check -s exit:0 -e ignore -o match:".*2001:db8:2::2.*" \
142 jexec cl traceroute6 -I 2001:db8:1::1
143}
144
145ttl_exceeded_cleanup()
146{
147 pft_cleanup
148}
149
86atf_init_test_cases()
87{
88 atf_add_test_case "zero_id"
150atf_init_test_cases()
151{
152 atf_add_test_case "zero_id"
153 atf_add_test_case "ttl_exceeded"
89}
154}