Date: Mon, 8 Mar 2010 21:30:12 +0000 (UTC) From: Qing Li <qingli@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r204893 - stable/8/sys/netinet6 Message-ID: <201003082130.o28LUCdW013376@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: qingli Date: Mon Mar 8 21:30:12 2010 New Revision: 204893 URL: http://svn.freebsd.org/changeset/base/204893 Log: MFC 204402 Use reference counting instead of locking to secure an address while that address is being used to generate temporary IPv6 address. This approach is sufficient and avoids recursive locking. Modified: stable/8/sys/netinet6/nd6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet6/nd6.c ============================================================================== --- stable/8/sys/netinet6/nd6.c Mon Mar 8 21:29:09 2010 (r204892) +++ stable/8/sys/netinet6/nd6.c Mon Mar 8 21:30:12 2010 (r204893) @@ -759,22 +759,25 @@ regen_tmpaddr(struct in6_ifaddr *ia6) */ if (!IFA6_IS_DEPRECATED(it6)) public_ifa6 = it6; + + if (public_ifa6 != NULL) + ifa_ref(&public_ifa6->ia_ifa); } + IF_ADDR_UNLOCK(ifp); if (public_ifa6 != NULL) { int e; if ((e = in6_tmpifadd(public_ifa6, 0, 0)) != 0) { - IF_ADDR_UNLOCK(ifp); + ifa_free(&public_ifa6->ia_ifa); log(LOG_NOTICE, "regen_tmpaddr: failed to create a new" " tmp addr,errno=%d\n", e); return (-1); } - IF_ADDR_UNLOCK(ifp); + ifa_free(&public_ifa6->ia_ifa); return (0); } - IF_ADDR_UNLOCK(ifp); return (-1); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003082130.o28LUCdW013376>