aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.d
diff options
context:
space:
mode:
authorMike Makonnen <mtm@FreeBSD.org>2009-02-02 15:33:22 +0000
committerMike Makonnen <mtm@FreeBSD.org>2009-02-02 15:33:22 +0000
commitbdc0df86f6fd71f62b2a592d218741b2e1633bb1 (patch)
treeb023effd5fe08e745530dbb4bed2b9fdc1479c20 /etc/rc.d
parent9e7948d849f939ae7c95a30ad23e8b215574f6e3 (diff)
Notes
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/defaultroute19
1 files changed, 15 insertions, 4 deletions
diff --git a/etc/rc.d/defaultroute b/etc/rc.d/defaultroute
index e241fc3d6887..4eb15dded2c4 100755
--- a/etc/rc.d/defaultroute
+++ b/etc/rc.d/defaultroute
@@ -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}