PERFORCE change 153421 for review

Qing Li qingli at FreeBSD.org
Sun Nov 23 20:13:14 PST 2008


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

Change 153421 by qingli at FreeBSD-newarp on 2008/11/24 04:13:09

	missed a file in the previous commit, and 
	fix locking on IPv4 arp input path

Affected files ...

.. //depot/projects/arp-v2/src/sys/net/if_llatbl.c#6 edit
.. //depot/projects/arp-v2/src/sys/netinet/if_ether.c#16 edit
.. //depot/projects/arp-v2/src/sys/netinet/ip_output.c#7 edit

Differences ...

==== //depot/projects/arp-v2/src/sys/net/if_llatbl.c#6 (text+ko) ====

@@ -473,9 +473,8 @@
 	}
 
 	/*
-	 * XXXXXXXX: A big and ugly hack!
-	 * I must redesign this before even committing to perforce. This is
-	 * just a hack to make new design working.
+	 * XXXXXXXX: 
+	 *   REVISE this approach if possible.
 	 */
 	IFNET_WLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {

==== //depot/projects/arp-v2/src/sys/netinet/if_ether.c#16 (text+ko) ====

@@ -561,7 +561,7 @@
 	sin.sin_family = AF_INET;
 	sin.sin_addr = isaddr;
 	flag = (itaddr.s_addr == myaddr.s_addr) ? LLE_CREATE : 0;
-/* Qing	IF_AFDATA_LOCK(ifp); */
+	IF_AFDATA_LOCK(ifp); 
 	la = lla_lookup(LLTABLE(ifp), flag, (struct sockaddr *)&sin);
 	if (la != NULL) {
 		/* the following is not an error when doing bridging */
@@ -695,10 +695,11 @@
 			}
 			(void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln);
 			(void)memcpy(ar_sha(ah), &la->ll_addr, ah->ar_hln);
-/* QING			IF_AFDATA_UNLOCK(ifp); */
 		}
 	}
 
+	IF_AFDATA_UNLOCK(ifp);
+
 	if (itaddr.s_addr == myaddr.s_addr &&
 	    IN_LINKLOCAL(ntohl(itaddr.s_addr))) {
 		/* RFC 3927 link-local IPv4; always reply by broadcast. */
@@ -724,8 +725,7 @@
 	return;
 
 drop:
-/*	if (la != NULL)
-	IF_AFDATA_UNLOCK(ifp); */
+	IF_AFDATA_UNLOCK(ifp);
 	m_freem(m);
 }
 #endif

==== //depot/projects/arp-v2/src/sys/netinet/ip_output.c#7 (text+ko) ====

@@ -560,10 +560,10 @@
 		 */
 		m->m_flags &= ~(M_PROTOFLAGS);
 
-		IF_LLTBLS_LOCK(ifp);
+		IF_AFDATA_LOCK(ifp);
 		error = (*ifp->if_output)(ifp, m,
 				(struct sockaddr *)dst, ro->ro_rt);
-		IF_LLTBLS_UNLOCK(ifp);
+		IF_AFDATA_UNLOCK(ifp);
 		goto done;
 	}
 
@@ -596,10 +596,10 @@
 			 */
 			m->m_flags &= ~(M_PROTOFLAGS);
 
-			IF_LLTBLS_LOCK(ifp);
+			IF_AFDATA_LOCK(ifp);
 			error = (*ifp->if_output)(ifp, m,
 			    (struct sockaddr *)dst, ro->ro_rt);
-			IF_LLTBLS_UNLOCK(ifp);
+			IF_AFDATA_UNLOCK(ifp);
 		} else
 			m_freem(m);
 	}


More information about the p4-projects mailing list