lla_lookup() does modification only when LLE_CREATE is specified.

Thus we can use IF_AFDATA_RLOCK() instead of IF_AFDATA_LOCK() when doing
lla_lookup() without LLE_CREATE flag.

Reviewed by:	glebius, adrian
MFC after:	1 week
Sponsored by:	Yandex LLC
This commit is contained in:
Andrey V. Elsukov 2014-01-02 08:40:37 +00:00
parent ccee6fd2e5
commit ea0c377602
3 changed files with 11 additions and 11 deletions

View file

@ -149,10 +149,10 @@ arp_ifscrub(struct ifnet *ifp, uint32_t addr)
addr4.sin_len = sizeof(addr4);
addr4.sin_family = AF_INET;
addr4.sin_addr.s_addr = addr;
IF_AFDATA_LOCK(ifp);
IF_AFDATA_RLOCK(ifp);
lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR),
(struct sockaddr *)&addr4);
IF_AFDATA_UNLOCK(ifp);
IF_AFDATA_RUNLOCK(ifp);
}
#endif
@ -801,9 +801,9 @@ reply:
struct llentry *lle = NULL;
sin.sin_addr = itaddr;
IF_AFDATA_LOCK(ifp);
IF_AFDATA_RLOCK(ifp);
lle = lla_lookup(LLTABLE(ifp), 0, (struct sockaddr *)&sin);
IF_AFDATA_UNLOCK(ifp);
IF_AFDATA_RUNLOCK(ifp);
if ((lle != NULL) && (lle->la_flags & LLE_PUB)) {
(void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln);

View file

@ -1146,9 +1146,9 @@ nd6_nud_hint(struct rtentry *rt, struct in6_addr *dst6, int force)
return;
ifp = rt->rt_ifp;
IF_AFDATA_LOCK(ifp);
IF_AFDATA_RLOCK(ifp);
ln = nd6_lookup(dst6, ND6_EXCLUSIVE, NULL);
IF_AFDATA_UNLOCK(ifp);
IF_AFDATA_RUNLOCK(ifp);
if (ln == NULL)
return;
@ -1574,16 +1574,16 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
* description on it in NS section (RFC 2461 7.2.3).
*/
flags = lladdr ? ND6_EXCLUSIVE : 0;
IF_AFDATA_LOCK(ifp);
IF_AFDATA_RLOCK(ifp);
ln = nd6_lookup(from, flags, ifp);
IF_AFDATA_RUNLOCK(ifp);
if (ln == NULL) {
flags |= ND6_EXCLUSIVE;
IF_AFDATA_LOCK(ifp);
ln = nd6_lookup(from, flags | ND6_CREATE, ifp);
IF_AFDATA_UNLOCK(ifp);
is_newentry = 1;
} else {
IF_AFDATA_UNLOCK(ifp);
/* do nothing if static ndp is set */
if (ln->la_flags & LLE_STATIC) {
static_route = 1;

View file

@ -723,9 +723,9 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
* If no neighbor cache entry is found, NA SHOULD silently be
* discarded.
*/
IF_AFDATA_LOCK(ifp);
IF_AFDATA_RLOCK(ifp);
ln = nd6_lookup(&taddr6, LLE_EXCLUSIVE, ifp);
IF_AFDATA_UNLOCK(ifp);
IF_AFDATA_RUNLOCK(ifp);
if (ln == NULL) {
goto freeit;
}