- Add rc.d/stf and rc.d/faith for stf(4) and faith(4). - Remove rc.d/auto_linklocal and rc.d/network_ipv6. - Move rc.d/sysctl to just before FILESYSTEMS because rc.d/netif depends on some sysctl variables. Reviewed by: brooks MFC after: 3 days
63 lines
1.2 KiB
Bash
Executable File
63 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Wait for the default route to be up
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: defaultroute
|
|
# REQUIRE: devd netif
|
|
# KEYWORD: nojail
|
|
|
|
. /etc/rc.subr
|
|
. /etc/network.subr
|
|
|
|
name="defaultroute"
|
|
start_cmd="defaultroute_start"
|
|
stop_cmd=":"
|
|
|
|
defaultroute_start()
|
|
{
|
|
local output carrier nocarrier nl
|
|
|
|
# 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=${defaultroute_delay}
|
|
while [ ${delay} -gt 0 ]; do
|
|
defif=`get_default_if -inet`
|
|
if [ -n "${defif}" ]; then
|
|
if [ ${delay} -ne ${defaultroute_delay} ]; then
|
|
echo -n "($defif)"
|
|
nl=1
|
|
fi
|
|
break
|
|
fi
|
|
if [ ${delay} -eq ${defaultroute_delay} ]; then
|
|
echo -n "Waiting ${delay}s for the default route interface: "
|
|
else
|
|
echo -n .
|
|
fi
|
|
nl=1
|
|
sleep 1
|
|
delay=$(($delay - 1))
|
|
done
|
|
|
|
[ -n "$nl" ] && echo
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|