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

Collapse All | Expand All

(-)etc/rc.d/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
(-)etc/rc.d/netwait (-30 / +32 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-30 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
26
	if [ -z "${netwait_if}" ] && [ -z "${netwait_ip}" ]; then
27
		err 1 "You must define one or more IP addresses in netwait_ip"
27
		err 1 "No interface or IP addresses listed, nothing to wait for"
28
	fi
28
	fi
29
29
30
	if [ ${netwait_timeout} -lt 1 ]; then
30
	if [ ${netwait_timeout} -lt 1 ]; then
Lines 31-51 Link Here
31
		err 1 "netwait_timeout must be >= 1"
31
		err 1 "netwait_timeout must be >= 1"
32
	fi
32
	fi
33
33
34
	# Handle SIGINT (Ctrl-C); force abort of while() loop
35
	trap break SIGINT
36
37
	if [ -n "${netwait_if}" ]; then
34
	if [ -n "${netwait_if}" ]; then
38
		echo -n "Waiting for $netwait_if to have link"
35
		echo "Waiting for $netwait_if to have link."
39
36
37
		# Handle SIGINT (Ctrl-C); force abort of while() loop
38
		trap break SIGINT
39
40
		count=1
40
		count=1
41
		while [ ${count} -le ${netwait_if_timeout} ]; do
41
		while [ ${count} -le ${netwait_if_timeout} ]; do
42
			if output=`/sbin/ifconfig ${netwait_if} 2>/dev/null`; then
42
			if output=`/sbin/ifconfig ${netwait_if} 2>/dev/null`; then
43
				link=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
43
				link=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
44
				if [ -z "${link}" ]; then
44
				if [ -z "${link}" ]; then
45
					echo '.'
45
					echo "Link acquired for $netwait_if."
46
					break
46
					break
47
				fi
47
				fi
48
			else
48
			elif [ ${count} -eq ${netwait_if_timeout} ]; then
49
				echo ''
49
				echo ''
50
				err 1 "ifconfig ${netwait_if} failed"
50
				err 1 "ifconfig ${netwait_if} failed"
51
			fi
51
			fi
Lines 64-97 Link Here
64
		fi
64
		fi
65
	fi
65
	fi
66
66
67
	# Handle SIGINT (Ctrl-C); force abort of while() loop
67
	if [ -n "${netwait_ip}" ]; then
68
	trap break SIGINT
68
		# Handle SIGINT (Ctrl-C); force abort of for() loop
69
		trap break SIGINT
69
70
70
	for ip in ${netwait_ip}; do
71
		for ip in ${netwait_ip}; do
71
		echo -n "Waiting for ${ip} to respond to ICMP"
72
			echo -n "Waiting for ${ip} to respond to ICMP"
72
73
73
		count=1
74
			count=1
74
		while [ ${count} -le ${netwait_timeout} ]; do
75
			while [ ${count} -le ${netwait_timeout} ]; do
75
			/sbin/ping -t 1 -c 1 -o ${ip} >/dev/null 2>&1
76
				/sbin/ping -t 1 -c 1 -o ${ip} >/dev/null 2>&1
76
			rc=$?
77
				rc=$?
77
78
78
			if [ $rc -eq 0 ]; then
79
				if [ $rc -eq 0 ]; then
79
				# Restore default SIGINT handler
80
					# Restore default SIGINT handler
80
				trap - SIGINT
81
					trap - SIGINT
81
82
82
				echo '.'
83
					echo '.'
83
				return
84
					return
84
			fi
85
				fi
85
			count=$((count+1))
86
				count=$((count+1))
87
			done
88
			echo ': No response from host.'
86
		done
89
		done
87
		echo ': No response from host.'
88
	done
89
90
90
	# Restore default SIGINT handler
91
		# Restore default SIGINT handler
91
	trap - SIGINT
92
		trap - SIGINT
92
93
93
	warn "Exhausted IP list.  Continuing with startup, but be aware you may"
94
		warn "Exhausted IP list.  Continuing with startup, but be aware you may"
94
	warn "not have a fully functional networking layer at this point."
95
		warn "not have a fully functional networking layer at this point."
96
	fi
95
}
97
}
96
98
97
load_rc_config $name
99
load_rc_config $name

Return to bug 205263