svn commit: r191279 - head/sys/kern

Robert Watson rwatson at FreeBSD.org
Sun Apr 19 21:36:19 UTC 2009


Author: rwatson
Date: Sun Apr 19 21:36:18 2009
New Revision: 191279
URL: http://svn.freebsd.org/changeset/base/191279

Log:
  Lock the interface address list while iterating a network interface's
  address list when searching for a link-layer address to use during uuid
  generation.
  
  MFC after:	2 weeks

Modified:
  head/sys/kern/kern_uuid.c

Modified: head/sys/kern/kern_uuid.c
==============================================================================
--- head/sys/kern/kern_uuid.c	Sun Apr 19 21:26:36 2009	(r191278)
+++ head/sys/kern/kern_uuid.c	Sun Apr 19 21:36:18 2009	(r191279)
@@ -101,16 +101,19 @@ uuid_node(uint16_t *node)
 	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		/* Walk the address list */
+		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
 			sdl = (struct sockaddr_dl*)ifa->ifa_addr;
 			if (sdl != NULL && sdl->sdl_family == AF_LINK &&
 			    sdl->sdl_type == IFT_ETHER) {
 				/* Got a MAC address. */
 				bcopy(LLADDR(sdl), node, UUID_NODE_LEN);
+				IF_ADDR_UNLOCK(ifp);
 				IFNET_RUNLOCK();
 				return;
 			}
 		}
+		IF_ADDR_UNLOCK(ifp);
 	}
 	IFNET_RUNLOCK();
 


More information about the svn-src-head mailing list