aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsysconfig/network-scripts/ifdown28
-rwxr-xr-xsysconfig/network-scripts/ifdown-ppp1
-rwxr-xr-xsysconfig/network-scripts/ifdown-sl1
-rwxr-xr-xsysconfig/network-scripts/ifup4
-rw-r--r--sysconfig/network-scripts/network-functions11
5 files changed, 33 insertions, 12 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 6f02c394..5018e708 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -19,7 +19,9 @@ CONFIG=$1
if [ $UID != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
- exec /usr/sbin/usernetctl $CONFIG down
+ if /usr/sbin/usernetctl $CONFIG report ; then
+ exec /usr/sbin/usernetctl $CONFIG down
+ fi
fi
echo "Users cannot control this device." >&2
exit 1
@@ -31,14 +33,7 @@ DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"`
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${DEVICETYPE}"
if [ -x $OTHERSCRIPT ]; then
- $OTHERSCRIPT $CONFIG $2
- exit $?
-fi
-
-if echo $DEVICE | grep -q ':' ; then
- ISALIAS=yes
-else
- ISALIAS=no
+ exec $OTHERSCRIPT $CONFIG $2
fi
if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
@@ -46,6 +41,17 @@ if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
fi
ifconfig ${DEVICE} down
+# wait up to 5 seconds for device to actually come down...
+waited=0
+while ! check_device_down && [ "$waited" -lt 50 ] ; do
+ usleep 100000
+ waited=$(($waited+1))
+done
+
+if [ "$retcode" = 0 ] ; then
+ /etc/sysconfig/network-scripts/ifdown-post $CONFIG
+ # do NOT use $? because ifdown should return whether or not
+ # the interface went down.
+fi
-exec /etc/sysconfig/network-scripts/ifdown-post $CONFIG
-
+exit $retcode
diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp
index 2e56b0c0..3265c72d 100755
--- a/sysconfig/network-scripts/ifdown-ppp
+++ b/sysconfig/network-scripts/ifdown-ppp
@@ -26,5 +26,6 @@ sleep 2
kill -TERM $PID > /dev/null 2>&1
# ip-down won't run in this case
/etc/sysconfig/network-scripts/ifdown-post $1
+[ ! -d /proc/$PID ] && exit 0
exit 1
diff --git a/sysconfig/network-scripts/ifdown-sl b/sysconfig/network-scripts/ifdown-sl
index 0bb9d425..813ee0af 100755
--- a/sysconfig/network-scripts/ifdown-sl
+++ b/sysconfig/network-scripts/ifdown-sl
@@ -40,6 +40,7 @@ if [ -d /proc/$PID ]; then
else
/etc/sysconfig/network-scripts/ifdown-post $1
fi
+[ ! -d /proc/$PID ] && exit 0
exit 1
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 64309d5b..3a979c91 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -21,7 +21,9 @@ CONFIG=$1
if [ $UID != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
- exec /usr/sbin/usernetctl $CONFIG up
+ if /usr/sbin/usernetctl $CONFIG report ; then
+ exec /usr/sbin/usernetctl $CONFIG up
+ fi
fi
echo "Users cannot control this device." >&2
exit 1
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index f015525d..feea9922 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -48,3 +48,14 @@ set_hostname()
echo "search $domain" >> /etc/resolv.conf
fi
}
+
+check_device_down ()
+{
+ if ifconfig ${DEVICE} | grep UP >/dev/null 2>&1 ; then
+ retcode=1
+ else
+ retcode=0
+ fi
+ return $retcode
+}
+