t_basic.sh revision 1.4 1 1.4 simonb # $NetBSD: t_basic.sh,v 1.4 2021/03/02 07:16:24 simonb Exp $
2 1.1 riastrad #
3 1.1 riastrad # Copyright (c) 2018 Ryota Ozaki <ozaki.ryota (at] gmail.com>
4 1.1 riastrad # All rights reserved.
5 1.1 riastrad #
6 1.1 riastrad # Redistribution and use in source and binary forms, with or without
7 1.1 riastrad # modification, are permitted provided that the following conditions
8 1.1 riastrad # are met:
9 1.1 riastrad # 1. Redistributions of source code must retain the above copyright
10 1.1 riastrad # notice, this list of conditions and the following disclaimer.
11 1.1 riastrad # 2. Redistributions in binary form must reproduce the above copyright
12 1.1 riastrad # notice, this list of conditions and the following disclaimer in the
13 1.1 riastrad # documentation and/or other materials provided with the distribution.
14 1.1 riastrad #
15 1.1 riastrad # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 1.1 riastrad # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 1.1 riastrad # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 1.1 riastrad # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 1.1 riastrad # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 1.1 riastrad # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 1.1 riastrad # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 1.1 riastrad # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.1 riastrad # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 1.1 riastrad # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 1.1 riastrad # POSSIBILITY OF SUCH DAMAGE.
26 1.1 riastrad #
27 1.1 riastrad
28 1.1 riastrad BUS=bus
29 1.1 riastrad SOCK_LOCAL=unix://wg_local
30 1.1 riastrad SOCK_PEER=unix://wg_peer
31 1.1 riastrad SOCK_PEER2=unix://wg_peer2
32 1.1 riastrad
33 1.1 riastrad
34 1.1 riastrad check_ping_payload()
35 1.1 riastrad {
36 1.1 riastrad local proto=$1
37 1.1 riastrad local ip=$2
38 1.1 riastrad local ping= size=
39 1.1 riastrad
40 1.1 riastrad if [ $proto = inet ]; then
41 1.1 riastrad ping="atf_check -s exit:0 -o ignore rump.ping -n -c 1 -w 1"
42 1.1 riastrad else
43 1.1 riastrad ping="atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X 1"
44 1.1 riastrad fi
45 1.1 riastrad
46 1.1 riastrad for size in $(seq 1 100) $(seq 450 550) $(seq 1400 1500); do
47 1.1 riastrad $ping -s $size $ip
48 1.1 riastrad done
49 1.1 riastrad }
50 1.1 riastrad
51 1.1 riastrad test_common()
52 1.1 riastrad {
53 1.1 riastrad local type=$1
54 1.1 riastrad local outer_proto=$2
55 1.1 riastrad local inner_proto=$3
56 1.1 riastrad local ifconfig="atf_check -s exit:0 rump.ifconfig"
57 1.1 riastrad local port=51820
58 1.1 riastrad local ip_local= ip_peer=
59 1.1 riastrad local ip_wg_local= ip_wg_peer=
60 1.1 riastrad local outer_prefix= outer_prefixall=
61 1.1 riastrad local inner_prefix= inner_prefixall=
62 1.1 riastrad
63 1.1 riastrad if [ $outer_proto = inet ]; then
64 1.1 riastrad ip_local=192.168.1.1
65 1.1 riastrad ip_peer=192.168.1.2
66 1.1 riastrad outer_prefix=24
67 1.1 riastrad outer_prefixall=32
68 1.1 riastrad else
69 1.1 riastrad ip_local=fc00::1
70 1.1 riastrad ip_peer=fc00::2
71 1.1 riastrad outer_prefix=64
72 1.1 riastrad outer_prefixall=128
73 1.1 riastrad fi
74 1.1 riastrad
75 1.1 riastrad if [ $inner_proto = inet ]; then
76 1.1 riastrad ip_wg_local=10.0.0.1
77 1.1 riastrad ip_wg_peer=10.0.0.2
78 1.1 riastrad inner_prefix=24
79 1.1 riastrad inner_prefixall=32
80 1.1 riastrad else
81 1.1 riastrad ip_wg_local=fd00::1
82 1.1 riastrad ip_wg_peer=fd00::2
83 1.1 riastrad inner_prefix=64
84 1.1 riastrad inner_prefixall=128
85 1.1 riastrad fi
86 1.1 riastrad
87 1.1 riastrad setup_servers
88 1.1 riastrad
89 1.1 riastrad # It sets key_priv_local key_pub_local key_priv_peer key_pub_peer
90 1.1 riastrad generate_keys
91 1.1 riastrad
92 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
93 1.1 riastrad setup_common shmif0 $outer_proto $ip_local $outer_prefix
94 1.1 riastrad setup_wg_common wg0 $inner_proto $ip_wg_local $inner_prefix $port "$key_priv_local"
95 1.2 roy add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall
96 1.4 simonb $ifconfig -w 10
97 1.1 riastrad
98 1.1 riastrad export RUMP_SERVER=$SOCK_PEER
99 1.1 riastrad setup_common shmif0 $outer_proto $ip_peer $outer_prefix
100 1.1 riastrad setup_wg_common wg0 $inner_proto $ip_wg_peer $inner_prefix $port "$key_priv_peer"
101 1.1 riastrad add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/$inner_prefixall
102 1.4 simonb $ifconfig -w 10
103 1.1 riastrad
104 1.1 riastrad if [ $type = basic ]; then
105 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
106 1.1 riastrad check_ping $inner_proto $ip_wg_peer
107 1.1 riastrad elif [ $type = payload ]; then
108 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
109 1.1 riastrad check_ping_payload $inner_proto $ip_wg_peer
110 1.1 riastrad fi
111 1.1 riastrad
112 1.1 riastrad destroy_wg_interfaces
113 1.1 riastrad }
114 1.1 riastrad
115 1.1 riastrad atf_test_case wg_create_destroy cleanup
116 1.1 riastrad wg_create_destroy_head()
117 1.1 riastrad {
118 1.1 riastrad
119 1.1 riastrad atf_set "descr" "tests to create/destroy wg(4) interfaces"
120 1.1 riastrad atf_set "require.progs" "rump_server" "wgconfig" "wg-keygen"
121 1.1 riastrad }
122 1.1 riastrad
123 1.1 riastrad wg_create_destroy_body()
124 1.1 riastrad {
125 1.1 riastrad
126 1.1 riastrad rump_server_crypto_start $SOCK_LOCAL netinet6 wg
127 1.1 riastrad
128 1.1 riastrad test_create_destroy_common $SOCK_LOCAL wg0 true
129 1.1 riastrad }
130 1.1 riastrad
131 1.1 riastrad wg_create_destroy_cleanup()
132 1.1 riastrad {
133 1.1 riastrad
134 1.1 riastrad $DEBUG && dump
135 1.1 riastrad cleanup
136 1.1 riastrad }
137 1.1 riastrad
138 1.1 riastrad wg_create_destroy_peers_common()
139 1.1 riastrad {
140 1.1 riastrad local proto=$1
141 1.1 riastrad local ifconfig="atf_check -s exit:0 rump.ifconfig"
142 1.1 riastrad local port=51820
143 1.1 riastrad local ip_local= ip_peer=
144 1.1 riastrad local ip_wg_local= ip_wg_peer=
145 1.1 riastrad local outer_prefix= outer_prefixall=
146 1.1 riastrad local inner_prefix= inner_prefixall=
147 1.1 riastrad
148 1.1 riastrad if [ $proto = inet ]; then
149 1.1 riastrad ip_local=192.168.1.1
150 1.1 riastrad ip_peer=192.168.1.2
151 1.1 riastrad outer_prefix=24
152 1.1 riastrad outer_prefixall=32
153 1.1 riastrad ip_wg_local=10.0.0.1
154 1.1 riastrad ip_wg_peer=10.0.0.2
155 1.1 riastrad inner_prefix=24
156 1.1 riastrad inner_prefixall=32
157 1.1 riastrad else
158 1.1 riastrad ip_local=fc00::1
159 1.1 riastrad ip_peer=fc00::2
160 1.1 riastrad outer_prefix=64
161 1.1 riastrad outer_prefixall=128
162 1.1 riastrad ip_wg_local=fd00::1
163 1.1 riastrad ip_wg_peer=fd00::2
164 1.1 riastrad inner_prefix=64
165 1.1 riastrad inner_prefixall=128
166 1.1 riastrad fi
167 1.1 riastrad
168 1.1 riastrad rump_server_crypto_start $SOCK_LOCAL netinet6 wg
169 1.1 riastrad rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
170 1.1 riastrad
171 1.1 riastrad # It sets key_priv_local key_pub_local key_priv_peer key_pub_peer
172 1.1 riastrad generate_keys
173 1.1 riastrad
174 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
175 1.1 riastrad setup_common shmif0 $proto $ip_local $outer_prefix
176 1.1 riastrad setup_wg_common wg0 $proto $ip_wg_local $inner_prefix $port "$key_priv_local"
177 1.1 riastrad
178 1.1 riastrad add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall
179 1.1 riastrad
180 1.1 riastrad delete_peer wg0 peer0
181 1.1 riastrad }
182 1.1 riastrad
183 1.1 riastrad atf_test_case wg_create_destroy_peers_ipv4 cleanup
184 1.1 riastrad wg_create_destroy_peers_ipv4_head()
185 1.1 riastrad {
186 1.1 riastrad
187 1.1 riastrad atf_set "descr" "tests to create/destroy peers (IPv4)"
188 1.1 riastrad atf_set "require.progs" "rump_server" "wgconfig" "wg-keygen"
189 1.1 riastrad }
190 1.1 riastrad
191 1.1 riastrad wg_create_destroy_peers_ipv4_body()
192 1.1 riastrad {
193 1.1 riastrad
194 1.1 riastrad wg_create_destroy_peers_common inet
195 1.1 riastrad }
196 1.1 riastrad
197 1.1 riastrad wg_create_destroy_peers_ipv4_cleanup()
198 1.1 riastrad {
199 1.1 riastrad
200 1.1 riastrad $DEBUG && dump
201 1.1 riastrad cleanup
202 1.1 riastrad }
203 1.1 riastrad
204 1.1 riastrad atf_test_case wg_create_destroy_peers_ipv6 cleanup
205 1.1 riastrad wg_create_destroy_peers_ipv6_head()
206 1.1 riastrad {
207 1.1 riastrad
208 1.1 riastrad atf_set "descr" "tests to create/destroy peers (IPv6)"
209 1.1 riastrad atf_set "require.progs" "rump_server" "wgconfig" "wg-keygen"
210 1.1 riastrad }
211 1.1 riastrad
212 1.1 riastrad wg_create_destroy_peers_ipv6_body()
213 1.1 riastrad {
214 1.1 riastrad
215 1.1 riastrad wg_create_destroy_peers_common inet6
216 1.1 riastrad }
217 1.1 riastrad
218 1.1 riastrad wg_create_destroy_peers_ipv6_cleanup()
219 1.1 riastrad {
220 1.1 riastrad
221 1.1 riastrad $DEBUG && dump
222 1.1 riastrad cleanup
223 1.1 riastrad }
224 1.1 riastrad
225 1.1 riastrad add_basic_test()
226 1.1 riastrad {
227 1.1 riastrad local inner=$1
228 1.1 riastrad local outer=$2
229 1.1 riastrad local ipv4=inet
230 1.1 riastrad local ipv6=inet6
231 1.1 riastrad
232 1.1 riastrad name="wg_basic_${inner}_over_${outer}"
233 1.1 riastrad fulldesc="Test wg(4) with ${inner} over ${outer}"
234 1.1 riastrad
235 1.1 riastrad eval inner=\$$inner
236 1.1 riastrad eval outer=\$$outer
237 1.1 riastrad
238 1.1 riastrad atf_test_case ${name} cleanup
239 1.1 riastrad eval "
240 1.1 riastrad ${name}_head() {
241 1.1 riastrad atf_set descr \"${fulldesc}\"
242 1.1 riastrad atf_set require.progs rump_server wgconfig wg-keygen
243 1.1 riastrad }
244 1.1 riastrad ${name}_body() {
245 1.1 riastrad test_common basic $outer $inner
246 1.1 riastrad rump_server_destroy_ifaces
247 1.1 riastrad }
248 1.1 riastrad ${name}_cleanup() {
249 1.1 riastrad \$DEBUG && dump
250 1.1 riastrad cleanup
251 1.1 riastrad }"
252 1.1 riastrad atf_add_test_case ${name}
253 1.1 riastrad }
254 1.1 riastrad
255 1.1 riastrad add_payload_sizes_test()
256 1.1 riastrad {
257 1.1 riastrad local inner=$1
258 1.1 riastrad local outer=$2
259 1.1 riastrad local ipv4=inet
260 1.1 riastrad local ipv6=inet6
261 1.1 riastrad
262 1.1 riastrad name="wg_payload_sizes_${inner}_over_${outer}"
263 1.1 riastrad fulldesc="Test wg(4) with ${inner} over ${outer} with various payload sizes"
264 1.1 riastrad
265 1.1 riastrad eval inner=\$$inner
266 1.1 riastrad eval outer=\$$outer
267 1.1 riastrad
268 1.1 riastrad atf_test_case ${name} cleanup
269 1.1 riastrad eval "
270 1.1 riastrad ${name}_head() {
271 1.1 riastrad atf_set descr \"${fulldesc}\"
272 1.1 riastrad atf_set require.progs rump_server wgconfig wg-keygen
273 1.1 riastrad }
274 1.1 riastrad ${name}_body() {
275 1.1 riastrad test_common payload $outer $inner
276 1.1 riastrad rump_server_destroy_ifaces
277 1.1 riastrad }
278 1.1 riastrad ${name}_cleanup() {
279 1.1 riastrad \$DEBUG && dump
280 1.1 riastrad cleanup
281 1.1 riastrad }"
282 1.1 riastrad atf_add_test_case ${name}
283 1.1 riastrad }
284 1.1 riastrad
285 1.1 riastrad atf_test_case wg_multiple_interfaces cleanup
286 1.1 riastrad wg_multiple_interfaces_head()
287 1.1 riastrad {
288 1.1 riastrad
289 1.1 riastrad atf_set "descr" "tests multiple wg(4) interfaces"
290 1.1 riastrad atf_set "require.progs" "rump_server" "wgconfig" "wg-keygen"
291 1.1 riastrad }
292 1.1 riastrad
293 1.1 riastrad wg_multiple_interfaces_body()
294 1.1 riastrad {
295 1.1 riastrad local ifconfig="atf_check -s exit:0 rump.ifconfig"
296 1.1 riastrad local ping="atf_check -s exit:0 -o ignore rump.ping -n -i 0.1 -c 3 -w 1"
297 1.1 riastrad local ping_fail="atf_check -s not-exit:0 -o ignore rump.ping -n -c 1 -w 1"
298 1.1 riastrad local key_priv_peer2=
299 1.1 riastrad local key_pub_peer2=
300 1.1 riastrad local ip_local=192.168.1.1
301 1.1 riastrad local ip_local2=192.168.2.1
302 1.1 riastrad local ip_peer=192.168.1.2
303 1.1 riastrad local ip_peer2=192.168.2.2
304 1.1 riastrad local ip_wg_local=10.0.0.1
305 1.1 riastrad local ip_wg_local2=10.0.1.1
306 1.1 riastrad local ip_wg_peer=10.0.0.2
307 1.1 riastrad local ip_wg_peer2=10.0.1.2
308 1.1 riastrad local port=51820
309 1.1 riastrad local port2=51821
310 1.1 riastrad local outfile=./out
311 1.1 riastrad
312 1.1 riastrad setup_servers
313 1.1 riastrad rump_server_add_iface $SOCK_LOCAL shmif1 $BUS
314 1.1 riastrad
315 1.1 riastrad rump_server_crypto_start $SOCK_PEER2 netinet6 wg
316 1.1 riastrad rump_server_add_iface $SOCK_PEER2 shmif0 $BUS
317 1.1 riastrad
318 1.1 riastrad # It sets key_priv_local key_pub_local key_priv_peer key_pub_peer
319 1.1 riastrad generate_keys
320 1.1 riastrad key_priv_peer2=$(wg-keygen)
321 1.1 riastrad key_pub_peer2=$(echo $key_priv_peer2| wg-keygen --pub)
322 1.1 riastrad
323 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
324 1.1 riastrad setup_common shmif0 inet $ip_local 24
325 1.1 riastrad setup_common shmif1 inet $ip_local2 24
326 1.1 riastrad setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
327 1.1 riastrad setup_wg_common wg1 inet $ip_wg_local2 24 $port2 "$key_priv_local"
328 1.2 roy add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
329 1.2 roy add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32
330 1.4 simonb $ifconfig -w 10
331 1.1 riastrad
332 1.1 riastrad export RUMP_SERVER=$SOCK_PEER
333 1.1 riastrad setup_common shmif0 inet $ip_peer 24
334 1.1 riastrad setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
335 1.2 roy add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
336 1.4 simonb $ifconfig -w 10
337 1.1 riastrad
338 1.1 riastrad export RUMP_SERVER=$SOCK_PEER2
339 1.1 riastrad setup_common shmif0 inet $ip_peer2 24
340 1.1 riastrad setup_wg_common wg0 inet $ip_wg_peer2 24 $port2 "$key_priv_peer2"
341 1.1 riastrad add_peer wg0 peer0 $key_pub_local $ip_local2:$port2 $ip_wg_local2/32
342 1.4 simonb $ifconfig -w 10
343 1.1 riastrad
344 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
345 1.1 riastrad
346 1.1 riastrad extract_new_packets $BUS > $outfile
347 1.1 riastrad $DEBUG && cat $outfile
348 1.1 riastrad
349 1.1 riastrad $ping $ip_wg_peer
350 1.1 riastrad
351 1.1 riastrad extract_new_packets $BUS > $outfile
352 1.1 riastrad $DEBUG && cat $outfile
353 1.1 riastrad
354 1.1 riastrad $ping $ip_wg_peer2
355 1.1 riastrad
356 1.1 riastrad extract_new_packets $BUS > $outfile
357 1.1 riastrad $DEBUG && cat $outfile
358 1.1 riastrad
359 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
360 1.1 riastrad $ifconfig wg0 destroy
361 1.1 riastrad $ifconfig wg1 destroy
362 1.1 riastrad export RUMP_SERVER=$SOCK_PEER
363 1.1 riastrad $ifconfig wg0 destroy
364 1.1 riastrad export RUMP_SERVER=$SOCK_PEER2
365 1.1 riastrad $ifconfig wg0 destroy
366 1.1 riastrad }
367 1.1 riastrad
368 1.1 riastrad wg_multiple_interfaces_cleanup()
369 1.1 riastrad {
370 1.1 riastrad
371 1.1 riastrad $DEBUG && dump
372 1.1 riastrad cleanup
373 1.1 riastrad }
374 1.1 riastrad
375 1.1 riastrad atf_test_case wg_multiple_peers cleanup
376 1.1 riastrad wg_multiple_peers_head()
377 1.1 riastrad {
378 1.1 riastrad
379 1.1 riastrad atf_set "descr" "tests multiple wg(4) peers"
380 1.1 riastrad atf_set "require.progs" "rump_server" "wgconfig" "wg-keygen"
381 1.1 riastrad }
382 1.1 riastrad
383 1.1 riastrad wg_multiple_peers_body()
384 1.1 riastrad {
385 1.1 riastrad local ifconfig="atf_check -s exit:0 rump.ifconfig"
386 1.1 riastrad local ping="atf_check -s exit:0 -o ignore rump.ping -n -i 0.1 -c 3 -w 1"
387 1.1 riastrad local ping_fail="atf_check -s not-exit:0 -o ignore rump.ping -n -c 1 -w 1"
388 1.1 riastrad local key_priv_peer2=
389 1.1 riastrad local key_pub_peer2=
390 1.1 riastrad local ip_local=192.168.1.1
391 1.1 riastrad local ip_peer=192.168.1.2
392 1.1 riastrad local ip_peer2=192.168.1.3
393 1.1 riastrad local ip_wg_local=10.0.0.1
394 1.1 riastrad local ip_wg_peer=10.0.0.2
395 1.1 riastrad local ip_wg_peer2=10.0.0.3
396 1.1 riastrad local port=51820
397 1.1 riastrad local outfile=./out
398 1.1 riastrad
399 1.1 riastrad setup_servers
400 1.1 riastrad rump_server_add_iface $SOCK_LOCAL shmif1 $BUS
401 1.1 riastrad
402 1.1 riastrad rump_server_crypto_start $SOCK_PEER2 netinet6 wg
403 1.1 riastrad rump_server_add_iface $SOCK_PEER2 shmif0 $BUS
404 1.1 riastrad
405 1.1 riastrad # It sets key_priv_local key_pub_local key_priv_peer key_pub_peer
406 1.1 riastrad generate_keys
407 1.1 riastrad key_priv_peer2=$(wg-keygen)
408 1.1 riastrad key_pub_peer2=$(echo $key_priv_peer2| wg-keygen --pub)
409 1.1 riastrad
410 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
411 1.1 riastrad setup_common shmif0 inet $ip_local 24
412 1.1 riastrad setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local"
413 1.2 roy add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32
414 1.2 roy add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32
415 1.4 simonb $ifconfig -w 10
416 1.1 riastrad
417 1.1 riastrad export RUMP_SERVER=$SOCK_PEER
418 1.1 riastrad setup_common shmif0 inet $ip_peer 24
419 1.1 riastrad setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer"
420 1.2 roy add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
421 1.4 simonb $ifconfig -w 10
422 1.1 riastrad
423 1.1 riastrad export RUMP_SERVER=$SOCK_PEER2
424 1.1 riastrad setup_common shmif0 inet $ip_peer2 24
425 1.1 riastrad setup_wg_common wg0 inet $ip_wg_peer2 24 $port "$key_priv_peer2"
426 1.1 riastrad add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32
427 1.4 simonb $ifconfig -w 10
428 1.1 riastrad
429 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
430 1.1 riastrad
431 1.1 riastrad extract_new_packets $BUS > $outfile
432 1.1 riastrad $DEBUG && cat $outfile
433 1.1 riastrad
434 1.1 riastrad $ping $ip_wg_peer
435 1.1 riastrad
436 1.1 riastrad extract_new_packets $BUS > $outfile
437 1.1 riastrad $DEBUG && cat $outfile
438 1.1 riastrad
439 1.1 riastrad $ping $ip_wg_peer2
440 1.1 riastrad
441 1.1 riastrad extract_new_packets $BUS > $outfile
442 1.1 riastrad $DEBUG && cat $outfile
443 1.1 riastrad
444 1.1 riastrad export RUMP_SERVER=$SOCK_LOCAL
445 1.1 riastrad $ifconfig wg0 destroy
446 1.1 riastrad export RUMP_SERVER=$SOCK_PEER
447 1.1 riastrad $ifconfig wg0 destroy
448 1.1 riastrad export RUMP_SERVER=$SOCK_PEER2
449 1.1 riastrad $ifconfig wg0 destroy
450 1.1 riastrad }
451 1.1 riastrad
452 1.1 riastrad wg_multiple_peers_cleanup()
453 1.1 riastrad {
454 1.1 riastrad
455 1.1 riastrad $DEBUG && dump
456 1.1 riastrad cleanup
457 1.1 riastrad }
458 1.1 riastrad
459 1.1 riastrad atf_init_test_cases()
460 1.1 riastrad {
461 1.1 riastrad
462 1.1 riastrad add_basic_test ipv4 ipv4
463 1.1 riastrad add_basic_test ipv4 ipv6
464 1.1 riastrad add_basic_test ipv6 ipv4
465 1.1 riastrad add_basic_test ipv6 ipv6
466 1.1 riastrad
467 1.1 riastrad add_payload_sizes_test ipv4 ipv4
468 1.1 riastrad add_payload_sizes_test ipv4 ipv6
469 1.1 riastrad add_payload_sizes_test ipv6 ipv4
470 1.1 riastrad add_payload_sizes_test ipv6 ipv6
471 1.1 riastrad
472 1.1 riastrad atf_add_test_case wg_create_destroy
473 1.1 riastrad atf_add_test_case wg_create_destroy_peers_ipv4
474 1.1 riastrad atf_add_test_case wg_create_destroy_peers_ipv6
475 1.1 riastrad atf_add_test_case wg_multiple_interfaces
476 1.1 riastrad atf_add_test_case wg_multiple_peers
477 1.1 riastrad }
478