Wed Oct 18 06:41:00 2023 UTC ()
Update the test case for MTU of lag to adapt new behavior


(yamaguchi)
diff -r1.9 -r1.10 src/tests/net/if_lagg/t_lagg.sh

cvs diff -r1.9 -r1.10 src/tests/net/if_lagg/t_lagg.sh (expand / switch to context diff)
--- src/tests/net/if_lagg/t_lagg.sh 2023/10/16 07:57:40 1.9
+++ src/tests/net/if_lagg/t_lagg.sh 2023/10/18 06:41:00 1.10
@@ -1,4 +1,4 @@
-#	$NetBSD: t_lagg.sh,v 1.9 2023/10/16 07:57:40 yamaguchi Exp $
+#	$NetBSD: t_lagg.sh,v 1.10 2023/10/18 06:41:00 yamaguchi Exp $
 #
 # Copyright (c) 2021 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -367,6 +367,7 @@
 lagg_mtu_body()
 {
 	local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
+	local mtu_lagg=1500
 	local mtu_1st=1450
 	local mtu_big=1460
 	local mtu_small=1440
@@ -379,60 +380,47 @@
 	rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2
 	$atf_ifconfig lagg0 create
 	$atf_ifconfig lagg0 laggproto lacp
+	$atf_ifconfig lagg0 up
 
 	$atf_ifconfig shmif0 mtu $mtu_1st
 	$atf_ifconfig shmif1 mtu $mtu_big
 	$atf_ifconfig shmif2 mtu $mtu_small
 
-	atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0
+	# check initial MTU settings
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0
 	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
 	atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1
 	atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2
 
 	# copy MTU from 1st port
 	$atf_ifconfig lagg0 laggport shmif0
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0
 
 	# copy MTU to added port
 	$atf_ifconfig lagg0 laggport shmif1
 	$atf_ifconfig lagg0 laggport shmif2
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif1
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif2
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif1
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif2
 
 	# reset MTU after detaching from lagg0
 	$atf_ifconfig lagg0 -laggport shmif2
 	atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2
 
 	# change MTU of lagg0
-	$atf_ifconfig lagg0 up
-	$atf_ifconfig lagg0 mtu 1500
-	atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0
-	atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif0
-	atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif1
+	mtu_lagg=1400
+	$atf_ifconfig lagg0 mtu $mtu_lagg
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0
+	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif1
 
 	# reset MTU after detching from lagg0
 	$atf_ifconfig lagg0 -laggport shmif0
 	$atf_ifconfig lagg0 -laggport shmif1
 	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
 	atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1
-
-	# MTU should not be changed
-	atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0
-
-	# copy MTU from 1st port even when MTU of lagg0 is changhed
-	$atf_ifconfig lagg0 mtu 1400
-	atf_check -s exit:0 -o match:"mtu *1400" rump.ifconfig lagg0
-	$atf_ifconfig lagg0 laggport shmif0
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
-
-	# MTU of lagg0 need not reset
-	$atf_ifconfig lagg0 -laggport shmif0
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0
-	atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
 }
 
 lagg_mtu_cleanup()