View | Details | Raw Unified | Return to bug 205263 | Differences between
and this patch

Collapse All | Expand All

(-)NETWORKING (-1 / +1 lines)
Lines 4-10 Link Here
4
#
4
#
5
5
6
# PROVIDE: NETWORKING NETWORK
6
# PROVIDE: NETWORKING NETWORK
7
# REQUIRE: netif netoptions routing ppp ipfw stf
7
# REQUIRE: netif netwait netoptions routing ppp ipfw stf
8
# REQUIRE: defaultroute routed route6d mroute6d resolv bridge
8
# REQUIRE: defaultroute routed route6d mroute6d resolv bridge
9
# REQUIRE: static_arp static_ndp
9
# REQUIRE: static_arp static_ndp
10
10
(-)netwait (-32 / +30 lines)
Lines 3-9 Link Here
3
# $FreeBSD$
3
# $FreeBSD$
4
#
4
#
5
# PROVIDE: netwait
5
# PROVIDE: netwait
6
# REQUIRE: NETWORKING
6
# REQUIRE: routing
7
# KEYWORD: nojail
7
# KEYWORD: nojail
8
#
8
#
9
# The netwait script is intended to be used by systems which have
9
# The netwait script is intended to be used by systems which have
Lines 23-51 Link Here
23
{
23
{
24
	local ip rc count output link
24
	local ip rc count output link
25
25
26
	if [ -z "${netwait_ip}" ]; then
27
		err 1 "You must define one or more IP addresses in netwait_ip"
28
	fi
29
30
	if [ ${netwait_timeout} -lt 1 ]; then
26
	if [ ${netwait_timeout} -lt 1 ]; then
31
		err 1 "netwait_timeout must be >= 1"
27
		err 1 "netwait_timeout must be >= 1"
32
	fi
28
	fi
33
29
34
	# Handle SIGINT (Ctrl-C); force abort of while() loop
35
	trap break SIGINT
36
37
	if [ -n "${netwait_if}" ]; then
30
	if [ -n "${netwait_if}" ]; then
38
		echo -n "Waiting for $netwait_if to have link"
31
		echo "Waiting for $netwait_if to have link."
39
32
33
		# Handle SIGINT (Ctrl-C); force abort of while() loop
34
		trap break SIGINT
35
40
		count=1
36
		count=1
41
		while [ ${count} -le ${netwait_if_timeout} ]; do
37
		while [ ${count} -le ${netwait_if_timeout} ]; do
42
			if output=`/sbin/ifconfig ${netwait_if} 2>/dev/null`; then
38
			if output=`/sbin/ifconfig ${netwait_if} 2>/dev/null`; then
43
				link=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
39
				link=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
44
				if [ -z "${link}" ]; then
40
				if [ -z "${link}" ]; then
45
					echo '.'
41
					echo "Link acquired for $netwait_if."
46
					break
42
					break
47
				fi
43
				fi
48
			else
44
			elif [ ${count} -eq ${netwait_if_timeout} ]; then
49
				echo ''
45
				echo ''
50
				err 1 "ifconfig ${netwait_if} failed"
46
				err 1 "ifconfig ${netwait_if} failed"
51
			fi
47
			fi
Lines 64-97 Link Here
64
		fi
60
		fi
65
	fi
61
	fi
66
62
67
	# Handle SIGINT (Ctrl-C); force abort of while() loop
63
	if [ -n "${netwait_ip}" ]; then
68
	trap break SIGINT
64
		# Handle SIGINT (Ctrl-C); force abort of for() loop
65
		trap break SIGINT
69
66
70
	for ip in ${netwait_ip}; do
67
		for ip in ${netwait_ip}; do
71
		echo -n "Waiting for ${ip} to respond to ICMP"
68
			echo -n "Waiting for ${ip} to respond to ICMP"
72
69
73
		count=1
70
			count=1
74
		while [ ${count} -le ${netwait_timeout} ]; do
71
			while [ ${count} -le ${netwait_timeout} ]; do
75
			/sbin/ping -t 1 -c 1 -o ${ip} >/dev/null 2>&1
72
				/sbin/ping -t 1 -c 1 -o ${ip} >/dev/null 2>&1
76
			rc=$?
73
				rc=$?
77
74
78
			if [ $rc -eq 0 ]; then
75
				if [ $rc -eq 0 ]; then
79
				# Restore default SIGINT handler
76
					# Restore default SIGINT handler
80
				trap - SIGINT
77
					trap - SIGINT
81
78
82
				echo '.'
79
					echo '.'
83
				return
80
					return
84
			fi
81
				fi
85
			count=$((count+1))
82
				count=$((count+1))
83
			done
84
			echo ': No response from host.'
86
		done
85
		done
87
		echo ': No response from host.'
88
	done
89
86
90
	# Restore default SIGINT handler
87
		# Restore default SIGINT handler
91
	trap - SIGINT
88
		trap - SIGINT
92
89
93
	warn "Exhausted IP list.  Continuing with startup, but be aware you may"
90
		warn "Exhausted IP list.  Continuing with startup, but be aware you may"
94
	warn "not have a fully functional networking layer at this point."
91
		warn "not have a fully functional networking layer at this point."
92
	fi
95
}
93
}
96
94
97
load_rc_config $name
95
load_rc_config $name

Return to bug 205263