svn commit: r188009 - head/etc/rc.d
Mike Makonnen
mtm at FreeBSD.org
Mon Feb 2 07:33:22 PST 2009
Author: mtm
Date: Mon Feb 2 15:33:22 2009
New Revision: 188009
URL: http://svn.freebsd.org/changeset/base/188009
Log:
The 30 second wait for network interfaces to show up effectively makes the
time to boot an unplugged system 30 sec. longer for no good reason. Therefore,
add a check to make sure that any DHCP interfaces are plugged in before
waiting.
Modified:
head/etc/rc.d/defaultroute
Modified: head/etc/rc.d/defaultroute
==============================================================================
--- head/etc/rc.d/defaultroute Mon Feb 2 14:30:07 2009 (r188008)
+++ head/etc/rc.d/defaultroute Mon Feb 2 15:33:22 2009 (r188009)
@@ -18,10 +18,21 @@ stop_cmd=":"
defaultroute_start()
{
- # Return without waiting if we don't have dhcp interfaces.
- # Once we can test that the link is actually up, we should
- # remove this test and always wait.
- [ -z "`list_net_interfaces dhcp`" ] && return
+ local output carrier nocarrier
+
+ # Return without waiting if we don't have dhcp interfaces or
+ # if none of the dhcp interfaces is plugged in.
+ dhcp_interfaces=`list_net_interfaces dhcp`
+ [ -z "${dhcp_interfaces}" ] && return
+ carrier=false
+ for _if in ${dhcp_interfaces}; do
+ output=`/sbin/ifconfig ${_if}`
+ nocarrier=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
+ [ -z "${nocarrier}" ] && carrier=true
+ done
+ if ! ${carrier}; then
+ return
+ fi
# Wait for a default route
delay=${if_up_delay}
More information about the svn-src-all
mailing list