| @@ -1,332 +1,333 @@ | | | @@ -1,332 +1,333 @@ |
1 | # $NetBSD: t_ifconfig.sh,v 1.12 2016/09/14 16:18:31 christos Exp $ | | 1 | # $NetBSD: t_ifconfig.sh,v 1.13 2016/10/01 15:35:22 roy Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2015 The NetBSD Foundation, Inc. | | 3 | # Copyright (c) 2015 The NetBSD Foundation, 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 | RUMP_SERVER1=unix://./r1 | | 28 | RUMP_SERVER1=unix://./r1 |
29 | RUMP_SERVER2=unix://./r2 | | 29 | RUMP_SERVER2=unix://./r2 |
30 | | | 30 | |
31 | RUMP_FLAGS=\ | | 31 | RUMP_FLAGS=\ |
32 | "-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif" | | 32 | "-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif" |
33 | RUMP_FLAGS="${RUMP_FLAGS} -lrumpdev" | | 33 | RUMP_FLAGS="${RUMP_FLAGS} -lrumpdev" |
34 | | | 34 | |
35 | TIMEOUT=3 | | 35 | TIMEOUT=3 |
36 | | | 36 | |
37 | anycast="[Aa][Nn][Yy][Cc][Aa][Ss][Tt]" | | 37 | anycast="[Aa][Nn][Yy][Cc][Aa][Ss][Tt]" |
38 | deprecated="[Dd][Ee][Pp][Rr][Ee][Cc][Aa][Tt][Ee][Dd]" | | 38 | deprecated="[Dd][Ee][Pp][Rr][Ee][Cc][Aa][Tt][Ee][Dd]" |
39 | | | 39 | |
40 | atf_test_case ifconfig_create_destroy cleanup | | 40 | atf_test_case ifconfig_create_destroy cleanup |
41 | ifconfig_create_destroy_head() | | 41 | ifconfig_create_destroy_head() |
42 | { | | 42 | { |
43 | | | 43 | |
44 | atf_set "descr" "tests of ifconfig create and destroy" | | 44 | atf_set "descr" "tests of ifconfig create and destroy" |
45 | atf_set "require.progs" "rump_server" | | 45 | atf_set "require.progs" "rump_server" |
46 | } | | 46 | } |
47 | | | 47 | |
48 | ifconfig_create_destroy_body() | | 48 | ifconfig_create_destroy_body() |
49 | { | | 49 | { |
50 | atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1} | | 50 | atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1} |
51 | | | 51 | |
52 | export RUMP_SERVER=${RUMP_SERVER1} | | 52 | export RUMP_SERVER=${RUMP_SERVER1} |
53 | | | 53 | |
54 | # Create and destroy (no address) | | 54 | # Create and destroy (no address) |
55 | atf_check -s exit:0 rump.ifconfig shmif0 create | | 55 | atf_check -s exit:0 rump.ifconfig shmif0 create |
56 | atf_check -s exit:0 rump.ifconfig shmif0 destroy | | 56 | atf_check -s exit:0 rump.ifconfig shmif0 destroy |
57 | | | 57 | |
58 | # Create and destroy (with an IPv4 address) | | 58 | # Create and destroy (with an IPv4 address) |
59 | atf_check -s exit:0 rump.ifconfig shmif0 create | | 59 | atf_check -s exit:0 rump.ifconfig shmif0 create |
60 | atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus | | 60 | atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus |
61 | atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1/24 | | 61 | atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1/24 |
62 | atf_check -s exit:0 rump.ifconfig shmif0 up | | 62 | atf_check -s exit:0 rump.ifconfig shmif0 up |
63 | atf_check -s exit:0 rump.ifconfig shmif0 destroy | | 63 | atf_check -s exit:0 rump.ifconfig shmif0 destroy |
64 | | | 64 | |
65 | # Create and destroy (with an IPv6 address) | | 65 | # Create and destroy (with an IPv6 address) |
66 | atf_check -s exit:0 rump.ifconfig shmif0 create | | 66 | atf_check -s exit:0 rump.ifconfig shmif0 create |
67 | atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus | | 67 | atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus |
68 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 | | 68 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 |
69 | atf_check -s exit:0 rump.ifconfig shmif0 up | | 69 | atf_check -s exit:0 rump.ifconfig shmif0 up |
70 | atf_check -s exit:0 rump.ifconfig shmif0 destroy | | 70 | atf_check -s exit:0 rump.ifconfig shmif0 destroy |
71 | | | 71 | |
72 | unset RUMP_SERVER | | 72 | unset RUMP_SERVER |
73 | } | | 73 | } |
74 | | | 74 | |
75 | ifconfig_create_destroy_cleanup() | | 75 | ifconfig_create_destroy_cleanup() |
76 | { | | 76 | { |
77 | | | 77 | |
78 | RUMP_SERVER=${RUMP_SERVER1} rump.halt | | 78 | RUMP_SERVER=${RUMP_SERVER1} rump.halt |
79 | } | | 79 | } |
80 | | | 80 | |
81 | atf_test_case ifconfig_options cleanup | | 81 | atf_test_case ifconfig_options cleanup |
82 | ifconfig_options_head() | | 82 | ifconfig_options_head() |
83 | { | | 83 | { |
84 | | | 84 | |
85 | atf_set "descr" "tests of ifconfig options" | | 85 | atf_set "descr" "tests of ifconfig options" |
86 | atf_set "require.progs" "rump_server" | | 86 | atf_set "require.progs" "rump_server" |
87 | } | | 87 | } |
88 | | | 88 | |
89 | ifconfig_options_body() | | 89 | ifconfig_options_body() |
90 | { | | 90 | { |
91 | | | 91 | |
92 | export RUMP_SERVER=${RUMP_SERVER1} | | 92 | export RUMP_SERVER=${RUMP_SERVER1} |
93 | atf_check -s exit:0 rump_server $RUMP_FLAGS $RUMP_SERVER1 | | 93 | atf_check -s exit:0 rump_server $RUMP_FLAGS $RUMP_SERVER1 |
94 | | | 94 | |
95 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create | | 95 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create |
96 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr bus1 | | 96 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr bus1 |
97 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet 10.0.0.1/24 | | 97 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet 10.0.0.1/24 |
98 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 fc00::1/64 | | 98 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 fc00::1/64 |
99 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up | | 99 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up |
100 | atf_check -s exit:0 -o ignore rump.ifconfig -w 10 | | 100 | atf_check -s exit:0 -o ignore rump.ifconfig -w 10 |
101 | $DEBUG && rump.ifconfig shmif0 | | 101 | $DEBUG && rump.ifconfig shmif0 |
102 | | | 102 | |
103 | # ifconfig [-N] interface address_family | | 103 | # ifconfig [-N] interface address_family |
104 | # -N resolves hostnames | | 104 | # -N resolves hostnames |
105 | atf_check -s exit:0 -o match:'inet 127.0.0.1' rump.ifconfig lo0 inet | | 105 | atf_check -s exit:0 -o match:'inet 127.0.0.1' rump.ifconfig lo0 inet |
106 | atf_check -s exit:0 -o match:'inet localhost' rump.ifconfig -N lo0 inet | | 106 | atf_check -s exit:0 -o match:'inet localhost' rump.ifconfig -N lo0 inet |
107 | atf_check -s exit:0 -o match:'inet6 ::1' rump.ifconfig lo0 inet6 | | 107 | atf_check -s exit:0 -o match:'inet6 ::1' rump.ifconfig lo0 inet6 |
108 | atf_check -s exit:0 -o match:'inet6 localhost' rump.ifconfig -N lo0 inet6 | | 108 | atf_check -s exit:0 -o match:'inet6 localhost' rump.ifconfig -N lo0 inet6 |
109 | atf_check -s not-exit:0 -e match:'not supported' rump.ifconfig lo0 atalk | | 109 | atf_check -s not-exit:0 -e match:'not supported' rump.ifconfig lo0 atalk |
110 | atf_check -s not-exit:0 -e match:'not supported' rump.ifconfig -N lo0 atalk | | 110 | atf_check -s not-exit:0 -e match:'not supported' rump.ifconfig -N lo0 atalk |
111 | atf_check -s exit:0 -o ignore rump.ifconfig lo0 link | | 111 | atf_check -s exit:0 -o ignore rump.ifconfig lo0 link |
112 | atf_check -s exit:0 -o ignore rump.ifconfig -N lo0 link | | 112 | atf_check -s exit:0 -o ignore rump.ifconfig -N lo0 link |
113 | | | 113 | |
114 | # ifconfig [-hLmNvz] interface | | 114 | # ifconfig [-hLmNvz] interface |
115 | # -h -v shows statistics in human readable format | | 115 | # -h -v shows statistics in human readable format |
116 | atf_check -s exit:0 -o ignore rump.ifconfig -h -v lo0 | | 116 | atf_check -s exit:0 -o ignore rump.ifconfig -h -v lo0 |
117 | # -L shows IPv6 lifetime | | 117 | # -L shows IPv6 lifetime |
118 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 fc00::2 \ | | 118 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 fc00::2 \ |
119 | pltime 100 | | 119 | pltime 100 |
120 | $DEBUG && rump.ifconfig -L shmif0 | | 120 | $DEBUG && rump.ifconfig -L shmif0 |
121 | atf_check -s exit:0 -o match:'pltime' rump.ifconfig -L shmif0 | | 121 | atf_check -s exit:0 -o match:'pltime' rump.ifconfig -L shmif0 |
122 | atf_check -s exit:0 -o match:'vltime' rump.ifconfig -L shmif0 | | 122 | atf_check -s exit:0 -o match:'vltime' rump.ifconfig -L shmif0 |
123 | # -m shows all of the supported media (not supported in shmif) | | 123 | # -m shows all of the supported media (not supported in shmif) |
124 | $DEBUG && rump.ifconfig -m shmif0 | | 124 | $DEBUG && rump.ifconfig -m shmif0 |
125 | atf_check -s exit:0 -o ignore rump.ifconfig -m shmif0 | | 125 | atf_check -s exit:0 -o ignore rump.ifconfig -m shmif0 |
126 | atf_check -s exit:0 -o match:'localhost' rump.ifconfig -N lo0 | | 126 | atf_check -s exit:0 -o match:'localhost' rump.ifconfig -N lo0 |
127 | atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0 | | 127 | atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0 |
128 | atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT localhost | | 128 | atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT localhost |
129 | # -z clears and shows statistics at that point | | 129 | # -z clears and shows statistics at that point |
130 | atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -z lo0 | | 130 | atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -z lo0 |
131 | atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0 | | 131 | atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0 |
132 | | | 132 | |
133 | # ifconfig -a [-bdhLNmsuvz] | | 133 | # ifconfig -a [-bdhLNmsuvz] |
134 | # -a shows all interfaces in the system | | 134 | # -a shows all interfaces in the system |
135 | $DEBUG && rump.ifconfig -a | | 135 | $DEBUG && rump.ifconfig -a |
136 | atf_check -s exit:0 -o match:'shmif0' -o match:'lo0' rump.ifconfig -a | | 136 | atf_check -s exit:0 -o match:'shmif0' -o match:'lo0' rump.ifconfig -a |
137 | # -a -b shows only broadcast interfaces | | 137 | # -a -b shows only broadcast interfaces |
138 | atf_check -s exit:0 -o match:'shmif0' -o not-match:'lo0' rump.ifconfig -a -b | | 138 | atf_check -s exit:0 -o match:'shmif0' -o not-match:'lo0' rump.ifconfig -a -b |
139 | # -a -d shows only down interfaces | | 139 | # -a -d shows only down interfaces |
140 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down | | 140 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down |
141 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -d | | 141 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -d |
142 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up | | 142 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up |
143 | atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -d | | 143 | atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -d |
144 | atf_check -s exit:0 -o match:'pltime' rump.ifconfig -a -L | | 144 | atf_check -s exit:0 -o match:'pltime' rump.ifconfig -a -L |
145 | atf_check -s exit:0 -o match:'vltime' rump.ifconfig -a -L | | 145 | atf_check -s exit:0 -o match:'vltime' rump.ifconfig -a -L |
146 | atf_check -s exit:0 -o match:'localhost' rump.ifconfig -a -N | | 146 | atf_check -s exit:0 -o match:'localhost' rump.ifconfig -a -N |
147 | atf_check -s exit:0 -o ignore rump.ifconfig -a -m | | 147 | atf_check -s exit:0 -o ignore rump.ifconfig -a -m |
148 | # -a -s shows only interfaces connected to a network | | 148 | # -a -s shows only interfaces connected to a network |
149 | # (shmif is always connected) | | 149 | # (shmif is always connected) |
150 | $DEBUG && rump.ifconfig -a -s | | 150 | $DEBUG && rump.ifconfig -a -s |
151 | atf_check -s exit:0 -o ignore rump.ifconfig -a -s | | 151 | atf_check -s exit:0 -o ignore rump.ifconfig -a -s |
152 | # -a -u shows only up interfaces | | 152 | # -a -u shows only up interfaces |
153 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -u | | 153 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -u |
154 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down | | 154 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down |
155 | atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -u | | 155 | atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -u |
156 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up | | 156 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up |
157 | atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v | | 157 | atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v |
158 | atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT localhost | | 158 | atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT localhost |
159 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down | | 159 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down |
160 | atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -a -z | | 160 | atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -a -z |
161 | atf_check -s exit:0 -o not-match:'2 packets' rump.ifconfig -a -v | | 161 | atf_check -s exit:0 -o not-match:'2 packets' rump.ifconfig -a -v |
162 | atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v | | 162 | atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v |
163 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up | | 163 | atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up |
164 | | | 164 | |
165 | # ifconfig -l [-bdsu] | | 165 | # ifconfig -l [-bdsu] |
166 | # -l shows only inteface names | | 166 | # -l shows only inteface names |
167 | atf_check -s exit:0 -o match:'lo0' rump.ifconfig -l | | 167 | atf_check -s exit:0 -o match:'lo0' rump.ifconfig -l |
168 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l | | 168 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l |
169 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -b | | 169 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -b |
170 | atf_check -s exit:0 -o not-match:'lo0' rump.ifconfig -l -b | | 170 | atf_check -s exit:0 -o not-match:'lo0' rump.ifconfig -l -b |
171 | atf_check -s exit:0 -o ignore rump.ifconfig -l -d | | 171 | atf_check -s exit:0 -o ignore rump.ifconfig -l -d |
172 | atf_check -s exit:0 -o match:'lo0' rump.ifconfig -l -s | | 172 | atf_check -s exit:0 -o match:'lo0' rump.ifconfig -l -s |
173 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -s | | 173 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -s |
174 | atf_check -s exit:0 -o match:'lo0' rump.ifconfig -l -u | | 174 | atf_check -s exit:0 -o match:'lo0' rump.ifconfig -l -u |
175 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -u | | 175 | atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -u |
176 | | | 176 | |
177 | # ifconfig -s interface | | 177 | # ifconfig -s interface |
178 | # -s interface exists with 0 / 1 if connected / disconnected | | 178 | # -s interface exists with 0 / 1 if connected / disconnected |
179 | atf_check -s exit:0 -o empty rump.ifconfig -s lo0 | | 179 | atf_check -s exit:0 -o empty rump.ifconfig -s lo0 |
180 | atf_check -s exit:0 -o empty rump.ifconfig -s shmif0 | | 180 | atf_check -s exit:0 -o empty rump.ifconfig -s shmif0 |
181 | | | 181 | |
182 | # ifconfig -C | | 182 | # ifconfig -C |
183 | # -C shows all of the interface cloners available on the system | | 183 | # -C shows all of the interface cloners available on the system |
184 | atf_check -s exit:0 -o match:'shmif lo carp' rump.ifconfig -C | | 184 | atf_check -s exit:0 -o match:'shmif lo carp' rump.ifconfig -C |
185 | | | 185 | |
186 | unset RUMP_SERVER | | 186 | unset RUMP_SERVER |
187 | } | | 187 | } |
188 | | | 188 | |
189 | ifconfig_options_cleanup() | | 189 | ifconfig_options_cleanup() |
190 | { | | 190 | { |
191 | | | 191 | |
192 | env RUMP_SERVER=${RUMP_SERVER1} rump.halt | | 192 | env RUMP_SERVER=${RUMP_SERVER1} rump.halt |
193 | } | | 193 | } |
194 | | | 194 | |
195 | | | 195 | |
196 | atf_test_case ifconfig_parameters cleanup | | 196 | atf_test_case ifconfig_parameters cleanup |
197 | ifconfig_parameters_head() | | 197 | ifconfig_parameters_head() |
198 | { | | 198 | { |
199 | atf_set "descr" "tests of interface parameters" | | 199 | atf_set "descr" "tests of interface parameters" |
200 | atf_set "require.progs" "rump_server" | | 200 | atf_set "require.progs" "rump_server" |
201 | } | | 201 | } |
202 | | | 202 | |
203 | ifconfig_parameters_body() | | 203 | ifconfig_parameters_body() |
204 | { | | 204 | { |
205 | local interval= | | 205 | local interval= |
206 | | | 206 | |
207 | atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1} | | 207 | atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1} |
208 | atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER2} | | 208 | atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER2} |
209 | | | 209 | |
210 | export RUMP_SERVER=${RUMP_SERVER1} | | 210 | export RUMP_SERVER=${RUMP_SERVER1} |
211 | atf_check -s exit:0 rump.ifconfig shmif0 create | | 211 | atf_check -s exit:0 rump.ifconfig shmif0 create |
212 | atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus | | 212 | atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus |
213 | atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1/24 | | 213 | atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1/24 |
214 | atf_check -s exit:0 rump.ifconfig shmif0 up | | 214 | atf_check -s exit:0 rump.ifconfig shmif0 up |
215 | unset RUMP_SERVER | | 215 | unset RUMP_SERVER |
216 | | | 216 | |
217 | export RUMP_SERVER=${RUMP_SERVER2} | | 217 | export RUMP_SERVER=${RUMP_SERVER2} |
218 | atf_check -s exit:0 rump.ifconfig shmif0 create | | 218 | atf_check -s exit:0 rump.ifconfig shmif0 create |
219 | atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus | | 219 | atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus |
220 | atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.2/24 | | 220 | atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.2/24 |
221 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.3/24 alias | | 221 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.3/24 alias |
222 | atf_check -s exit:0 rump.ifconfig shmif0 up | | 222 | atf_check -s exit:0 rump.ifconfig shmif0 up |
223 | unset RUMP_SERVER | | 223 | unset RUMP_SERVER |
224 | | | 224 | |
225 | export RUMP_SERVER=${RUMP_SERVER1} | | 225 | export RUMP_SERVER=${RUMP_SERVER1} |
226 | | | 226 | |
227 | # active | | 227 | # active |
228 | atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:01 active | | 228 | atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:01 active |
229 | atf_check -s exit:0 -o match:'address:.b2:a0:75:00:00:01' \ | | 229 | atf_check -s exit:0 -o match:'address:.b2:a0:75:00:00:01' \ |
230 | rump.ifconfig shmif0 | | 230 | rump.ifconfig shmif0 |
231 | # down, up | | 231 | # down, up |
232 | atf_check -s exit:0 rump.ifconfig shmif0 down | | 232 | atf_check -s exit:0 rump.ifconfig shmif0 down |
233 | atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 \ | | 233 | atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 \ |
234 | -w $TIMEOUT -n 192.168.0.2 | | 234 | -w $TIMEOUT -n 192.168.0.2 |
235 | atf_check -s exit:0 rump.ifconfig shmif0 up | | 235 | atf_check -s exit:0 rump.ifconfig shmif0 up |
| | | 236 | atf_check -s exit:0 rump.ifconfig -w 10 |
236 | atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT -n 192.168.0.2 | | 237 | atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT -n 192.168.0.2 |
237 | | | 238 | |
238 | # alias | | 239 | # alias |
239 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 alias | | 240 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 alias |
240 | atf_check -s exit:0 -o match:'alias 192.168.1.1' rump.ifconfig shmif0 | | 241 | atf_check -s exit:0 -o match:'192.168.1.1/24' rump.ifconfig shmif0 |
241 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 -alias | | 242 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 -alias |
242 | atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 | | 243 | atf_check -s exit:0 -o not-match:'192.168.1.1/24' rump.ifconfig shmif0 |
243 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 | | 244 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 |
244 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 | | 245 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 |
245 | atf_check -s exit:0 -o match:'fc00::1' rump.ifconfig shmif0 inet6 | | 246 | atf_check -s exit:0 -o match:'fc00::1' rump.ifconfig shmif0 inet6 |
246 | atf_check -s exit:0 -o match:'fc00::2' rump.ifconfig shmif0 inet6 | | 247 | atf_check -s exit:0 -o match:'fc00::2' rump.ifconfig shmif0 inet6 |
247 | | | 248 | |
248 | # delete | | 249 | # delete |
249 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1 alias | | 250 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1 alias |
250 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1 delete | | 251 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1 delete |
251 | atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 inet | | 252 | atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 inet |
252 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1 delete | | 253 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1 delete |
253 | atf_check -s exit:0 -o not-match:'192.168.0.1' rump.ifconfig shmif0 inet | | 254 | atf_check -s exit:0 -o not-match:'192.168.0.1' rump.ifconfig shmif0 inet |
254 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 delete | | 255 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 delete |
255 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 delete | | 256 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 delete |
256 | atf_check -s exit:0 -o not-match:'fc00::1' rump.ifconfig shmif0 inet6 | | 257 | atf_check -s exit:0 -o not-match:'fc00::1' rump.ifconfig shmif0 inet6 |
257 | atf_check -s exit:0 -o not-match:'fc00::2' rump.ifconfig shmif0 inet6 | | 258 | atf_check -s exit:0 -o not-match:'fc00::2' rump.ifconfig shmif0 inet6 |
258 | # can delete inactive link | | 259 | # can delete inactive link |
259 | atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:02 | | 260 | atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:02 |
260 | atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:02 delete | | 261 | atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:02 delete |
261 | # cannot delete active link | | 262 | # cannot delete active link |
262 | atf_check -s not-exit:0 -e match:'SIOCDLIFADDR: Device busy' \ | | 263 | atf_check -s not-exit:0 -e match:'SIOCDLIFADDR: Device busy' \ |
263 | rump.ifconfig shmif0 link b2:a0:75:00:00:01 delete | | 264 | rump.ifconfig shmif0 link b2:a0:75:00:00:01 delete |
264 | | | 265 | |
265 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1/24 | | 266 | atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1/24 |
266 | | | 267 | |
267 | # arp | | 268 | # arp |
268 | atf_check -s exit:0 rump.ifconfig shmif0 -arp | | 269 | atf_check -s exit:0 rump.ifconfig shmif0 -arp |
269 | atf_check -s not-exit:0 -o ignore -e ignore \ | | 270 | atf_check -s not-exit:0 -o ignore -e ignore \ |
270 | rump.ping -c 1 -w $TIMEOUT -n 192.168.0.3 | | 271 | rump.ping -c 1 -w $TIMEOUT -n 192.168.0.3 |
271 | atf_check -s exit:0 -o not-match:'192.168.0.3' rump.arp -an | | 272 | atf_check -s exit:0 -o not-match:'192.168.0.3' rump.arp -an |
272 | # The entry shouldn't appear in the routing table anymore | | 273 | # The entry shouldn't appear in the routing table anymore |
273 | atf_check -s exit:0 -o not-match:'192.168.0.3' rump.netstat -nr | | 274 | atf_check -s exit:0 -o not-match:'192.168.0.3' rump.netstat -nr |
274 | | | 275 | |
275 | # netmask | | 276 | # netmask |
276 | atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 netmask 255.255.255.0 alias | | 277 | atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 netmask 255.255.255.0 alias |
277 | atf_check -s exit:0 -o match:'172.16.0/24' rump.netstat -rn -f inet | | 278 | atf_check -s exit:0 -o match:'172.16.0/24' rump.netstat -rn -f inet |
278 | atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 delete | | 279 | atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 delete |
279 | | | 280 | |
280 | # broadcast (does it not work?) | | 281 | # broadcast (does it not work?) |
281 | atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 \ | | 282 | atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 \ |
282 | broadcast 255.255.255.255 alias | | 283 | broadcast 255.255.255.255 alias |
283 | atf_check -s exit:0 -o match:'broadcast 255.255.255.255' \ | | 284 | atf_check -s exit:0 -o match:'broadcast 255.255.255.255' \ |
284 | rump.ifconfig shmif0 inet | | 285 | rump.ifconfig shmif0 inet |
285 | | | 286 | |
286 | # metric (external only) | | 287 | # metric (external only) |
287 | atf_check -s exit:0 rump.ifconfig shmif0 metric 10 | | 288 | atf_check -s exit:0 rump.ifconfig shmif0 metric 10 |
288 | atf_check -s exit:0 rump.ifconfig shmif0 metric 0 | | 289 | atf_check -s exit:0 rump.ifconfig shmif0 metric 0 |
289 | | | 290 | |
290 | # prefixlen | | 291 | # prefixlen |
291 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 prefixlen 70 | | 292 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 prefixlen 70 |
292 | atf_check -s exit:0 -o match:'fc00::/70' rump.netstat -rn -f inet6 | | 293 | atf_check -s exit:0 -o match:'fc00::/70' rump.netstat -rn -f inet6 |
293 | | | 294 | |
294 | # anycast | | 295 | # anycast |
295 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 anycast | | 296 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 anycast |
296 | atf_check -s exit:0 -o match:"fc00::2.+$anycast" rump.ifconfig shmif0 inet6 | | 297 | atf_check -s exit:0 -o match:"fc00::2.+$anycast" rump.ifconfig shmif0 inet6 |
297 | | | 298 | |
298 | # deprecated | | 299 | # deprecated |
299 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 deprecated | | 300 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 deprecated |
300 | # Not deprecated immediately. Need to wait nd6_timer that does it is scheduled. | | 301 | # Not deprecated immediately. Need to wait nd6_timer that does it is scheduled. |
301 | interval=$(sysctl -n net.inet6.icmp6.nd6_prune) | | 302 | interval=$(sysctl -n net.inet6.icmp6.nd6_prune) |
302 | atf_check -s exit:0 sleep $((interval + 1)) | | 303 | atf_check -s exit:0 sleep $((interval + 1)) |
303 | atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 | | 304 | atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 |
304 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 -deprecated | | 305 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 -deprecated |
305 | atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 | | 306 | atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 |
306 | | | 307 | |
307 | # pltime | | 308 | # pltime |
308 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 pltime 3 | | 309 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 pltime 3 |
309 | atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 | | 310 | atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 |
310 | atf_check -s exit:0 sleep 5 | | 311 | atf_check -s exit:0 sleep 5 |
311 | atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 | | 312 | atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 |
312 | | | 313 | |
313 | # eui64 | | 314 | # eui64 |
314 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00:1::0 eui64 | | 315 | atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00:1::0 eui64 |
315 | atf_check -s exit:0 -o match:'fc00:1::' rump.ifconfig shmif0 inet6 | | 316 | atf_check -s exit:0 -o match:'fc00:1::' rump.ifconfig shmif0 inet6 |
316 | | | 317 | |
317 | unset RUMP_SERVER | | 318 | unset RUMP_SERVER |
318 | } | | 319 | } |
319 | | | 320 | |
320 | ifconfig_parameters_cleanup() | | 321 | ifconfig_parameters_cleanup() |
321 | { | | 322 | { |
322 | env RUMP_SERVER=${RUMP_SERVER1} rump.halt | | 323 | env RUMP_SERVER=${RUMP_SERVER1} rump.halt |
323 | env RUMP_SERVER=${RUMP_SERVER2} rump.halt | | 324 | env RUMP_SERVER=${RUMP_SERVER2} rump.halt |
324 | } | | 325 | } |
325 | | | 326 | |
326 | atf_init_test_cases() | | 327 | atf_init_test_cases() |
327 | { | | 328 | { |
328 | | | 329 | |
329 | atf_add_test_case ifconfig_create_destroy | | 330 | atf_add_test_case ifconfig_create_destroy |
330 | atf_add_test_case ifconfig_options | | 331 | atf_add_test_case ifconfig_options |
331 | atf_add_test_case ifconfig_parameters | | 332 | atf_add_test_case ifconfig_parameters |
332 | } | | 333 | } |