Use if_addr_rlock/if_addr_runlock for if_spp when iterating if_addrhead,

as it is loadable as a module.

Approved by:	re (kib)
MFC after:	6 weeks
This commit is contained in:
rwatson 2009-06-26 18:50:49 +00:00
parent 5a005d1974
commit d5ad725967

View File

@ -4905,7 +4905,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
* aliases don't make any sense on a p2p link anyway.
*/
si = 0;
IF_ADDR_LOCK(ifp);
if_addr_rlock(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
if (ifa->ifa_addr->sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa->ifa_addr;
@ -4924,7 +4924,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
if (si && si->sin_addr.s_addr)
ddst = si->sin_addr.s_addr;
}
IF_ADDR_UNLOCK(ifp);
if_addr_runlock(ifp);
if (dst) *dst = ntohl(ddst);
if (src) *src = ntohl(ssrc);
@ -4948,7 +4948,7 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
* aliases don't make any sense on a p2p link anyway.
*/
si = 0;
IF_ADDR_LOCK(ifp);
if_addr_rlock(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa->ifa_addr;
@ -4958,7 +4958,7 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
}
}
}
IF_ADDR_UNLOCK(ifp);
if_addr_runlock(ifp);
if (ifa != NULL) {
int error;
@ -5010,7 +5010,7 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst,
* aliases don't make any sense on a p2p link anyway.
*/
si = NULL;
IF_ADDR_LOCK(ifp);
if_addr_rlock(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
if (ifa->ifa_addr->sa_family == AF_INET6) {
si = (struct sockaddr_in6 *)ifa->ifa_addr;
@ -5036,7 +5036,7 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst,
bcopy(&ddst, dst, sizeof(*dst));
if (src)
bcopy(&ssrc, src, sizeof(*src));
IF_ADDR_UNLOCK(ifp);
if_addr_runlock(ifp);
}
#ifdef IPV6CP_MYIFID_DYN
@ -5065,7 +5065,7 @@ sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src)
*/
sin6 = NULL;
IF_ADDR_LOCK(ifp);
if_addr_rlock(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family == AF_INET6) {
sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
@ -5075,7 +5075,7 @@ sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src)
}
}
}
IF_ADDR_UNLOCK(ifp);
if_addr_runlock(ifp);
if (ifa != NULL) {
int error;