From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-999034-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 75E4D1381F1
	for <garchives@archives.gentoo.org>; Sun, 21 Jan 2018 21:59:16 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 4E088E075F;
	Sun, 21 Jan 2018 21:59:15 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 2B666E075F
	for <gentoo-commits@lists.gentoo.org>; Sun, 21 Jan 2018 21:59:14 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 9CD75335CB7
	for <gentoo-commits@lists.gentoo.org>; Sun, 21 Jan 2018 21:59:13 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 789C91D
	for <gentoo-commits@lists.gentoo.org>; Sun, 21 Jan 2018 21:59:09 +0000 (UTC)
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" <robbat2@gentoo.org>
Message-ID: <1516571442.1b52dd84770eab44b5590ecb5cd386eca36f9b34.robbat2@OpenRC>
Subject: [gentoo-commits] proj/netifrc:master commit in: net/
X-VCS-Repository: proj/netifrc
X-VCS-Files: net/iproute2.sh
X-VCS-Directories: net/
X-VCS-Committer: robbat2
X-VCS-Committer-Name: Robin H. Johnson
X-VCS-Revision: 1b52dd84770eab44b5590ecb5cd386eca36f9b34
X-VCS-Branch: master
Date: Sun, 21 Jan 2018 21:59:09 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 790efb70-bb2e-465f-bcfe-83fbaf567f10
X-Archives-Hash: 6f3870fdbb50a152de20b99aeac68cab

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