3 # Wait for the default route to be up if DHCP is in use
8 # PROVIDE: defaultroute
16 start_cmd="defaultroute_start"
19 # Does any interface have a carrier?
20 defaultroute_carrier()
22 local carrier nocarrier
25 for _if in ${dhcp_interfaces}; do
26 output=`/sbin/ifconfig ${_if}`
27 nocarrier=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
28 [ -z "${nocarrier}" ] && carrier=0
37 afexists inet || return 0
39 # Return without waiting if we don't have dhcp interfaces or
40 # if none of the dhcp interfaces is plugged in.
41 dhcp_interfaces=`list_net_interfaces dhcp`
42 [ -z "${dhcp_interfaces}" ] && return
44 # Wait for a default route
46 while [ ${waited} -lt ${defaultroute_delay} ]; do
47 defif=`get_default_if -inet`
48 if [ -n "${defif}" ]; then
49 if [ ${waited} -ne 0 ]; then
55 if [ ${waited} -eq 0 ]; then
56 echo -n "Waiting ${defaultroute_delay}s for the default route interface: "
60 if [ ${waited} -eq ${defaultroute_carrier_delay} ] && ! defaultroute_carrier; then
61 echo -n "(no carrier)"
66 waited=$(($waited + 1))