Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc Instead of waiting for a duration based in IPv6 DAD coun...



details:   https://anonhg.NetBSD.org/src/rev/4ea03aafd69d
branches:  trunk
changeset: 342742:4ea03aafd69d
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Jan 07 11:51:07 2016 +0000

description:
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.

diffstat:

 etc/defaults/rc.conf |   9 ++++++++-
 etc/rc.d/network     |  25 ++++++++++++-------------
 2 files changed, 20 insertions(+), 14 deletions(-)

diffs (78 lines):

diff -r 017f3cb52a50 -r 4ea03aafd69d etc/defaults/rc.conf
--- a/etc/defaults/rc.conf      Thu Jan 07 11:32:21 2016 +0000
+++ b/etc/defaults/rc.conf      Thu Jan 07 11:51:07 2016 +0000
@@ -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 @@
 
 # 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
diff -r 017f3cb52a50 -r 4ea03aafd69d etc/rc.d/network
--- a/etc/rc.d/network  Thu Jan 07 11:32:21 2016 +0000
+++ b/etc/rc.d/network  Thu Jan 07 11:51:07 2016 +0000
@@ -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_defaultroute6
        have_inet6 &&
        network_start_ipv6_autoconf
+       network_wait_dad
        network_start_local
 }
 
@@ -433,18 +434,6 @@
 {
        # 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 @@
        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



Home | Main Index | Thread Index | Old Index