From 90004e3f54a4f58aa7a415781b0a0824fb9d7eb2 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 28 Feb 2006 20:21:39 +0000 Subject: don't cause the module to get reloaded on ifdown if it's not loaded (#179809) --- sysconfig/network-scripts/ifdown-eth | 16 +++++++++------- sysconfig/network-scripts/network-functions | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'sysconfig/network-scripts') diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index 1150f098..55c02fbd 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -77,14 +77,16 @@ retcode=0 # may have been changed in the config file since the device was # brought up. Flush all addresses associated with this # instance instead. -if [ "${REALDEVICE}" = "${DEVICE}" ]; then - ip addr flush dev ${REALDEVICE} 2>/dev/null -else - ip addr flush dev ${REALDEVICE} label ${DEVICE} 2>/dev/null -fi +if [ -d "/sys/class/net/${REALDEVICE}" ]; then + if [ "${REALDEVICE}" = "${DEVICE}" ]; then + ip addr flush dev ${REALDEVICE} 2>/dev/null + else + ip addr flush dev ${REALDEVICE} label ${DEVICE} 2>/dev/null + fi -if [ "${REALDEVICE}" = "${DEVICE}" ]; then - ip link set dev ${DEVICE} down 2>/dev/null + if [ "${REALDEVICE}" = "${DEVICE}" ]; then + ip link set dev ${DEVICE} down 2>/dev/null + fi fi [ "$retcode" = "0" ] && retcode=$? diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 92800149..1ed37e01 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -12,7 +12,7 @@ get_hwaddr () { if [ -f /sys/class/net/${1}/address ]; then cat /sys/class/net/${1}/address - else + elif [ -d "/sys/class/net/${1}" ]; then LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \ sed 's/.*link\/[^ ]* \([[:alnum:]:]*\).*/\1/' fi @@ -241,7 +241,7 @@ check_device_down () return 0 fi else - if LC_ALL=C ip -o link ls dev $1 2>/dev/null | grep -q ",UP" ; then + if LC_ALL=C ip -o link 2>/dev/null | grep -q "$1:.*,UP" ; then return 1 else return 0 -- cgit v1.2.1