View | Details | Raw Unified | Return to bug 697929
Collapse All | Expand All

(-)a/config/sysconfig.config-network (+17 lines)
Lines 135-140 MANDATORY_DEVICES="" Link Here
135
#
135
#
136
WAIT_FOR_INTERFACES="30"
136
WAIT_FOR_INTERFACES="30"
137
137
138
## Type:        integer
139
## Default:     ""
140
#
141
# The number of seconds to wait for link to become useable / ready.
142
# Default is to use WAIT_FOR_INTERFACES/2 seconds. Set to 0 to disable.
143
#
144
LINK_READY_WAIT=""
145
146
## Type:        integer
147
## Default:     ""
148
#
149
# The number of seconds to wait for the end of IPv6 duplicate address
150
# detection. Default is to use WAIT_FOR_INTERFACES/5 seconds. Set to
151
# 0 to disable.
152
#
153
IPV6_DAD_WAIT=""
154
138
## Type:	yesno
155
## Type:	yesno
139
## Default:	yes
156
## Default:	yes
140
#
157
#
(-)a/scripts/functions (+75 lines)
Lines 110-115 is_iface_up () { Link Here
110
	esac
110
	esac
111
}
111
}
112
112
113
link_ready_check () {
114
        local c=`cat /sys/class/net/${1}/carrier 2>/dev/null`
115
        local d=`cat /sys/class/net/${1}/dormant 2>/dev/null`
116
        local o=`cat /sys/class/net/${1}/operstate 2>/dev/null`
117
118
        #debug "link ready ${1}: carrier=$c, dormant=$d, operstate=$o"
119
        if test -e "/sys/class/net/${1}/operstate" ; then
120
                # SLE 11 has carrier + operstate + dormant
121
		test "$d" = "0" || return 3
122
		test "$c" = "1" || return 2
123
		test \( "$o" = "up" -o "$o" = "unknown" \) || return 1
124
        else
125
                # e.g. SLE 10 does not have operstate/dormant
126
                test "$c" = "1" || return 1
127
        fi
128
	return 0
129
}
130
131
link_ready_wait () {
132
	local iface=$1
133
	local wsecs=${2:-0}
134
	local uwait=25000
135
	local loops=$(((wsecs * 100000) / $uwait))
136
	local loop ret=0
137
	for((loop=0; loop < $loops; loop++)) ; do
138
		link_ready_check "$iface" ; ret=$?
139
		test $ret -ne 0 && usleep $uwait || break
140
	done
141
	return $ret
142
}
143
144
ipv6_addr_dad_check()
145
{
146
	local iface="$1" word i
147
	local nodad=1 tentative=1 dadfailed=1
148
	test -f "/sys/class/net/$iface/ifindex" || return 1
149
	while read -a word ; do
150
		test "${word[0]}" != "inet6" && continue
151
		for((i=2; i<${#word[@]}; ++i)) ; do
152
			case ${word[$i]} in
153
			nodad)		nodad=0     ;;
154
			tentative)	tentative=0 ;;
155
			dadfailed)	dadfailed=0 ;;
156
			flags)  ((i++))
157
				rx='^[[:xdigit:]]+$'
158
				[[ "${word[$i]}" =~ $rx ]] || continue
159
				hx="0x${word[$i]}"
160
				test $(( $hx & 0x02 )) -ne 0 && nodad=0
161
				test $(( $hx & 0x08 )) -ne 0 && dadfailed=0
162
				test $(( $hx & 0x40 )) -ne 0 && tentative=0
163
			;;
164
			esac
165
		done
166
		#debug "ipv6 dad $iface: nodad=$nodad, dadfailed=$dadfailed, tentative=$tentative"
167
		test $nodad     -eq 0 && continue
168
		test $dadfailed -eq 0 && return 2
169
		test $tentative -eq 0 && return 3
170
	done < <(LC_ALL=C ip -6 addr show ${iface:+dev "$iface"} 2>/dev/null)
171
	return $R_SUCCESS
172
}
173
174
ipv6_addr_dad_wait()
175
{
176
	local iface=$1
177
	local wsecs=${2:-0}
178
	local uwait=25000
179
	local loops=$(((wsecs * 100000) / $uwait))
180
	local loop ret=0
181
	for((loop=0; loop < $loops; loop++)) ; do
182
		ipv6_addr_dad_check "$iface" ; ret=$?
183
		test $ret -eq 3 && usleep $uwait || break
184
	done
185
	return $ret
186
}
187
113
get_ethtool_drv_info () {
188
get_ethtool_drv_info () {
114
	test -n "$1" || return 1
189
	test -n "$1" || return 1
115
	local ethtool="/sbin/ethtool"
190
	local ethtool="/sbin/ethtool"
(-)a/scripts/ifup (-9 / +74 lines)
Lines 936-946 case "$BOOTPROTO$SKIP_MAIN_PART" in Link Here
936
			;;
936
			;;
937
			ifstatus)
937
			ifstatus)
938
				if is_iface_up $INTERFACE ; then
938
				if is_iface_up $INTERFACE ; then
939
					message_if_not_run_from_rc "$INTERFACE is up"
939
					message "`printf "    %-9s is up" "$INTERFACE"`"
940
					message_if_not_run_from_rc "$(ip addr show $INTERFACE)"
940
					message_if_not_run_from_rc "$(ip addr show $INTERFACE)"
941
					while read a b c d e f g h i; do
942
						message "`printf "    %-9s IP address: %s" "$i" "$d"`"
943
					done < <(ip -o -4 addr show $INTERFACE)
944
					ifstatus-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS}
941
					ifstatus-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS}
945
					retcode=$R_SUCCESS
942
					retcode=$R_SUCCESS
946
				else
943
				else
Lines 1095-1101 case "$BOOTPROTO$SKIP_MAIN_PART" in Link Here
1095
						ADDRCOUNT=$(($ADDRCOUNT + 1))
1092
						ADDRCOUNT=$(($ADDRCOUNT + 1))
1096
					done
1093
					done
1097
				fi
1094
				fi
1095
1098
				ifup-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS}
1096
				ifup-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS}
1097
1098
				#
1099
				# OK, everything is set up here .. lets check the state
1100
				#
1101
1102
				# - link
1103
				link_ready_wait "$INTERFACE" "${LINK_READY_WAIT:-$((WAIT_FOR_INTERFACES/2))}"
1104
				link_ret=$?
1105
				if [ "$retcode" = "$R_SUCCESS" ] ; then
1106
					# do not override codes when already set (e.g. $R_DHCP_BG)
1107
					case "$link_ret" in
1108
					1|2|3) retcode=$R_NOTRUNNING ;;
1109
					esac
1110
				fi
1111
1112
				# - dad
1113
				if [ "$retcode" = "$R_SUCCESS" -a -d /proc/sys/net/ipv6 ] ; then
1114
					IPV6_DAD_WAIT=${IPV6_DAD_WAIT:-$((WAIT_FOR_INTERFACES/5))}
1115
					ipv6_addr_dad_wait "$INTERFACE" "$IPV6_DAD_WAIT"
1116
					dad_ret=$?
1117
					case $dad_ret in
1118
					1|2) retcode=$R_NOTRUNNING ;;
1119
					3)   retcode=$R_DHCP_BG    ;;
1120
					esac
1121
				fi
1122
1099
				;;
1123
				;;
1100
			ifdown)
1124
			ifdown)
1101
				case "$BOOTPROTO" in
1125
				case "$BOOTPROTO" in
Lines 1117-1129 case "$BOOTPROTO$SKIP_MAIN_PART" in Link Here
1117
				;;
1141
				;;
1118
			ifstatus)
1142
			ifstatus)
1119
				if is_iface_up $INTERFACE ; then
1143
				if is_iface_up $INTERFACE ; then
1120
					message_if_not_run_from_rc "$INTERFACE is up"
1121
					message_if_not_run_from_rc "$(ip addr show $INTERFACE)"
1144
					message_if_not_run_from_rc "$(ip addr show $INTERFACE)"
1122
					while read a b c d e f g h i; do
1145
					if [ "$RUN_FROM_RC" = "yes" ]; then
1123
						message "`printf "    %-9s IP address: %s" "$i" "$d"`"
1146
						while read a b c d e f g h i; do
1124
					done < <(ip -o -4 addr show $INTERFACE)
1147
							message "`printf "    %-9s IP address: %s" "$i" "$d"`"
1148
						done < <(ip -o -4 addr show $INTERFACE)
1149
						while read a b c d e f g h i; do
1150
							test "$f" = "global" || continue
1151
							message "`printf "    %-9s IP address: %s" "$b" "$d"`"
1152
						done < <(ip -o -6 addr show $INTERFACE)
1153
					fi
1154
1125
					ifstatus-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS}
1155
					ifstatus-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS}
1156
1126
					retcode=$R_SUCCESS
1157
					retcode=$R_SUCCESS
1158
					dad_ret=0
1159
					link_ret=0
1160
1161
					# Check the link
1162
					if [ -n "$LINK_READY_WAIT" -a $((LINK_READY_WAIT)) -gt 0 ] ; then
1163
						# check the link
1164
						link_ready_check "$INTERFACE" || link_ret=$?
1165
						case $link_ret in
1166
						1|2|3) retcode=$R_NOTRUNNING ;;
1167
						esac
1168
					fi
1169
1170
					# Check ipv6 dad
1171
					if [ "$retcode" = "$R_SUCCESS" -a -d /proc/sys/net/ipv6 ] ; then
1172
						IPV6_DAD_WAIT=${IPV6_DAD_WAIT:-$((WAIT_FOR_INTERFACES/5))}
1173
						if [ $((IPV6_DAD_WAIT)) -gt 0 ] ; then
1174
							ipv6_addr_dad_check "$INTERFACE"
1175
							dad_ret=$?
1176
						fi
1177
					fi
1178
1179
					# OK, now show the results
1180
					case $link_ret in
1181
					0)
1182
					   # in link problem cases, IPv6 dad status is not yet interesting
1183
					   msg="is up"
1184
					   case $dad_ret in
1185
					   2) msg="is up, but ipv6 duplicate address check failed";;
1186
					   3) msg="is up, but has tentative ipv6 address";;
1187
					   esac
1188
					   message "`printf "    %-9s $msg" "$INTERFACE"`" ;;
1189
					1) message "`printf "    %-9s is not up" "$INTERFACE"`" ;;
1190
					2) message "`printf "    %-9s is dormant" "$INTERFACE"`" ;;
1191
					3) message "`printf "    %-9s has no carrier" "$INTERFACE"`" ;;
1192
					esac
1127
				else
1193
				else
1128
					# message_if_not_run_from_rc "$INTERFACE is down"
1194
					# message_if_not_run_from_rc "$INTERFACE is down"
1129
					message "`printf "    %-9s is down" $INTERFACE`"
1195
					message "`printf "    %-9s is down" $INTERFACE`"
1130
- 

Return to bug 697929