xref: /netbsd-src/tests/net/route/t_route.sh (revision 34a1a4b9aabbaa31943bd98468335d808353e50c)
1#	$NetBSD: t_route.sh,v 1.15 2022/09/20 02:25:07 knakahara Exp $
2#
3# Copyright (c) 2016 Internet Initiative Japan Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
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
17# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
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
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
25# POSSIBILITY OF SUCH DAMAGE.
26#
27
28# non_subnet_gateway
29SOCK_CLIENT=unix://commsock1
30SOCK_GW=unix://commsock2
31BUS=bus1
32
33# command_get
34SOCKSRC=unix://commsock1
35SOCKFWD=unix://commsock2
36SOCKDST=unix://commsock3
37IP4SRC=10.0.1.2
38IP4SRCGW=10.0.1.1
39IP4DSTGW=10.0.2.1
40IP4DST=10.0.2.2
41IP4DST_BCAST=10.0.2.255
42IP6SRC=fc00:0:0:1::2
43IP6SRCGW=fc00:0:0:1::1
44IP6DSTGW=fc00:0:0:2::1
45IP6DST=fc00:0:0:2::2
46BUS_SRCGW=bus1
47BUS_DSTGW=bus2
48# command_add
49SOCKHOST=unix://commsock1
50
51DEBUG=${DEBUG:-false}
52TIMEOUT=1
53PING_OPTS="-n -c 1 -w $TIMEOUT"
54
55atf_test_case route_non_subnet_gateway cleanup
56route_non_subnet_gateway_head()
57{
58
59	atf_set "descr" "tests of a gateway not on the local subnet"
60	atf_set "require.progs" "rump_server"
61}
62
63route_non_subnet_gateway_body()
64{
65
66	rump_server_start $SOCK_CLIENT
67	rump_server_start $SOCK_GW
68
69	export RUMP_SERVER=${SOCK_GW}
70	rump_server_add_iface $SOCK_GW shmif0 $BUS
71	atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1
72	atf_check -s exit:0 rump.ifconfig shmif0 up
73
74	# The gateway knows the client
75	atf_check -s exit:0 -o match:'add net 10.0.0.1: gateway shmif0' \
76	    rump.route add -net 10.0.0.1/32 -link -cloning -iface shmif0
77
78	$DEBUG && rump.netstat -nr -f inet
79
80	export RUMP_SERVER=${SOCK_CLIENT}
81	rump_server_add_iface $SOCK_CLIENT shmif0 $BUS
82	atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/32
83	atf_check -s exit:0 rump.ifconfig shmif0 up
84	atf_check -s exit:0 rump.ifconfig -w 10
85
86	$DEBUG && rump.netstat -nr -f inet
87
88	# Don't know a route to the gateway yet
89	atf_check -s not-exit:0 -o match:'100.0% packet loss' \
90	    -e match:'No route to host' rump.ping $PING_OPTS 192.168.0.1
91
92	# Teach a route to the gateway
93	atf_check -s exit:0 -o match:'add net 192.168.0.1: gateway shmif0' \
94	    rump.route add -net 192.168.0.1/32 -link -cloning -iface shmif0
95	atf_check -s exit:0 -o match:'add net default: gateway 192.168.0.1' \
96	    rump.route add default -ifa 10.0.0.1 192.168.0.1
97
98	$DEBUG && rump.netstat -nr -f inet
99
100	# Be reachable to the gateway
101	atf_check -s exit:0 -o ignore rump.ping $PING_OPTS 192.168.0.1
102
103	rump_server_destroy_ifaces
104}
105
106route_non_subnet_gateway_cleanup()
107{
108
109	$DEBUG && dump
110	cleanup
111}
112
113atf_test_case route_command_get cleanup
114atf_test_case route_command_get6 cleanup
115route_command_get_head()
116{
117
118	atf_set "descr" "tests of route get command"
119	atf_set "require.progs" "rump_server"
120}
121
122route_command_get6_head()
123{
124
125	atf_set "descr" "tests of route get command (IPv6)"
126	atf_set "require.progs" "rump_server"
127}
128
129setup_endpoint()
130{
131	local sock=${1}
132	local addr=${2}
133	local bus=${3}
134	local mode=${4}
135	local gw=${5}
136
137	export RUMP_SERVER=${sock}
138	rump_server_add_iface $sock shmif0 $bus
139	if [ $mode = "ipv6" ]; then
140		atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr}
141		atf_check -s exit:0 -o ignore rump.route add -inet6 default ${gw}
142	else
143		atf_check -s exit:0 rump.ifconfig shmif0 inet ${addr} netmask 0xffffff00
144		atf_check -s exit:0 -o ignore rump.route add default ${gw}
145	fi
146	atf_check -s exit:0 rump.ifconfig shmif0 up
147	atf_check -s exit:0 rump.ifconfig -w 10
148
149	if $DEBUG; then
150		rump.ifconfig shmif0
151		rump.netstat -nr
152	fi
153}
154
155setup_forwarder()
156{
157	mode=${1}
158
159	rump_server_add_iface $SOCKFWD shmif0 $BUS_SRCGW
160	rump_server_add_iface $SOCKFWD shmif1 $BUS_DSTGW
161
162	export RUMP_SERVER=$SOCKFWD
163	if [ $mode = "ipv6" ]; then
164		atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6SRCGW}
165		atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6DSTGW}
166	else
167		atf_check -s exit:0 rump.ifconfig shmif0 inet ${IP4SRCGW} netmask 0xffffff00
168		atf_check -s exit:0 rump.ifconfig shmif1 inet ${IP4DSTGW} netmask 0xffffff00
169	fi
170
171	atf_check -s exit:0 rump.ifconfig shmif0 up
172	atf_check -s exit:0 rump.ifconfig shmif1 up
173	atf_check -s exit:0 rump.ifconfig -w 10
174
175	if $DEBUG; then
176		rump.netstat -nr
177		if [ $mode = "ipv6" ]; then
178			rump.sysctl net.inet6.ip6.forwarding
179		else
180			rump.sysctl net.inet.ip.forwarding
181		fi
182	fi
183}
184
185setup_forwarding()
186{
187	export RUMP_SERVER=$SOCKFWD
188	atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.ip.forwarding=1
189}
190
191setup_forwarding6()
192{
193	export RUMP_SERVER=$SOCKFWD
194	atf_check -s exit:0 -o ignore rump.sysctl -w net.inet6.ip6.forwarding=1
195}
196
197setup()
198{
199
200	rump_server_start $SOCKSRC
201	rump_server_start $SOCKFWD
202	rump_server_start $SOCKDST
203
204	setup_endpoint $SOCKSRC $IP4SRC $BUS_SRCGW ipv4 $IP4SRCGW
205	setup_endpoint $SOCKDST $IP4DST $BUS_DSTGW ipv4 $IP4DSTGW
206	setup_forwarder ipv4
207}
208
209setup6()
210{
211
212	rump_server_start $SOCKSRC netinet6
213	rump_server_start $SOCKFWD netinet6
214	rump_server_start $SOCKDST netinet6
215
216	setup_endpoint $SOCKSRC $IP6SRC $BUS_SRCGW ipv6 $IP6SRCGW
217	setup_endpoint $SOCKDST $IP6DST $BUS_DSTGW ipv6 $IP6DSTGW
218	setup_forwarder ipv6
219}
220
221test_route_get()
222{
223
224	export RUMP_SERVER=$SOCKSRC
225	$DEBUG && rump.netstat -nr -f inet
226	$DEBUG && rump.arp -n -a
227
228	# Make sure an ARP cache to the gateway doesn't exist
229	rump.arp -d $IP4SRCGW
230
231	# Local
232	cat >./expect <<-EOF
233   route to: 10.0.1.2
234destination: 10.0.1.2
235 local addr: 10.0.1.2
236  interface: lo0
237      flags: 0x40045<UP,HOST,DONE,LOCAL>
238 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
239	EOF
240	rump.route -n get $IP4SRC > ./output
241	$DEBUG && cat ./expect ./output
242	# XXX: omit the last line because expire is unstable on rump kernel.
243	sed -i '$d' ./output
244	atf_check -s exit:0 diff ./expect ./output
245
246	# Neighbor
247	cat >./expect <<-EOF
248   route to: 10.0.1.1
249destination: 10.0.1.0
250       mask: 255.255.255.0
251 local addr: 10.0.1.2
252  interface: shmif0
253      flags: 0x141<UP,DONE,CONNECTED>
254 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
255	EOF
256	rump.route -n get $IP4SRCGW > ./output
257	$DEBUG && cat ./expect ./output
258	sed -i '$d' ./output
259	atf_check -s exit:0 diff ./expect ./output
260
261	# Remote host
262	cat >./expect <<-EOF
263   route to: 10.0.2.2
264destination: default
265       mask: default
266    gateway: 10.0.1.1
267 local addr: 10.0.1.2
268  interface: shmif0
269      flags: 0x843<UP,GATEWAY,DONE,STATIC>
270 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
271	EOF
272	rump.route -n get $IP4DST > ./output
273	$DEBUG && cat ./expect ./output
274	sed -i '$d' ./output
275	atf_check -s exit:0 diff ./expect ./output
276
277	# Create a ARP cache
278	atf_check -s exit:0 -o ignore rump.ping -q -n -w $TIMEOUT -c 1 $IP4SRCGW
279
280	# Neighbor with a cache (no different from w/o cache)
281	cat >./expect <<-EOF
282   route to: 10.0.1.1
283destination: 10.0.1.0
284       mask: 255.255.255.0
285 local addr: 10.0.1.2
286  interface: shmif0
287      flags: 0x141<UP,DONE,CONNECTED>
288 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
289	EOF
290	rump.route -n get $IP4SRCGW > ./output
291	$DEBUG && cat ./expect ./output
292	sed -i '$d' ./output
293	atf_check -s exit:0 diff ./expect ./output
294}
295
296test_route_get6()
297{
298
299	export RUMP_SERVER=$SOCKSRC
300	$DEBUG && rump.netstat -nr -f inet
301	$DEBUG && rump.ndp -n -a
302
303	# Make sure an ARP cache to the gateway doesn't exist
304	rump.ndp -d $IP6SRCGW
305
306	# Local
307	cat >./expect <<-EOF
308   route to: fc00:0:0:1::2
309destination: fc00:0:0:1::2
310 local addr: fc00:0:0:1::2
311  interface: lo0
312      flags: 0x40045<UP,HOST,DONE,LOCAL>
313 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
314	EOF
315	rump.route -n get -inet6 $IP6SRC > ./output
316	$DEBUG && cat ./expect ./output
317	sed -i '$d' ./output
318	atf_check -s exit:0 diff ./expect ./output
319
320	# Neighbor
321	cat >./expect <<-EOF
322   route to: fc00:0:0:1::1
323destination: fc00:0:0:1::
324       mask: ffff:ffff:ffff:ffff::
325 local addr: fc00:0:0:1::2
326  interface: shmif0
327      flags: 0x141<UP,DONE,CONNECTED>
328 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
329	EOF
330	rump.route -n get -inet6 $IP6SRCGW > ./output
331	$DEBUG && cat ./expect ./output
332	sed -i '$d' ./output
333	atf_check -s exit:0 diff ./expect ./output
334
335	# Remote host
336	cat >./expect <<-EOF
337   route to: fc00:0:0:2::2
338destination: ::
339       mask: default
340    gateway: fc00:0:0:1::1
341 local addr: fc00:0:0:1::2
342  interface: shmif0
343      flags: 0x843<UP,GATEWAY,DONE,STATIC>
344 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
345	EOF
346	rump.route -n get -inet6 $IP6DST > ./output
347	$DEBUG && cat ./expect ./output
348	sed -i '$d' ./output
349	atf_check -s exit:0 diff ./expect ./output
350
351	# Create a NDP cache
352	atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6SRCGW
353
354	# Neighbor with a cache (no different from w/o cache)
355	cat >./expect <<-EOF
356   route to: fc00:0:0:1::1
357destination: fc00:0:0:1::
358       mask: ffff:ffff:ffff:ffff::
359 local addr: fc00:0:0:1::2
360  interface: shmif0
361      flags: 0x141<UP,DONE,CONNECTED>
362 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
363	EOF
364	rump.route -n get -inet6 $IP6SRCGW > ./output
365	$DEBUG && cat ./expect ./output
366	sed -i '$d' ./output
367	atf_check -s exit:0 diff ./expect ./output
368}
369
370route_command_get_body()
371{
372
373	setup
374	setup_forwarding
375	test_route_get
376	rump_server_destroy_ifaces
377}
378
379route_command_get6_body()
380{
381
382	setup6
383	setup_forwarding6
384	test_route_get6
385	rump_server_destroy_ifaces
386}
387
388route_command_get_cleanup()
389{
390
391	$DEBUG && dump
392	cleanup
393}
394
395route_command_get6_cleanup()
396{
397
398	$DEBUG && dump
399	cleanup
400}
401
402atf_test_case route_default_reject cleanup
403route_default_reject_head()
404{
405
406	atf_set "descr" "tests for making a default route reject"
407	atf_set "require.progs" "rump_server"
408}
409
410route_default_reject_body()
411{
412
413	rump_server_start $SOCKSRC netinet6
414	rump_server_add_iface $SOCKSRC shmif0 $BUS_SRCGW
415
416	export RUMP_SERVER=$SOCKSRC
417
418	# From /etc/rc.d/network
419	atf_check -s exit:0 -o match:'add net ::0.0.0.0: gateway ::1' \
420	    rump.route add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject
421
422	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6SRC/64 up
423	$DEBUG && rump.netstat -nr -f inet6
424	atf_check -s exit:0 -o match:"add net default: gateway $IP6SRCGW" \
425	    rump.route add -inet6 default $IP6SRCGW
426	$DEBUG && rump.netstat -nr -f inet6
427	$DEBUG && rump.route -n get -inet6 default
428	atf_check -s exit:0 -o match:'change net default' \
429	    rump.route change -inet6 default -reject
430	$DEBUG && rump.netstat -nr -f inet6
431
432	rump_server_destroy_ifaces
433}
434
435route_default_reject_cleanup()
436{
437
438	$DEBUG && dump
439	cleanup
440}
441
442atf_test_case route_command_add cleanup
443route_command_add_head()
444{
445
446	atf_set "descr" "tests of route add command"
447	atf_set "require.progs" "rump_server"
448}
449
450route_command_add_body()
451{
452
453	rump_server_start $SOCKHOST
454
455	export RUMP_SERVER=${SOCKHOST}
456	rump_server_add_iface $SOCKHOST shmif0 $BUS
457	atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/24
458
459	# Accept the route whose gateway is in a subnet of interface address
460	atf_check -s exit:0 -o ignore rump.route add \
461	    -net 10.0.1.0/24 10.0.0.2
462	atf_check -s exit:0 -o ignore rump.route add \
463	    -host 10.0.2.1 10.0.0.3
464
465	# Accept the route whose gateway is an interface
466	atf_check -s exit:0 -o ignore rump.route add \
467	    -net 10.0.3.0/24 -connected -link -iface shmif0
468
469	# Accept the route whose gateway is reachable and not RTF_GATEWAY
470	atf_check -s exit:0 -o ignore rump.route add \
471	    -net 10.0.4.0/24 10.0.3.1
472
473	# Don't accept the route whose destination is reachable and
474	# gateway is unreachable
475	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
476	    -net 10.0.1.0/26 10.0.5.1
477
478	# Don't accept the route whose gateway is reachable and RTF_GATEWAY
479	atf_check -s not-exit:0 -o ignore -e ignore rump.route add \
480	    -net 10.0.6.0/24 10.0.1.1
481
482	rump_server_destroy_ifaces
483}
484
485route_command_add_cleanup()
486{
487
488	$DEBUG && dump
489	cleanup
490}
491
492atf_test_case route_command_add6 cleanup
493route_command_add6_head()
494{
495
496	atf_set "descr" "tests of route add command (IPv6)"
497	atf_set "require.progs" "rump_server"
498}
499
500route_command_add6_body()
501{
502
503	rump_server_start $SOCKHOST netinet6
504
505	export RUMP_SERVER=${SOCKHOST}
506	rump_server_add_iface $SOCKHOST shmif0 $BUS
507	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1/64
508
509	# Accept the route whose gateway is in a subnet of interface address
510	atf_check -s exit:0 -o ignore rump.route add -inet6\
511	    -net fc00:1::0/64 fc00::2
512	atf_check -s exit:0 -o ignore rump.route add -inet6\
513	    -host fc00:2::1 fc00::3
514
515	# Accept the route whose gateway is an interface
516	atf_check -s exit:0 -o ignore rump.route add -inet6\
517	    -net fc00:3::0/64 -connected -link -iface shmif0
518
519	# Accept the route whose gateway is reachable and not RTF_GATEWAY
520	atf_check -s exit:0 -o ignore rump.route add -inet6\
521	    -net fc00:4::0/64 fc00:3::1
522
523	# Don't accept the route whose destination is reachable and
524	# gateway is unreachable
525	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
526	    -inet6 -net fc00::4/128 fc00:5::1
527
528	# Don't accept the route whose gateway is reachable and RTF_GATEWAY
529	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
530	    -inet6 -net fc00:6::0/64 fc00:1::1
531
532	rump_server_destroy_ifaces
533}
534
535route_command_add6_cleanup()
536{
537
538	$DEBUG && dump
539	cleanup
540}
541
542test_route_address_removal()
543{
544
545	rump_server_start $SOCKHOST netinet6
546
547	export RUMP_SERVER=${SOCKHOST}
548	rump_server_add_iface $SOCKHOST shmif0 $BUS
549
550	#
551	# 1. test auto removal of a route that depends a removing address
552	#
553	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1/$prefix
554	atf_check -s exit:0 -o match:"add net $alt_net(/$prefix)?: gateway $addrgw" \
555	    rump.route -n add -$af -net $alt_net/$prefix $addrgw
556	$DEBUG && rump.netstat -nr -f $af
557	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1 delete
558	$DEBUG && rump.netstat -nr -f $af
559
560	# The route should be deleted on the address removal
561	atf_check -s not-exit:0 -e match:"writing to routing socket: not in table" \
562	    rump.route -n get -$af $alt_addr
563
564	#
565	# 2. test auto update of a route that depends a removing address where
566	#    there is another address with the same prefix sharing a connected
567	#    route
568	#
569	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1/$prefix
570	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr2/$prefix alias
571	atf_check -s exit:0 -o match:"add net $alt_net(/$prefix)?: gateway $addrgw" \
572	    rump.route -n add -$af -net $alt_net/$prefix $addrgw
573	$DEBUG && rump.netstat -nr -f $af
574
575	atf_check -s exit:0 -o match:"local addr: $addr1" \
576	    rump.route -n get -$af $addrgw
577	atf_check -s exit:0 -o match:"local addr: $addr1" \
578	    rump.route -n get -$af $alt_addr
579
580	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1 delete
581	$DEBUG && rump.netstat -nr -f $af
582
583	# local addr (rt_ifa) of the connected route should be changed
584	# on the address removal
585	atf_check -s exit:0 -o match:"local addr: $addr2" \
586	    rump.route -n get -$af $addrgw
587	# local addr (rt_ifa) of the related route should be changed
588	# on the address removal too
589	atf_check -s exit:0 -o match:"local addr: $addr2" \
590	    rump.route -n get -$af $alt_addr
591
592	# cleanup
593	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr2 delete
594
595	#
596	# 3. test auto update of a route that depends a removing address where
597	#    there is another address with a different (short) prefix
598	#
599	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1/$prefix
600	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr2/$prefix_short alias
601	atf_check -s exit:0 -o match:"add net $alt_net(/$prefix)?: gateway $addrgw" \
602	    rump.route -n add -$af -net $alt_net/$prefix $addrgw
603	$DEBUG && rump.netstat -nr -f $af
604
605	atf_check -s exit:0 -o match:"local addr: $addr1" \
606	    rump.route -n get -$af $addrgw
607	atf_check -s exit:0 -o match:"local addr: $addr1" \
608	    rump.route -n get -$af $alt_addr
609
610	atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1 delete
611	$DEBUG && rump.netstat -nr -f $af
612
613	# local addr (rt_ifa) of the connected route should be changed
614	# on the address removal
615	atf_check -s exit:0 -o match:"local addr: $addr2" \
616	    rump.route -n get -$af $addrgw
617	if [ $af = inet ]; then
618		# local addr (rt_ifa) of the related route should be changed
619		# on the address removal too
620		atf_check -s exit:0 -o match:"local addr: $addr2" \
621		    rump.route -n get -$af $alt_addr
622	else
623		# For IPv6, each address has its own connected route so the
624		# address removal just results in a removal of the related route
625		atf_check -s not-exit:0 \
626		    -e match:"writing to routing socket: not in table" \
627		    rump.route -n get -$af $alt_addr
628	fi
629
630	rump_server_destroy_ifaces
631}
632
633atf_test_case route_address_removal cleanup
634route_address_removal_head()
635{
636
637	atf_set "descr" "tests of auto removal/update of routes on address removal (IPv4)"
638	atf_set "require.progs" "rump_server"
639}
640
641route_address_removal_body()
642{
643	local addr1=10.0.0.1
644	local addr2=10.0.0.2
645	local addrgw=10.0.0.3
646	local prefix=24
647	local prefix_short=16
648	local alt_net=10.0.1.0
649	local alt_addr=10.0.1.1
650	local af=inet
651
652	test_route_address_removal
653}
654
655route_address_removal_cleanup()
656{
657
658	$DEBUG && dump
659	cleanup
660}
661
662atf_test_case route_address_removal6 cleanup
663route_address_removal6_head()
664{
665
666	atf_set "descr" "tests of auto removal/update of routes on address removal (IPv6)"
667	atf_set "require.progs" "rump_server"
668}
669
670route_address_removal6_body()
671{
672	local addr1=fd00::1
673	local addr2=fd00::2
674	local addrgw=fd00::3
675	local prefix=64
676	local prefix_short=32
677	local alt_net=fd00:1::0
678	local alt_addr=fd00:1::1
679	local af=inet6
680
681	test_route_address_removal
682}
683
684route_address_removal6_cleanup()
685{
686
687	$DEBUG && dump
688	cleanup
689}
690
691
692atf_init_test_cases()
693{
694
695	atf_add_test_case route_non_subnet_gateway
696	atf_add_test_case route_command_get
697	atf_add_test_case route_command_get6
698	atf_add_test_case route_default_reject
699	atf_add_test_case route_command_add
700	atf_add_test_case route_command_add6
701	atf_add_test_case route_address_removal
702	atf_add_test_case route_address_removal6
703}
704