Module Name:    src
Committed By:   gson
Date:           Mon Jul 27 06:52:48 UTC 2020

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

Log Message:
Instead of just skipping interfaces that are "up", skip the whole
repeated_updown test case unless explicitly enabled with "atf-run -v
run_unsafe=yes".  Gratuitously configuring interfaces "up" is no more
safe than gratuitously configuring them "down"; for example, it could
lead to accidentally connecting to an insecure network or diverting
traffic from the desired route.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/tests/sbin/ifconfig/t_repeated_updown.sh:1.5
--- src/tests/sbin/ifconfig/t_repeated_updown.sh:1.4	Wed Jul 22 05:47:24 2020
+++ src/tests/sbin/ifconfig/t_repeated_updown.sh	Mon Jul 27 06:52:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_repeated_updown.sh,v 1.4 2020/07/22 05:47:24 martin Exp $
+# $NetBSD: t_repeated_updown.sh,v 1.5 2020/07/27 06:52:48 gson Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -36,18 +36,25 @@ repeated_updown_head() {
 
 repeated_updown_body() {
 
+	if ! [ $(atf_config_get "run_unsafe" "no") = "yes" ]
+	then
+		atf_skip "can disrupt networking; also PR port-evbarm/55504"
+	fi
+
 	# Try to avoid stalling any automated test runs.
 	#
 	n=35
 
 	for i in $(ifconfig -l); do
 
-		# skip all interfaces that are already marked UP
-		ifconfig $i | fgrep -q UP >/dev/null && continue
+		state="up"
+		ifconfig -s $i
 
-		state="down"
-		ifconfig $i up
-		echo "Initialized $i up"
+		if [ $? -eq 1 ]; then
+			state="down"
+			ifconfig $i up
+			echo "Initialized $i up"
+		fi
 
 		while [ $n -gt 0 ]; do
 			ifconfig $i down

Reply via email to