svn commit: r233200 - in stable/9/sys: i386/conf kern net netatalk
netinet netinet6 netipx
John Baldwin
jhb at FreeBSD.org
Mon Mar 19 20:49:17 UTC 2012
Author: jhb
Date: Mon Mar 19 20:49:16 2012
New Revision: 233200
URL: http://svn.freebsd.org/changeset/base/233200
Log:
MFC 229621:
Convert all users of IF_ADDR_LOCK to use new locking macros that specify
either a read lock or write lock.
Modified:
stable/9/sys/kern/kern_uuid.c
stable/9/sys/net/if.c
stable/9/sys/net/rtsock.c
stable/9/sys/netatalk/aarp.c
stable/9/sys/netatalk/at_control.c
stable/9/sys/netinet/if_ether.c
stable/9/sys/netinet/igmp.c
stable/9/sys/netinet/in.c
stable/9/sys/netinet/in_mcast.c
stable/9/sys/netinet/in_pcb.c
stable/9/sys/netinet/in_var.h
stable/9/sys/netinet/ip_carp.c
stable/9/sys/netinet/ip_icmp.c
stable/9/sys/netinet/ip_input.c
stable/9/sys/netinet/sctp_bsd_addr.c
stable/9/sys/netinet6/icmp6.c
stable/9/sys/netinet6/in6.c
stable/9/sys/netinet6/in6_ifattach.c
stable/9/sys/netinet6/in6_mcast.c
stable/9/sys/netinet6/in6_var.h
stable/9/sys/netinet6/ip6_input.c
stable/9/sys/netinet6/mld6.c
stable/9/sys/netinet6/nd6.c
stable/9/sys/netinet6/nd6_rtr.c
stable/9/sys/netipx/ipx.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/amd64/include/xen/ (props changed)
stable/9/sys/boot/ (props changed)
stable/9/sys/boot/i386/efi/ (props changed)
stable/9/sys/boot/ia64/efi/ (props changed)
stable/9/sys/boot/ia64/ski/ (props changed)
stable/9/sys/boot/powerpc/boot1.chrp/ (props changed)
stable/9/sys/boot/powerpc/ofw/ (props changed)
stable/9/sys/cddl/contrib/opensolaris/ (props changed)
stable/9/sys/conf/ (props changed)
stable/9/sys/contrib/dev/acpica/ (props changed)
stable/9/sys/contrib/octeon-sdk/ (props changed)
stable/9/sys/contrib/pf/ (props changed)
stable/9/sys/contrib/x86emu/ (props changed)
stable/9/sys/fs/ (props changed)
stable/9/sys/fs/ntfs/ (props changed)
stable/9/sys/i386/conf/XENHVM (props changed)
Modified: stable/9/sys/kern/kern_uuid.c
==============================================================================
--- stable/9/sys/kern/kern_uuid.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/kern/kern_uuid.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -98,20 +98,20 @@ uuid_node(uint16_t *node)
IFNET_RLOCK_NOSLEEP();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
/* Walk the address list */
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(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);
+ IF_ADDR_RUNLOCK(ifp);
IFNET_RUNLOCK_NOSLEEP();
CURVNET_RESTORE();
return;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
IFNET_RUNLOCK_NOSLEEP();
Modified: stable/9/sys/net/if.c
==============================================================================
--- stable/9/sys/net/if.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/net/if.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -802,10 +802,10 @@ if_purgemaddrs(struct ifnet *ifp)
struct ifmultiaddr *ifma;
struct ifmultiaddr *next;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next)
if_delmulti_locked(ifp, ifma, 1);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
}
/*
@@ -1149,10 +1149,10 @@ if_addgroup(struct ifnet *ifp, const cha
ifgl->ifgl_group = ifg;
ifgm->ifgm_ifp = ifp;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
TAILQ_INSERT_TAIL(&ifg->ifg_members, ifgm, ifgm_next);
TAILQ_INSERT_TAIL(&ifp->if_groups, ifgl, ifgl_next);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
IFNET_WUNLOCK();
@@ -1179,9 +1179,9 @@ if_delgroup(struct ifnet *ifp, const cha
return (ENOENT);
}
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next)
if (ifgm->ifgm_ifp == ifp)
@@ -1222,9 +1222,9 @@ if_delgroups(struct ifnet *ifp)
strlcpy(groupname, ifgl->ifgl_group->ifg_group, IFNAMSIZ);
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next)
if (ifgm->ifgm_ifp == ifp)
@@ -1266,33 +1266,33 @@ if_getgroup(struct ifgroupreq *data, str
struct ifgroupreq *ifgr = data;
if (ifgr->ifgr_len == 0) {
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next)
ifgr->ifgr_len += sizeof(struct ifg_req);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
return (0);
}
len = ifgr->ifgr_len;
ifgp = ifgr->ifgr_groups;
/* XXX: wire */
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) {
if (len < sizeof(ifgrq)) {
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
return (EINVAL);
}
bzero(&ifgrq, sizeof ifgrq);
strlcpy(ifgrq.ifgrq_group, ifgl->ifgl_group->ifg_group,
sizeof(ifgrq.ifgrq_group));
if ((error = copyout(&ifgrq, ifgp, sizeof(struct ifg_req)))) {
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
return (error);
}
len -= sizeof(ifgrq);
ifgp++;
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
return (0);
}
@@ -1399,28 +1399,28 @@ void
if_addr_rlock(struct ifnet *ifp)
{
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
}
void
if_addr_runlock(struct ifnet *ifp)
{
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
void
if_maddr_rlock(struct ifnet *ifp)
{
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
}
void
if_maddr_runlock(struct ifnet *ifp)
{
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
/*
@@ -1532,14 +1532,14 @@ ifa_ifwithaddr_internal(struct sockaddr
IFNET_RLOCK_NOSLEEP();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
if (sa_equal(addr, ifa->ifa_addr)) {
if (getref)
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
/* IP6 doesn't have broadcast */
@@ -1549,11 +1549,11 @@ ifa_ifwithaddr_internal(struct sockaddr
sa_equal(ifa->ifa_broadaddr, addr)) {
if (getref)
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
ifa = NULL;
done:
@@ -1587,7 +1587,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add
IFNET_RLOCK_NOSLEEP();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
@@ -1596,11 +1596,11 @@ ifa_ifwithbroadaddr(struct sockaddr *add
ifa->ifa_broadaddr->sa_len != 0 &&
sa_equal(ifa->ifa_broadaddr, addr)) {
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
ifa = NULL;
done:
@@ -1622,18 +1622,18 @@ ifa_ifwithdstaddr(struct sockaddr *addr)
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
continue;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
if (ifa->ifa_dstaddr != NULL &&
sa_equal(addr, ifa->ifa_dstaddr)) {
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
ifa = NULL;
done:
@@ -1667,12 +1667,12 @@ ifa_ifwithnet(struct sockaddr *addr, int
/*
* Scan though each interface, looking for ones that have addresses
* in this address family. Maintain a reference on ifa_maybe once
- * we find one, as we release the IF_ADDR_LOCK() that kept it stable
+ * we find one, as we release the IF_ADDR_RLOCK() that kept it stable
* when we move onto the next interface.
*/
IFNET_RLOCK_NOSLEEP();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
char *cp, *cp2, *cp3;
@@ -1691,7 +1691,7 @@ next: continue;
if (ifa->ifa_dstaddr != NULL &&
sa_equal(addr, ifa->ifa_dstaddr)) {
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
} else {
@@ -1702,7 +1702,7 @@ next: continue;
if (ifa->ifa_claim_addr) {
if ((*ifa->ifa_claim_addr)(ifa, addr)) {
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
continue;
@@ -1742,7 +1742,7 @@ next: continue;
}
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
ifa = ifa_maybe;
ifa_maybe = NULL;
@@ -1768,7 +1768,7 @@ ifaof_ifpforaddr(struct sockaddr *addr,
if (af >= AF_MAX)
return (NULL);
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != af)
continue;
@@ -1800,7 +1800,7 @@ ifaof_ifpforaddr(struct sockaddr *addr,
done:
if (ifa != NULL)
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
return (ifa);
}
@@ -2350,9 +2350,9 @@ ifhwioctl(u_long cmd, struct ifnet *ifp,
* lose a race while we check if the membership
* already exists.
*/
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
ifma = if_findmulti(ifp, &ifr->ifr_addr);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
if (ifma != NULL)
error = EADDRINUSE;
else
@@ -2768,7 +2768,7 @@ again:
}
addrs = 0;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
struct sockaddr *sa = ifa->ifa_addr;
@@ -2800,7 +2800,7 @@ again:
if (sbuf_error(sb) == 0)
valid_len = sbuf_len(sb);
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
if (addrs == 0) {
bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr));
sbuf_bcat(sb, &ifr, sizeof(ifr));
@@ -2958,13 +2958,13 @@ if_addmulti(struct ifnet *ifp, struct so
* If the address is already present, return a new reference to it;
* otherwise, allocate storage and set up a new address.
*/
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
ifma = if_findmulti(ifp, sa);
if (ifma != NULL) {
ifma->ifma_refcount++;
if (retifma != NULL)
*retifma = ifma;
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (0);
}
@@ -3030,7 +3030,7 @@ if_addmulti(struct ifnet *ifp, struct so
* pointer is still valid.
*/
rt_newmaddrmsg(RTM_NEWMADDR, ifma);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
/*
* We are certain we have added something, so call down to the
@@ -3050,7 +3050,7 @@ free_llsa_out:
free(llsa, M_IFMADDR);
unlock_out:
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (error);
}
@@ -3084,12 +3084,12 @@ if_delmulti(struct ifnet *ifp, struct so
if (ifp == NULL)
return (ENOENT);
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
lastref = 0;
ifma = if_findmulti(ifp, sa);
if (ifma != NULL)
lastref = if_delmulti_locked(ifp, ifma, 0);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
if (ifma == NULL)
return (ENOENT);
@@ -3111,10 +3111,10 @@ if_delallmulti(struct ifnet *ifp)
struct ifmultiaddr *ifma;
struct ifmultiaddr *next;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next)
if_delmulti_locked(ifp, ifma, 0);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
}
/*
@@ -3151,7 +3151,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm
* If and only if the ifnet instance exists: Acquire the address lock.
*/
if (ifp != NULL)
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
lastref = if_delmulti_locked(ifp, ifma, 0);
@@ -3161,7 +3161,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm
* Release the address lock.
* If the group was left: update the hardware hash filter.
*/
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
if (lastref && ifp->if_ioctl != NULL) {
(void)(*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0);
}
@@ -3183,7 +3183,7 @@ if_delmulti_locked(struct ifnet *ifp, st
if (ifp != NULL && ifma->ifma_ifp != NULL) {
KASSERT(ifma->ifma_ifp == ifp,
("%s: inconsistent ifp %p", __func__, ifp));
- IF_ADDR_LOCK_ASSERT(ifp);
+ IF_ADDR_WLOCK_ASSERT(ifp);
}
ifp = ifma->ifma_ifp;
@@ -3256,14 +3256,14 @@ if_setlladdr(struct ifnet *ifp, const u_
struct ifaddr *ifa;
struct ifreq ifr;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
ifa = ifp->if_addr;
if (ifa == NULL) {
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
return (EINVAL);
}
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
if (sdl == NULL) {
ifa_free(ifa);
Modified: stable/9/sys/net/rtsock.c
==============================================================================
--- stable/9/sys/net/rtsock.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/net/rtsock.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -479,7 +479,7 @@ rtm_get_jailed(struct rt_addrinfo *info,
* Try to find an address on the given outgoing interface
* that belongs to the jail.
*/
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
struct sockaddr *sa;
sa = ifa->ifa_addr;
@@ -491,7 +491,7 @@ rtm_get_jailed(struct rt_addrinfo *info,
break;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
if (!found) {
/*
* As a last resort return the 'default' jail address.
@@ -521,7 +521,7 @@ rtm_get_jailed(struct rt_addrinfo *info,
* Try to find an address on the given outgoing interface
* that belongs to the jail.
*/
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
struct sockaddr *sa;
sa = ifa->ifa_addr;
@@ -534,7 +534,7 @@ rtm_get_jailed(struct rt_addrinfo *info,
break;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
if (!found) {
/*
* As a last resort return the 'default' jail address.
@@ -1710,7 +1710,7 @@ sysctl_iflist(int af, struct walkarg *w)
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
ifa = ifp->if_addr;
info.rti_info[RTAX_IFP] = ifa->ifa_addr;
len = rt_msg2(RTM_IFINFO, &info, NULL, w);
@@ -1744,13 +1744,13 @@ sysctl_iflist(int af, struct walkarg *w)
goto done;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] =
info.rti_info[RTAX_BRD] = NULL;
}
done:
if (ifp != NULL)
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
IFNET_RUNLOCK();
return (error);
}
@@ -1771,7 +1771,7 @@ sysctl_ifmalist(int af, struct walkarg *
continue;
ifa = ifp->if_addr;
info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (af && af != ifma->ifma_addr->sa_family)
continue;
@@ -1792,12 +1792,12 @@ sysctl_ifmalist(int af, struct walkarg *
ifmam->ifmam_addrs = info.rti_addrs;
error = SYSCTL_OUT(w->w_req, w->w_tmem, len);
if (error) {
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
done:
IFNET_RUNLOCK();
Modified: stable/9/sys/netatalk/aarp.c
==============================================================================
--- stable/9/sys/netatalk/aarp.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netatalk/aarp.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -406,7 +406,7 @@ at_aarpinput(struct ifnet *ifp, struct m
* Since we don't know the net, we just look for the first
* phase 1 address on the interface.
*/
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead);
aa;
aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) {
@@ -416,12 +416,12 @@ at_aarpinput(struct ifnet *ifp, struct m
}
}
if (aa == NULL) {
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
m_freem(m);
return;
}
ifa_ref(&aa->aa_ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net;
}
Modified: stable/9/sys/netatalk/at_control.c
==============================================================================
--- stable/9/sys/netatalk/at_control.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netatalk/at_control.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -254,9 +254,9 @@ at_control(struct socket *so, u_long cmd
*/
aa->aa_ifp = ifp;
ifa_ref(&aa->aa_ifa); /* if_addrhead */
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
} else {
/*
* If we DID find one then we clobber any routes
@@ -357,9 +357,9 @@ at_control(struct socket *so, u_long cmd
* remove the ifaddr from the interface
*/
ifa = (struct ifaddr *)aa;
- 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 */
/*
Modified: stable/9/sys/netinet/if_ether.c
==============================================================================
--- stable/9/sys/netinet/if_ether.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netinet/if_ether.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -617,15 +617,15 @@ in_arpinput(struct mbuf *m)
* No match, use the first inet address on the receive interface
* as a dummy address for the rest of the function.
*/
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
if (ifa->ifa_addr->sa_family == AF_INET) {
ia = ifatoia(ifa);
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto match;
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
/*
* If bridging, fall back to using any inet address.
Modified: stable/9/sys/netinet/igmp.c
==============================================================================
--- stable/9/sys/netinet/igmp.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netinet/igmp.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -617,7 +617,7 @@ igmp_ifdetach(struct ifnet *ifp)
igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp;
if (igi->igi_version == IGMP_VERSION_3) {
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_INET ||
ifma->ifma_protospec == NULL)
@@ -633,7 +633,7 @@ igmp_ifdetach(struct ifnet *ifp)
}
inm_clear_recorded(inm);
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
/*
* Free the in_multi reference(s) for this IGMP lifecycle.
*/
@@ -750,7 +750,7 @@ igmp_input_v1_query(struct ifnet *ifp, c
* for the interface on which the query arrived,
* except those which are already running.
*/
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_INET ||
ifma->ifma_protospec == NULL)
@@ -778,7 +778,7 @@ igmp_input_v1_query(struct ifnet *ifp, c
break;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
out_locked:
IGMP_UNLOCK();
@@ -851,7 +851,7 @@ igmp_input_v2_query(struct ifnet *ifp, c
*/
CTR2(KTR_IGMPV3, "process v2 general query on ifp %p(%s)",
ifp, ifp->if_xname);
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_INET ||
ifma->ifma_protospec == NULL)
@@ -859,7 +859,7 @@ igmp_input_v2_query(struct ifnet *ifp, c
inm = (struct in_multi *)ifma->ifma_protospec;
igmp_v2_update_group(inm, timer);
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
} else {
/*
* Group-specific IGMPv2 query, we need only
@@ -1707,7 +1707,7 @@ igmp_fasttimo_vnet(void)
IFQ_SET_MAXLEN(&scq, IGMP_MAX_STATE_CHANGE_PACKETS);
}
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_INET ||
ifma->ifma_protospec == NULL)
@@ -1725,7 +1725,7 @@ igmp_fasttimo_vnet(void)
break;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
if (igi->igi_version == IGMP_VERSION_3) {
struct in_multi *tinm;
@@ -2022,7 +2022,7 @@ igmp_v3_cancel_link_timers(struct igmp_i
* for all memberships scoped to this link.
*/
ifp = igi->igi_ifp;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_INET ||
ifma->ifma_protospec == NULL)
@@ -2067,7 +2067,7 @@ igmp_v3_cancel_link_timers(struct igmp_i
inm->inm_timer = 0;
_IF_DRAIN(&inm->inm_scq);
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
SLIST_FOREACH_SAFE(inm, &igi->igi_relinmhead, inm_nrele, tinm) {
SLIST_REMOVE_HEAD(&igi->igi_relinmhead, inm_nrele);
inm_release_locked(inm);
@@ -3330,7 +3330,7 @@ igmp_v3_dispatch_general_query(struct ig
ifp = igi->igi_ifp;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_INET ||
ifma->ifma_protospec == NULL)
@@ -3361,7 +3361,7 @@ igmp_v3_dispatch_general_query(struct ig
break;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0;
igmp_dispatch_queue(&igi->igi_gq, IGMP_MAX_RESPONSE_BURST, loop);
Modified: stable/9/sys/netinet/in.c
==============================================================================
--- stable/9/sys/netinet/in.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netinet/in.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -326,7 +326,7 @@ in_control(struct socket *so, u_long cmd
ifa_ref(&ia->ia_ifa);
IN_IFADDR_RUNLOCK();
if (ia == NULL) {
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
iap = ifatoia(ifa);
if (iap->ia_addr.sin_family == AF_INET) {
@@ -340,7 +340,7 @@ in_control(struct socket *so, u_long cmd
}
if (ia != NULL)
ifa_ref(&ia->ia_ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
if (ia == NULL)
iaIsFirst = 1;
@@ -404,9 +404,9 @@ in_control(struct socket *so, u_long cmd
ia->ia_ifp = ifp;
ifa_ref(ifa); /* if_addrhead */
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
ifa_ref(ifa); /* in_ifaddrhead */
IN_IFADDR_WLOCK();
TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link);
@@ -586,7 +586,7 @@ in_control(struct socket *so, u_long cmd
panic("in_control: unsupported ioctl");
}
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
/* Re-check that ia is still part of the list. */
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa == &ia->ia_ifa)
@@ -598,12 +598,12 @@ in_control(struct socket *so, u_long cmd
* try it again for the next loop as there is no other exit
* path between here and out.
*/
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
error = EADDRNOTAVAIL;
goto out;
}
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 */
IN_IFADDR_WLOCK();
@@ -753,7 +753,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo
}
}
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
@@ -766,7 +766,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo
}
if (ifa != NULL)
ifa_ref(ifa);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
if (ifa == NULL)
return (EADDRNOTAVAIL);
ia = (struct in_ifaddr *)ifa;
@@ -1292,7 +1292,7 @@ in_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_INET ||
ifma->ifma_protospec == NULL)
@@ -1304,7 +1304,7 @@ in_purgemaddrs(struct ifnet *ifp)
inm = (struct in_multi *)ifma->ifma_protospec;
LIST_INSERT_HEAD(&purgeinms, inm, inm_link);
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
LIST_FOREACH_SAFE(inm, &purgeinms, inm_link, tinm) {
LIST_REMOVE(inm, inm_link);
Modified: stable/9/sys/netinet/in_mcast.c
==============================================================================
--- stable/9/sys/netinet/in_mcast.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netinet/in_mcast.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -421,7 +421,7 @@ in_getmulti(struct ifnet *ifp, const str
return (error);
/* XXX ifma_protospec must be covered by IF_ADDR_LOCK */
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
/*
* If something other than netinet is occupying the link-layer
@@ -445,11 +445,11 @@ in_getmulti(struct ifnet *ifp, const str
#endif
++inm->inm_refcount;
*pinm = inm;
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (0);
}
- IF_ADDR_LOCK_ASSERT(ifp);
+ IF_ADDR_WLOCK_ASSERT(ifp);
/*
* A new in_multi record is needed; allocate and initialize it.
@@ -461,7 +461,7 @@ in_getmulti(struct ifnet *ifp, const str
inm = malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO);
if (inm == NULL) {
if_delmulti_ifma(ifma);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (ENOMEM);
}
inm->inm_addr = *group;
@@ -484,7 +484,7 @@ in_getmulti(struct ifnet *ifp, const str
*pinm = inm;
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (0);
}
@@ -2796,7 +2796,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A
IN_MULTI_LOCK();
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_INET ||
ifma->ifma_protospec == NULL)
@@ -2829,7 +2829,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A
break;
}
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
IN_MULTI_UNLOCK();
Modified: stable/9/sys/netinet/in_pcb.c
==============================================================================
--- stable/9/sys/netinet/in_pcb.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netinet/in_pcb.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -744,7 +744,7 @@ in_pcbladdr(struct inpcb *inp, struct in
ifp = ia->ia_ifp;
ifa_free(&ia->ia_ifa);
ia = NULL;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
sa = ifa->ifa_addr;
@@ -758,10 +758,10 @@ in_pcbladdr(struct inpcb *inp, struct in
}
if (ia != NULL) {
laddr->s_addr = ia->ia_addr.sin_addr.s_addr;
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
/* 3. As a last resort return the 'default' jail address. */
error = prison_get_ip4(cred, laddr);
@@ -803,7 +803,7 @@ in_pcbladdr(struct inpcb *inp, struct in
*/
ia = NULL;
ifp = sro.ro_rt->rt_ifp;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
sa = ifa->ifa_addr;
if (sa->sa_family != AF_INET)
@@ -816,10 +816,10 @@ in_pcbladdr(struct inpcb *inp, struct in
}
if (ia != NULL) {
laddr->s_addr = ia->ia_addr.sin_addr.s_addr;
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
/* 3. As a last resort return the 'default' jail address. */
error = prison_get_ip4(cred, laddr);
@@ -867,7 +867,7 @@ in_pcbladdr(struct inpcb *inp, struct in
ifp = ia->ia_ifp;
ifa_free(&ia->ia_ifa);
ia = NULL;
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
sa = ifa->ifa_addr;
@@ -882,10 +882,10 @@ in_pcbladdr(struct inpcb *inp, struct in
}
if (ia != NULL) {
laddr->s_addr = ia->ia_addr.sin_addr.s_addr;
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
goto done;
}
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
}
/* 3. As a last resort return the 'default' jail address. */
Modified: stable/9/sys/netinet/in_var.h
==============================================================================
--- stable/9/sys/netinet/in_var.h Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netinet/in_var.h Mon Mar 19 20:49:16 2012 (r233200)
@@ -393,9 +393,9 @@ inm_lookup(struct ifnet *ifp, const stru
struct in_multi *inm;
IN_MULTI_LOCK_ASSERT();
- IF_ADDR_LOCK(ifp);
+ IF_ADDR_RLOCK(ifp);
inm = inm_lookup_locked(ifp, ina);
- IF_ADDR_UNLOCK(ifp);
+ IF_ADDR_RUNLOCK(ifp);
return (inm);
}
Modified: stable/9/sys/netinet/ip_carp.c
==============================================================================
--- stable/9/sys/netinet/ip_carp.c Mon Mar 19 20:15:18 2012 (r233199)
+++ stable/9/sys/netinet/ip_carp.c Mon Mar 19 20:49:16 2012 (r233200)
@@ -292,7 +292,7 @@ carp_hmac_prepare(struct carp_softc *sc)
found = 0;
last = cur;
cur.s_addr = 0xffffffff;
- IF_ADDR_LOCK(SC2IFP(sc));
+ IF_ADDR_RLOCK(SC2IFP(sc));
TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) {
in.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr;
if (ifa->ifa_addr->sa_family == AF_INET &&
@@ -302,7 +302,7 @@ carp_hmac_prepare(struct carp_softc *sc)
found++;
}
}
- IF_ADDR_UNLOCK(SC2IFP(sc));
+ IF_ADDR_RUNLOCK(SC2IFP(sc));
if (found)
SHA1Update(&sc->sc_sha1, (void *)&cur, sizeof(cur));
} while (found);
@@ -313,7 +313,7 @@ carp_hmac_prepare(struct carp_softc *sc)
found = 0;
last6 = cur6;
memset(&cur6, 0xff, sizeof(cur6));
- IF_ADDR_LOCK(SC2IFP(sc));
+ IF_ADDR_RLOCK(SC2IFP(sc));
TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) {
in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
if (IN6_IS_SCOPE_EMBED(&in6))
@@ -325,7 +325,7 @@ carp_hmac_prepare(struct carp_softc *sc)
found++;
}
}
- IF_ADDR_UNLOCK(SC2IFP(sc));
+ IF_ADDR_RUNLOCK(SC2IFP(sc));
if (found)
SHA1Update(&sc->sc_sha1, (void *)&cur6, sizeof(cur6));
} while (found);
@@ -1168,7 +1168,7 @@ carp_addrcount(struct carp_if *cif, stru
(SC2IFP(vh)->if_flags & IFF_UP) &&
(SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) ||
(type == CARP_COUNT_MASTER && vh->sc_state == MASTER)) {
- IF_ADDR_LOCK(SC2IFP(vh));
+ IF_ADDR_RLOCK(SC2IFP(vh));
TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist,
ifa_list) {
if (ifa->ifa_addr->sa_family == AF_INET &&
@@ -1176,7 +1176,7 @@ carp_addrcount(struct carp_if *cif, stru
ifatoia(ifa)->ia_addr.sin_addr.s_addr)
count++;
}
- IF_ADDR_UNLOCK(SC2IFP(vh));
+ IF_ADDR_RUNLOCK(SC2IFP(vh));
}
}
return (count);
@@ -1216,7 +1216,7 @@ carp_iamatch(struct ifnet *ifp, struct i
TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) {
if ((SC2IFP(vh)->if_flags & IFF_UP) &&
(SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) {
- IF_ADDR_LOCK(SC2IFP(vh));
+ IF_ADDR_RLOCK(SC2IFP(vh));
TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist,
ifa_list) {
if (ifa->ifa_addr->sa_family ==
@@ -1227,11 +1227,11 @@ carp_iamatch(struct ifnet *ifp, struct i
if (vh->sc_state ==
MASTER) {
*enaddr = IF_LLADDR(vh->sc_ifp);
- IF_ADDR_UNLOCK(SC2IFP(vh));
+ IF_ADDR_RUNLOCK(SC2IFP(vh));
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-stable-9
mailing list