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.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.c')
-rw-r--r-- | sys/netinet6/in6.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 4b9bfb7..5aded02 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -978,9 +978,9 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, ia->ia_ifa.ifa_netmask = (struct sockaddr *)&ia->ia_prefixmask; ia->ia_ifp = ifp; ifa_ref(&ia->ia_ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_ref(&ia->ia_ifa); /* in6_ifaddrhead */ IN6_IFADDR_WLOCK(); @@ -1335,7 +1335,7 @@ in6_purgeaddr(struct ifaddr *ifa) * link-local and node-local all-nodes multicast * address routes */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa0, &ifp->if_addrhead, ifa_link) { if ((ifa0->ifa_addr->sa_family != AF_INET6) || memcmp(&satosin6(ifa0->ifa_addr)->sin6_addr, @@ -1347,7 +1347,7 @@ in6_purgeaddr(struct ifaddr *ifa) } if (ifa0 != NULL) ifa_ref(ifa0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * Remove the loopback route to the interface address. @@ -1517,9 +1517,9 @@ in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) { int s = splnet(); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ /* @@ -1746,7 +1746,7 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, } } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1769,7 +1769,7 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, } if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!ifa) return EADDRNOTAVAIL; ia = ifa2ia6(ifa); @@ -1853,13 +1853,13 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia, * if this is its first address, * and to validate the address if necessary. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifacount++; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); ia->ia_addr = *sin6; @@ -1930,7 +1930,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags) { struct ifaddr *ifa; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1942,7 +1942,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags) break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return ((struct in6_ifaddr *)ifa); } @@ -1957,7 +1957,7 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, struct in6_addr *addr) { struct ifaddr *ifa; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1966,7 +1966,7 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, struct in6_addr *addr) break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return ((struct in6_ifaddr *)ifa); } @@ -2207,7 +2207,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) * If two or more, return one which matches the dst longest. * If none, return one of global addresses assigned other ifs. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -2241,7 +2241,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) } if (besta) { ifa_ref(&besta->ia_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (besta); } @@ -2262,10 +2262,10 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (struct in6_ifaddr *)ifa; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* use the last-resort values, that are, deprecated addresses */ if (dep[0]) @@ -2285,7 +2285,7 @@ in6_if_up(struct ifnet *ifp) struct ifaddr *ifa; struct in6_ifaddr *ia; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -2301,7 +2301,7 @@ in6_if_up(struct ifnet *ifp) arc4random() % (MAX_RTR_SOLICITATION_DELAY * hz)); } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * special cases, like 6to4, are handled in in6_ifattach |