CVS commit: src/tests/net/if_vlan

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jul 14 08:51:51 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
vlan: Added missing $HIJACKING before brconfig


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.22 src/tests/net/if_vlan/t_vlan.sh:1.23
--- src/tests/net/if_vlan/t_vlan.sh:1.22	Wed Jul 14 08:50:24 2021
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Jul 14 08:51:51 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.22 2021/07/14 08:50:24 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.23 2021/07/14 08:51:51 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -723,7 +723,7 @@ vlan_bridge_body_common()
 	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 
 	$atf_brconfig bridge0 add vlan0
-	$DEBUG && brconfig bridge0
+	$DEBUG && $HIJACKING /sbin/brconfig bridge0
 	atf_check -s exit:0 -o match:'mtu 1495' rump.ifconfig vlan0
 	$atf_brconfig bridge0 delete vlan0
 
@@ -734,13 +734,13 @@ vlan_bridge_body_common()
 	$atf_ifconfig vlan0 mtu 1495
 	$atf_brconfig bridge0 add vlan0
 
-	$DEBUG && brconfig bridge0
+	$DEBUG && $HIJACKING /sbin/brconfig bridge0
 	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 	$atf_brconfig bridge0 delete vlan0
 
 	$atf_ifconfig bridge0 mtu 1497
 	atf_check -s not-exit:0 -o ignore -e ignore \
-	/sbin/brconfig bridge0 add vlan0
+	$HIJACKING /sbin/brconfig bridge0 add vlan0
 
 	#
 	# Destroy a vlan interface that is bridge member



CVS commit: src/tests/net/if_vlan

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jul 14 08:50:24 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Added tests for adding vlan(4) to a bridge and deleting from it

- add vlan(4) that has no parent interface to a bridge member
   - the vlan(4) cannot be added to a bridge member
- detach the parent interface of vlan(4) that is in a bridge member
   - vlan(4) is deleted from a bridge member at the detaching


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.21 src/tests/net/if_vlan/t_vlan.sh:1.22
--- src/tests/net/if_vlan/t_vlan.sh:1.21	Wed Jul 14 06:35:59 2021
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Jul 14 08:50:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.21 2021/07/14 06:35:59 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.22 2021/07/14 08:50:24 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -681,8 +681,6 @@ vlan_bridge_body_common()
 	$atf_ifconfig shmif0 up
 
 	$atf_ifconfig vlan0 create
-	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
-	$atf_ifconfig vlan0 up
 	$DEBUG && rump.ifconfig vlan0
 
 	$atf_ifconfig bridge0 create
@@ -692,16 +690,36 @@ vlan_bridge_body_common()
 	# Add vlan to bridge member
 	#
 	$atf_ifconfig bridge0 mtu 1496
+
+	# vlan0 can not add to bridge member
+	# because it is not an ethernet device
+	atf_check -s not-exit:0 -e match:'Invalid argument' \
+	$HIJACKING /sbin/brconfig bridge0 add vlan0
+
+	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
+	$atf_ifconfig vlan0 up
 	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 
+	# vlan0 becomes an ethernet device
+	# after attaching the parent interface
 	$atf_brconfig bridge0 add vlan0
-	$DEBUG && brconfig bridge0
+	$DEBUG && $HIJACKING /sbin/brconfig bridge0
+
 	$atf_brconfig bridge0 delete vlan0
 
+	$atf_brconfig bridge0 add vlan0
+	$atf_ifconfig vlan0 -vlanif
+	atf_check -s exit:0 -o not-match:'vlan0' \
+	$HIJACKING /sbin/brconfig bridge0
+	atf_check -s not-exit:0 -e match:'No such' \
+	$HIJACKING /sbin/brconfig bridge0 delete vlan0
+
 	#
 	# decrease MTU on adding to bridge member
 	#
 	$atf_ifconfig bridge0 mtu 1495
+	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
+	$atf_ifconfig vlan0 up
 	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 
 	$atf_brconfig bridge0 add vlan0



CVS commit: src/tests/net/if_vlan

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jul 14 06:36:00 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Added a test about clearing IFF_PROMISC at vlan_unconfig

This test is related to PR/49196


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.20 src/tests/net/if_vlan/t_vlan.sh:1.21
--- src/tests/net/if_vlan/t_vlan.sh:1.20	Fri Jul  9 05:54:11 2021
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Jul 14 06:35:59 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.20 2021/07/09 05:54:11 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.21 2021/07/14 06:35:59 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -986,6 +986,27 @@ vlan_promisc_body()
 
 	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0
 	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig shmif0
+	$atf_ifconfig vlan0 -vlanif
+
+	#
+	# clear IFF_PROMISC after bpf_detach called from ether_ifdetach
+	#
+	$atf_ifconfig vlan0 vlan 1 vlanif shmif0
+	$atf_ifconfig vlan0 up
+
+	$bpfopen -r vlan0 &
+	pid=$!
+
+	atf_check -s exit:0 -o match:'PROMISC' rump.ifconfig vlan0
+	atf_check -s exit:0 -o match:'PROMISC' rump.ifconfig shmif0
+
+	$atf_ifconfig vlan0 -vlanif
+
+	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0
+	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig shmif0
+
+	kill -TERM $pid
+	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0
 }
 
 vlan_promisc_cleanup()



CVS commit: src/tests/net/if_vlan

2021-07-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jul  6 01:18:22 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
vlan: added checks of linkstate


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.18 src/tests/net/if_vlan/t_vlan.sh:1.19
--- src/tests/net/if_vlan/t_vlan.sh:1.18	Fri Jul  2 04:38:10 2021
+++ src/tests/net/if_vlan/t_vlan.sh	Tue Jul  6 01:18:22 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.18 2021/07/02 04:38:10 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.19 2021/07/06 01:18:22 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -589,8 +589,12 @@ vlan_configs_body_common()
 	$atf_ifconfig shmif1 link b0:a0:75:00:01:01 active
 	$atf_ifconfig vlan0 create
 
+	atf_check -s exit:0 -o match:'status: +down' \
+	rump.ifconfig vlan0
 	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
 	$atf_ifconfig vlan0 -vlanif
+	atf_check -s exit:0 -o match:'status: +down' \
+	rump.ifconfig vlan0
 
 	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
 	$atf_ifconfig vlan0 -vlanif shmif0



CVS commit: src/tests/net/if_vlan

2021-07-01 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Jul  2 04:38:11 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Added tests for changing a MTU when the vlan(4) is added to bridge(4)

The tests is for PR kern/56292


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.17 src/tests/net/if_vlan/t_vlan.sh:1.18
--- src/tests/net/if_vlan/t_vlan.sh:1.17	Sun Mar  8 09:05:33 2020
+++ src/tests/net/if_vlan/t_vlan.sh	Fri Jul  2 04:38:10 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.17 2020/03/08 09:05:33 nisimura Exp $
+#	$NetBSD: t_vlan.sh,v 1.18 2021/07/02 04:38:10 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -669,6 +669,7 @@ vlan_configs6_cleanup()
 vlan_bridge_body_common()
 {
 	local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
+	local atf_brconfig="atf_check -s exit:0 $HIJACKING /sbin/brconfig"
 
 	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
 
@@ -681,17 +682,49 @@ vlan_bridge_body_common()
 	$DEBUG && rump.ifconfig vlan0
 
 	$atf_ifconfig bridge0 create
-	# Adjust to the MTU of a vlan on a shmif
-	$atf_ifconfig bridge0 mtu 1496
 	$atf_ifconfig bridge0 up
-	# Test brconfig add
-	atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0
+
+	#
+	# Add vlan to bridge member
+	#
+	$atf_ifconfig bridge0 mtu 1496
+	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
+
+	$atf_brconfig bridge0 add vlan0
+	$DEBUG && brconfig bridge0
+	$atf_brconfig bridge0 delete vlan0
+
+	#
+	# decrease MTU on adding to bridge member
+	#
+	$atf_ifconfig bridge0 mtu 1495
+	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
+
+	$atf_brconfig bridge0 add vlan0
+	$DEBUG && brconfig bridge0
+	atf_check -s exit:0 -o match:'mtu 1495' rump.ifconfig vlan0
+	$atf_brconfig bridge0 delete vlan0
+
+	#
+	# increase MTU on adding to bridge member
+	#
+	$atf_ifconfig bridge0 mtu 1496
+	$atf_ifconfig vlan0 mtu 1495
+	$atf_brconfig bridge0 add vlan0
+
 	$DEBUG && brconfig bridge0
-	# Test brconfig delete
-	atf_check -s exit:0 $HIJACKING brconfig bridge0 delete vlan0
+	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
+	$atf_brconfig bridge0 delete vlan0
 
-	atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0
-	# Test vlan destruction with bridge
+	$atf_ifconfig bridge0 mtu 1497
+	atf_check -s not-exit:0 -o ignore -e ignore \
+	/sbin/brconfig bridge0 add vlan0
+
+	#
+	# Destroy a vlan interface that is bridge member
+	#
+	$atf_ifconfig bridge0 mtu 1496
+	$atf_brconfig bridge0 add vlan0
 	$atf_ifconfig vlan0 destroy
 
 	rump_server_destroy_ifaces



CVS commit: src/tests/net/if_vlan

2020-03-08 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sun Mar  8 09:05:34 UTC 2020

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
address to ATF t_vlan failure. adapt ifmcstat(8) output format change.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.16 src/tests/net/if_vlan/t_vlan.sh:1.17
--- src/tests/net/if_vlan/t_vlan.sh:1.16	Mon Nov 11 02:40:48 2019
+++ src/tests/net/if_vlan/t_vlan.sh	Sun Mar  8 09:05:33 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.16 2019/11/11 02:40:48 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.17 2020/03/08 09:05:33 nisimura Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -792,7 +792,7 @@ vlan_multicast_body_common()
 	# add an address to different interfaces
 	$atf_siocXmulti add vlan0 $mcaddr
 	$atf_siocXmulti add vlan1 $mcaddr
-	atf_check -s exit:0 -o match:"${eth_mcaddr}: 2" $HIJACKING ifmcstat
+	atf_check -s exit:0 -o match:"${eth_mcaddr} refcount 2" $HIJACKING ifmcstat
 	$atf_siocXmulti del vlan0 $mcaddr
 
 	# delete the address with invalid interface
@@ -805,7 +805,7 @@ vlan_multicast_body_common()
 	$atf_siocXmulti add vlan0 $mcaddr
 	$atf_siocXmulti add vlan0 $mcaddr
 	$atf_siocXmulti add vlan0 $mcaddr
-	atf_check -s exit:0 -o match:"${eth_mcaddr}: 3" $HIJACKING ifmcstat
+	atf_check -s exit:0 -o match:"${eth_mcaddr} refcount 3" $HIJACKING ifmcstat
 	$atf_siocXmulti del vlan0 $mcaddr
 	$atf_siocXmulti del vlan0 $mcaddr
 	$atf_siocXmulti del vlan0 $mcaddr



CVS commit: src/tests/net/if_vlan

2018-12-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Dec 11 03:47:51 UTC 2018

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
tests: add missing $af


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.14 src/tests/net/if_vlan/t_vlan.sh:1.15
--- src/tests/net/if_vlan/t_vlan.sh:1.14	Fri Dec  7 09:29:01 2018
+++ src/tests/net/if_vlan/t_vlan.sh	Tue Dec 11 03:47:51 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.14 2018/12/07 09:29:01 ozaki-r Exp $
+#	$NetBSD: t_vlan.sh,v 1.15 2018/12/11 03:47:51 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -376,7 +376,7 @@ vlan_vlanid_body_common()
 
 	$atf_ifconfig vlan0 -vlanif
 	atf_check -s not-exit:0 -e match:"Invalid argument" \
-	rump.ifconfig vlan0 $local0/$prefix
+	rump.ifconfig vlan0 $af $local0/$prefix
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	$atf_ifconfig vlan0 vlan 10 vlanif shmif0



CVS commit: src/tests/net/if_vlan

2018-12-07 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec  7 09:29:01 UTC 2018

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
tests: check error messages strictly


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.13 src/tests/net/if_vlan/t_vlan.sh:1.14
--- src/tests/net/if_vlan/t_vlan.sh:1.13	Fri Dec  7 09:28:31 2018
+++ src/tests/net/if_vlan/t_vlan.sh	Fri Dec  7 09:29:01 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.13 2018/12/07 09:28:31 ozaki-r Exp $
+#	$NetBSD: t_vlan.sh,v 1.14 2018/12/07 09:29:01 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -342,7 +342,7 @@ vlan_vlanid_body_common()
 	$atf_ifconfig vlan0 create
 
 	export RUMP_SERVER=$SOCK_LOCAL
-	atf_check -s not-exit:0 -e ignore\
+	atf_check -s not-exit:0 -e match:"^usage: rump.ifconfig" \
 	rump.ifconfig vlan0 vlan -1 vlanif shmif0
 
 	# $config_and_ping 0 # reserved vlan id
@@ -368,14 +368,14 @@ vlan_vlanid_body_common()
 	done
 
 	$atf_ifconfig vlan0 vlan 1 vlanif shmif0
-	atf_check -s not-exit:0 -e ignore \
+	atf_check -s not-exit:0 -e match:"SIOCSETVLAN: Device busy" \
 	rump.ifconfig vlan0 vlan 2 vlanif shmif0
 
-	atf_check -s not-exit:0 -e ignore \
+	atf_check -s not-exit:0 -e match:"SIOCSETVLAN: Device busy" \
 	rump.ifconfig vlan0 vlan 1 vlanif shmif1
 
 	$atf_ifconfig vlan0 -vlanif
-	atf_check -s not-exit:0 -e ignore \
+	atf_check -s not-exit:0 -e match:"Invalid argument" \
 	rump.ifconfig vlan0 $local0/$prefix
 
 	export RUMP_SERVER=$SOCK_LOCAL
@@ -469,8 +469,8 @@ vlan_configs_body_common()
 	$atf_ifconfig vlan0 -vlanif shmif0
 
 	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
-	atf_check -s exit:0 -e ignore rump.ifconfig vlan0 -vlanif shmif1
-	atf_check -s exit:0 -e ignore rump.ifconfig vlan0 -vlanif shmif2
+	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif1
+	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif2
 
 	$atf_ifconfig vlan0 -vlanif
 
@@ -659,7 +659,8 @@ vlan_multicast_body_common()
 	atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat
 
 	# delete a non-existing address
-	atf_check -s not-exit:0 -e ignore $HIJACKING $siocXmulti del vlan0 $mcaddr
+	atf_check -s not-exit:0 -e match:"Invalid argument" \
+	$HIJACKING $siocXmulti del vlan0 $mcaddr
 
 	# add an address to different interfaces
 	$atf_siocXmulti add vlan0 $mcaddr



CVS commit: src/tests/net/if_vlan

2018-12-07 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec  7 09:28:31 UTC 2018

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
tests: reduce repeated phrases... (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.12 src/tests/net/if_vlan/t_vlan.sh:1.13
--- src/tests/net/if_vlan/t_vlan.sh:1.12	Wed Nov 14 05:07:48 2018
+++ src/tests/net/if_vlan/t_vlan.sh	Fri Dec  7 09:28:31 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.12 2018/11/14 05:07:48 knakahara Exp $
+#	$NetBSD: t_vlan.sh,v 1.13 2018/12/07 09:28:31 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -45,43 +45,45 @@ DEBUG=${DEBUG:-false}
 
 vlan_create_destroy_body_common()
 {
+	local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
+
 	export RUMP_SERVER=${SOCK_LOCAL}
 
-	atf_check -s exit:0 rump.ifconfig vlan0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+	$atf_ifconfig vlan0 create
+	$atf_ifconfig vlan0 destroy
 
-	atf_check -s exit:0 rump.ifconfig vlan0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 up
-	atf_check -s exit:0 rump.ifconfig vlan0 down
-	atf_check -s exit:0 rump.ifconfig vlan0 destroy
-
-	atf_check -s exit:0 rump.ifconfig shmif0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 vlan 1 vlanif shmif0
-	atf_check -s exit:0 rump.ifconfig vlan0 up
-	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+	$atf_ifconfig vlan0 create
+	$atf_ifconfig vlan0 up
+	$atf_ifconfig vlan0 down
+	$atf_ifconfig vlan0 destroy
+
+	$atf_ifconfig shmif0 create
+	$atf_ifconfig vlan0 create
+	$atf_ifconfig vlan0 vlan 1 vlanif shmif0
+	$atf_ifconfig vlan0 up
+	$atf_ifconfig vlan0 destroy
 
 	# more than one vlan interface with a same parent interface
-	atf_check -s exit:0 rump.ifconfig shmif1 create
-	atf_check -s exit:0 rump.ifconfig vlan0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
-	atf_check -s exit:0 rump.ifconfig vlan1 create
-	atf_check -s exit:0 rump.ifconfig vlan1 vlan 11 vlanif shmif0
+	$atf_ifconfig shmif1 create
+	$atf_ifconfig vlan0 create
+	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
+	$atf_ifconfig vlan1 create
+	$atf_ifconfig vlan1 vlan 11 vlanif shmif0
 
 	# more than one interface with another parent interface
-	atf_check -s exit:0 rump.ifconfig vlan2 create
-	atf_check -s exit:0 rump.ifconfig vlan2 vlan 12 vlanif shmif1
-	atf_check -s exit:0 rump.ifconfig vlan3 create
-	atf_check -s exit:0 rump.ifconfig vlan3 vlan 13 vlanif shmif1
-	atf_check -s exit:0 rump.ifconfig shmif0 destroy
+	$atf_ifconfig vlan2 create
+	$atf_ifconfig vlan2 vlan 12 vlanif shmif1
+	$atf_ifconfig vlan3 create
+	$atf_ifconfig vlan3 vlan 13 vlanif shmif1
+	$atf_ifconfig shmif0 destroy
 	atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan0
 	atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan1
 	atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan2
 	atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan3
-	atf_check -s exit:0 rump.ifconfig vlan0 destroy
-	atf_check -s exit:0 rump.ifconfig vlan1 destroy
-	atf_check -s exit:0 rump.ifconfig vlan2 destroy
-	atf_check -s exit:0 rump.ifconfig vlan3 destroy
+	$atf_ifconfig vlan0 destroy
+	$atf_ifconfig vlan1 destroy
+	$atf_ifconfig vlan2 destroy
+	$atf_ifconfig vlan3 destroy
 
 }
 
@@ -133,6 +135,7 @@ vlan_create_destroy6_cleanup()
 
 vlan_basic_body_common()
 {
+	local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
 	local outfile=./out
 	local af=inet
 	local prefix=24
@@ -152,23 +155,23 @@ vlan_basic_body_common()
 	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS
 
 	export RUMP_SERVER=$SOCK_LOCAL
-	atf_check -s exit:0 rump.ifconfig shmif0 up
+	$atf_ifconfig shmif0 up
 	export RUMP_SERVER=$SOCK_REMOTE
-	atf_check -s exit:0 rump.ifconfig shmif0 up
+	$atf_ifconfig shmif0 up
 
 	export RUMP_SERVER=$SOCK_LOCAL
-	atf_check -s exit:0 rump.ifconfig vlan0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
-	atf_check -s exit:0 rump.ifconfig vlan0 $af $local0/$prefix
-	atf_check -s exit:0 rump.ifconfig vlan0 up
-	atf_check -s exit:0 rump.ifconfig -w 10
+	$atf_ifconfig vlan0 create
+	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
+	$atf_ifconfig vlan0 $af $local0/$prefix
+	$atf_ifconfig vlan0 up
+	$atf_ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_REMOTE
-	atf_check -s exit:0 rump.ifconfig vlan0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
-	atf_check -s exit:0 rump.ifconfig vlan0 $af $remote0/$prefix
-	atf_check -s exit:0 rump.ifconfig vlan0 up
-	atf_check -s exit:0 rump.ifconfig -w 10
+	$atf_ifconfig vlan0 create
+	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
+	$atf_ifconfig vlan0 $af $remote0/$prefix
+	$atf_ifconfig vlan0 up
+	$atf_ifconfig -w 10
 
 	

CVS commit: src/tests/net/if_vlan

2018-11-13 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Nov 14 05:07:48 UTC 2018

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
let ATF detect a bug fixed by if_vla.c:r1.132.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.11 src/tests/net/if_vlan/t_vlan.sh:1.12
--- src/tests/net/if_vlan/t_vlan.sh:1.11	Thu Jun 14 08:38:24 2018
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Nov 14 05:07:48 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.11 2018/06/14 08:38:24 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.12 2018/11/14 05:07:48 knakahara Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -449,6 +449,9 @@ vlan_configs_body_common()
 
 	atf_check -s exit:0 rump.ifconfig shmif0 create
 	atf_check -s exit:0 rump.ifconfig shmif1 create
+	# unset U/L bit to detect a bug fixed by if_vlan.c:r1.132
+	atf_check -s exit:0 rump.ifconfig shmif0 link b0:a0:75:00:01:00 active
+	atf_check -s exit:0 rump.ifconfig shmif1 link b0:a0:75:00:01:01 active
 	atf_check -s exit:0 rump.ifconfig vlan0 create
 
 	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0



CVS commit: src/tests/net/if_vlan

2018-06-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Jun 14 08:38:24 UTC 2018

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Update the error message in t_vlan (ENXIO => EINVAL)

ok ozaki-r@


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.10 src/tests/net/if_vlan/t_vlan.sh:1.11
--- src/tests/net/if_vlan/t_vlan.sh:1.10	Thu Jun 14 08:22:52 2018
+++ src/tests/net/if_vlan/t_vlan.sh	Thu Jun 14 08:38:24 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.10 2018/06/14 08:22:52 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.11 2018/06/14 08:38:24 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -655,7 +655,7 @@ vlan_multicast_body_common()
 	atf_check -s exit:0 $HIJACKING $siocXmulti del vlan0 $mcaddr
 
 	# delete the address with invalid interface
-	atf_check -s not-exit:0 -e match:"Device not configured" \
+	atf_check -s not-exit:0 -e match:"Invalid argument" \
 	$HIJACKING $siocXmulti del vlan0 $mcaddr
 
 	atf_check -s exit:0 $HIJACKING $siocXmulti del vlan1 $mcaddr



CVS commit: src/tests/net/if_vlan

2018-06-11 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Jun 12 04:21:22 UTC 2018

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Add tests of vlan with bridge

The tests trigger a panic reported in PR kern/53357.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.8 src/tests/net/if_vlan/t_vlan.sh:1.9
--- src/tests/net/if_vlan/t_vlan.sh:1.8	Thu Feb  1 05:22:02 2018
+++ src/tests/net/if_vlan/t_vlan.sh	Tue Jun 12 04:21:22 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.8 2018/02/01 05:22:02 ozaki-r Exp $
+#	$NetBSD: t_vlan.sh,v 1.9 2018/06/12 04:21:22 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -524,6 +524,80 @@ vlan_configs6_cleanup()
 	cleanup
 }
 
+vlan_bridge_body_common()
+{
+
+	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
+
+	export RUMP_SERVER=$SOCK_LOCAL
+	atf_check -s exit:0 rump.ifconfig shmif0 up
+
+	atf_check -s exit:0 rump.ifconfig vlan0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan0 up
+	$DEBUG && rump.ifconfig vlan0
+
+	atf_check -s exit:0 rump.ifconfig bridge0 create
+	# Adjust to the MTU of a vlan on a shmif
+	atf_check -s exit:0 rump.ifconfig bridge0 mtu 1496
+	atf_check -s exit:0 rump.ifconfig bridge0 up
+	# Test brconfig add
+	atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0
+	$DEBUG && brconfig bridge0
+	# Test brconfig delete
+	atf_check -s exit:0 $HIJACKING brconfig bridge0 delete vlan0
+
+	atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0
+	# Test vlan destruction with bridge
+	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+
+	rump_server_destroy_ifaces
+}
+
+atf_test_case vlan_bridge cleanup
+vlan_bridge_head()
+{
+
+	atf_set "descr" "tests of vlan interfaces with bridges (IPv4)"
+	atf_set "require.progs" "rump_server"
+}
+
+vlan_bridge_body()
+{
+
+	rump_server_start $SOCK_LOCAL vlan bridge
+	vlan_bridge_body_common
+}
+
+vlan_bridge_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
+atf_test_case vlan_bridge6 cleanup
+vlan_bridge6_head()
+{
+
+	atf_set "descr" "tests of vlan interfaces with bridges (IPv6)"
+	atf_set "require.progs" "rump_server"
+}
+
+vlan_bridge6_body()
+{
+
+	rump_server_start $SOCK_LOCAL vlan netinet6 bridge
+	vlan_bridge_body_common
+}
+
+vlan_bridge6_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -531,9 +605,11 @@ atf_init_test_cases()
 	atf_add_test_case vlan_basic
 	atf_add_test_case vlan_vlanid
 	atf_add_test_case vlan_configs
+	atf_add_test_case vlan_bridge
 
 	atf_add_test_case vlan_create_destroy6
 	atf_add_test_case vlan_basic6
 	atf_add_test_case vlan_vlanid6
 	atf_add_test_case vlan_configs6
+	atf_add_test_case vlan_bridge6
 }



CVS commit: src/tests/net/if_vlan

2017-11-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Nov 23 04:59:49 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Since there was already a test to verify that vlan tag 4096 is
detected as invalid, become the "someone" referred to in the
previous commit log, and add tests for 0 and 4095 as well, and
while here, throw in a few more that might elicit bugs.

And if the shell running the tests is able, add tests of a few
random vlan tags between 2 and 4093 (1 and 4094 are always tested)
to check that anything in range works (well, partially check...)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.6 src/tests/net/if_vlan/t_vlan.sh:1.7
--- src/tests/net/if_vlan/t_vlan.sh:1.6	Thu Nov 23 04:12:36 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Thu Nov 23 04:59:49 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.6 2017/11/23 04:12:36 kre Exp $
+#	$NetBSD: t_vlan.sh,v 1.7 2017/11/23 04:59:49 kre Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -337,9 +337,22 @@ vlan_vlanid_body_common()
 	$config_and_ping 4094
 	# $config_and_ping 4095 #reserved vlan id
 
+	if [ "${RANDOM:-0}" != "${RANDOM:-0}" ]
+	then
+		for TAG in $(( ${RANDOM:-0} % 4092 + 2 )) \
+			   $(( ${RANDOM:-0} % 4092 + 2 )) \
+			   $(( ${RANDOM:-0} % 4092 + 2 ))
+		do
+			$config_and_ping "${TAG}"
+		done
+	fi
+
 	export RUMP_SERVER=$SOCK_LOCAL
-	atf_check -s not-exit:0 -e ignore \
-	rump.ifconfig vlan0 vlan 4096 vlanif shmif0
+	for TAG in 0 4095 4096 $((4096*4 + 1)) 65536 65537 $((65536 + 4095))
+	do
+		atf_check -s not-exit:0 -e not-empty \
+		rump.ifconfig vlan0 vlan "${TAG}" vlanif shmif0
+	done
 
 	atf_check -s exit:0 rump.ifconfig vlan0 vlan 1 vlanif shmif0
 	atf_check -s not-exit:0 -e ignore \



CVS commit: src/tests/net/if_vlan

2017-11-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Nov 23 04:12:36 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Don't attempt to test vlan tags 0 or 4095, which are now rejected
as invalid (perhaps someone could add a test to verify that they
continue to be rejected?)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.5 src/tests/net/if_vlan/t_vlan.sh:1.6
--- src/tests/net/if_vlan/t_vlan.sh:1.5	Thu Nov 16 06:31:00 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Thu Nov 23 04:12:36 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.5 2017/11/16 06:31:00 msaitoh Exp $
+#	$NetBSD: t_vlan.sh,v 1.6 2017/11/23 04:12:36 kre Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -332,10 +332,10 @@ vlan_vlanid_body_common()
 	atf_check -s not-exit:0 -e ignore\
 	rump.ifconfig vlan0 vlan -1 vlanif shmif0
 
-	$config_and_ping 0 # reserved vlan id
+	# $config_and_ping 0 # reserved vlan id
 	$config_and_ping 1
 	$config_and_ping 4094
-	$config_and_ping 4095 #reserved vlan id
+	# $config_and_ping 4095 #reserved vlan id
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	atf_check -s not-exit:0 -e ignore \



CVS commit: src/tests/net/if_vlan

2017-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 16 06:31:00 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
 Add test case of vlan(4)'s re-configure without destroy
(see also if_vlan.c rev. 1.104). Written by s-yamaguchi@iij.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.4 src/tests/net/if_vlan/t_vlan.sh:1.5
--- src/tests/net/if_vlan/t_vlan.sh:1.4	Wed Oct 11 08:10:53 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Thu Nov 16 06:31:00 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.4 2017/10/11 08:10:53 msaitoh Exp $
+#	$NetBSD: t_vlan.sh,v 1.5 2017/11/16 06:31:00 msaitoh Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -456,7 +456,13 @@ vlan_configs_body_common()
 	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
 	atf_check -s not-exit:0 -e match:'File exists' \
 	rump.ifconfig vlan1 vlan 10 vlanif shmif0
-	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif
+	atf_check -s exit:0 rump.ifconfig vlan1 vlan 10 vlanif shmif1
+
+	atf_check -s exit:0 rump.ifconfig vlan1 -vlanif shmif1
+	atf_check -s exit:0 rump.ifconfig vlan1 vlan 10 vlanif shmif1
+
+	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
 }
 
 atf_test_case vlan_configs cleanup



CVS commit: src/tests/net/if_vlan

2017-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct 11 08:10:53 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
 Add a test case for duplicated VLAN ID.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.3 src/tests/net/if_vlan/t_vlan.sh:1.4
--- src/tests/net/if_vlan/t_vlan.sh:1.3	Wed Aug  9 06:19:56 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Oct 11 08:10:53 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.3 2017/08/09 06:19:56 knakahara Exp $
+#	$NetBSD: t_vlan.sh,v 1.4 2017/10/11 08:10:53 msaitoh Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -451,6 +451,12 @@ vlan_configs_body_common()
 	atf_check -s exit:0 -e match:'Invalid argument' \
 	rump.ifconfig vlan0 mtu 41
 	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif
+
+	atf_check -s exit:0 rump.ifconfig vlan1 create
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+	atf_check -s not-exit:0 -e match:'File exists' \
+	rump.ifconfig vlan1 vlan 10 vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif
 }
 
 atf_test_case vlan_configs cleanup



CVS commit: src/tests/net/if_vlan

2017-08-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Aug  9 06:19:56 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Add counter check to vlan(4) ATF. Implemented by s-yamaguchi@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.2 src/tests/net/if_vlan/t_vlan.sh:1.3
--- src/tests/net/if_vlan/t_vlan.sh:1.2	Wed Jun 14 02:32:29 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Aug  9 06:19:56 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.2 2017/06/14 02:32:29 ozaki-r Exp $
+#	$NetBSD: t_vlan.sh,v 1.3 2017/08/09 06:19:56 knakahara Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -182,6 +182,20 @@ vlan_basic_body_common()
 
 	extract_new_packets $BUS > $outfile
 	atf_check -s exit:0 -o match:'vlan 20' cat $outfile
+
+	export RUMP_SERVER=$SOCK_LOCAL
+	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan0 $af $local0/$prefix
+	atf_check -s exit:0 rump.ifconfig vlan0 up
+	atf_check -s exit:0 rump.ifconfig -w 10
+
+	atf_check -s exit:0 -o ignore rump.ifconfig -z vlan0
+	atf_check -s exit:0 -o ignore $ping_cmd $remote0
+	rump.ifconfig -v vlan0 > $outfile
+
+	atf_check -s exit:0 -o not-match:' 0 packets' cat $outfile
+	atf_check -s exit:0 -o not-match:' 0 bytes' cat $outfile
 }
 
 atf_test_case vlan_basic cleanup



CVS commit: src/tests/net/if_vlan

2017-06-13 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jun 14 02:32:29 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Add test cases for vlan(4)

>From s-yamaguchi@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_vlan/t_vlan.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/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.1 src/tests/net/if_vlan/t_vlan.sh:1.2
--- src/tests/net/if_vlan/t_vlan.sh:1.1	Sat Nov 26 03:19:49 2016
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Jun 14 02:32:29 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.1 2016/11/26 03:19:49 ozaki-r Exp $
+#	$NetBSD: t_vlan.sh,v 1.2 2017/06/14 02:32:29 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -28,11 +28,56 @@
 BUS=bus
 SOCK_LOCAL=unix://commsock1
 SOCK_REMOTE=unix://commsock2
-IP_LOCAL=10.0.0.1
-IP_REMOTE=10.0.0.2
+IP_LOCAL0=10.0.0.1
+IP_LOCAL1=10.0.1.1
+IP_REMOTE0=10.0.0.2
+IP_REMOTE1=10.0.1.2
+IP6_LOCAL0=fc00:0::1
+IP6_LOCAL1=fc00:1::1
+IP6_REMOTE0=fc00:0::2
+IP6_REMOTE1=fc00:1::2
 
 DEBUG=${DEBUG:-false}
 
+vlan_create_destroy_body_common()
+{
+	export RUMP_SERVER=${SOCK_LOCAL}
+
+	atf_check -s exit:0 rump.ifconfig vlan0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 up
+	atf_check -s exit:0 rump.ifconfig vlan0 down
+	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+
+	atf_check -s exit:0 rump.ifconfig shmif0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 1 vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan0 up
+	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+
+	# more than one vlan interface with a same parent interface
+	atf_check -s exit:0 rump.ifconfig shmif1 create
+	atf_check -s exit:0 rump.ifconfig vlan0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan1 create
+	atf_check -s exit:0 rump.ifconfig vlan1 vlan 11 vlanif shmif0
+
+	# more than one interface with another parent interface
+	atf_check -s exit:0 rump.ifconfig vlan2 create
+	atf_check -s exit:0 rump.ifconfig vlan2 vlan 12 vlanif shmif1
+	atf_check -s exit:0 rump.ifconfig vlan3 create
+	atf_check -s exit:0 rump.ifconfig vlan3 vlan 13 vlanif shmif1
+	atf_check -s exit:0 rump.ifconfig shmif0 destroy
+	atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan0
+	atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan1
+	atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan2
+	atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan3
+	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+	atf_check -s exit:0 rump.ifconfig vlan1 destroy
+	atf_check -s exit:0 rump.ifconfig vlan2 destroy
+	atf_check -s exit:0 rump.ifconfig vlan3 destroy
+
+}
+
 atf_test_case vlan_create_destroy cleanup
 vlan_create_destroy_head()
 {
@@ -43,17 +88,12 @@ vlan_create_destroy_head()
 
 vlan_create_destroy_body()
 {
-
 	rump_server_start $SOCK_LOCAL vlan
 
-	export RUMP_SERVER=${SOCK_LOCAL}
-
-	atf_check -s exit:0 rump.ifconfig vlan0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 up
-	atf_check -s exit:0 rump.ifconfig vlan0 down
-	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+	vlan_create_destroy_body_common
 }
 
+
 vlan_create_destroy_cleanup()
 {
 
@@ -61,20 +101,47 @@ vlan_create_destroy_cleanup()
 	cleanup
 }
 
-atf_test_case vlan_basic cleanup
-vlan_basic_head()
+atf_test_case vlan_create_destroy6 cleanup
+vlan_create_destroy6_head()
 {
 
-	atf_set "descr" "tests of communications over vlan interfaces"
+	atf_set "descr" "tests of creation and deletion of vlan interface with IPv6"
 	atf_set "require.progs" "rump_server"
 }
 
-vlan_basic_body()
+vlan_create_destroy6_body()
 {
 
-	rump_server_start $SOCK_LOCAL vlan
+	rump_server_start $SOCK_LOCAL vlan netinet6
+
+	vlan_create_destroy_body_common
+}
+
+vlan_create_destroy6_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
+vlan_basic_body_common()
+{
+	local outfile=./out
+	local af=inet
+	local prefix=24
+	local local0=$IP_LOCAL0
+	local remote0=$IP_REMOTE0
+	local ping_cmd="rump.ping -n -w 1 -c 1"
+
+	if [ x"$1" = x"inet6" ]; then
+		af="inet6"
+		prefix=64
+		local0=$IP6_LOCAL0
+		remote0=$IP6_REMOTE0
+		ping_cmd="rump.ping6 -n -c 1"
+	fi
+
 	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
-	rump_server_start $SOCK_REMOTE vlan
 	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS
 
 	export RUMP_SERVER=$SOCK_LOCAL
@@ -85,19 +152,53 @@ vlan_basic_body()
 	export RUMP_SERVER=$SOCK_LOCAL
 	atf_check -s exit:0 rump.ifconfig vlan0 create
 	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
-	atf_check -s exit:0 rump.ifconfig vlan0 $IP_LOCAL/24
+	atf_check -s exit:0 rump.ifconfig vlan0 $af $local0/$prefix
 	atf_check -s exit:0 rump.ifconfig vlan0 up
 	atf_check -s exit:0 rump.ifconfig -w 10
 
 	export RUMP_SERVER=$SOCK_REMOTE
 	atf_check -s exit:0 rump.ifconfig vlan0 create
 	atf_check