Update Netgraph nodes to use if_addr_rlock()/if_addr_runlock() instead

of IF_ADDR_LOCK()/IF_ADDR_UNLOCK() when iterating ifp->if_addrhead.

MFC after:	6 weeks
This commit is contained in:
Robert Watson 2009-06-26 00:49:12 +00:00
parent 6c8615603b
commit c4c96d5ea5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195024
2 changed files with 5 additions and 5 deletions

View File

@ -466,12 +466,12 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
/* Determine size of response and allocate it */
buflen = 0;
IF_ADDR_LOCK(ifp);
if_addr_rlock(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
buflen += SA_SIZE(ifa->ifa_addr);
NG_MKRESPONSE(resp, msg, buflen, M_NOWAIT);
if (resp == NULL) {
IF_ADDR_UNLOCK(ifp);
if_addr_runlock(ifp);
error = ENOMEM;
break;
}
@ -490,7 +490,7 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
ptr += len;
buflen -= len;
}
IF_ADDR_UNLOCK(ifp);
if_addr_runlock(ifp);
break;
}

View File

@ -683,7 +683,7 @@ ng_iface_rcvmsg(node_p node, item_p item, hook_p lasthook)
struct ifaddr *ifa;
/* Return the first configured IP address */
IF_ADDR_LOCK(ifp);
if_addr_rlock(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
struct ng_cisco_ipaddr *ips;
@ -701,7 +701,7 @@ ng_iface_rcvmsg(node_p node, item_p item, hook_p lasthook)
ifa->ifa_netmask)->sin_addr;
break;
}
IF_ADDR_UNLOCK(ifp);
if_addr_runlock(ifp);
/* No IP addresses on this interface? */
if (ifa == NULL)