PERFORCE change 40796 for review

Sam Leffler sam at FreeBSD.org
Wed Oct 29 18:15:51 PST 2003


http://perforce.freebsd.org/chv.cgi?CH=40796

Change 40796 by sam at 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) {
 		/*


More information about the p4-projects mailing list