aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPreston Brown <pbrown@redhat.com>2001-06-01 20:12:33 +0000
committerPreston Brown <pbrown@redhat.com>2001-06-01 20:12:33 +0000
commitb31155c54ce5381a12b36812f452ffbf844328b6 (patch)
treec6352954782fca3f1de92924ca8d9651ed55be71
parent87d53d2102748afaea96114df869323a85c60f1f (diff)
downloadinitscripts-b31155c54ce5381a12b36812f452ffbf844328b6.tar
initscripts-b31155c54ce5381a12b36812f452ffbf844328b6.tar.gz
initscripts-b31155c54ce5381a12b36812f452ffbf844328b6.tar.bz2
initscripts-b31155c54ce5381a12b36812f452ffbf844328b6.tar.xz
initscripts-b31155c54ce5381a12b36812f452ffbf844328b6.zip
check link status before trying DHCP/BOOTP.
-rwxr-xr-xsysconfig/network-scripts/ifup6
-rw-r--r--sysconfig/network-scripts/network-functions14
2 files changed, 19 insertions, 1 deletions
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index ce0ca127..f1aad49c 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -147,7 +147,11 @@ if [ -n "${DYNCONFIG}" ]; then
DHCPCDARGS="${DHCPCDARGS} -R"
fi
echo -n $"Determining IP information for ${DEVICE}..."
-
+ if check_link_down ${DEVICE}; then
+ echo " failed; no link present. Check cable?"
+ exit 1
+ fi
+
# DHCP clients need DNS to be available, and we don't know
# what DNS server they're using until they are done.
FWHACK=
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index ee65bd61..fdd4a211 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -81,6 +81,20 @@ check_device_down ()
return $retcode
}
+check_link_down ()
+{
+ if [ -x /sbin/mii-tool ]; then
+ output=`/sbin/mii-tool $1 2>&1`
+ if echo $output | grep -q "Operation not supported"; then
+ return 0
+ elif echo $output | grep -q "link ok"; then
+ return 0
+ else
+ return 1
+ fi
+ fi
+ return 0
+}
check_default_route ()
{