9 # The netwait script is intended to be used by systems which have
10 # statically-configured IP addresses in rc.conf(5). If your system
11 # uses DHCP, you should use synchronous_dhclient="YES" in your
12 # /etc/rc.conf instead of using netwait.
19 start_cmd="${name}_start"
24 local ip rc count output link
26 if [ -z "${netwait_ip}" ]; then
27 err 1 "You must define one or more IP addresses in netwait_ip"
30 if [ ${netwait_timeout} -lt 1 ]; then
31 err 1 "netwait_timeout must be >= 1"
34 # Handle SIGINT (Ctrl-C); force abort of while() loop
37 if [ -n "${netwait_if}" ]; then
38 echo -n "Waiting for $netwait_if to have link"
41 while [ ${count} -le ${netwait_if_timeout} ]; do
42 if output=`/sbin/ifconfig ${netwait_if} 2>/dev/null`; then
43 link=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
44 if [ -z "${link}" ]; then
50 err 1 "ifconfig ${netwait_if} failed"
55 if [ -n "${link}" ]; then
56 # Restore default SIGINT handler
60 warn "Interface still has no link. Continuing with startup, but"
61 warn "be aware you may not have a fully functional networking"
62 warn "layer at this point."
67 # Handle SIGINT (Ctrl-C); force abort of while() loop
70 for ip in ${netwait_ip}; do
71 echo -n "Waiting for ${ip} to respond to ICMP"
74 while [ ${count} -le ${netwait_timeout} ]; do
75 /sbin/ping -t 1 -c 1 -o ${ip} >/dev/null 2>&1
78 if [ $rc -eq 0 ]; then
79 # Restore default SIGINT handler
87 echo ': No response from host.'
90 # Restore default SIGINT handler
93 warn "Exhausted IP list. Continuing with startup, but be aware you may"
94 warn "not have a fully functional networking layer at this point."