Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Oct 2003 18:15:49 -0800 (PST)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 40796 for review
Message-ID:  <200310300215.h9U2FnTm079652@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=40796

Change 40796 by sam@sam_ebb on 2003/10/29 18:15:18

	use a local variable to eliminate holding a lock across
	a call out of view

Affected files ...

.. //depot/projects/netperf/sys/netinet6/nd6_nbr.c#6 edit

Differences ...

==== //depot/projects/netperf/sys/netinet6/nd6_nbr.c#6 (text+ko) ====

@@ -207,6 +207,7 @@
 	if (!ifa) {
 		struct rtentry *rt;
 		struct sockaddr_in6 tsin6;
+		int need_proxy;
 
 		bzero(&tsin6, sizeof tsin6);		
 		tsin6.sin6_len = sizeof(struct sockaddr_in6);
@@ -214,8 +215,11 @@
 		tsin6.sin6_addr = taddr6;
 
 		rt = rtalloc1((struct sockaddr *)&tsin6, 0, 0);
-		if (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 &&
-		    rt->rt_gateway->sa_family == AF_LINK) {
+		need_proxy = (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 &&
+		    rt->rt_gateway->sa_family == AF_LINK);
+		if (rt)
+			rtfree(rt);
+		if (need_proxy) {
 			/*
 			 * proxy NDP for single entry
 			 */
@@ -226,8 +230,6 @@
 				proxydl = SDL(rt->rt_gateway);
 			}
 		}
-		if (rt)
-			rtfree(rt);
 	}
 	if (!ifa) {
 		/*



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