summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/routing
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2008-05-18 02:57:54 +0000
committerbrooks <brooks@FreeBSD.org>2008-05-18 02:57:54 +0000
commitfc753396196ab7fd0f6725e0c142c26dc4498e44 (patch)
tree7da87d89a34f14081b2e6b17c19b6a87f3ed4213 /etc/rc.d/routing
parent91e9f2c6bec59500926e01add956c95394f9ab24 (diff)
downloadFreeBSD-src-fc753396196ab7fd0f6725e0c142c26dc4498e44.zip
FreeBSD-src-fc753396196ab7fd0f6725e0c142c26dc4498e44.tar.gz
Move the wait for a default route to rc.d/routing. Once we test for
non-dhcp interfaces to negotiate/associate this will make more sense. This also correctly gets run after both devd and netif are run so it has a chance of working.
Diffstat (limited to 'etc/rc.d/routing')
-rw-r--r--etc/rc.d/routing28
1 files changed, 27 insertions, 1 deletions
diff --git a/etc/rc.d/routing b/etc/rc.d/routing
index 874eda5..33424fd 100644
--- a/etc/rc.d/routing
+++ b/etc/rc.d/routing
@@ -6,10 +6,11 @@
#
# PROVIDE: routing
-# REQUIRE: netif ppp
+# REQUIRE: devd netif ppp
# KEYWORD: nojail
. /etc/rc.subr
+. /etc/network.subr
name="routing"
start_cmd="routing_start"
@@ -22,6 +23,31 @@ routing_start()
{
static_start
options_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.
+ dhcp_interfaces=`list_net_interfaces dhcp`
+ [ -z "`list_net_interfaces dhcp`" ] && return
+
+ # Wait for a default route
+ delay=${if_up_delay}
+ while [ ${delay} -gt 0 ]; do
+ defif=`get_default_if -inet`
+ if [ -n "${defif}" ]; then
+ if [ ${delay} -ne ${if_up_delay} ]; then
+ echo "($defif)"
+ fi
+ break
+ fi
+ if [ ${delay} -eq ${if_up_delay} ]; then
+ echo -n "Waiting ${delay}s for an interface to come up: "
+ else
+ echo -n .
+ fi
+ sleep 1
+ delay=`expr $delay - 1`
+ done
}
routing_stop()
OpenPOWER on IntegriCloud