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

Reply via email to