aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2010-02-12 17:09:22 -0500
committerBill Nottingham <notting@redhat.com>2010-02-12 17:14:36 -0500
commit2f22452b3850d8eb3ade92f2f7dc7bf0c0e4bcb6 (patch)
tree8ae0566082f3338abfd350fe2bffc8b8551f1ae8
parentc1e1d25537379ea51d5bdaf4a8cfe04b6f3deb32 (diff)
downloadinitscripts-2f22452b3850d8eb3ade92f2f7dc7bf0c0e4bcb6.tar
initscripts-2f22452b3850d8eb3ade92f2f7dc7bf0c0e4bcb6.tar.gz
initscripts-2f22452b3850d8eb3ade92f2f7dc7bf0c0e4bcb6.tar.bz2
initscripts-2f22452b3850d8eb3ade92f2f7dc7bf0c0e4bcb6.tar.xz
initscripts-2f22452b3850d8eb3ade92f2f7dc7bf0c0e4bcb6.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.
-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 38440e5b..1d1c43d2 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -169,8 +169,7 @@ do_netreport ()
# 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
[ -n "$BONDING_OPTS" ] && install_bonding_driver $1
@@ -201,8 +200,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 ()
@@ -233,19 +231,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_ethtool ()
@@ -260,7 +250,7 @@ check_ethtool ()
check_link_down ()
{
if [ -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