Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/sbin/ifconfig Instead of just skipping interfaces that...



details:   https://anonhg.NetBSD.org/src/rev/2338e79891e8
branches:  trunk
changeset: 936446:2338e79891e8
user:      gson <gson%NetBSD.org@localhost>
date:      Mon Jul 27 06:52:48 2020 +0000

description:
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.

diffstat:

 tests/sbin/ifconfig/t_repeated_updown.sh |  19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 286bed6b7c6c -r 2338e79891e8 tests/sbin/ifconfig/t_repeated_updown.sh
--- a/tests/sbin/ifconfig/t_repeated_updown.sh  Mon Jul 27 00:34:56 2020 +0000
+++ b/tests/sbin/ifconfig/t_repeated_updown.sh  Mon Jul 27 06:52:48 2020 +0000
@@ -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_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



Home | Main Index | Thread Index | Old Index