commit:     1b52dd84770eab44b5590ecb5cd386eca36f9b34
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 21:50:38 2018 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 21:50:42 2018 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=1b52dd84

net/iproute2: improve DAD tentative wait/output.

If an interface had dad_timeout=0 set, then the wait loop output is
confusing. Skip it entirely, printing a useful message:
> Not waiting for DAD timeout on tentative IPv6 addresses (per conf.d/net 
> dad_timeout)

Refactor the DAD tentantive conditionals for ease of debugging.

Bug 636846 suggests that some kernels are still showing tentative
addresses despite sysctls being set.

Bug: https://bugs.gentoo.org/636846
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 net/iproute2.sh | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/net/iproute2.sh b/net/iproute2.sh
index d33ee11..2d83534 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -441,9 +441,13 @@ _iproute2_route_flush() {
        _cmd ip $FAMILY route flush table cache dev "${IFACE}"
 }
 
+_iproute2_ipv6_tentative_output() {
+       LC_ALL=C ip -family inet6 addr show dev ${IFACE} tentative
+}
+
 _iproute2_ipv6_tentative()
 {
-       [ -n "$(LC_ALL=C ip -family inet6 addr show dev ${IFACE} tentative)" ] 
&& return 0
+       [ -n "$(_iproute2_ipv6_tentative_output)" ] && return 0
 
        return 1
 }
@@ -462,11 +466,15 @@ iproute2_post_start()
 
        # This block must be non-fatal, otherwise the interface will not be
        # recorded as starting, and later services may be blocked.
-       if _iproute2_ipv6_tentative; then
-               if [ "$EINFO_VERBOSE" = "yes" ]; then
-                       veinfo "Found tentative addresses:"
-                       LC_ALL=C ip -family inet6 addr show dev ${IFACE} 
tentative
-               fi
+       _iproute2_ipv6_tentative ; ret_tentative=$?
+       if [ $ret_tentative -eq 0 -a "$EINFO_VERBOSE" = "yes" ]; then
+               veinfo "Found tentative addresses:"
+               _iproute2_ipv6_tentative_output
+       fi
+       # This could be nested, but the conditionals are very deep at that 
point.
+       if [ $ret_tentative -eq 0 -a $_dad_timeout -le 0 ]; then
+               einfo "Not waiting for DAD timeout on tentative IPv6 addresses 
(per conf.d/net dad_timeout)"
+       elif [ $ret_tentative -eq 0 ]; then
                einfon "Waiting for tentative IPv6 addresses to complete DAD 
(${_dad_timeout} seconds) "
                while [ $_dad_timeout -gt 0 ]; do
                        _iproute2_ipv6_tentative || break

Reply via email to