diff options
author | jhb <jhb@FreeBSD.org> | 2012-01-05 19:00:36 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2012-01-05 19:00:36 +0000 |
commit | 4ef366671a65893ccd19a3fc76c415ab0d9a25f2 (patch) | |
tree | e3a128009150d5297d5066b93f051a1a5e2375a5 /sys/netinet6/in6_ifattach.c | |
parent | 219e62f17ed5852c0d61721758ef94a0587939f4 (diff) | |
download | FreeBSD-src-4ef366671a65893ccd19a3fc76c415ab0d9a25f2.zip FreeBSD-src-4ef366671a65893ccd19a3fc76c415ab0d9a25f2.tar.gz |
Convert all users of IF_ADDR_LOCK to use new locking macros that specify
either a read lock or write lock.
Reviewed by: bz
MFC after: 2 weeks
Diffstat (limited to 'sys/netinet6/in6_ifattach.c')
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index f28ae5b..f8134ca 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -243,7 +243,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6) static u_int8_t allone[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; @@ -255,7 +255,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6) goto found; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; @@ -282,7 +282,7 @@ found: /* look at IEEE802/EUI64 only */ if (addrlen != 8 && addrlen != 6) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; } @@ -292,11 +292,11 @@ found: * card insertion. */ if (bcmp(addr, allzero, addrlen) == 0) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; } if (bcmp(addr, allone, addrlen) == 0) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; } @@ -317,11 +317,11 @@ found: case IFT_ARCNET: if (addrlen != 1) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; } if (!addr[0]) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; } @@ -345,17 +345,17 @@ found: * identifier source (can be renumbered). * we don't do this. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; default: - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; } /* sanity check: g bit must not indicate "group" */ if (EUI64_GROUP(in6)) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; } @@ -368,11 +368,11 @@ found: */ if ((in6->s6_addr[8] & ~(EUI64_GBIT | EUI64_UBIT)) == 0x00 && bcmp(&in6->s6_addr[9], allzero, 7) == 0) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return -1; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return 0; } @@ -833,9 +833,9 @@ in6_ifdetach(struct ifnet *ifp) } /* remove from the linked list */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); /* if_addrhead */ IN6_IFADDR_WLOCK(); @@ -950,7 +950,7 @@ in6_purgemaddrs(struct ifnet *ifp) * We need to do this as IF_ADDR_LOCK() may be re-acquired * by code further down. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) @@ -958,7 +958,7 @@ in6_purgemaddrs(struct ifnet *ifp) inm = (struct in6_multi *)ifma->ifma_protospec; LIST_INSERT_HEAD(&purgeinms, inm, in6m_entry); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); LIST_FOREACH_SAFE(inm, &purgeinms, in6m_entry, tinm) { LIST_REMOVE(inm, in6m_entry); |