diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-04-19 21:36:18 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-04-19 21:36:18 +0000 |
commit | f15ded690a481d4683aad66a5943543e8dc79545 (patch) | |
tree | c7e73ce6d362f79cb55f1c7597898f409816e8b4 | |
parent | ab17fac487a2edc11c9643eaab1c3c4e1dd5589b (diff) | |
download | FreeBSD-src-f15ded690a481d4683aad66a5943543e8dc79545.zip FreeBSD-src-f15ded690a481d4683aad66a5943543e8dc79545.tar.gz |
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
-rw-r--r-- | sys/kern/kern_uuid.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_uuid.c b/sys/kern/kern_uuid.c index 16105e9..eec37ef 100644 --- a/sys/kern/kern_uuid.c +++ b/sys/kern/kern_uuid.c @@ -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(); |