Bugzilla – Attachment 451318 Details for
Bug 697929
ipv6, rcnetwork returns before dad completed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
Patch to wait for link and ipv6 dad
0003-Wait-for-link-and-ipv6-duplicate-address-detection.patch (text/plain), 7.53 KB, created by
Marius Tomaschewski
on 2011-09-16 13:24:19 UTC
(
hide
)
Description:
Patch to wait for link and ipv6 dad
Filename:
MIME Type:
Creator:
Marius Tomaschewski
Created:
2011-09-16 13:24:19 UTC
Size:
7.53 KB
patch
obsolete
>From c0993cd31fca9d88c91f89eb9d6a1f1481b8fcce Mon Sep 17 00:00:00 2001 >From: Marius Tomaschewski <mt@suse.com> >Date: Fri, 16 Sep 2011 15:07:10 +0200 >Subject: [PATCH] Wait for link and ipv6 duplicate address detection > >Fixed to wait until link becomes ready and ipv6 duplicate address >detection finished what can cause failures of further services. >Added LINK_READY_WAIT and IPV6_DAD_WAIT variables (bnc#697929). > >Signed-off-by: Marius Tomaschewski <mt@suse.com> >--- > config/sysconfig.config-network | 17 ++++++++ > scripts/functions | 75 +++++++++++++++++++++++++++++++++++ > scripts/ifup | 82 +++++++++++++++++++++++++++++++++++---- > 3 files changed, 166 insertions(+), 8 deletions(-) > >diff --git a/config/sysconfig.config-network b/config/sysconfig.config-network >index 1411957..c39a265 100644 >--- a/config/sysconfig.config-network >+++ b/config/sysconfig.config-network >@@ -135,6 +135,23 @@ MANDATORY_DEVICES="" > # > WAIT_FOR_INTERFACES="30" > >+## Type: integer >+## Default: "" >+# >+# The number of seconds to wait for link to become useable / ready. >+# Default is to use WAIT_FOR_INTERFACES/2 seconds. Set to 0 to disable. >+# >+LINK_READY_WAIT="" >+ >+## Type: integer >+## Default: "" >+# >+# The number of seconds to wait for the end of IPv6 duplicate address >+# detection. Default is to use WAIT_FOR_INTERFACES/5 seconds. Set to >+# 0 to disable. >+# >+IPV6_DAD_WAIT="" >+ > ## Type: yesno > ## Default: yes > # >diff --git a/scripts/functions b/scripts/functions >index f3ad06e..5d8c035 100644 >--- a/scripts/functions >+++ b/scripts/functions >@@ -110,6 +110,81 @@ is_iface_up () { > esac > } > >+link_ready_check () { >+ local c=`cat /sys/class/net/${1}/carrier 2>/dev/null` >+ local d=`cat /sys/class/net/${1}/dormant 2>/dev/null` >+ local o=`cat /sys/class/net/${1}/operstate 2>/dev/null` >+ >+ #debug "link ready ${1}: carrier=$c, dormant=$d, operstate=$o" >+ if test -e "/sys/class/net/${1}/operstate" ; then >+ # SLE 11 has carrier + operstate + dormant >+ test "$d" = "0" || return 3 >+ test "$c" = "1" || return 2 >+ test \( "$o" = "up" -o "$o" = "unknown" \) || return 1 >+ else >+ # e.g. SLE 10 does not have operstate/dormant >+ test "$c" = "1" || return 1 >+ fi >+ return 0 >+} >+ >+link_ready_wait () { >+ local iface=$1 >+ local wsecs=${2:-0} >+ local uwait=25000 >+ local loops=$(((wsecs * 100000) / $uwait)) >+ local loop ret=0 >+ for((loop=0; loop < $loops; loop++)) ; do >+ link_ready_check "$iface" ; ret=$? >+ test $ret -ne 0 && usleep $uwait || break >+ done >+ return $ret >+} >+ >+ipv6_addr_dad_check() >+{ >+ local iface="$1" word i >+ local nodad=1 tentative=1 dadfailed=1 >+ test -f "/sys/class/net/$iface/ifindex" || return 1 >+ while read -a word ; do >+ test "${word[0]}" != "inet6" && continue >+ for((i=2; i<${#word[@]}; ++i)) ; do >+ case ${word[$i]} in >+ nodad) nodad=0 ;; >+ tentative) tentative=0 ;; >+ dadfailed) dadfailed=0 ;; >+ flags) ((i++)) >+ rx='^[[:xdigit:]]+$' >+ [[ "${word[$i]}" =~ $rx ]] || continue >+ hx="0x${word[$i]}" >+ test $(( $hx & 0x02 )) -ne 0 && nodad=0 >+ test $(( $hx & 0x08 )) -ne 0 && dadfailed=0 >+ test $(( $hx & 0x40 )) -ne 0 && tentative=0 >+ ;; >+ esac >+ done >+ #debug "ipv6 dad $iface: nodad=$nodad, dadfailed=$dadfailed, tentative=$tentative" >+ test $nodad -eq 0 && continue >+ test $dadfailed -eq 0 && return 2 >+ test $tentative -eq 0 && return 3 >+ done < <(LC_ALL=C ip -6 addr show ${iface:+dev "$iface"} 2>/dev/null) >+ return $R_SUCCESS >+} >+ >+ipv6_addr_dad_wait() >+{ >+ local iface=$1 >+ local wsecs=${2:-0} >+ local uwait=25000 >+ local loops=$(((wsecs * 100000) / $uwait)) >+ local loop ret=0 >+ for((loop=0; loop < $loops; loop++)) ; do >+ ipv6_addr_dad_check "$iface" ; ret=$? >+ test $ret -eq 3 && usleep $uwait || break >+ done >+ return $ret >+} >+ > get_ethtool_drv_info () { > test -n "$1" || return 1 > local ethtool="/sbin/ethtool" >diff --git a/scripts/ifup b/scripts/ifup >index 5c445d0..85a9251 100755 >--- a/scripts/ifup >+++ b/scripts/ifup >@@ -936,11 +936,8 @@ case "$BOOTPROTO$SKIP_MAIN_PART" in > ;; > ifstatus) > if is_iface_up $INTERFACE ; then >- message_if_not_run_from_rc "$INTERFACE is up" >+ message "`printf " %-9s is up" "$INTERFACE"`" > message_if_not_run_from_rc "$(ip addr show $INTERFACE)" >- while read a b c d e f g h i; do >- message "`printf " %-9s IP address: %s" "$i" "$d"`" >- done < <(ip -o -4 addr show $INTERFACE) > ifstatus-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS} > retcode=$R_SUCCESS > else >@@ -1095,7 +1092,34 @@ case "$BOOTPROTO$SKIP_MAIN_PART" in > ADDRCOUNT=$(($ADDRCOUNT + 1)) > done > fi >+ > ifup-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS} >+ >+ # >+ # OK, everything is set up here .. lets check the state >+ # >+ >+ # - link >+ link_ready_wait "$INTERFACE" "${LINK_READY_WAIT:-$((WAIT_FOR_INTERFACES/2))}" >+ link_ret=$? >+ if [ "$retcode" = "$R_SUCCESS" ] ; then >+ # do not override codes when already set (e.g. $R_DHCP_BG) >+ case "$link_ret" in >+ 1|2|3) retcode=$R_NOTRUNNING ;; >+ esac >+ fi >+ >+ # - dad >+ if [ "$retcode" = "$R_SUCCESS" -a -d /proc/sys/net/ipv6 ] ; then >+ IPV6_DAD_WAIT=${IPV6_DAD_WAIT:-$((WAIT_FOR_INTERFACES/5))} >+ ipv6_addr_dad_wait "$INTERFACE" "$IPV6_DAD_WAIT" >+ dad_ret=$? >+ case $dad_ret in >+ 1|2) retcode=$R_NOTRUNNING ;; >+ 3) retcode=$R_DHCP_BG ;; >+ esac >+ fi >+ > ;; > ifdown) > case "$BOOTPROTO" in >@@ -1117,13 +1141,55 @@ case "$BOOTPROTO$SKIP_MAIN_PART" in > ;; > ifstatus) > if is_iface_up $INTERFACE ; then >- message_if_not_run_from_rc "$INTERFACE is up" > message_if_not_run_from_rc "$(ip addr show $INTERFACE)" >- while read a b c d e f g h i; do >- message "`printf " %-9s IP address: %s" "$i" "$d"`" >- done < <(ip -o -4 addr show $INTERFACE) >+ if [ "$RUN_FROM_RC" = "yes" ]; then >+ while read a b c d e f g h i; do >+ message "`printf " %-9s IP address: %s" "$i" "$d"`" >+ done < <(ip -o -4 addr show $INTERFACE) >+ while read a b c d e f g h i; do >+ test "$f" = "global" || continue >+ message "`printf " %-9s IP address: %s" "$b" "$d"`" >+ done < <(ip -o -6 addr show $INTERFACE) >+ fi >+ > ifstatus-route $CONFIG $INTERFACE ${OPTIONS:+-o $OPTIONS} >+ > retcode=$R_SUCCESS >+ dad_ret=0 >+ link_ret=0 >+ >+ # Check the link >+ if [ -n "$LINK_READY_WAIT" -a $((LINK_READY_WAIT)) -gt 0 ] ; then >+ # check the link >+ link_ready_check "$INTERFACE" || link_ret=$? >+ case $link_ret in >+ 1|2|3) retcode=$R_NOTRUNNING ;; >+ esac >+ fi >+ >+ # Check ipv6 dad >+ if [ "$retcode" = "$R_SUCCESS" -a -d /proc/sys/net/ipv6 ] ; then >+ IPV6_DAD_WAIT=${IPV6_DAD_WAIT:-$((WAIT_FOR_INTERFACES/5))} >+ if [ $((IPV6_DAD_WAIT)) -gt 0 ] ; then >+ ipv6_addr_dad_check "$INTERFACE" >+ dad_ret=$? >+ fi >+ fi >+ >+ # OK, now show the results >+ case $link_ret in >+ 0) >+ # in link problem cases, IPv6 dad status is not yet interesting >+ msg="is up" >+ case $dad_ret in >+ 2) msg="is up, but ipv6 duplicate address check failed";; >+ 3) msg="is up, but has tentative ipv6 address";; >+ esac >+ message "`printf " %-9s $msg" "$INTERFACE"`" ;; >+ 1) message "`printf " %-9s is not up" "$INTERFACE"`" ;; >+ 2) message "`printf " %-9s is dormant" "$INTERFACE"`" ;; >+ 3) message "`printf " %-9s has no carrier" "$INTERFACE"`" ;; >+ esac > else > # message_if_not_run_from_rc "$INTERFACE is down" > message "`printf " %-9s is down" $INTERFACE`" >-- >1.7.3.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 697929
: 451318 |
452941
|
452988