commit:     50c9fd7827fa58d27a593c8c480068f85c047cec
Author:     Thomas D <whissi <AT> whissi <DOT> de>
AuthorDate: Wed Apr 16 09:51:56 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Mar 10 16:14:49 2015 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=50c9fd78

net/iproute2: Add timeout information and timeout progress indicator

With this patch we will show the currently set dad_timeout value to the
user. The timeout progress will be shown using dots.

The idea is stolen from _wait_for_carrier() in init.d/net.lo.in.

This patch will also undo commit

  732a9a4999f479ee97a404252f6a0eba4a86e338

X-Gentoo-Bug: 488250
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=488250

 net/iproute2.sh | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/net/iproute2.sh b/net/iproute2.sh
index 7918941..8053b2f 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -351,9 +351,10 @@ _iproute2_ipv6_tentative()
 
 iproute2_post_start()
 {
-       local n=
-       eval n=\$dad_timeout_${IFVAR}
-       [ -z "$n" ] && n=${dad_timeout:-10}
+       local _dad_timeout=
+
+       eval _dad_timeout=\$dad_timeout_${IFVAR}
+       _dad_timeout=${_dad_timeout:-${dad_timeout:-5}}
 
        local policyroute_order=
        eval policyroute_order=\$policy_rules_before_routes_${IFVAR}
@@ -361,14 +362,22 @@ iproute2_post_start()
        yesno "$policyroute_order" || _iproute2_policy_routing
 
        if _iproute2_ipv6_tentative; then
-               ebegin "Waiting for IPv6 addresses"
-               while [ $n -ge 0 ]; do
+               einfon "Waiting for IPv6 addresses (${_dad_timeout} seconds) "
+               while [ $_dad_timeout -gt 0 ]; do
                        _iproute2_ipv6_tentative || break
                        sleep 1
-                       : $(( n -= 1 ))
+                       : $(( _dad_timeout -= 1 ))
+                       printf "."
                done
-               [ $n -ge 0 ]
-               eend $?
+
+               echo ""
+
+               if [ $_dad_timeout -le 0 ]; then
+                       eend 1
+                       return 1
+               else
+                       eend 0
+               fi
        fi
 
        return 0

Reply via email to