aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts
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:09:22 -0500
commitfd6c8abcfab9a555ab2805850c091a94cfc82a72 (patch)
tree48e4c9ca0a02d1d9ed23f014ec5ab9e67cd03d22 /sysconfig/network-scripts
parent89183909b2965e6bc2991b2512161414d2028be8 (diff)
downloadinitscripts-fd6c8abcfab9a555ab2805850c091a94cfc82a72.tar
initscripts-fd6c8abcfab9a555ab2805850c091a94cfc82a72.tar.gz
initscripts-fd6c8abcfab9a555ab2805850c091a94cfc82a72.tar.bz2
initscripts-fd6c8abcfab9a555ab2805850c091a94cfc82a72.tar.xz
initscripts-fd6c8abcfab9a555ab2805850c091a94cfc82a72.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.
Diffstat (limited to 'sysconfig/network-scripts')
-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 ccb4da59..475d42a0 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -175,8 +175,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
@@ -207,8 +206,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 ()
@@ -239,19 +237,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 ()
@@ -266,7 +256,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