aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2010-02-12 17:09:22 -0500
committerHarald Hoyer <harald@redhat.com>2010-09-13 15:33:49 +0200
commit643c05c59a581663140e307f08732c6bef3d7622 (patch)
tree545b34dea95ec1b2dd68d2f1b2bf42caa67f7bbd /sysconfig/network-scripts/network-functions
parent00ba92b1adbb7d02f86b87a95b797b0332d42aec (diff)
downloadinitscripts-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
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions18
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