diff options
author | Bill Nottingham <notting@redhat.com> | 2010-02-12 17:09:22 -0500 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2010-09-13 15:33:49 +0200 |
commit | 643c05c59a581663140e307f08732c6bef3d7622 (patch) | |
tree | 545b34dea95ec1b2dd68d2f1b2bf42caa67f7bbd | |
parent | 00ba92b1adbb7d02f86b87a95b797b0332d42aec (diff) | |
download | initscripts-643c05c59a581663140e307f08732c6bef3d7622.tar initscripts-643c05c59a581663140e307f08732c6bef3d7622.tar.gz initscripts-643c05c59a581663140e307f08732c6bef3d7622.tar.bz2 initscripts-643c05c59a581663140e307f08732c6bef3d7622.tar.xz initscripts-643c05c59a581663140e307f08732c6bef3d7622.zip |
Fix various device checks to not misidentify devices.
Also, don't use ifconfig for checking link state on alias devices;
/sbin/ip does fine with that.
https://bugzilla.redhat.com/show_bug.cgi?id=538863
-rw-r--r-- | sysconfig/network-scripts/network-functions | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 79985e6b..ebd6fba3 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -214,8 +214,7 @@ rename_device() # Sets $alias to the device module if $? != 0 is_available () { - LC_ALL= LANG= ip -o link | grep -q $1 - [ "$?" = "1" ] || return 0 + [ -d "/sys/class/net/$1" ] && return 0 alias=$(modprobe -c | awk \ 'BEGIN { alias = ""; } @@ -245,8 +244,7 @@ END { install_bonding_driver $1 fi - LC_ALL= LANG= ip -o link | grep -q $1 - return $? + [ -d "/sys/class/net/$1" ] && return 0 || return 1 } need_hostname () @@ -277,19 +275,11 @@ set_hostname () check_device_down () { - if echo $1 | grep -q ':' ; then - if LC_ALL=C ifconfig -a 2>/dev/null | grep -q $1 ; then - return 1 - else - return 0 - fi - else - if LC_ALL=C ip -o link 2>/dev/null | grep -q "$1[:@].*,UP" ; then + if LC_ALL=C ip -o link show dev $1 2>/dev/null | grep -q ",UP" ; then return 1 else return 0 fi - fi } check_mii_tool () @@ -312,7 +302,7 @@ check_ethtool () check_link_down () { if [ -x /sbin/mii-tool -o -x /sbin/ethtool ]; then - if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q UP ; then + if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q ",UP" ; then ip link set dev $1 up >/dev/null 2>&1 fi timeout=0 |