Module Name:    src
Committed By:   ozaki-r
Date:           Fri Mar 24 03:47:25 UTC 2017

Modified Files:
        src/tests/net/route: t_route.sh

Log Message:
Add test cases for PR kern/52077

>From s-yamaguchi@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/route/t_route.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/route/t_route.sh
diff -u src/tests/net/route/t_route.sh:1.11 src/tests/net/route/t_route.sh:1.12
--- src/tests/net/route/t_route.sh:1.11	Tue Mar 21 04:03:17 2017
+++ src/tests/net/route/t_route.sh	Fri Mar 24 03:47:25 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_route.sh,v 1.11 2017/03/21 04:03:17 ozaki-r Exp $
+#	$NetBSD: t_route.sh,v 1.12 2017/03/24 03:47:25 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -45,6 +45,8 @@ IP6DSTGW=fc00:0:0:2::1
 IP6DST=fc00:0:0:2::2
 BUS_SRCGW=bus1
 BUS_DSTGW=bus2
+# command_add
+SOCKHOST=unix://commsock1
 
 DEBUG=${DEBUG:-false}
 TIMEOUT=1
@@ -437,6 +439,106 @@ route_default_reject_cleanup()
 	cleanup
 }
 
+atf_test_case route_command_add cleanup
+route_command_add_head()
+{
+
+	atf_set "descr" "tests of route add command"
+	atf_set "require.progs" "rump_server"
+}
+
+route_command_add_body()
+{
+
+	rump_server_start $SOCKHOST
+
+	export RUMP_SERVER=${SOCKHOST}
+	rump_server_add_iface $SOCKHOST shmif0 $BUS
+	atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/24
+
+	# Accept the route whose gateway is in a subnet of interface address
+	atf_check -s exit:0 -o ignore rump.route add \
+	    -net 10.0.1.0/24 10.0.0.2
+	atf_check -s exit:0 -o ignore rump.route add \
+	    -host 10.0.2.1 10.0.0.3
+
+	# Accept the route whose gateway is an interface
+	atf_check -s exit:0 -o ignore rump.route add \
+	    -net 10.0.3.0/24 -connected -link -iface shmif0
+
+	# Accept the route whose gateway is reachable and not RTF_GATEWAY
+	atf_check -s exit:0 -o ignore rump.route add \
+	    -net 10.0.4.0/24 10.0.3.1
+
+	# Don't accept the route whose destination is reachable and
+	# gateway is unreachable
+	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+	    -net 10.0.1.0/26 10.0.5.1
+
+	# Don't accept the route whose gateway is reachable and RTF_GATEWAY
+	atf_check -s not-exit:0 -o ignore -e ignore rump.route add \
+	    -net 10.0.6.0/24 10.0.1.1
+
+	rump_server_destroy_ifaces
+}
+
+route_command_add_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
+atf_test_case route_command_add6 cleanup
+route_command_add6_head()
+{
+
+	atf_set "descr" "tests of route add command (IPv6)"
+	atf_set "require.progs" "rump_server"
+}
+
+route_command_add6_body()
+{
+
+	rump_server_start $SOCKHOST netinet6
+
+	export RUMP_SERVER=${SOCKHOST}
+	rump_server_add_iface $SOCKHOST shmif0 $BUS
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1/64
+
+	# Accept the route whose gateway is in a subnet of interface address
+	atf_check -s exit:0 -o ignore rump.route add -inet6\
+	    -net fc00:1::0/64 fc00::2
+	atf_check -s exit:0 -o ignore rump.route add -inet6\
+	    -host fc00:2::1 fc00::3
+
+	# Accept the route whose gateway is an interface
+	atf_check -s exit:0 -o ignore rump.route add -inet6\
+	    -net fc00:3::0/64 -connected -link -iface shmif0
+
+	# Accept the route whose gateway is reachable and not RTF_GATEWAY
+	atf_check -s exit:0 -o ignore rump.route add -inet6\
+	    -net fc00:4::0/64 fc00:3::1
+
+	# Don't accept the route whose destination is reachable and
+	# gateway is unreachable
+	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+	    -inet6 -net fc00::4/128 fc00:5::1
+
+	# Don't accept the route whose gateway is reachable and RTF_GATEWAY
+	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+	    -inet6 -net fc00:6::0/64 fc00:1::1
+
+	rump_server_destroy_ifaces
+}
+
+route_command_add6_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -444,4 +546,6 @@ atf_init_test_cases()
 	atf_add_test_case route_command_get
 	atf_add_test_case route_command_get6
 	atf_add_test_case route_default_reject
+	atf_add_test_case route_command_add
+	atf_add_test_case route_command_add6
 }

Reply via email to