Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jan 2012 04:45:33 +0900 (JST)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        dk@neveragain.de
Cc:        freebsd-net@FreeBSD.org
Subject:   Re: Unnecessary sleep in network.subr: ipv6_up()
Message-ID:  <20120117.044533.1784742896398431105.hrs@allbsd.org>
In-Reply-To: <20120110102405.GA82356@neveragain.de>
References:  <20120110102405.GA82356@neveragain.de>

next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart0(Tue_Jan_17_04_45_33_2012_849)--
Content-Type: Multipart/Mixed;
	boundary="--Next_Part(Tue_Jan_17_04_45_33_2012_075)--"
Content-Transfer-Encoding: 7bit

----Next_Part(Tue_Jan_17_04_45_33_2012_075)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Dennis Koegel <dk@neveragain.de> wrote
  in <20120110102405.GA82356@neveragain.de>:

dk> Cheers,
dk>
dk> problem: Having a *lot* of IPv6 interfaces (Vlan interfaces in this case)
dk> causes a huge and annoying delay time at system boot in 9.0R.
dk>
dk> ipv6_up() in network.subr does this:
dk>
dk> +	# wait for DAD
dk> +	sleep `${SYSCTL_N} net.inet6.ip6.dad_count`
dk> +	sleep 1
dk>
dk> This happens for each and every interface, at a minimum (and default) of
dk> two seconds per interface.
dk>
dk> It seems the behaviour was introduced with r197139. Before this merge,
dk> /etc/rc.d/network_ipv6 did the same sleeps, but only once for the whole
dk> network startup.
dk>
dk> I don't see why this should happen per interface, so I suggest the extra
dk> sleeps are limited to "once per network startup" once again (or maybe
dk> removed?).

 Can you try the attached patch and let me know if it works fine on
 your system?

-- Hiroki

----Next_Part(Tue_Jan_17_04_45_33_2012_075)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="etc_dadwait.20120117-1.diff"

Index: etc/network.subr
===================================================================
--- etc/network.subr	(revision 230227)
+++ etc/network.subr	(working copy)
@@ -559,10 +559,6 @@
 	ipv6_prefix_hostid_addr_common ${_if} alias && _ret=0
 	ipv6_accept_rtadv_up ${_if} && _ret=0

-	# wait for DAD
-	sleep `${SYSCTL_N} net.inet6.ip6.dad_count`
-	sleep 1
-
 	return $_ret
 }

Index: etc/rc.d/netif
===================================================================
--- etc/rc.d/netif	(revision 230227)
+++ etc/rc.d/netif	(working copy)
@@ -123,16 +123,26 @@
 		_cooked_list="`list_net_interfaces`"
 	fi

+	_dadwait=
 	_fail=
 	_ok=
 	for ifn in ${_cooked_list}; do
 		if ${_func} ${ifn} $2; then
 			_ok="${_ok} ${ifn}"
+			if ipv6if ${ifn}; then
+				_dadwait=1
+			fi
 		else
 			_fail="${_fail} ${ifn}"
 		fi
 	done

+	# inet6 address configuration needs sleep for DAD.
+	if [ -n "${_dadwait}" ]; then
+		sleep `${SYSCTL_N} net.inet6.ip6.dad_count`
+		sleep 1
+	fi
+
 	_str=
 	if [ -n "${_ok}" ]; then
 		case ${_func} in

----Next_Part(Tue_Jan_17_04_45_33_2012_075)----

----Security_Multipart0(Tue_Jan_17_04_45_33_2012_849)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEABECAAYFAk8Ufl0ACgkQTyzT2CeTzy3sNQCfXds1WoPW+0VaVmVZZvGnOVtG
PesAn0sjZ077ENZgwnbfKIhYrqjATcUC
=yLXv
-----END PGP SIGNATURE-----

----Security_Multipart0(Tue_Jan_17_04_45_33_2012_849)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120117.044533.1784742896398431105.hrs>