svn commit: r185832 - user/kmacy/head_arpv2/sys/netinet6

Kip Macy kmacy at FreeBSD.org
Tue Dec 9 19:47:22 PST 2008


Author: kmacy
Date: Wed Dec 10 03:47:21 2008
New Revision: 185832
URL: http://svn.freebsd.org/changeset/base/185832

Log:
  - fix case where flags was not passed to lla_lookup
  - use exclusive flag to determine whether or not to wunlock rather than
    the condition that determined the use of the exclusive flag

Modified:
  user/kmacy/head_arpv2/sys/netinet6/nd6.c
  user/kmacy/head_arpv2/sys/netinet6/nd6.h

Modified: user/kmacy/head_arpv2/sys/netinet6/nd6.c
==============================================================================
--- user/kmacy/head_arpv2/sys/netinet6/nd6.c	Wed Dec 10 03:30:37 2008	(r185831)
+++ user/kmacy/head_arpv2/sys/netinet6/nd6.c	Wed Dec 10 03:47:21 2008	(r185832)
@@ -1618,7 +1618,7 @@ nd6_cache_lladdr(struct ifnet *ifp, stru
 	
 done:	
 	if (ln) {
-		if (lladdr)
+		if (flags & ND6_EXCLUSIVE)
 			LLE_WUNLOCK(ln);
 		else
 			LLE_RUNLOCK(ln);
@@ -1697,7 +1697,7 @@ nd6_output(struct ifnet *ifp, struct ifn
 	 */
 	flags = m ? LLE_EXCLUSIVE : 0;
 	IF_AFDATA_LOCK(rt->rt_ifp);
-	ln = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)dst);
+	ln = lla_lookup(LLTABLE6(ifp), flags, (struct sockaddr *)dst);
 	IF_AFDATA_UNLOCK(rt->rt_ifp);
 	if ((ln == NULL) && nd6_is_addr_neighbor(dst, ifp))  {
 		/*
@@ -1782,21 +1782,22 @@ nd6_output(struct ifnet *ifp, struct ifn
 		ln->la_hold = m;
 	}
 
+	if (flags & LLE_EXCLUSIVE)
+		LLE_WUNLOCK(ln);
+	else
+		LLE_RUNLOCK(ln);
+	
 	/*
 	 * If there has been no NS for the neighbor after entering the
 	 * INCOMPLETE state, send the first solicitation.
 	 */
 	if (!ND6_LLINFO_PERMANENT(ln) && ln->la_asked == 0) {
 		ln->la_asked++;
+		
 		nd6_llinfo_settimer(ln,
 		    (long)ND_IFINFO(ifp)->retrans * hz / 1000);
 		nd6_ns_output(ifp, NULL, &dst->sin6_addr, ln, 0);
 	}
-	if (m0)
-		LLE_WUNLOCK(ln);
-	else
-		LLE_RUNLOCK(ln);
-	
 	return (0);
 
   sendpkt:
@@ -1806,7 +1807,7 @@ nd6_output(struct ifnet *ifp, struct ifn
 		goto bad;
 	}
 	if (ln) {
-		if (m0)
+		if (flags & LLE_EXCLUSIVE)
 			LLE_WUNLOCK(ln);
 		else
 			LLE_RUNLOCK(ln);
@@ -1824,7 +1825,7 @@ nd6_output(struct ifnet *ifp, struct ifn
 
   bad:
 	if (ln) {
-		if (m0)
+		if (flags & LLE_EXCLUSIVE)
 			LLE_WUNLOCK(ln);
 		else
 			LLE_RUNLOCK(ln);

Modified: user/kmacy/head_arpv2/sys/netinet6/nd6.h
==============================================================================
--- user/kmacy/head_arpv2/sys/netinet6/nd6.h	Wed Dec 10 03:30:37 2008	(r185831)
+++ user/kmacy/head_arpv2/sys/netinet6/nd6.h	Wed Dec 10 03:47:21 2008	(r185832)
@@ -85,8 +85,8 @@ struct nd_ifinfo {
 				     */
 #define ND6_IFF_DONT_SET_IFROUTE	0x10
 
-#define	ND6_CREATE		0x1
-#define	ND6_EXCLUSIVE		0x2
+#define	ND6_CREATE		LLE_CREATE
+#define	ND6_EXCLUSIVE		LLE_EXCLUSIVE
 
 #ifdef _KERNEL
 #define ND_IFINFO(ifp) \


More information about the svn-src-user mailing list