Submitted By: Brian Weber
Date: 22 August 2006
Name: blfs-bootscripts-6.1.dhcpcd.no-carrier.patch
Description: The patch handles the case of a missing carrier on a NIC,
ie an unplugged cable or the router/hub down, at boot time by issuing a
warning and skipping the startup of dhcp instead of mindlessly waiting
for the timeout.
--- blfs-bootscripts-6.1/blfs/sysconfig/network-devices/services/dhcpcd
2005-08-01 19:29:19.000000000 +0000
+++ /etc/sysconfig/network-devices/services/dhcpcd 2006-08-23
05:21:04.000000000 +0000
@@ -4,9 +4,10 @@
# Based upon lfs-bootscripts-1.12 $network_devices/if{down,up}
# Rewritten by Nathan Coulson <[EMAIL PROTECTED]>
# Adapted for dhcpcd by DJ Lucas <[EMAIL PROTECTED]>
+# Modified by Brian Weber to handle an absent carrier on an interface.
-#$LastChangedBy: bdubbs $
-#$Date: 2005-08-01 13:29:19 -0600 (Mon, 01 Aug 2005) $
+#$LastChangedBy: bweber $
+#$Date: 2006-08-22 20:02:00 -0500 (Tue, 22 Aug 2006) $
. /etc/sysconfig/rc
. $rc_functions
@@ -15,6 +16,14 @@
PIDFILE="/var/run/dhcpcd-$1.pid"
LEASEINFO="/var/lib/dhcpc/dhcpcd-$1.info"
+# Abort startup and issue a warning if interface lacks a carrier.
+link_status=`ip link show ${1} 2> /dev/null`
+if [ "$2" = "up" ] && echo $link_status | grep -q "NO-CARRIER" ; then
+ boot_mesg "Skipping startup of dhcpcd: '${1}' NO-CARRIER!"
${WARNING}
+ echo_warning
+ exit 0
+else
+
case "$2" in
up)
boot_mesg -n "Starting dhcpcd on the $1 interface..."
@@ -84,7 +93,7 @@
echo ""
echo_ok
elif [ "$RET" -eq 1 ]; then
- boot_mesg "dhcpcd not running!" ${WARNING}
+ boot_mesg " (dhcpcd not running}" ${WARNING}
echo_warning
else
echo ""
@@ -109,4 +118,6 @@
;;
esac
+fi
+
# End $network_devices/services/dhcpcd
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
http://linuxfromscratch.org/mailman/listinfo/patches
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page