| @@ -1,881 +1,881 @@ | | | @@ -1,881 +1,881 @@ |
1 | # $NetBSD: t_vlan.sh,v 1.16 2019/11/11 02:40:48 yamaguchi Exp $ | | 1 | # $NetBSD: t_vlan.sh,v 1.17 2020/03/08 09:05:33 nisimura Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2016 Internet Initiative Japan Inc. | | 3 | # Copyright (c) 2016 Internet Initiative Japan Inc. |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # | | 14 | # |
15 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 15 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
16 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 16 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
17 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 17 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
19 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 19 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 | # POSSIBILITY OF SUCH DAMAGE. | | 25 | # POSSIBILITY OF SUCH DAMAGE. |
26 | # | | 26 | # |
27 | | | 27 | |
28 | BUS=bus | | 28 | BUS=bus |
29 | SOCK_LOCAL=unix://commsock1 | | 29 | SOCK_LOCAL=unix://commsock1 |
30 | SOCK_REMOTE=unix://commsock2 | | 30 | SOCK_REMOTE=unix://commsock2 |
31 | IP_LOCAL0=10.0.0.1 | | 31 | IP_LOCAL0=10.0.0.1 |
32 | IP_LOCAL1=10.0.1.1 | | 32 | IP_LOCAL1=10.0.1.1 |
33 | IP_REMOTE0=10.0.0.2 | | 33 | IP_REMOTE0=10.0.0.2 |
34 | IP_REMOTE1=10.0.1.2 | | 34 | IP_REMOTE1=10.0.1.2 |
35 | IP_MCADDR0=224.0.0.10 | | 35 | IP_MCADDR0=224.0.0.10 |
36 | IP6_LOCAL0=fc00::1 | | 36 | IP6_LOCAL0=fc00::1 |
37 | IP6_LOCAL1=fc00:1::1 | | 37 | IP6_LOCAL1=fc00:1::1 |
38 | IP6_REMOTE0=fc00::2 | | 38 | IP6_REMOTE0=fc00::2 |
39 | IP6_REMOTE1=fc00:1::2 | | 39 | IP6_REMOTE1=fc00:1::2 |
40 | IP6_MCADDR0=ff11::10 | | 40 | IP6_MCADDR0=ff11::10 |
41 | ETH_IP_MCADDR0=01:00:5e:00:00:0a | | 41 | ETH_IP_MCADDR0=01:00:5e:00:00:0a |
42 | ETH_IP6_MCADDR0=33:33:00:00:00:10 | | 42 | ETH_IP6_MCADDR0=33:33:00:00:00:10 |
43 | | | 43 | |
44 | DEBUG=${DEBUG:-false} | | 44 | DEBUG=${DEBUG:-false} |
45 | | | 45 | |
46 | vlan_create_destroy_body_common() | | 46 | vlan_create_destroy_body_common() |
47 | { | | 47 | { |
48 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 48 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
49 | | | 49 | |
50 | export RUMP_SERVER=${SOCK_LOCAL} | | 50 | export RUMP_SERVER=${SOCK_LOCAL} |
51 | | | 51 | |
52 | $atf_ifconfig vlan0 create | | 52 | $atf_ifconfig vlan0 create |
53 | $atf_ifconfig vlan0 destroy | | 53 | $atf_ifconfig vlan0 destroy |
54 | | | 54 | |
55 | $atf_ifconfig vlan0 create | | 55 | $atf_ifconfig vlan0 create |
56 | $atf_ifconfig vlan0 up | | 56 | $atf_ifconfig vlan0 up |
57 | $atf_ifconfig vlan0 down | | 57 | $atf_ifconfig vlan0 down |
58 | $atf_ifconfig vlan0 destroy | | 58 | $atf_ifconfig vlan0 destroy |
59 | | | 59 | |
60 | $atf_ifconfig shmif0 create | | 60 | $atf_ifconfig shmif0 create |
61 | $atf_ifconfig vlan0 create | | 61 | $atf_ifconfig vlan0 create |
62 | $atf_ifconfig vlan0 vlan 1 vlanif shmif0 | | 62 | $atf_ifconfig vlan0 vlan 1 vlanif shmif0 |
63 | $atf_ifconfig vlan0 up | | 63 | $atf_ifconfig vlan0 up |
64 | $atf_ifconfig vlan0 destroy | | 64 | $atf_ifconfig vlan0 destroy |
65 | | | 65 | |
66 | # more than one vlan interface with a same parent interface | | 66 | # more than one vlan interface with a same parent interface |
67 | $atf_ifconfig shmif1 create | | 67 | $atf_ifconfig shmif1 create |
68 | $atf_ifconfig vlan0 create | | 68 | $atf_ifconfig vlan0 create |
69 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 69 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
70 | $atf_ifconfig vlan1 create | | 70 | $atf_ifconfig vlan1 create |
71 | $atf_ifconfig vlan1 vlan 11 vlanif shmif0 | | 71 | $atf_ifconfig vlan1 vlan 11 vlanif shmif0 |
72 | | | 72 | |
73 | # more than one interface with another parent interface | | 73 | # more than one interface with another parent interface |
74 | $atf_ifconfig vlan2 create | | 74 | $atf_ifconfig vlan2 create |
75 | $atf_ifconfig vlan2 vlan 12 vlanif shmif1 | | 75 | $atf_ifconfig vlan2 vlan 12 vlanif shmif1 |
76 | $atf_ifconfig vlan3 create | | 76 | $atf_ifconfig vlan3 create |
77 | $atf_ifconfig vlan3 vlan 13 vlanif shmif1 | | 77 | $atf_ifconfig vlan3 vlan 13 vlanif shmif1 |
78 | $atf_ifconfig shmif0 destroy | | 78 | $atf_ifconfig shmif0 destroy |
79 | atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan0 | | 79 | atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan0 |
80 | atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan1 | | 80 | atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan1 |
81 | atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan2 | | 81 | atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan2 |
82 | atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan3 | | 82 | atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan3 |
83 | $atf_ifconfig vlan0 destroy | | 83 | $atf_ifconfig vlan0 destroy |
84 | $atf_ifconfig vlan1 destroy | | 84 | $atf_ifconfig vlan1 destroy |
85 | $atf_ifconfig vlan2 destroy | | 85 | $atf_ifconfig vlan2 destroy |
86 | $atf_ifconfig vlan3 destroy | | 86 | $atf_ifconfig vlan3 destroy |
87 | | | 87 | |
88 | } | | 88 | } |
89 | | | 89 | |
90 | atf_test_case vlan_create_destroy cleanup | | 90 | atf_test_case vlan_create_destroy cleanup |
91 | vlan_create_destroy_head() | | 91 | vlan_create_destroy_head() |
92 | { | | 92 | { |
93 | | | 93 | |
94 | atf_set "descr" "tests of creation and deletion of vlan interface" | | 94 | atf_set "descr" "tests of creation and deletion of vlan interface" |
95 | atf_set "require.progs" "rump_server" | | 95 | atf_set "require.progs" "rump_server" |
96 | } | | 96 | } |
97 | | | 97 | |
98 | vlan_create_destroy_body() | | 98 | vlan_create_destroy_body() |
99 | { | | 99 | { |
100 | rump_server_start $SOCK_LOCAL vlan | | 100 | rump_server_start $SOCK_LOCAL vlan |
101 | | | 101 | |
102 | vlan_create_destroy_body_common | | 102 | vlan_create_destroy_body_common |
103 | } | | 103 | } |
104 | | | 104 | |
105 | | | 105 | |
106 | vlan_create_destroy_cleanup() | | 106 | vlan_create_destroy_cleanup() |
107 | { | | 107 | { |
108 | | | 108 | |
109 | $DEBUG && dump | | 109 | $DEBUG && dump |
110 | cleanup | | 110 | cleanup |
111 | } | | 111 | } |
112 | | | 112 | |
113 | atf_test_case vlan_create_destroy6 cleanup | | 113 | atf_test_case vlan_create_destroy6 cleanup |
114 | vlan_create_destroy6_head() | | 114 | vlan_create_destroy6_head() |
115 | { | | 115 | { |
116 | | | 116 | |
117 | atf_set "descr" "tests of creation and deletion of vlan interface with IPv6" | | 117 | atf_set "descr" "tests of creation and deletion of vlan interface with IPv6" |
118 | atf_set "require.progs" "rump_server" | | 118 | atf_set "require.progs" "rump_server" |
119 | } | | 119 | } |
120 | | | 120 | |
121 | vlan_create_destroy6_body() | | 121 | vlan_create_destroy6_body() |
122 | { | | 122 | { |
123 | | | 123 | |
124 | rump_server_start $SOCK_LOCAL vlan netinet6 | | 124 | rump_server_start $SOCK_LOCAL vlan netinet6 |
125 | | | 125 | |
126 | vlan_create_destroy_body_common | | 126 | vlan_create_destroy_body_common |
127 | } | | 127 | } |
128 | | | 128 | |
129 | vlan_create_destroy6_cleanup() | | 129 | vlan_create_destroy6_cleanup() |
130 | { | | 130 | { |
131 | | | 131 | |
132 | $DEBUG && dump | | 132 | $DEBUG && dump |
133 | cleanup | | 133 | cleanup |
134 | } | | 134 | } |
135 | | | 135 | |
136 | vlan_basic_body_common() | | 136 | vlan_basic_body_common() |
137 | { | | 137 | { |
138 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 138 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
139 | local outfile=./out | | 139 | local outfile=./out |
140 | local af=inet | | 140 | local af=inet |
141 | local prefix=24 | | 141 | local prefix=24 |
142 | local local0=$IP_LOCAL0 | | 142 | local local0=$IP_LOCAL0 |
143 | local remote0=$IP_REMOTE0 | | 143 | local remote0=$IP_REMOTE0 |
144 | local ping_cmd="rump.ping -n -w 1 -c 1" | | 144 | local ping_cmd="rump.ping -n -w 1 -c 1" |
145 | | | 145 | |
146 | if [ x"$1" = x"inet6" ]; then | | 146 | if [ x"$1" = x"inet6" ]; then |
147 | af="inet6" | | 147 | af="inet6" |
148 | prefix=64 | | 148 | prefix=64 |
149 | local0=$IP6_LOCAL0 | | 149 | local0=$IP6_LOCAL0 |
150 | remote0=$IP6_REMOTE0 | | 150 | remote0=$IP6_REMOTE0 |
151 | ping_cmd="rump.ping6 -n -c 1" | | 151 | ping_cmd="rump.ping6 -n -c 1" |
152 | fi | | 152 | fi |
153 | | | 153 | |
154 | rump_server_add_iface $SOCK_LOCAL shmif0 $BUS | | 154 | rump_server_add_iface $SOCK_LOCAL shmif0 $BUS |
155 | rump_server_add_iface $SOCK_REMOTE shmif0 $BUS | | 155 | rump_server_add_iface $SOCK_REMOTE shmif0 $BUS |
156 | | | 156 | |
157 | export RUMP_SERVER=$SOCK_LOCAL | | 157 | export RUMP_SERVER=$SOCK_LOCAL |
158 | $atf_ifconfig shmif0 up | | 158 | $atf_ifconfig shmif0 up |
159 | export RUMP_SERVER=$SOCK_REMOTE | | 159 | export RUMP_SERVER=$SOCK_REMOTE |
160 | $atf_ifconfig shmif0 up | | 160 | $atf_ifconfig shmif0 up |
161 | | | 161 | |
162 | export RUMP_SERVER=$SOCK_LOCAL | | 162 | export RUMP_SERVER=$SOCK_LOCAL |
163 | $atf_ifconfig vlan0 create | | 163 | $atf_ifconfig vlan0 create |
164 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 164 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
165 | $atf_ifconfig vlan0 $af $local0/$prefix | | 165 | $atf_ifconfig vlan0 $af $local0/$prefix |
166 | $atf_ifconfig vlan0 up | | 166 | $atf_ifconfig vlan0 up |
167 | $atf_ifconfig -w 10 | | 167 | $atf_ifconfig -w 10 |
168 | | | 168 | |
169 | export RUMP_SERVER=$SOCK_REMOTE | | 169 | export RUMP_SERVER=$SOCK_REMOTE |
170 | $atf_ifconfig vlan0 create | | 170 | $atf_ifconfig vlan0 create |
171 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 171 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
172 | $atf_ifconfig vlan0 $af $remote0/$prefix | | 172 | $atf_ifconfig vlan0 $af $remote0/$prefix |
173 | $atf_ifconfig vlan0 up | | 173 | $atf_ifconfig vlan0 up |
174 | $atf_ifconfig -w 10 | | 174 | $atf_ifconfig -w 10 |
175 | | | 175 | |
176 | extract_new_packets $BUS > $outfile | | 176 | extract_new_packets $BUS > $outfile |
177 | | | 177 | |
178 | export RUMP_SERVER=$SOCK_LOCAL | | 178 | export RUMP_SERVER=$SOCK_LOCAL |
179 | atf_check -s exit:0 -o ignore $ping_cmd $remote0 | | 179 | atf_check -s exit:0 -o ignore $ping_cmd $remote0 |
180 | | | 180 | |
181 | extract_new_packets $BUS > $outfile | | 181 | extract_new_packets $BUS > $outfile |
182 | atf_check -s exit:0 -o match:'vlan 10' cat $outfile | | 182 | atf_check -s exit:0 -o match:'vlan 10' cat $outfile |
183 | | | 183 | |
184 | $atf_ifconfig vlan0 -vlanif | | 184 | $atf_ifconfig vlan0 -vlanif |
185 | $atf_ifconfig vlan0 vlan 20 vlanif shmif0 | | 185 | $atf_ifconfig vlan0 vlan 20 vlanif shmif0 |
186 | $atf_ifconfig vlan0 $af $local0/$prefix | | 186 | $atf_ifconfig vlan0 $af $local0/$prefix |
187 | $atf_ifconfig vlan0 up | | 187 | $atf_ifconfig vlan0 up |
188 | $atf_ifconfig -w 10 | | 188 | $atf_ifconfig -w 10 |
189 | | | 189 | |
190 | extract_new_packets $BUS > $outfile | | 190 | extract_new_packets $BUS > $outfile |
191 | atf_check -s not-exit:0 -o ignore $ping_cmd $remote0 | | 191 | atf_check -s not-exit:0 -o ignore $ping_cmd $remote0 |
192 | | | 192 | |
193 | extract_new_packets $BUS > $outfile | | 193 | extract_new_packets $BUS > $outfile |
194 | atf_check -s exit:0 -o match:'vlan 20' cat $outfile | | 194 | atf_check -s exit:0 -o match:'vlan 20' cat $outfile |
195 | | | 195 | |
196 | export RUMP_SERVER=$SOCK_LOCAL | | 196 | export RUMP_SERVER=$SOCK_LOCAL |
197 | $atf_ifconfig vlan0 -vlanif | | 197 | $atf_ifconfig vlan0 -vlanif |
198 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 198 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
199 | $atf_ifconfig vlan0 $af $local0/$prefix | | 199 | $atf_ifconfig vlan0 $af $local0/$prefix |
200 | $atf_ifconfig vlan0 up | | 200 | $atf_ifconfig vlan0 up |
201 | $atf_ifconfig -w 10 | | 201 | $atf_ifconfig -w 10 |
202 | | | 202 | |
203 | atf_check -s exit:0 -o ignore rump.ifconfig -z vlan0 | | 203 | atf_check -s exit:0 -o ignore rump.ifconfig -z vlan0 |
204 | atf_check -s exit:0 -o ignore $ping_cmd $remote0 | | 204 | atf_check -s exit:0 -o ignore $ping_cmd $remote0 |
205 | rump.ifconfig -v vlan0 > $outfile | | 205 | rump.ifconfig -v vlan0 > $outfile |
206 | | | 206 | |
207 | atf_check -s exit:0 -o not-match:' 0 packets' cat $outfile | | 207 | atf_check -s exit:0 -o not-match:' 0 packets' cat $outfile |
208 | atf_check -s exit:0 -o not-match:' 0 bytes' cat $outfile | | 208 | atf_check -s exit:0 -o not-match:' 0 bytes' cat $outfile |
209 | } | | 209 | } |
210 | | | 210 | |
211 | atf_test_case vlan_basic cleanup | | 211 | atf_test_case vlan_basic cleanup |
212 | vlan_basic_head() | | 212 | vlan_basic_head() |
213 | { | | 213 | { |
214 | | | 214 | |
215 | atf_set "descr" "tests of communications over vlan interfaces" | | 215 | atf_set "descr" "tests of communications over vlan interfaces" |
216 | atf_set "require.progs" "rump_server" | | 216 | atf_set "require.progs" "rump_server" |
217 | } | | 217 | } |
218 | | | 218 | |
219 | vlan_basic_body() | | 219 | vlan_basic_body() |
220 | { | | 220 | { |
221 | rump_server_start $SOCK_LOCAL vlan | | 221 | rump_server_start $SOCK_LOCAL vlan |
222 | rump_server_start $SOCK_REMOTE vlan | | 222 | rump_server_start $SOCK_REMOTE vlan |
223 | | | 223 | |
224 | vlan_basic_body_common inet | | 224 | vlan_basic_body_common inet |
225 | | | 225 | |
226 | } | | 226 | } |
227 | | | 227 | |
228 | vlan_basic_cleanup() | | 228 | vlan_basic_cleanup() |
229 | { | | 229 | { |
230 | | | 230 | |
231 | $DEBUG && dump | | 231 | $DEBUG && dump |
232 | cleanup | | 232 | cleanup |
233 | } | | 233 | } |
234 | | | 234 | |
235 | atf_test_case vlan_basic6 cleanup | | 235 | atf_test_case vlan_basic6 cleanup |
236 | vlan_basic6_head() | | 236 | vlan_basic6_head() |
237 | { | | 237 | { |
238 | | | 238 | |
239 | atf_set "descr" "tests of communications over vlan interfaces using IPv6" | | 239 | atf_set "descr" "tests of communications over vlan interfaces using IPv6" |
240 | atf_set "require.progs" "rump_server" | | 240 | atf_set "require.progs" "rump_server" |
241 | } | | 241 | } |
242 | | | 242 | |
243 | vlan_basic6_body() | | 243 | vlan_basic6_body() |
244 | { | | 244 | { |
245 | rump_server_start $SOCK_LOCAL vlan netinet6 | | 245 | rump_server_start $SOCK_LOCAL vlan netinet6 |
246 | rump_server_start $SOCK_REMOTE vlan netinet6 | | 246 | rump_server_start $SOCK_REMOTE vlan netinet6 |
247 | | | 247 | |
248 | vlan_basic_body_common inet6 | | 248 | vlan_basic_body_common inet6 |
249 | } | | 249 | } |
250 | | | 250 | |
251 | vlan_basic6_cleanup() | | 251 | vlan_basic6_cleanup() |
252 | { | | 252 | { |
253 | | | 253 | |
254 | $DEBUG && dump | | 254 | $DEBUG && dump |
255 | cleanup | | 255 | cleanup |
256 | } | | 256 | } |
257 | | | 257 | |
258 | vlan_auto_follow_mtu_body_common() | | 258 | vlan_auto_follow_mtu_body_common() |
259 | { | | 259 | { |
260 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 260 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
261 | local outfile=./out | | 261 | local outfile=./out |
262 | local af=inet | | 262 | local af=inet |
263 | local prefix=24 | | 263 | local prefix=24 |
264 | local local0=$IP_LOCAL0 | | 264 | local local0=$IP_LOCAL0 |
265 | local remote0=$IP_REMOTE0 | | 265 | local remote0=$IP_REMOTE0 |
266 | local ping_cmd="rump.ping -D -n -w 1 -c 1" | | 266 | local ping_cmd="rump.ping -D -n -w 1 -c 1" |
267 | local mtu=1500 | | 267 | local mtu=1500 |
268 | local vlan_mtu=`expr $mtu - 4` | | 268 | local vlan_mtu=`expr $mtu - 4` |
269 | # ipv4 header=20bytes, icmp header=8bytes | | 269 | # ipv4 header=20bytes, icmp header=8bytes |
270 | local padding=`expr $vlan_mtu - 20 - 8` | | 270 | local padding=`expr $vlan_mtu - 20 - 8` |
271 | local over_padding=`expr $vlan_mtu - 20 - 8 + 1` | | 271 | local over_padding=`expr $vlan_mtu - 20 - 8 + 1` |
272 | local nonfrag_msg="$local0 > $remote0: ICMP echo request" | | 272 | local nonfrag_msg="$local0 > $remote0: ICMP echo request" |
273 | # unused for ipv4 | | 273 | # unused for ipv4 |
274 | local frag_msg="" | | 274 | local frag_msg="" |
275 | | | 275 | |
276 | if [ x"$1" = x"inet6" ]; then | | 276 | if [ x"$1" = x"inet6" ]; then |
277 | af="inet6" | | 277 | af="inet6" |
278 | prefix=64 | | 278 | prefix=64 |
279 | local0=$IP6_LOCAL0 | | 279 | local0=$IP6_LOCAL0 |
280 | remote0=$IP6_REMOTE0 | | 280 | remote0=$IP6_REMOTE0 |
281 | # ipv6 header=40bytes, icmpv6 header=8bytes | | 281 | # ipv6 header=40bytes, icmpv6 header=8bytes |
282 | padding=`expr $vlan_mtu - 40 - 8` | | 282 | padding=`expr $vlan_mtu - 40 - 8` |
283 | over_padding=`expr $vlan_mtu - 40 - 8 + 1` | | 283 | over_padding=`expr $vlan_mtu - 40 - 8 + 1` |
284 | ping_cmd="rump.ping6 -mm -n -c 1 -i 1" | | 284 | ping_cmd="rump.ping6 -mm -n -c 1 -i 1" |
285 | nonfrag_msg="$local0 > $remote0: ICMP6, echo request" | | 285 | nonfrag_msg="$local0 > $remote0: ICMP6, echo request" |
286 | frag_msg="$local0 > $remote0: frag .* ICMP6, echo request" | | 286 | frag_msg="$local0 > $remote0: frag .* ICMP6, echo request" |
287 | fi | | 287 | fi |
288 | | | 288 | |
289 | rump_server_add_iface $SOCK_LOCAL shmif0 $BUS | | 289 | rump_server_add_iface $SOCK_LOCAL shmif0 $BUS |
290 | rump_server_add_iface $SOCK_REMOTE shmif0 $BUS | | 290 | rump_server_add_iface $SOCK_REMOTE shmif0 $BUS |
291 | | | 291 | |
292 | export RUMP_SERVER=$SOCK_LOCAL | | 292 | export RUMP_SERVER=$SOCK_LOCAL |
293 | $atf_ifconfig shmif0 up | | 293 | $atf_ifconfig shmif0 up |
294 | export RUMP_SERVER=$SOCK_REMOTE | | 294 | export RUMP_SERVER=$SOCK_REMOTE |
295 | $atf_ifconfig shmif0 up | | 295 | $atf_ifconfig shmif0 up |
296 | | | 296 | |
297 | export RUMP_SERVER=$SOCK_LOCAL | | 297 | export RUMP_SERVER=$SOCK_LOCAL |
298 | $atf_ifconfig vlan0 create | | 298 | $atf_ifconfig vlan0 create |
299 | | | 299 | |
300 | # since upper bound of shmif's mtu is 1500, | | 300 | # since upper bound of shmif's mtu is 1500, |
301 | # so we lower vlan's mtu instead of raising shmif's. | | 301 | # so we lower vlan's mtu instead of raising shmif's. |
302 | # to do this, we change the interface's parameter | | 302 | # to do this, we change the interface's parameter |
303 | # such as ND_IFINFO(ifp)->maxmtu that is changed by SIOCSIFMTU. | | 303 | # such as ND_IFINFO(ifp)->maxmtu that is changed by SIOCSIFMTU. |
304 | | | 304 | |
305 | # $atf_config shmif0 mtu 1600 | | 305 | # $atf_config shmif0 mtu 1600 |
306 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 306 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
307 | $atf_ifconfig vlan0 mtu 1400 | | 307 | $atf_ifconfig vlan0 mtu 1400 |
308 | $atf_ifconfig vlan0 -vlanif shmif0 | | 308 | $atf_ifconfig vlan0 -vlanif shmif0 |
309 | | | 309 | |
310 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 310 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
311 | $atf_ifconfig vlan0 $af $local0/$prefix | | 311 | $atf_ifconfig vlan0 $af $local0/$prefix |
312 | $atf_ifconfig vlan0 up | | 312 | $atf_ifconfig vlan0 up |
313 | $atf_ifconfig -w 10 | | 313 | $atf_ifconfig -w 10 |
314 | | | 314 | |
315 | export RUMP_SERVER=$SOCK_REMOTE | | 315 | export RUMP_SERVER=$SOCK_REMOTE |
316 | $atf_ifconfig vlan0 create | | 316 | $atf_ifconfig vlan0 create |
317 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 317 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
318 | $atf_ifconfig vlan0 $af $remote0/$prefix | | 318 | $atf_ifconfig vlan0 $af $remote0/$prefix |
319 | $atf_ifconfig vlan0 up | | 319 | $atf_ifconfig vlan0 up |
320 | $atf_ifconfig -w 10 | | 320 | $atf_ifconfig -w 10 |
321 | | | 321 | |
322 | extract_new_packets $BUS > $outfile | | 322 | extract_new_packets $BUS > $outfile |
323 | export RUMP_SERVER=$SOCK_LOCAL | | 323 | export RUMP_SERVER=$SOCK_LOCAL |
324 | | | 324 | |
325 | atf_check -s exit:0 -o ignore $ping_cmd -s $padding $remote0 | | 325 | atf_check -s exit:0 -o ignore $ping_cmd -s $padding $remote0 |
326 | extract_new_packets $BUS > $outfile | | 326 | extract_new_packets $BUS > $outfile |
327 | atf_check -s exit:0 -o match:"$nonfrag_msg" cat $outfile | | 327 | atf_check -s exit:0 -o match:"$nonfrag_msg" cat $outfile |
328 | | | 328 | |
329 | if [ x"$1" = x"inet6" ]; then | | 329 | if [ x"$1" = x"inet6" ]; then |
330 | atf_check -s exit:0 -o ignore $ping_cmd -s $over_padding $remote0 | | 330 | atf_check -s exit:0 -o ignore $ping_cmd -s $over_padding $remote0 |
331 | extract_new_packets $BUS > $outfile | | 331 | extract_new_packets $BUS > $outfile |
332 | atf_check -s exit:0 -o match:"$frag_msg" cat $outfile | | 332 | atf_check -s exit:0 -o match:"$frag_msg" cat $outfile |
333 | else | | 333 | else |
334 | atf_check -s not-exit:0 -o ignore -e match:"Message too long" \ | | 334 | atf_check -s not-exit:0 -o ignore -e match:"Message too long" \ |
335 | $ping_cmd -s $over_padding $remote0 | | 335 | $ping_cmd -s $over_padding $remote0 |
336 | fi | | 336 | fi |
337 | } | | 337 | } |
338 | | | 338 | |
339 | atf_test_case vlan_auto_follow_mtu cleanup | | 339 | atf_test_case vlan_auto_follow_mtu cleanup |
340 | vlan_auto_follow_mtu_head() | | 340 | vlan_auto_follow_mtu_head() |
341 | { | | 341 | { |
342 | | | 342 | |
343 | atf_set "descr" "tests of setting vlan mtu using IPv4" | | 343 | atf_set "descr" "tests of setting vlan mtu using IPv4" |
344 | atf_set "require.progs" "rump_server" | | 344 | atf_set "require.progs" "rump_server" |
345 | } | | 345 | } |
346 | | | 346 | |
347 | vlan_auto_follow_mtu_body() | | 347 | vlan_auto_follow_mtu_body() |
348 | { | | 348 | { |
349 | rump_server_start $SOCK_LOCAL vlan | | 349 | rump_server_start $SOCK_LOCAL vlan |
350 | rump_server_start $SOCK_REMOTE vlan | | 350 | rump_server_start $SOCK_REMOTE vlan |
351 | | | 351 | |
352 | vlan_auto_follow_mtu_body_common inet | | 352 | vlan_auto_follow_mtu_body_common inet |
353 | } | | 353 | } |
354 | | | 354 | |
355 | vlan_auto_follow_mtu_cleanup() | | 355 | vlan_auto_follow_mtu_cleanup() |
356 | { | | 356 | { |
357 | | | 357 | |
358 | $DEBUG && dump | | 358 | $DEBUG && dump |
359 | cleanup | | 359 | cleanup |
360 | } | | 360 | } |
361 | | | 361 | |
362 | atf_test_case vlan_auto_follow_mtu6 cleanup | | 362 | atf_test_case vlan_auto_follow_mtu6 cleanup |
363 | vlan_auto_follow_mtu6_head() | | 363 | vlan_auto_follow_mtu6_head() |
364 | { | | 364 | { |
365 | | | 365 | |
366 | atf_set "descr" "tests of setting vlan mtu using IPv6" | | 366 | atf_set "descr" "tests of setting vlan mtu using IPv6" |
367 | atf_set "require.progs" "rump_server" | | 367 | atf_set "require.progs" "rump_server" |
368 | } | | 368 | } |
369 | | | 369 | |
370 | vlan_auto_follow_mtu6_body() | | 370 | vlan_auto_follow_mtu6_body() |
371 | { | | 371 | { |
372 | rump_server_start $SOCK_LOCAL vlan netinet6 | | 372 | rump_server_start $SOCK_LOCAL vlan netinet6 |
373 | rump_server_start $SOCK_REMOTE vlan netinet6 | | 373 | rump_server_start $SOCK_REMOTE vlan netinet6 |
374 | | | 374 | |
375 | vlan_auto_follow_mtu_body_common inet6 | | 375 | vlan_auto_follow_mtu_body_common inet6 |
376 | } | | 376 | } |
377 | | | 377 | |
378 | vlan_auto_follow_mtu6_cleanup() | | 378 | vlan_auto_follow_mtu6_cleanup() |
379 | { | | 379 | { |
380 | | | 380 | |
381 | $DEBUG && dump | | 381 | $DEBUG && dump |
382 | cleanup | | 382 | cleanup |
383 | } | | 383 | } |
384 | | | 384 | |
385 | vlanid_config_and_ping() | | 385 | vlanid_config_and_ping() |
386 | { | | 386 | { |
387 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 387 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
388 | local vlanid=$1 | | 388 | local vlanid=$1 |
389 | shift | | 389 | shift |
390 | | | 390 | |
391 | export RUMP_SERVER=$SOCK_LOCAL | | 391 | export RUMP_SERVER=$SOCK_LOCAL |
392 | $atf_ifconfig vlan0 vlan $vlanid vlanif shmif0 | | 392 | $atf_ifconfig vlan0 vlan $vlanid vlanif shmif0 |
393 | $atf_ifconfig vlan0 $IP_LOCAL0/24 | | 393 | $atf_ifconfig vlan0 $IP_LOCAL0/24 |
394 | $atf_ifconfig vlan0 up | | 394 | $atf_ifconfig vlan0 up |
395 | | | 395 | |
396 | export RUMP_SERVER=$SOCK_REMOTE | | 396 | export RUMP_SERVER=$SOCK_REMOTE |
397 | $atf_ifconfig vlan0 vlan $vlanid vlanif shmif0 | | 397 | $atf_ifconfig vlan0 vlan $vlanid vlanif shmif0 |
398 | $atf_ifconfig vlan0 $IP_REMOTE0/24 | | 398 | $atf_ifconfig vlan0 $IP_REMOTE0/24 |
399 | $atf_ifconfig vlan0 up | | 399 | $atf_ifconfig vlan0 up |
400 | | | 400 | |
401 | export RUMP_SERVER=$SOCK_LOCAL | | 401 | export RUMP_SERVER=$SOCK_LOCAL |
402 | atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP_REMOTE0 | | 402 | atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP_REMOTE0 |
403 | $atf_ifconfig vlan0 -vlanif | | 403 | $atf_ifconfig vlan0 -vlanif |
404 | | | 404 | |
405 | export RUMP_SERVER=$SOCK_REMOTE | | 405 | export RUMP_SERVER=$SOCK_REMOTE |
406 | $atf_ifconfig vlan0 -vlanif | | 406 | $atf_ifconfig vlan0 -vlanif |
407 | } | | 407 | } |
408 | | | 408 | |
409 | vlanid_config_and_ping6() | | 409 | vlanid_config_and_ping6() |
410 | { | | 410 | { |
411 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 411 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
412 | local vlanid=$1 | | 412 | local vlanid=$1 |
413 | shift | | 413 | shift |
414 | | | 414 | |
415 | export RUMP_SERVER=$SOCK_LOCAL | | 415 | export RUMP_SERVER=$SOCK_LOCAL |
416 | $atf_ifconfig vlan0 vlan $vlanid vlanif shmif0 | | 416 | $atf_ifconfig vlan0 vlan $vlanid vlanif shmif0 |
417 | $atf_ifconfig vlan0 inet6 $IP6_LOCAL0/64 | | 417 | $atf_ifconfig vlan0 inet6 $IP6_LOCAL0/64 |
418 | $atf_ifconfig vlan0 up | | 418 | $atf_ifconfig vlan0 up |
419 | | | 419 | |
420 | export RUMP_SERVER=$SOCK_REMOTE | | 420 | export RUMP_SERVER=$SOCK_REMOTE |
421 | $atf_ifconfig vlan0 vlan $vlanid vlanif shmif0 | | 421 | $atf_ifconfig vlan0 vlan $vlanid vlanif shmif0 |
422 | $atf_ifconfig vlan0 inet6 $IP6_REMOTE0/64 | | 422 | $atf_ifconfig vlan0 inet6 $IP6_REMOTE0/64 |
423 | $atf_ifconfig vlan0 up | | 423 | $atf_ifconfig vlan0 up |
424 | | | 424 | |
425 | export RUMP_SERVER=$SOCK_LOCAL | | 425 | export RUMP_SERVER=$SOCK_LOCAL |
426 | atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 $IP6_REMOTE0 | | 426 | atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 $IP6_REMOTE0 |
427 | $atf_ifconfig vlan0 -vlanif | | 427 | $atf_ifconfig vlan0 -vlanif |
428 | | | 428 | |
429 | export RUMP_SERVER=$SOCK_REMOTE | | 429 | export RUMP_SERVER=$SOCK_REMOTE |
430 | $atf_ifconfig vlan0 -vlanif | | 430 | $atf_ifconfig vlan0 -vlanif |
431 | } | | 431 | } |
432 | | | 432 | |
433 | vlan_vlanid_body_common() | | 433 | vlan_vlanid_body_common() |
434 | { | | 434 | { |
435 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 435 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
436 | local af=inet | | 436 | local af=inet |
437 | local prefix=24 | | 437 | local prefix=24 |
438 | local sysctl_param="net.inet.ip.dad_count=0" | | 438 | local sysctl_param="net.inet.ip.dad_count=0" |
439 | local ping_cmd="rump.ping -n -w 1 -c 1" | | 439 | local ping_cmd="rump.ping -n -w 1 -c 1" |
440 | local config_and_ping=vlanid_config_and_ping | | 440 | local config_and_ping=vlanid_config_and_ping |
441 | local local0=$IP_LOCAL0 | | 441 | local local0=$IP_LOCAL0 |
442 | local local1=$IP_LOCAL1 | | 442 | local local1=$IP_LOCAL1 |
443 | local remote0=$IP_REMOTE0 | | 443 | local remote0=$IP_REMOTE0 |
444 | local remote1=$IP_REMOTE1 | | 444 | local remote1=$IP_REMOTE1 |
445 | | | 445 | |
446 | if [ x"$1" = x"inet6" ]; then | | 446 | if [ x"$1" = x"inet6" ]; then |
447 | af=inet6 | | 447 | af=inet6 |
448 | prefix=64 | | 448 | prefix=64 |
449 | sysctl_param="net.inet6.ip6.dad_count=0" | | 449 | sysctl_param="net.inet6.ip6.dad_count=0" |
450 | ping_cmd="rump.ping6 -n -c 1" | | 450 | ping_cmd="rump.ping6 -n -c 1" |
451 | config_and_ping=vlanid_config_and_ping6 | | 451 | config_and_ping=vlanid_config_and_ping6 |
452 | local0=$IP6_LOCAL0 | | 452 | local0=$IP6_LOCAL0 |
453 | local1=$IP6_LOCAL1 | | 453 | local1=$IP6_LOCAL1 |
454 | remote0=$IP6_REMOTE0 | | 454 | remote0=$IP6_REMOTE0 |
455 | remote1=$IP6_REMOTE1 | | 455 | remote1=$IP6_REMOTE1 |
456 | fi | | 456 | fi |
457 | | | 457 | |
458 | rump_server_add_iface $SOCK_LOCAL shmif0 $BUS | | 458 | rump_server_add_iface $SOCK_LOCAL shmif0 $BUS |
459 | rump_server_add_iface $SOCK_REMOTE shmif0 $BUS | | 459 | rump_server_add_iface $SOCK_REMOTE shmif0 $BUS |
460 | | | 460 | |
461 | export RUMP_SERVER=$SOCK_LOCAL | | 461 | export RUMP_SERVER=$SOCK_LOCAL |
462 | atf_check -s exit:0 -o ignore rump.sysctl -w $sysctl_param | | 462 | atf_check -s exit:0 -o ignore rump.sysctl -w $sysctl_param |
463 | $atf_ifconfig shmif0 up | | 463 | $atf_ifconfig shmif0 up |
464 | $atf_ifconfig vlan0 create | | 464 | $atf_ifconfig vlan0 create |
465 | | | 465 | |
466 | export RUMP_SERVER=$SOCK_REMOTE | | 466 | export RUMP_SERVER=$SOCK_REMOTE |
467 | atf_check -s exit:0 -o ignore rump.sysctl -w $sysctl_param | | 467 | atf_check -s exit:0 -o ignore rump.sysctl -w $sysctl_param |
468 | $atf_ifconfig shmif0 up | | 468 | $atf_ifconfig shmif0 up |
469 | $atf_ifconfig vlan0 create | | 469 | $atf_ifconfig vlan0 create |
470 | | | 470 | |
471 | export RUMP_SERVER=$SOCK_LOCAL | | 471 | export RUMP_SERVER=$SOCK_LOCAL |
472 | atf_check -s not-exit:0 -e match:"^usage: rump.ifconfig" \ | | 472 | atf_check -s not-exit:0 -e match:"^usage: rump.ifconfig" \ |
473 | rump.ifconfig vlan0 vlan -1 vlanif shmif0 | | 473 | rump.ifconfig vlan0 vlan -1 vlanif shmif0 |
474 | | | 474 | |
475 | # $config_and_ping 0 # reserved vlan id | | 475 | # $config_and_ping 0 # reserved vlan id |
476 | $config_and_ping 1 | | 476 | $config_and_ping 1 |
477 | $config_and_ping 4094 | | 477 | $config_and_ping 4094 |
478 | # $config_and_ping 4095 #reserved vlan id | | 478 | # $config_and_ping 4095 #reserved vlan id |
479 | | | 479 | |
480 | if [ "${RANDOM:-0}" != "${RANDOM:-0}" ] | | 480 | if [ "${RANDOM:-0}" != "${RANDOM:-0}" ] |
481 | then | | 481 | then |
482 | for TAG in $(( ${RANDOM:-0} % 4092 + 2 )) \ | | 482 | for TAG in $(( ${RANDOM:-0} % 4092 + 2 )) \ |
483 | $(( ${RANDOM:-0} % 4092 + 2 )) \ | | 483 | $(( ${RANDOM:-0} % 4092 + 2 )) \ |
484 | $(( ${RANDOM:-0} % 4092 + 2 )) | | 484 | $(( ${RANDOM:-0} % 4092 + 2 )) |
485 | do | | 485 | do |
486 | $config_and_ping "${TAG}" | | 486 | $config_and_ping "${TAG}" |
487 | done | | 487 | done |
488 | fi | | 488 | fi |
489 | | | 489 | |
490 | export RUMP_SERVER=$SOCK_LOCAL | | 490 | export RUMP_SERVER=$SOCK_LOCAL |
491 | for TAG in 0 4095 4096 $((4096*4 + 1)) 65536 65537 $((65536 + 4095)) | | 491 | for TAG in 0 4095 4096 $((4096*4 + 1)) 65536 65537 $((65536 + 4095)) |
492 | do | | 492 | do |
493 | atf_check -s not-exit:0 -e not-empty \ | | 493 | atf_check -s not-exit:0 -e not-empty \ |
494 | rump.ifconfig vlan0 vlan "${TAG}" vlanif shmif0 | | 494 | rump.ifconfig vlan0 vlan "${TAG}" vlanif shmif0 |
495 | done | | 495 | done |
496 | | | 496 | |
497 | $atf_ifconfig vlan0 vlan 1 vlanif shmif0 | | 497 | $atf_ifconfig vlan0 vlan 1 vlanif shmif0 |
498 | atf_check -s not-exit:0 -e match:"SIOCSETVLAN: Device busy" \ | | 498 | atf_check -s not-exit:0 -e match:"SIOCSETVLAN: Device busy" \ |
499 | rump.ifconfig vlan0 vlan 2 vlanif shmif0 | | 499 | rump.ifconfig vlan0 vlan 2 vlanif shmif0 |
500 | | | 500 | |
501 | atf_check -s not-exit:0 -e match:"SIOCSETVLAN: Device busy" \ | | 501 | atf_check -s not-exit:0 -e match:"SIOCSETVLAN: Device busy" \ |
502 | rump.ifconfig vlan0 vlan 1 vlanif shmif1 | | 502 | rump.ifconfig vlan0 vlan 1 vlanif shmif1 |
503 | | | 503 | |
504 | $atf_ifconfig vlan0 -vlanif | | 504 | $atf_ifconfig vlan0 -vlanif |
505 | atf_check -s not-exit:0 -e match:"Invalid argument" \ | | 505 | atf_check -s not-exit:0 -e match:"Invalid argument" \ |
506 | rump.ifconfig vlan0 $af $local0/$prefix | | 506 | rump.ifconfig vlan0 $af $local0/$prefix |
507 | | | 507 | |
508 | export RUMP_SERVER=$SOCK_LOCAL | | 508 | export RUMP_SERVER=$SOCK_LOCAL |
509 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 509 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
510 | $atf_ifconfig vlan0 $af $local0/$prefix | | 510 | $atf_ifconfig vlan0 $af $local0/$prefix |
511 | $atf_ifconfig vlan0 up | | 511 | $atf_ifconfig vlan0 up |
512 | $atf_ifconfig vlan1 create | | 512 | $atf_ifconfig vlan1 create |
513 | $atf_ifconfig vlan1 vlan 11 vlanif shmif0 | | 513 | $atf_ifconfig vlan1 vlan 11 vlanif shmif0 |
514 | $atf_ifconfig vlan1 $af $local1/$prefix | | 514 | $atf_ifconfig vlan1 $af $local1/$prefix |
515 | $atf_ifconfig vlan1 up | | 515 | $atf_ifconfig vlan1 up |
516 | | | 516 | |
517 | export RUMP_SERVER=$SOCK_REMOTE | | 517 | export RUMP_SERVER=$SOCK_REMOTE |
518 | $atf_ifconfig vlan0 -vlanif | | 518 | $atf_ifconfig vlan0 -vlanif |
519 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 519 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
520 | $atf_ifconfig vlan0 $af $remote0/$prefix | | 520 | $atf_ifconfig vlan0 $af $remote0/$prefix |
521 | $atf_ifconfig vlan0 up | | 521 | $atf_ifconfig vlan0 up |
522 | $atf_ifconfig vlan1 create | | 522 | $atf_ifconfig vlan1 create |
523 | $atf_ifconfig vlan1 vlan 11 vlanif shmif0 | | 523 | $atf_ifconfig vlan1 vlan 11 vlanif shmif0 |
524 | $atf_ifconfig vlan1 $af $remote1/$prefix | | 524 | $atf_ifconfig vlan1 $af $remote1/$prefix |
525 | $atf_ifconfig vlan1 up | | 525 | $atf_ifconfig vlan1 up |
526 | | | 526 | |
527 | export RUMP_SERVER=$SOCK_LOCAL | | 527 | export RUMP_SERVER=$SOCK_LOCAL |
528 | atf_check -s exit:0 -o ignore $ping_cmd $remote0 | | 528 | atf_check -s exit:0 -o ignore $ping_cmd $remote0 |
529 | atf_check -s exit:0 -o ignore $ping_cmd $remote1 | | 529 | atf_check -s exit:0 -o ignore $ping_cmd $remote1 |
530 | } | | 530 | } |
531 | | | 531 | |
532 | atf_test_case vlan_vlanid cleanup | | 532 | atf_test_case vlan_vlanid cleanup |
533 | vlan_vlanid_head() | | 533 | vlan_vlanid_head() |
534 | { | | 534 | { |
535 | | | 535 | |
536 | atf_set "descr" "tests of configuration for vlan id" | | 536 | atf_set "descr" "tests of configuration for vlan id" |
537 | atf_set "require.progs" "rump_server" | | 537 | atf_set "require.progs" "rump_server" |
538 | } | | 538 | } |
539 | | | 539 | |
540 | vlan_vlanid_body() | | 540 | vlan_vlanid_body() |
541 | { | | 541 | { |
542 | rump_server_start $SOCK_LOCAL vlan | | 542 | rump_server_start $SOCK_LOCAL vlan |
543 | rump_server_start $SOCK_REMOTE vlan | | 543 | rump_server_start $SOCK_REMOTE vlan |
544 | | | 544 | |
545 | vlan_vlanid_body_common inet | | 545 | vlan_vlanid_body_common inet |
546 | } | | 546 | } |
547 | | | 547 | |
548 | vlan_vlanid_cleanup() | | 548 | vlan_vlanid_cleanup() |
549 | { | | 549 | { |
550 | | | 550 | |
551 | $DEBUG && dump | | 551 | $DEBUG && dump |
552 | cleanup | | 552 | cleanup |
553 | } | | 553 | } |
554 | | | 554 | |
555 | atf_test_case vlan_vlanid6 cleanup | | 555 | atf_test_case vlan_vlanid6 cleanup |
556 | vlan_vlanid6_head() | | 556 | vlan_vlanid6_head() |
557 | { | | 557 | { |
558 | | | 558 | |
559 | atf_set "descr" "tests of configuration for vlan id using IPv6" | | 559 | atf_set "descr" "tests of configuration for vlan id using IPv6" |
560 | atf_set "require.progs" "rump_server" | | 560 | atf_set "require.progs" "rump_server" |
561 | } | | 561 | } |
562 | | | 562 | |
563 | | | 563 | |
564 | vlan_vlanid6_body() | | 564 | vlan_vlanid6_body() |
565 | { | | 565 | { |
566 | rump_server_start $SOCK_LOCAL vlan netinet6 | | 566 | rump_server_start $SOCK_LOCAL vlan netinet6 |
567 | rump_server_start $SOCK_REMOTE vlan netinet6 | | 567 | rump_server_start $SOCK_REMOTE vlan netinet6 |
568 | | | 568 | |
569 | vlan_vlanid_body_common inet6 | | 569 | vlan_vlanid_body_common inet6 |
570 | } | | 570 | } |
571 | | | 571 | |
572 | vlan_vlanid6_cleanup() | | 572 | vlan_vlanid6_cleanup() |
573 | { | | 573 | { |
574 | | | 574 | |
575 | $DEBUG && dump | | 575 | $DEBUG && dump |
576 | cleanup | | 576 | cleanup |
577 | } | | 577 | } |
578 | | | 578 | |
579 | vlan_configs_body_common() | | 579 | vlan_configs_body_common() |
580 | { | | 580 | { |
581 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 581 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
582 | | | 582 | |
583 | export RUMP_SERVER=${SOCK_LOCAL} | | 583 | export RUMP_SERVER=${SOCK_LOCAL} |
584 | | | 584 | |
585 | $atf_ifconfig shmif0 create | | 585 | $atf_ifconfig shmif0 create |
586 | $atf_ifconfig shmif1 create | | 586 | $atf_ifconfig shmif1 create |
587 | # unset U/L bit to detect a bug fixed by if_vlan.c:r1.132 | | 587 | # unset U/L bit to detect a bug fixed by if_vlan.c:r1.132 |
588 | $atf_ifconfig shmif0 link b0:a0:75:00:01:00 active | | 588 | $atf_ifconfig shmif0 link b0:a0:75:00:01:00 active |
589 | $atf_ifconfig shmif1 link b0:a0:75:00:01:01 active | | 589 | $atf_ifconfig shmif1 link b0:a0:75:00:01:01 active |
590 | $atf_ifconfig vlan0 create | | 590 | $atf_ifconfig vlan0 create |
591 | | | 591 | |
592 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 592 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
593 | $atf_ifconfig vlan0 -vlanif | | 593 | $atf_ifconfig vlan0 -vlanif |
594 | | | 594 | |
595 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 595 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
596 | $atf_ifconfig vlan0 -vlanif shmif0 | | 596 | $atf_ifconfig vlan0 -vlanif shmif0 |
597 | | | 597 | |
598 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 598 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
599 | atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif1 | | 599 | atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif1 |
600 | atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif2 | | 600 | atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif2 |
601 | | | 601 | |
602 | $atf_ifconfig vlan0 -vlanif | | 602 | $atf_ifconfig vlan0 -vlanif |
603 | | | 603 | |
604 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 604 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
605 | atf_check -s exit:0 -e match:'Invalid argument' \ | | 605 | atf_check -s exit:0 -e match:'Invalid argument' \ |
606 | rump.ifconfig vlan0 mtu 1497 | | 606 | rump.ifconfig vlan0 mtu 1497 |
607 | $atf_ifconfig vlan0 mtu 1496 | | 607 | $atf_ifconfig vlan0 mtu 1496 |
608 | $atf_ifconfig vlan0 mtu 42 | | 608 | $atf_ifconfig vlan0 mtu 42 |
609 | atf_check -s exit:0 -e match:'Invalid argument' \ | | 609 | atf_check -s exit:0 -e match:'Invalid argument' \ |
610 | rump.ifconfig vlan0 mtu 41 | | 610 | rump.ifconfig vlan0 mtu 41 |
611 | $atf_ifconfig vlan0 -vlanif | | 611 | $atf_ifconfig vlan0 -vlanif |
612 | | | 612 | |
613 | $atf_ifconfig vlan1 create | | 613 | $atf_ifconfig vlan1 create |
614 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 614 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
615 | atf_check -s not-exit:0 -e match:'File exists' \ | | 615 | atf_check -s not-exit:0 -e match:'File exists' \ |
616 | rump.ifconfig vlan1 vlan 10 vlanif shmif0 | | 616 | rump.ifconfig vlan1 vlan 10 vlanif shmif0 |
617 | $atf_ifconfig vlan1 vlan 10 vlanif shmif1 | | 617 | $atf_ifconfig vlan1 vlan 10 vlanif shmif1 |
618 | | | 618 | |
619 | $atf_ifconfig vlan1 -vlanif shmif1 | | 619 | $atf_ifconfig vlan1 -vlanif shmif1 |
620 | $atf_ifconfig vlan1 vlan 10 vlanif shmif1 | | 620 | $atf_ifconfig vlan1 vlan 10 vlanif shmif1 |
621 | | | 621 | |
622 | $atf_ifconfig vlan0 -vlanif shmif0 | | 622 | $atf_ifconfig vlan0 -vlanif shmif0 |
623 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 623 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
624 | } | | 624 | } |
625 | | | 625 | |
626 | atf_test_case vlan_configs cleanup | | 626 | atf_test_case vlan_configs cleanup |
627 | vlan_configs_head() | | 627 | vlan_configs_head() |
628 | { | | 628 | { |
629 | atf_set "descr" "tests of configuration except vlan id" | | 629 | atf_set "descr" "tests of configuration except vlan id" |
630 | atf_set "require.progs" "rump_server" | | 630 | atf_set "require.progs" "rump_server" |
631 | } | | 631 | } |
632 | | | 632 | |
633 | vlan_configs_body() | | 633 | vlan_configs_body() |
634 | { | | 634 | { |
635 | | | 635 | |
636 | rump_server_start $SOCK_LOCAL vlan | | 636 | rump_server_start $SOCK_LOCAL vlan |
637 | | | 637 | |
638 | vlan_configs_body_common | | 638 | vlan_configs_body_common |
639 | | | 639 | |
640 | } | | 640 | } |
641 | | | 641 | |
642 | vlan_configs_cleanup() | | 642 | vlan_configs_cleanup() |
643 | { | | 643 | { |
644 | | | 644 | |
645 | $DEBUG && dump | | 645 | $DEBUG && dump |
646 | cleanup | | 646 | cleanup |
647 | } | | 647 | } |
648 | | | 648 | |
649 | atf_test_case vlan_configs6 cleanup | | 649 | atf_test_case vlan_configs6 cleanup |
650 | vlan_configs6_head() | | 650 | vlan_configs6_head() |
651 | { | | 651 | { |
652 | atf_set "descr" "tests of configuration except vlan id using IPv6" | | 652 | atf_set "descr" "tests of configuration except vlan id using IPv6" |
653 | atf_set "require.progs" "rump_server" | | 653 | atf_set "require.progs" "rump_server" |
654 | } | | 654 | } |
655 | | | 655 | |
656 | vlan_configs6_body() | | 656 | vlan_configs6_body() |
657 | { | | 657 | { |
658 | rump_server_start $SOCK_LOCAL vlan netinet6 | | 658 | rump_server_start $SOCK_LOCAL vlan netinet6 |
659 | | | 659 | |
660 | vlan_configs_body_common | | 660 | vlan_configs_body_common |
661 | } | | 661 | } |
662 | | | 662 | |
663 | vlan_configs6_cleanup() | | 663 | vlan_configs6_cleanup() |
664 | { | | 664 | { |
665 | $DEBUG && dump | | 665 | $DEBUG && dump |
666 | cleanup | | 666 | cleanup |
667 | } | | 667 | } |
668 | | | 668 | |
669 | vlan_bridge_body_common() | | 669 | vlan_bridge_body_common() |
670 | { | | 670 | { |
671 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 671 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
672 | | | 672 | |
673 | rump_server_add_iface $SOCK_LOCAL shmif0 $BUS | | 673 | rump_server_add_iface $SOCK_LOCAL shmif0 $BUS |
674 | | | 674 | |
675 | export RUMP_SERVER=$SOCK_LOCAL | | 675 | export RUMP_SERVER=$SOCK_LOCAL |
676 | $atf_ifconfig shmif0 up | | 676 | $atf_ifconfig shmif0 up |
677 | | | 677 | |
678 | $atf_ifconfig vlan0 create | | 678 | $atf_ifconfig vlan0 create |
679 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 679 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
680 | $atf_ifconfig vlan0 up | | 680 | $atf_ifconfig vlan0 up |
681 | $DEBUG && rump.ifconfig vlan0 | | 681 | $DEBUG && rump.ifconfig vlan0 |
682 | | | 682 | |
683 | $atf_ifconfig bridge0 create | | 683 | $atf_ifconfig bridge0 create |
684 | # Adjust to the MTU of a vlan on a shmif | | 684 | # Adjust to the MTU of a vlan on a shmif |
685 | $atf_ifconfig bridge0 mtu 1496 | | 685 | $atf_ifconfig bridge0 mtu 1496 |
686 | $atf_ifconfig bridge0 up | | 686 | $atf_ifconfig bridge0 up |
687 | # Test brconfig add | | 687 | # Test brconfig add |
688 | atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 | | 688 | atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 |
689 | $DEBUG && brconfig bridge0 | | 689 | $DEBUG && brconfig bridge0 |
690 | # Test brconfig delete | | 690 | # Test brconfig delete |
691 | atf_check -s exit:0 $HIJACKING brconfig bridge0 delete vlan0 | | 691 | atf_check -s exit:0 $HIJACKING brconfig bridge0 delete vlan0 |
692 | | | 692 | |
693 | atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 | | 693 | atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 |
694 | # Test vlan destruction with bridge | | 694 | # Test vlan destruction with bridge |
695 | $atf_ifconfig vlan0 destroy | | 695 | $atf_ifconfig vlan0 destroy |
696 | | | 696 | |
697 | rump_server_destroy_ifaces | | 697 | rump_server_destroy_ifaces |
698 | } | | 698 | } |
699 | | | 699 | |
700 | atf_test_case vlan_bridge cleanup | | 700 | atf_test_case vlan_bridge cleanup |
701 | vlan_bridge_head() | | 701 | vlan_bridge_head() |
702 | { | | 702 | { |
703 | | | 703 | |
704 | atf_set "descr" "tests of vlan interfaces with bridges (IPv4)" | | 704 | atf_set "descr" "tests of vlan interfaces with bridges (IPv4)" |
705 | atf_set "require.progs" "rump_server" | | 705 | atf_set "require.progs" "rump_server" |
706 | } | | 706 | } |
707 | | | 707 | |
708 | vlan_bridge_body() | | 708 | vlan_bridge_body() |
709 | { | | 709 | { |
710 | | | 710 | |
711 | rump_server_start $SOCK_LOCAL vlan bridge | | 711 | rump_server_start $SOCK_LOCAL vlan bridge |
712 | vlan_bridge_body_common | | 712 | vlan_bridge_body_common |
713 | } | | 713 | } |
714 | | | 714 | |
715 | vlan_bridge_cleanup() | | 715 | vlan_bridge_cleanup() |
716 | { | | 716 | { |
717 | | | 717 | |
718 | $DEBUG && dump | | 718 | $DEBUG && dump |
719 | cleanup | | 719 | cleanup |
720 | } | | 720 | } |
721 | | | 721 | |
722 | atf_test_case vlan_bridge6 cleanup | | 722 | atf_test_case vlan_bridge6 cleanup |
723 | vlan_bridge6_head() | | 723 | vlan_bridge6_head() |
724 | { | | 724 | { |
725 | | | 725 | |
726 | atf_set "descr" "tests of vlan interfaces with bridges (IPv6)" | | 726 | atf_set "descr" "tests of vlan interfaces with bridges (IPv6)" |
727 | atf_set "require.progs" "rump_server" | | 727 | atf_set "require.progs" "rump_server" |
728 | } | | 728 | } |
729 | | | 729 | |
730 | vlan_bridge6_body() | | 730 | vlan_bridge6_body() |
731 | { | | 731 | { |
732 | | | 732 | |
733 | rump_server_start $SOCK_LOCAL vlan netinet6 bridge | | 733 | rump_server_start $SOCK_LOCAL vlan netinet6 bridge |
734 | vlan_bridge_body_common | | 734 | vlan_bridge_body_common |
735 | } | | 735 | } |
736 | | | 736 | |
737 | vlan_bridge6_cleanup() | | 737 | vlan_bridge6_cleanup() |
738 | { | | 738 | { |
739 | | | 739 | |
740 | $DEBUG && dump | | 740 | $DEBUG && dump |
741 | cleanup | | 741 | cleanup |
742 | } | | 742 | } |
743 | | | 743 | |
744 | vlan_multicast_body_common() | | 744 | vlan_multicast_body_common() |
745 | { | | 745 | { |
746 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 746 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
747 | local af="inet" | | 747 | local af="inet" |
748 | local local0=$IP_LOCAL0 | | 748 | local local0=$IP_LOCAL0 |
749 | local local1=$IP_LOCAL1 | | 749 | local local1=$IP_LOCAL1 |
750 | local mcaddr=$IP_MCADDR0 | | 750 | local mcaddr=$IP_MCADDR0 |
751 | local eth_mcaddr=$ETH_IP_MCADDR0 | | 751 | local eth_mcaddr=$ETH_IP_MCADDR0 |
752 | local prefix=24 | | 752 | local prefix=24 |
753 | local siocXmulti="$(atf_get_srcdir)/siocXmulti" | | 753 | local siocXmulti="$(atf_get_srcdir)/siocXmulti" |
754 | local atf_siocXmulti="atf_check -s exit:0 $HIJACKING $siocXmulti" | | 754 | local atf_siocXmulti="atf_check -s exit:0 $HIJACKING $siocXmulti" |
755 | | | 755 | |
756 | if [ x"$1" = x"inet6" ]; then | | 756 | if [ x"$1" = x"inet6" ]; then |
757 | af="inet6" | | 757 | af="inet6" |
758 | prefix=64 | | 758 | prefix=64 |
759 | local0=$IP6_LOCAL0 | | 759 | local0=$IP6_LOCAL0 |
760 | local1=$IP6_LOCAL1 | | 760 | local1=$IP6_LOCAL1 |
761 | mcaddr=$IP6_MCADDR0 | | 761 | mcaddr=$IP6_MCADDR0 |
762 | eth_mcaddr=$ETH_IP6_MCADDR0 | | 762 | eth_mcaddr=$ETH_IP6_MCADDR0 |
763 | fi | | 763 | fi |
764 | | | 764 | |
765 | export RUMP_SERVER=$SOCK_LOCAL | | 765 | export RUMP_SERVER=$SOCK_LOCAL |
766 | | | 766 | |
767 | $atf_ifconfig shmif0 create | | 767 | $atf_ifconfig shmif0 create |
768 | $atf_ifconfig shmif0 linkstr net0 up | | 768 | $atf_ifconfig shmif0 linkstr net0 up |
769 | $atf_ifconfig vlan0 create | | 769 | $atf_ifconfig vlan0 create |
770 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 | | 770 | $atf_ifconfig vlan0 vlan 10 vlanif shmif0 |
771 | $atf_ifconfig vlan0 $af $local0/$prefix up | | 771 | $atf_ifconfig vlan0 $af $local0/$prefix up |
772 | $atf_ifconfig vlan1 create | | 772 | $atf_ifconfig vlan1 create |
773 | $atf_ifconfig vlan1 vlan 11 vlanif shmif0 | | 773 | $atf_ifconfig vlan1 vlan 11 vlanif shmif0 |
774 | $atf_ifconfig vlan1 $af $local1/$prefix up | | 774 | $atf_ifconfig vlan1 $af $local1/$prefix up |
775 | $atf_ifconfig -w 10 | | 775 | $atf_ifconfig -w 10 |
776 | | | 776 | |
777 | # check the initial state | | 777 | # check the initial state |
778 | atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat | | 778 | atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat |
779 | | | 779 | |
780 | # add a multicast address | | 780 | # add a multicast address |
781 | $atf_siocXmulti add vlan0 $mcaddr | | 781 | $atf_siocXmulti add vlan0 $mcaddr |
782 | atf_check -s exit:0 -o match:"$eth_mcaddr" $HIJACKING ifmcstat | | 782 | atf_check -s exit:0 -o match:"$eth_mcaddr" $HIJACKING ifmcstat |
783 | | | 783 | |
784 | # delete the address | | 784 | # delete the address |
785 | $atf_siocXmulti del vlan0 $mcaddr | | 785 | $atf_siocXmulti del vlan0 $mcaddr |
786 | atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat | | 786 | atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat |
787 | | | 787 | |
788 | # delete a non-existing address | | 788 | # delete a non-existing address |
789 | atf_check -s not-exit:0 -e match:"Invalid argument" \ | | 789 | atf_check -s not-exit:0 -e match:"Invalid argument" \ |
790 | $HIJACKING $siocXmulti del vlan0 $mcaddr | | 790 | $HIJACKING $siocXmulti del vlan0 $mcaddr |
791 | | | 791 | |
792 | # add an address to different interfaces | | 792 | # add an address to different interfaces |
793 | $atf_siocXmulti add vlan0 $mcaddr | | 793 | $atf_siocXmulti add vlan0 $mcaddr |
794 | $atf_siocXmulti add vlan1 $mcaddr | | 794 | $atf_siocXmulti add vlan1 $mcaddr |
795 | atf_check -s exit:0 -o match:"${eth_mcaddr}: 2" $HIJACKING ifmcstat | | 795 | atf_check -s exit:0 -o match:"${eth_mcaddr} refcount 2" $HIJACKING ifmcstat |
796 | $atf_siocXmulti del vlan0 $mcaddr | | 796 | $atf_siocXmulti del vlan0 $mcaddr |
797 | | | 797 | |
798 | # delete the address with invalid interface | | 798 | # delete the address with invalid interface |
799 | atf_check -s not-exit:0 -e match:"Invalid argument" \ | | 799 | atf_check -s not-exit:0 -e match:"Invalid argument" \ |
800 | $HIJACKING $siocXmulti del vlan0 $mcaddr | | 800 | $HIJACKING $siocXmulti del vlan0 $mcaddr |
801 | | | 801 | |
802 | $atf_siocXmulti del vlan1 $mcaddr | | 802 | $atf_siocXmulti del vlan1 $mcaddr |
803 | | | 803 | |
804 | # add and delete a same address more than once | | 804 | # add and delete a same address more than once |
805 | $atf_siocXmulti add vlan0 $mcaddr | | 805 | $atf_siocXmulti add vlan0 $mcaddr |
806 | $atf_siocXmulti add vlan0 $mcaddr | | 806 | $atf_siocXmulti add vlan0 $mcaddr |
807 | $atf_siocXmulti add vlan0 $mcaddr | | 807 | $atf_siocXmulti add vlan0 $mcaddr |
808 | atf_check -s exit:0 -o match:"${eth_mcaddr}: 3" $HIJACKING ifmcstat | | 808 | atf_check -s exit:0 -o match:"${eth_mcaddr} refcount 3" $HIJACKING ifmcstat |
809 | $atf_siocXmulti del vlan0 $mcaddr | | 809 | $atf_siocXmulti del vlan0 $mcaddr |
810 | $atf_siocXmulti del vlan0 $mcaddr | | 810 | $atf_siocXmulti del vlan0 $mcaddr |
811 | $atf_siocXmulti del vlan0 $mcaddr | | 811 | $atf_siocXmulti del vlan0 $mcaddr |
812 | atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat | | 812 | atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat |
813 | | | 813 | |
814 | # delete all address added to parent device when remove | | 814 | # delete all address added to parent device when remove |
815 | # the config of parent interface | | 815 | # the config of parent interface |
816 | $atf_siocXmulti add vlan0 $mcaddr | | 816 | $atf_siocXmulti add vlan0 $mcaddr |
817 | $atf_siocXmulti add vlan0 $mcaddr | | 817 | $atf_siocXmulti add vlan0 $mcaddr |
818 | $atf_siocXmulti add vlan0 $mcaddr | | 818 | $atf_siocXmulti add vlan0 $mcaddr |
819 | $atf_ifconfig vlan0 -vlanif shmif0 | | 819 | $atf_ifconfig vlan0 -vlanif shmif0 |
820 | atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat | | 820 | atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat |
821 | } | | 821 | } |
822 | | | 822 | |
823 | atf_test_case vlan_multicast cleanup | | 823 | atf_test_case vlan_multicast cleanup |
824 | vlan_multicast_head() | | 824 | vlan_multicast_head() |
825 | { | | 825 | { |
826 | atf_set "descr" "tests of multicast address adding and deleting" | | 826 | atf_set "descr" "tests of multicast address adding and deleting" |
827 | atf_set "require.progs" "rump_server" | | 827 | atf_set "require.progs" "rump_server" |
828 | } | | 828 | } |
829 | | | 829 | |
830 | vlan_multicast_body() | | 830 | vlan_multicast_body() |
831 | { | | 831 | { |
832 | rump_server_start $SOCK_LOCAL vlan | | 832 | rump_server_start $SOCK_LOCAL vlan |
833 | | | 833 | |
834 | vlan_multicast_body_common inet | | 834 | vlan_multicast_body_common inet |
835 | } | | 835 | } |
836 | | | 836 | |
837 | vlan_multicast_cleanup() | | 837 | vlan_multicast_cleanup() |
838 | { | | 838 | { |
839 | $DEBUG && dump | | 839 | $DEBUG && dump |
840 | cleanup | | 840 | cleanup |
841 | } | | 841 | } |
842 | | | 842 | |
843 | atf_test_case vlan_multicast6 cleanup | | 843 | atf_test_case vlan_multicast6 cleanup |
844 | vlan_multicast6_head() | | 844 | vlan_multicast6_head() |
845 | { | | 845 | { |
846 | atf_set "descr" "tests of multicast address adding and deleting with IPv6" | | 846 | atf_set "descr" "tests of multicast address adding and deleting with IPv6" |
847 | atf_set "require.progs" "rump_server" | | 847 | atf_set "require.progs" "rump_server" |
848 | } | | 848 | } |
849 | | | 849 | |
850 | vlan_multicast6_body() | | 850 | vlan_multicast6_body() |
851 | { | | 851 | { |
852 | rump_server_start $SOCK_LOCAL vlan netinet6 | | 852 | rump_server_start $SOCK_LOCAL vlan netinet6 |
853 | | | 853 | |
854 | vlan_multicast_body_common inet6 | | 854 | vlan_multicast_body_common inet6 |
855 | } | | 855 | } |
856 | | | 856 | |
857 | vlan_multicast6_cleanup() | | 857 | vlan_multicast6_cleanup() |
858 | { | | 858 | { |
859 | $DEBUG && dump | | 859 | $DEBUG && dump |
860 | cleanup | | 860 | cleanup |
861 | } | | 861 | } |
862 | | | 862 | |
863 | atf_init_test_cases() | | 863 | atf_init_test_cases() |
864 | { | | 864 | { |
865 | | | 865 | |
866 | atf_add_test_case vlan_create_destroy | | 866 | atf_add_test_case vlan_create_destroy |
867 | atf_add_test_case vlan_basic | | 867 | atf_add_test_case vlan_basic |
868 | atf_add_test_case vlan_auto_follow_mtu | | 868 | atf_add_test_case vlan_auto_follow_mtu |
869 | atf_add_test_case vlan_vlanid | | 869 | atf_add_test_case vlan_vlanid |
870 | atf_add_test_case vlan_configs | | 870 | atf_add_test_case vlan_configs |
871 | atf_add_test_case vlan_bridge | | 871 | atf_add_test_case vlan_bridge |
872 | atf_add_test_case vlan_multicast | | 872 | atf_add_test_case vlan_multicast |
873 | | | 873 | |
874 | atf_add_test_case vlan_create_destroy6 | | 874 | atf_add_test_case vlan_create_destroy6 |
875 | atf_add_test_case vlan_basic6 | | 875 | atf_add_test_case vlan_basic6 |
876 | atf_add_test_case vlan_auto_follow_mtu6 | | 876 | atf_add_test_case vlan_auto_follow_mtu6 |
877 | atf_add_test_case vlan_vlanid6 | | 877 | atf_add_test_case vlan_vlanid6 |
878 | atf_add_test_case vlan_configs6 | | 878 | atf_add_test_case vlan_configs6 |
879 | atf_add_test_case vlan_bridge6 | | 879 | atf_add_test_case vlan_bridge6 |
880 | atf_add_test_case vlan_multicast6 | | 880 | atf_add_test_case vlan_multicast6 |
881 | } | | 881 | } |