Module Name:    src
Committed By:   martin
Date:           Wed Jul 22 05:47:24 UTC 2020

Modified Files:
        src/tests/sbin/ifconfig: t_repeated_updown.sh

Log Message:
Skip interfaces that are already UP before the test starts. We can
not change state of the test host this way, it breaks e.g. test systems
with the root filesystem on NFS.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/sbin/ifconfig/t_repeated_updown.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/sbin/ifconfig/t_repeated_updown.sh
diff -u src/tests/sbin/ifconfig/t_repeated_updown.sh:1.3 src/tests/sbin/ifconfig/t_repeated_updown.sh:1.4
--- src/tests/sbin/ifconfig/t_repeated_updown.sh:1.3	Sat Jun 27 04:15:17 2020
+++ src/tests/sbin/ifconfig/t_repeated_updown.sh	Wed Jul 22 05:47:24 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_repeated_updown.sh,v 1.3 2020/06/27 04:15:17 jruoho Exp $
+# $NetBSD: t_repeated_updown.sh,v 1.4 2020/07/22 05:47:24 martin Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -42,14 +42,12 @@ repeated_updown_body() {
 
 	for i in $(ifconfig -l); do
 
-		state="up"
-		ifconfig -s $i
+		# skip all interfaces that are already marked UP
+		ifconfig $i | fgrep -q UP >/dev/null && continue
 
-		if [ $? -eq 1 ]; then
-			state="down"
-			ifconfig $i up
-			echo "Initialized $i up"
-		fi
+		state="down"
+		ifconfig $i up
+		echo "Initialized $i up"
 
 		while [ $n -gt 0 ]; do
 			ifconfig $i down

Reply via email to