Fix the wait for default route change I made a few weeks ago by creating

a new defaultroute script that just does the wait.  The previous attempt
created a circular dependency through network_ipv6.

Pointy hat to:	brooks
This commit is contained in:
Brooks Davis 2008-06-05 17:26:47 +00:00
parent 02c916540f
commit 06118b48d0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179566
4 changed files with 51 additions and 28 deletions

View File

@ -7,7 +7,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
apm apmd archdep atm1 atm2 atm3 auditd auto_linklocal \
bgfsck bluetooth bootparams bridge bsnmpd bthidd \
ccd cleanvar cleartmp cron \
ddb devd devfs dhclient \
ddb defaultroute devd devfs dhclient \
dmesg dumpon \
early.sh encswap \
fsck ftp-proxy ftpd \

View File

@ -5,7 +5,7 @@
# PROVIDE: NETWORKING NETWORK
# REQUIRE: netif netoptions routing network_ipv6 ppp
# REQUIRE: routed mrouted route6d mroute6d resolv
# REQUIRE: defaultroute routed mrouted route6d mroute6d resolv
# This is a dummy dependency, for services which require networking
# to be operational before starting.

48
etc/rc.d/defaultroute Normal file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# Wait for the default route to be up
#
# $FreeBSD$
#
# PROVIDE: defaultroute
# REQUIRE: devd netif network_ipv6
# KEYWORD: nojail
. /etc/rc.subr
. /etc/network.subr
name="defaultroute"
start_cmd="defaultroute_start"
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.
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
}
load_rc_config $name
run_rc_command "$1"

View File

@ -6,7 +6,7 @@
#
# PROVIDE: routing
# REQUIRE: devd netif ppp
# REQUIRE: netif ppp
# KEYWORD: nojail
. /etc/rc.subr
@ -23,31 +23,6 @@ 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()