Home | History | Annotate | Line # | Download | only in route
t_route.sh revision 1.6.2.2
      1  1.6.2.2  pgoyette #	$NetBSD: t_route.sh,v 1.6.2.2 2017/04/26 02:53:34 pgoyette Exp $
      2      1.1     ozaki #
      3      1.1     ozaki # Copyright (c) 2016 Internet Initiative Japan Inc.
      4      1.1     ozaki # All rights reserved.
      5      1.1     ozaki #
      6      1.1     ozaki # Redistribution and use in source and binary forms, with or without
      7      1.1     ozaki # modification, are permitted provided that the following conditions
      8      1.1     ozaki # are met:
      9      1.1     ozaki # 1. Redistributions of source code must retain the above copyright
     10      1.1     ozaki #    notice, this list of conditions and the following disclaimer.
     11      1.1     ozaki # 2. Redistributions in binary form must reproduce the above copyright
     12      1.1     ozaki #    notice, this list of conditions and the following disclaimer in the
     13      1.1     ozaki #    documentation and/or other materials provided with the distribution.
     14      1.1     ozaki #
     15      1.1     ozaki # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     16      1.1     ozaki # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     17      1.1     ozaki # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18      1.1     ozaki # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     19      1.1     ozaki # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20      1.1     ozaki # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21      1.1     ozaki # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22      1.1     ozaki # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23      1.1     ozaki # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24      1.1     ozaki # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25      1.1     ozaki # POSSIBILITY OF SUCH DAMAGE.
     26      1.1     ozaki #
     27      1.1     ozaki 
     28      1.2     ozaki # non_subnet_gateway
     29      1.1     ozaki SOCK_CLIENT=unix://commsock1
     30      1.1     ozaki SOCK_GW=unix://commsock2
     31      1.1     ozaki BUS=bus1
     32      1.1     ozaki 
     33      1.2     ozaki # command_get
     34      1.2     ozaki SOCKSRC=unix://commsock1
     35      1.2     ozaki SOCKFWD=unix://commsock2
     36      1.2     ozaki SOCKDST=unix://commsock3
     37      1.2     ozaki IP4SRC=10.0.1.2
     38      1.2     ozaki IP4SRCGW=10.0.1.1
     39      1.2     ozaki IP4DSTGW=10.0.2.1
     40      1.2     ozaki IP4DST=10.0.2.2
     41      1.2     ozaki IP4DST_BCAST=10.0.2.255
     42      1.2     ozaki IP6SRC=fc00:0:0:1::2
     43      1.2     ozaki IP6SRCGW=fc00:0:0:1::1
     44      1.2     ozaki IP6DSTGW=fc00:0:0:2::1
     45      1.2     ozaki IP6DST=fc00:0:0:2::2
     46      1.2     ozaki BUS_SRCGW=bus1
     47      1.2     ozaki BUS_DSTGW=bus2
     48  1.6.2.2  pgoyette # command_add
     49  1.6.2.2  pgoyette SOCKHOST=unix://commsock1
     50      1.2     ozaki 
     51  1.6.2.1  pgoyette DEBUG=${DEBUG:-false}
     52      1.1     ozaki TIMEOUT=1
     53      1.1     ozaki PING_OPTS="-n -c 1 -w $TIMEOUT"
     54      1.1     ozaki 
     55      1.5     ozaki atf_test_case route_non_subnet_gateway cleanup
     56      1.5     ozaki route_non_subnet_gateway_head()
     57      1.1     ozaki {
     58      1.1     ozaki 
     59      1.1     ozaki 	atf_set "descr" "tests of a gateway not on the local subnet"
     60      1.1     ozaki 	atf_set "require.progs" "rump_server"
     61      1.1     ozaki }
     62      1.1     ozaki 
     63      1.5     ozaki route_non_subnet_gateway_body()
     64      1.1     ozaki {
     65      1.1     ozaki 
     66  1.6.2.1  pgoyette 	rump_server_start $SOCK_CLIENT
     67  1.6.2.1  pgoyette 	rump_server_start $SOCK_GW
     68      1.1     ozaki 
     69      1.1     ozaki 	export RUMP_SERVER=${SOCK_GW}
     70  1.6.2.1  pgoyette 	rump_server_add_iface $SOCK_GW shmif0 $BUS
     71      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1
     72      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 up
     73      1.1     ozaki 
     74      1.1     ozaki 	# The gateway knows the client
     75      1.1     ozaki 	atf_check -s exit:0 -o match:'add net 10.0.0.1: gateway shmif0' \
     76      1.1     ozaki 	    rump.route add -net 10.0.0.1/32 -link -cloning -iface shmif0
     77      1.1     ozaki 
     78      1.1     ozaki 	$DEBUG && rump.netstat -nr -f inet
     79      1.1     ozaki 
     80      1.1     ozaki 	export RUMP_SERVER=${SOCK_CLIENT}
     81  1.6.2.1  pgoyette 	rump_server_add_iface $SOCK_CLIENT shmif0 $BUS
     82      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/32
     83      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 up
     84  1.6.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
     85      1.1     ozaki 
     86      1.1     ozaki 	$DEBUG && rump.netstat -nr -f inet
     87      1.1     ozaki 
     88      1.1     ozaki 	# Don't know a route to the gateway yet
     89      1.1     ozaki 	atf_check -s not-exit:0 -o match:'100.0% packet loss' \
     90      1.1     ozaki 	    -e match:'No route to host' rump.ping $PING_OPTS 192.168.0.1
     91      1.1     ozaki 
     92      1.1     ozaki 	# Teach a route to the gateway
     93      1.1     ozaki 	atf_check -s exit:0 -o match:'add net 192.168.0.1: gateway shmif0' \
     94      1.1     ozaki 	    rump.route add -net 192.168.0.1/32 -link -cloning -iface shmif0
     95      1.1     ozaki 	atf_check -s exit:0 -o match:'add net default: gateway 192.168.0.1' \
     96      1.1     ozaki 	    rump.route add default -ifa 10.0.0.1 192.168.0.1
     97      1.1     ozaki 
     98      1.1     ozaki 	$DEBUG && rump.netstat -nr -f inet
     99      1.1     ozaki 
    100      1.1     ozaki 	# Be reachable to the gateway
    101      1.1     ozaki 	atf_check -s exit:0 -o ignore rump.ping $PING_OPTS 192.168.0.1
    102      1.1     ozaki 
    103  1.6.2.1  pgoyette 	rump_server_destroy_ifaces
    104      1.1     ozaki }
    105      1.1     ozaki 
    106      1.5     ozaki route_non_subnet_gateway_cleanup()
    107      1.1     ozaki {
    108      1.1     ozaki 
    109  1.6.2.1  pgoyette 	$DEBUG && dump
    110  1.6.2.1  pgoyette 	cleanup
    111      1.1     ozaki }
    112      1.1     ozaki 
    113      1.5     ozaki atf_test_case route_command_get cleanup
    114      1.5     ozaki atf_test_case route_command_get6 cleanup
    115      1.5     ozaki route_command_get_head()
    116      1.2     ozaki {
    117      1.2     ozaki 
    118      1.2     ozaki 	atf_set "descr" "tests of route get command"
    119      1.2     ozaki 	atf_set "require.progs" "rump_server"
    120      1.2     ozaki }
    121      1.2     ozaki 
    122      1.5     ozaki route_command_get6_head()
    123      1.2     ozaki {
    124      1.2     ozaki 
    125      1.2     ozaki 	atf_set "descr" "tests of route get command (IPv6)"
    126      1.2     ozaki 	atf_set "require.progs" "rump_server"
    127      1.2     ozaki }
    128      1.2     ozaki 
    129      1.2     ozaki setup_endpoint()
    130      1.2     ozaki {
    131      1.2     ozaki 	local sock=${1}
    132      1.2     ozaki 	local addr=${2}
    133      1.2     ozaki 	local bus=${3}
    134      1.2     ozaki 	local mode=${4}
    135      1.2     ozaki 	local gw=${5}
    136      1.2     ozaki 
    137      1.2     ozaki 	export RUMP_SERVER=${sock}
    138  1.6.2.1  pgoyette 	rump_server_add_iface $sock shmif0 $bus
    139      1.2     ozaki 	if [ $mode = "ipv6" ]; then
    140      1.2     ozaki 		atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr}
    141      1.2     ozaki 		atf_check -s exit:0 -o ignore rump.route add -inet6 default ${gw}
    142      1.2     ozaki 	else
    143      1.2     ozaki 		atf_check -s exit:0 rump.ifconfig shmif0 inet ${addr} netmask 0xffffff00
    144      1.2     ozaki 		atf_check -s exit:0 -o ignore rump.route add default ${gw}
    145      1.2     ozaki 	fi
    146      1.2     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 up
    147  1.6.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
    148      1.2     ozaki 
    149      1.2     ozaki 	if $DEBUG; then
    150      1.2     ozaki 		rump.ifconfig shmif0
    151      1.2     ozaki 		rump.netstat -nr
    152      1.2     ozaki 	fi
    153      1.2     ozaki }
    154      1.2     ozaki 
    155      1.2     ozaki setup_forwarder()
    156      1.2     ozaki {
    157      1.2     ozaki 	mode=${1}
    158      1.2     ozaki 
    159  1.6.2.1  pgoyette 	rump_server_add_iface $SOCKFWD shmif0 $BUS_SRCGW
    160  1.6.2.1  pgoyette 	rump_server_add_iface $SOCKFWD shmif1 $BUS_DSTGW
    161      1.2     ozaki 
    162  1.6.2.1  pgoyette 	export RUMP_SERVER=$SOCKFWD
    163      1.2     ozaki 	if [ $mode = "ipv6" ]; then
    164      1.2     ozaki 		atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6SRCGW}
    165      1.2     ozaki 		atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6DSTGW}
    166      1.2     ozaki 	else
    167      1.2     ozaki 		atf_check -s exit:0 rump.ifconfig shmif0 inet ${IP4SRCGW} netmask 0xffffff00
    168      1.2     ozaki 		atf_check -s exit:0 rump.ifconfig shmif1 inet ${IP4DSTGW} netmask 0xffffff00
    169      1.2     ozaki 	fi
    170      1.2     ozaki 
    171      1.2     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 up
    172      1.2     ozaki 	atf_check -s exit:0 rump.ifconfig shmif1 up
    173  1.6.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
    174      1.2     ozaki 
    175      1.2     ozaki 	if $DEBUG; then
    176      1.2     ozaki 		rump.netstat -nr
    177      1.2     ozaki 		if [ $mode = "ipv6" ]; then
    178      1.2     ozaki 			rump.sysctl net.inet6.ip6.forwarding
    179      1.2     ozaki 		else
    180      1.2     ozaki 			rump.sysctl net.inet.ip.forwarding
    181      1.2     ozaki 		fi
    182      1.2     ozaki 	fi
    183      1.2     ozaki }
    184      1.2     ozaki 
    185      1.2     ozaki setup_forwarding()
    186      1.2     ozaki {
    187      1.2     ozaki 	export RUMP_SERVER=$SOCKFWD
    188      1.2     ozaki 	atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.ip.forwarding=1
    189      1.2     ozaki }
    190      1.2     ozaki 
    191      1.2     ozaki setup_forwarding6()
    192      1.2     ozaki {
    193      1.2     ozaki 	export RUMP_SERVER=$SOCKFWD
    194      1.2     ozaki 	atf_check -s exit:0 -o ignore rump.sysctl -w net.inet6.ip6.forwarding=1
    195      1.2     ozaki }
    196      1.2     ozaki 
    197      1.2     ozaki setup()
    198      1.2     ozaki {
    199      1.2     ozaki 
    200  1.6.2.1  pgoyette 	rump_server_start $SOCKSRC
    201  1.6.2.1  pgoyette 	rump_server_start $SOCKFWD
    202  1.6.2.1  pgoyette 	rump_server_start $SOCKDST
    203      1.2     ozaki 
    204      1.2     ozaki 	setup_endpoint $SOCKSRC $IP4SRC $BUS_SRCGW ipv4 $IP4SRCGW
    205      1.2     ozaki 	setup_endpoint $SOCKDST $IP4DST $BUS_DSTGW ipv4 $IP4DSTGW
    206      1.2     ozaki 	setup_forwarder ipv4
    207      1.2     ozaki }
    208      1.2     ozaki 
    209      1.2     ozaki setup6()
    210      1.2     ozaki {
    211      1.2     ozaki 
    212  1.6.2.1  pgoyette 	rump_server_start $SOCKSRC netinet6
    213  1.6.2.1  pgoyette 	rump_server_start $SOCKFWD netinet6
    214  1.6.2.1  pgoyette 	rump_server_start $SOCKDST netinet6
    215      1.2     ozaki 
    216      1.2     ozaki 	setup_endpoint $SOCKSRC $IP6SRC $BUS_SRCGW ipv6 $IP6SRCGW
    217      1.2     ozaki 	setup_endpoint $SOCKDST $IP6DST $BUS_DSTGW ipv6 $IP6DSTGW
    218      1.2     ozaki 	setup_forwarder ipv6
    219      1.2     ozaki }
    220      1.2     ozaki 
    221      1.2     ozaki test_route_get()
    222      1.2     ozaki {
    223      1.2     ozaki 
    224      1.2     ozaki 	export RUMP_SERVER=$SOCKSRC
    225      1.2     ozaki 	$DEBUG && rump.netstat -nr -f inet
    226      1.2     ozaki 	$DEBUG && rump.arp -n -a
    227      1.2     ozaki 
    228      1.2     ozaki 	# Make sure an ARP cache to the gateway doesn't exist
    229      1.2     ozaki 	rump.arp -d $IP4SRCGW
    230      1.2     ozaki 
    231      1.2     ozaki 	# Local
    232      1.2     ozaki 	cat >./expect <<-EOF
    233      1.2     ozaki    route to: 10.0.1.2
    234      1.2     ozaki destination: 10.0.1.2
    235      1.2     ozaki  local addr: 10.0.1.2
    236      1.2     ozaki   interface: lo0
    237      1.2     ozaki       flags: <UP,HOST,DONE,LLINFO,LOCAL>
    238      1.2     ozaki  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
    239      1.2     ozaki 	EOF
    240      1.2     ozaki 	rump.route -n get $IP4SRC > ./output
    241      1.2     ozaki 	$DEBUG && cat ./expect ./output
    242      1.6     ozaki 	# XXX: omit the last line because expire is unstable on rump kernel.
    243      1.6     ozaki 	sed -i '$d' ./output
    244      1.3     ozaki 	atf_check -s exit:0 diff ./expect ./output
    245      1.2     ozaki 
    246      1.2     ozaki 	# Neighbor
    247      1.2     ozaki 	cat >./expect <<-EOF
    248      1.2     ozaki    route to: 10.0.1.1
    249      1.2     ozaki destination: 10.0.1.0
    250      1.2     ozaki        mask: 255.255.255.0
    251      1.2     ozaki  local addr: 10.0.1.2
    252      1.2     ozaki   interface: shmif0
    253      1.4     ozaki       flags: <UP,DONE,CONNECTED>
    254      1.2     ozaki  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
    255      1.2     ozaki 	EOF
    256      1.2     ozaki 	rump.route -n get $IP4SRCGW > ./output
    257      1.2     ozaki 	$DEBUG && cat ./expect ./output
    258      1.6     ozaki 	sed -i '$d' ./output
    259      1.3     ozaki 	atf_check -s exit:0 diff ./expect ./output
    260      1.2     ozaki 
    261      1.2     ozaki 	# Remote host
    262      1.2     ozaki 	cat >./expect <<-EOF
    263      1.2     ozaki    route to: 10.0.2.2
    264      1.2     ozaki destination: default
    265      1.2     ozaki        mask: default
    266      1.2     ozaki     gateway: 10.0.1.1
    267      1.2     ozaki  local addr: 10.0.1.2
    268      1.2     ozaki   interface: shmif0
    269      1.2     ozaki       flags: <UP,GATEWAY,DONE,STATIC>
    270      1.2     ozaki  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
    271      1.2     ozaki 	EOF
    272      1.2     ozaki 	rump.route -n get $IP4DST > ./output
    273      1.2     ozaki 	$DEBUG && cat ./expect ./output
    274      1.6     ozaki 	sed -i '$d' ./output
    275      1.3     ozaki 	atf_check -s exit:0 diff ./expect ./output
    276      1.2     ozaki 
    277      1.2     ozaki 	# Create a ARP cache
    278      1.2     ozaki 	atf_check -s exit:0 -o ignore rump.ping -q -n -w $TIMEOUT -c 1 $IP4SRCGW
    279      1.2     ozaki 
    280      1.4     ozaki 	# Neighbor with a cache (no different from w/o cache)
    281      1.2     ozaki 	cat >./expect <<-EOF
    282      1.2     ozaki    route to: 10.0.1.1
    283      1.4     ozaki destination: 10.0.1.0
    284      1.4     ozaki        mask: 255.255.255.0
    285      1.2     ozaki  local addr: 10.0.1.2
    286      1.2     ozaki   interface: shmif0
    287      1.4     ozaki       flags: <UP,DONE,CONNECTED>
    288      1.2     ozaki  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
    289      1.2     ozaki 	EOF
    290      1.2     ozaki 	rump.route -n get $IP4SRCGW > ./output
    291      1.2     ozaki 	$DEBUG && cat ./expect ./output
    292      1.6     ozaki 	sed -i '$d' ./output
    293      1.4     ozaki 	atf_check -s exit:0 diff ./expect ./output
    294      1.2     ozaki }
    295      1.2     ozaki 
    296      1.2     ozaki test_route_get6()
    297      1.2     ozaki {
    298      1.2     ozaki 
    299      1.2     ozaki 	export RUMP_SERVER=$SOCKSRC
    300      1.2     ozaki 	$DEBUG && rump.netstat -nr -f inet
    301      1.2     ozaki 	$DEBUG && rump.ndp -n -a
    302      1.2     ozaki 
    303      1.2     ozaki 	# Make sure an ARP cache to the gateway doesn't exist
    304      1.2     ozaki 	rump.ndp -d $IP6SRCGW
    305      1.2     ozaki 
    306      1.2     ozaki 	# Local
    307      1.2     ozaki 	cat >./expect <<-EOF
    308      1.2     ozaki    route to: fc00:0:0:1::2
    309      1.2     ozaki destination: fc00:0:0:1::2
    310      1.2     ozaki  local addr: fc00:0:0:1::2
    311      1.2     ozaki   interface: lo0
    312      1.2     ozaki       flags: <UP,HOST,DONE,LLINFO,LOCAL>
    313      1.2     ozaki  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
    314      1.2     ozaki 	EOF
    315      1.2     ozaki 	rump.route -n get -inet6 $IP6SRC > ./output
    316      1.2     ozaki 	$DEBUG && cat ./expect ./output
    317      1.6     ozaki 	sed -i '$d' ./output
    318      1.3     ozaki 	atf_check -s exit:0 diff ./expect ./output
    319      1.2     ozaki 
    320      1.2     ozaki 	# Neighbor
    321      1.2     ozaki 	cat >./expect <<-EOF
    322      1.2     ozaki    route to: fc00:0:0:1::1
    323      1.2     ozaki destination: fc00:0:0:1::
    324      1.2     ozaki        mask: ffff:ffff:ffff:ffff::
    325      1.2     ozaki  local addr: fc00:0:0:1::2
    326      1.2     ozaki   interface: shmif0
    327      1.4     ozaki       flags: <UP,DONE,CONNECTED>
    328      1.2     ozaki  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
    329      1.2     ozaki 	EOF
    330      1.2     ozaki 	rump.route -n get -inet6 $IP6SRCGW > ./output
    331      1.2     ozaki 	$DEBUG && cat ./expect ./output
    332      1.6     ozaki 	sed -i '$d' ./output
    333      1.3     ozaki 	atf_check -s exit:0 diff ./expect ./output
    334      1.2     ozaki 
    335      1.2     ozaki 	# Remote host
    336      1.2     ozaki 	cat >./expect <<-EOF
    337      1.2     ozaki    route to: fc00:0:0:2::2
    338      1.2     ozaki destination: ::
    339      1.2     ozaki        mask: default
    340      1.2     ozaki     gateway: fc00:0:0:1::1
    341      1.2     ozaki  local addr: fc00:0:0:1::2
    342      1.2     ozaki   interface: shmif0
    343      1.2     ozaki       flags: <UP,GATEWAY,DONE,STATIC>
    344      1.2     ozaki  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
    345      1.2     ozaki 	EOF
    346      1.2     ozaki 	rump.route -n get -inet6 $IP6DST > ./output
    347      1.2     ozaki 	$DEBUG && cat ./expect ./output
    348      1.6     ozaki 	sed -i '$d' ./output
    349      1.3     ozaki 	atf_check -s exit:0 diff ./expect ./output
    350      1.2     ozaki 
    351      1.2     ozaki 	# Create a NDP cache
    352      1.2     ozaki 	atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6SRCGW
    353      1.2     ozaki 
    354      1.4     ozaki 	# Neighbor with a cache (no different from w/o cache)
    355      1.2     ozaki 	cat >./expect <<-EOF
    356      1.2     ozaki    route to: fc00:0:0:1::1
    357      1.4     ozaki destination: fc00:0:0:1::
    358      1.4     ozaki        mask: ffff:ffff:ffff:ffff::
    359      1.2     ozaki  local addr: fc00:0:0:1::2
    360      1.2     ozaki   interface: shmif0
    361      1.4     ozaki       flags: <UP,DONE,CONNECTED>
    362      1.2     ozaki  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
    363      1.2     ozaki 	EOF
    364      1.2     ozaki 	rump.route -n get -inet6 $IP6SRCGW > ./output
    365      1.2     ozaki 	$DEBUG && cat ./expect ./output
    366      1.6     ozaki 	sed -i '$d' ./output
    367      1.3     ozaki 	atf_check -s exit:0 diff ./expect ./output
    368      1.2     ozaki }
    369      1.2     ozaki 
    370      1.5     ozaki route_command_get_body()
    371      1.2     ozaki {
    372      1.2     ozaki 
    373      1.2     ozaki 	setup
    374      1.2     ozaki 	setup_forwarding
    375      1.2     ozaki 	test_route_get
    376  1.6.2.1  pgoyette 	rump_server_destroy_ifaces
    377      1.2     ozaki }
    378      1.2     ozaki 
    379      1.5     ozaki route_command_get6_body()
    380      1.2     ozaki {
    381      1.2     ozaki 
    382      1.2     ozaki 	setup6
    383      1.2     ozaki 	setup_forwarding6
    384      1.2     ozaki 	test_route_get6
    385  1.6.2.1  pgoyette 	rump_server_destroy_ifaces
    386      1.2     ozaki }
    387      1.2     ozaki 
    388      1.5     ozaki route_command_get_cleanup()
    389      1.2     ozaki {
    390  1.6.2.1  pgoyette 
    391      1.2     ozaki 	$DEBUG && dump
    392      1.2     ozaki 	cleanup
    393      1.2     ozaki }
    394      1.2     ozaki 
    395      1.5     ozaki route_command_get6_cleanup()
    396      1.2     ozaki {
    397  1.6.2.1  pgoyette 
    398  1.6.2.1  pgoyette 	$DEBUG && dump
    399      1.2     ozaki 	cleanup
    400      1.2     ozaki }
    401      1.2     ozaki 
    402  1.6.2.2  pgoyette atf_test_case route_default_reject cleanup
    403  1.6.2.2  pgoyette route_default_reject_head()
    404  1.6.2.2  pgoyette {
    405  1.6.2.2  pgoyette 
    406  1.6.2.2  pgoyette 	atf_set "descr" "tests for making a default route reject"
    407  1.6.2.2  pgoyette 	atf_set "require.progs" "rump_server"
    408  1.6.2.2  pgoyette }
    409  1.6.2.2  pgoyette 
    410  1.6.2.2  pgoyette route_default_reject_body()
    411  1.6.2.2  pgoyette {
    412  1.6.2.2  pgoyette 
    413  1.6.2.2  pgoyette 	rump_server_start $SOCKSRC netinet6
    414  1.6.2.2  pgoyette 	rump_server_add_iface $SOCKSRC shmif0 $BUS_SRCGW
    415  1.6.2.2  pgoyette 
    416  1.6.2.2  pgoyette 	export RUMP_SERVER=$SOCKSRC
    417  1.6.2.2  pgoyette 
    418  1.6.2.2  pgoyette 	# From /etc/rc.d/network
    419  1.6.2.2  pgoyette 	atf_check -s exit:0 -o match:'add net ::0.0.0.0: gateway ::1' \
    420  1.6.2.2  pgoyette 	    rump.route add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject
    421  1.6.2.2  pgoyette 
    422  1.6.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6SRC/64 up
    423  1.6.2.2  pgoyette 	$DEBUG && rump.netstat -nr -f inet6
    424  1.6.2.2  pgoyette 	atf_check -s exit:0 -o match:"add net default: gateway $IP6SRCGW" \
    425  1.6.2.2  pgoyette 	    rump.route add -inet6 default $IP6SRCGW
    426  1.6.2.2  pgoyette 	$DEBUG && rump.netstat -nr -f inet6
    427  1.6.2.2  pgoyette 	$DEBUG && rump.route -n get -inet6 default
    428  1.6.2.2  pgoyette 	atf_check -s exit:0 -o match:'change net default' \
    429  1.6.2.2  pgoyette 	    rump.route change -inet6 default -reject
    430  1.6.2.2  pgoyette 	$DEBUG && rump.netstat -nr -f inet6
    431  1.6.2.2  pgoyette 
    432  1.6.2.2  pgoyette 	rump_server_destroy_ifaces
    433  1.6.2.2  pgoyette }
    434  1.6.2.2  pgoyette 
    435  1.6.2.2  pgoyette route_default_reject_cleanup()
    436  1.6.2.2  pgoyette {
    437  1.6.2.2  pgoyette 
    438  1.6.2.2  pgoyette 	$DEBUG && dump
    439  1.6.2.2  pgoyette 	cleanup
    440  1.6.2.2  pgoyette }
    441  1.6.2.2  pgoyette 
    442  1.6.2.2  pgoyette atf_test_case route_command_add cleanup
    443  1.6.2.2  pgoyette route_command_add_head()
    444  1.6.2.2  pgoyette {
    445  1.6.2.2  pgoyette 
    446  1.6.2.2  pgoyette 	atf_set "descr" "tests of route add command"
    447  1.6.2.2  pgoyette 	atf_set "require.progs" "rump_server"
    448  1.6.2.2  pgoyette }
    449  1.6.2.2  pgoyette 
    450  1.6.2.2  pgoyette route_command_add_body()
    451  1.6.2.2  pgoyette {
    452  1.6.2.2  pgoyette 
    453  1.6.2.2  pgoyette 	rump_server_start $SOCKHOST
    454  1.6.2.2  pgoyette 
    455  1.6.2.2  pgoyette 	export RUMP_SERVER=${SOCKHOST}
    456  1.6.2.2  pgoyette 	rump_server_add_iface $SOCKHOST shmif0 $BUS
    457  1.6.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/24
    458  1.6.2.2  pgoyette 
    459  1.6.2.2  pgoyette 	# Accept the route whose gateway is in a subnet of interface address
    460  1.6.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.route add \
    461  1.6.2.2  pgoyette 	    -net 10.0.1.0/24 10.0.0.2
    462  1.6.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.route add \
    463  1.6.2.2  pgoyette 	    -host 10.0.2.1 10.0.0.3
    464  1.6.2.2  pgoyette 
    465  1.6.2.2  pgoyette 	# Accept the route whose gateway is an interface
    466  1.6.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.route add \
    467  1.6.2.2  pgoyette 	    -net 10.0.3.0/24 -connected -link -iface shmif0
    468  1.6.2.2  pgoyette 
    469  1.6.2.2  pgoyette 	# Accept the route whose gateway is reachable and not RTF_GATEWAY
    470  1.6.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.route add \
    471  1.6.2.2  pgoyette 	    -net 10.0.4.0/24 10.0.3.1
    472  1.6.2.2  pgoyette 
    473  1.6.2.2  pgoyette 	# Don't accept the route whose destination is reachable and
    474  1.6.2.2  pgoyette 	# gateway is unreachable
    475  1.6.2.2  pgoyette 	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
    476  1.6.2.2  pgoyette 	    -net 10.0.1.0/26 10.0.5.1
    477  1.6.2.2  pgoyette 
    478  1.6.2.2  pgoyette 	# Don't accept the route whose gateway is reachable and RTF_GATEWAY
    479  1.6.2.2  pgoyette 	atf_check -s not-exit:0 -o ignore -e ignore rump.route add \
    480  1.6.2.2  pgoyette 	    -net 10.0.6.0/24 10.0.1.1
    481  1.6.2.2  pgoyette 
    482  1.6.2.2  pgoyette 	rump_server_destroy_ifaces
    483  1.6.2.2  pgoyette }
    484  1.6.2.2  pgoyette 
    485  1.6.2.2  pgoyette route_command_add_cleanup()
    486  1.6.2.2  pgoyette {
    487  1.6.2.2  pgoyette 
    488  1.6.2.2  pgoyette 	$DEBUG && dump
    489  1.6.2.2  pgoyette 	cleanup
    490  1.6.2.2  pgoyette }
    491  1.6.2.2  pgoyette 
    492  1.6.2.2  pgoyette atf_test_case route_command_add6 cleanup
    493  1.6.2.2  pgoyette route_command_add6_head()
    494  1.6.2.2  pgoyette {
    495  1.6.2.2  pgoyette 
    496  1.6.2.2  pgoyette 	atf_set "descr" "tests of route add command (IPv6)"
    497  1.6.2.2  pgoyette 	atf_set "require.progs" "rump_server"
    498  1.6.2.2  pgoyette }
    499  1.6.2.2  pgoyette 
    500  1.6.2.2  pgoyette route_command_add6_body()
    501  1.6.2.2  pgoyette {
    502  1.6.2.2  pgoyette 
    503  1.6.2.2  pgoyette 	rump_server_start $SOCKHOST netinet6
    504  1.6.2.2  pgoyette 
    505  1.6.2.2  pgoyette 	export RUMP_SERVER=${SOCKHOST}
    506  1.6.2.2  pgoyette 	rump_server_add_iface $SOCKHOST shmif0 $BUS
    507  1.6.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1/64
    508  1.6.2.2  pgoyette 
    509  1.6.2.2  pgoyette 	# Accept the route whose gateway is in a subnet of interface address
    510  1.6.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.route add -inet6\
    511  1.6.2.2  pgoyette 	    -net fc00:1::0/64 fc00::2
    512  1.6.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.route add -inet6\
    513  1.6.2.2  pgoyette 	    -host fc00:2::1 fc00::3
    514  1.6.2.2  pgoyette 
    515  1.6.2.2  pgoyette 	# Accept the route whose gateway is an interface
    516  1.6.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.route add -inet6\
    517  1.6.2.2  pgoyette 	    -net fc00:3::0/64 -connected -link -iface shmif0
    518  1.6.2.2  pgoyette 
    519  1.6.2.2  pgoyette 	# Accept the route whose gateway is reachable and not RTF_GATEWAY
    520  1.6.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.route add -inet6\
    521  1.6.2.2  pgoyette 	    -net fc00:4::0/64 fc00:3::1
    522  1.6.2.2  pgoyette 
    523  1.6.2.2  pgoyette 	# Don't accept the route whose destination is reachable and
    524  1.6.2.2  pgoyette 	# gateway is unreachable
    525  1.6.2.2  pgoyette 	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
    526  1.6.2.2  pgoyette 	    -inet6 -net fc00::4/128 fc00:5::1
    527  1.6.2.2  pgoyette 
    528  1.6.2.2  pgoyette 	# Don't accept the route whose gateway is reachable and RTF_GATEWAY
    529  1.6.2.2  pgoyette 	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
    530  1.6.2.2  pgoyette 	    -inet6 -net fc00:6::0/64 fc00:1::1
    531  1.6.2.2  pgoyette 
    532  1.6.2.2  pgoyette 	rump_server_destroy_ifaces
    533  1.6.2.2  pgoyette }
    534  1.6.2.2  pgoyette 
    535  1.6.2.2  pgoyette route_command_add6_cleanup()
    536  1.6.2.2  pgoyette {
    537  1.6.2.2  pgoyette 
    538  1.6.2.2  pgoyette 	$DEBUG && dump
    539  1.6.2.2  pgoyette 	cleanup
    540  1.6.2.2  pgoyette }
    541  1.6.2.2  pgoyette 
    542      1.1     ozaki atf_init_test_cases()
    543      1.1     ozaki {
    544      1.1     ozaki 
    545      1.5     ozaki 	atf_add_test_case route_non_subnet_gateway
    546      1.5     ozaki 	atf_add_test_case route_command_get
    547      1.5     ozaki 	atf_add_test_case route_command_get6
    548  1.6.2.2  pgoyette 	atf_add_test_case route_default_reject
    549  1.6.2.2  pgoyette 	atf_add_test_case route_command_add
    550  1.6.2.2  pgoyette 	atf_add_test_case route_command_add6
    551      1.1     ozaki }
    552