Module Name:    src
Committed By:   roy
Date:           Thu Jan  7 11:51:07 UTC 2016

Modified Files:
        src/etc/defaults: rc.conf
        src/etc/rc.d: network

Log Message:
Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/etc/defaults/rc.conf
cvs rdiff -u -r1.69 -r1.70 src/etc/rc.d/network

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/defaults/rc.conf
diff -u src/etc/defaults/rc.conf:1.135 src/etc/defaults/rc.conf:1.136
--- src/etc/defaults/rc.conf:1.135	Sat Dec 26 21:05:11 2015
+++ src/etc/defaults/rc.conf	Thu Jan  7 11:51:07 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: rc.conf,v 1.135 2015/12/26 21:05:11 plunky Exp $
+#	$NetBSD: rc.conf,v 1.136 2016/01/07 11:51:07 roy Exp $
 #
 # /etc/defaults/rc.conf --
 #	default configuration of /etc/rc.conf
@@ -162,6 +162,13 @@ securelevel=""					# securelevel to set 
 
 # Networking startup.
 #
+# Wait up to 15 seconds for the tentative flag to clear from all addresses.
+# Wait up to 5 seconds for the detached flag to clear from all addresses.
+# Addresses are detached if there is no carrier, thus we have a small
+# wait to see if we get a carrier.
+# Even a wired interface may not recognise it has a carrier right away.
+ifconfig_wait_dad_flags="-w 15 -W 5"
+
 mdnsd=NO
 npf=NO
 ipfilter=NO		ipfilter_flags=""	# uses /etc/ipf.conf

Index: src/etc/rc.d/network
diff -u src/etc/rc.d/network:1.69 src/etc/rc.d/network:1.70
--- src/etc/rc.d/network:1.69	Tue Oct 14 20:49:47 2014
+++ src/etc/rc.d/network	Thu Jan  7 11:51:07 2016
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.69 2014/10/14 20:49:47 christos Exp $
+# $NetBSD: network,v 1.70 2016/01/07 11:51:07 roy Exp $
 #
 
 # PROVIDE: network
@@ -51,6 +51,7 @@ network_start()
 	network_start_defaultroute6
 	have_inet6 &&
 	network_start_ipv6_autoconf
+	network_wait_dad
 	network_start_local
 }
 
@@ -433,18 +434,6 @@ network_start_ipv6_autoconf()
 {
 	# IPv6 interface autoconfiguration.
 
-	dadcount=$(/sbin/sysctl -n net.inet6.ip6.dad_count 2>/dev/null)
-	if [ -n "$dadcount" -a "$dadcount" != 0 ]; then
-		# wait till DAD is completed
-		echo 'Waiting for DAD to complete for' \
-		    'statically configured addresses...'
-		# Add 1 for MAX_RTR_SOLICITATION_DELAY and another
-		# to give time for the last DAD packet to respond and
-		# a few more for luck.
-		waitsecs=$((dadcount + 4))
-		/sbin/ifconfig -w $waitsecs
-	fi
-
 	# dhcpcd will ensure DAD completes before forking
 	if checkyesnox rtsol && ! checkyesno dhcpcd; then
 		if [ "$ip6mode" = "autohost" ]; then
@@ -455,6 +444,16 @@ network_start_ipv6_autoconf()
 	fi
 }
 
+network_wait_dad()
+{
+	# Wait for the DAD flags to clear form all addresses.
+	if [ -n "$ifconfig_wait_dad_flags" ]; then
+		echo 'Waiting for DAD to complete for' \
+		    'statically configured addresses...'
+		ifconfig $ifconfig_wait_dad_flags
+	fi
+}
+
 network_start_local()
 {
 	# XXX this must die

Reply via email to