summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/nd6_rtr.c
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2008-12-16 03:05:18 +0000
committerkmacy <kmacy@FreeBSD.org>2008-12-16 03:05:18 +0000
commite73e7617200018fa199d34702b760f0ac34c11da (patch)
treed0f1dd8738dc61beba6c5f18ff80b7632621d445 /sys/netinet6/nd6_rtr.c
parent81140652bf20ae41a8e681a9fb108fa4e324629a (diff)
downloadFreeBSD-src-e73e7617200018fa199d34702b760f0ac34c11da.zip
FreeBSD-src-e73e7617200018fa199d34702b760f0ac34c11da.tar.gz
simplify locking in find_pfxlist_reachable_router
Diffstat (limited to 'sys/netinet6/nd6_rtr.c')
-rw-r--r--sys/netinet6/nd6_rtr.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index bc1ccc6..588fb8c 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1329,19 +1329,20 @@ find_pfxlist_reachable_router(struct nd_prefix *pr)
{
struct nd_pfxrouter *pfxrtr;
struct llentry *ln;
+ int canreach;
for (pfxrtr = LIST_FIRST(&pr->ndpr_advrtrs); pfxrtr;
pfxrtr = LIST_NEXT(pfxrtr, pfr_entry)) {
IF_AFDATA_LOCK(pfxrtr->router->ifp);
- if (((ln = nd6_lookup(&pfxrtr->router->rtaddr, 0,
- pfxrtr->router->ifp)) != NULL) &&
- ND6_IS_LLINFO_PROBREACH(ln)) {
- LLE_RUNLOCK(ln);
- break; /* found */
- }
- if (ln != NULL)
- LLE_RUNLOCK(ln);
+ ln = nd6_lookup(&pfxrtr->router->rtaddr, 0, pfxrtr->router->ifp);
IF_AFDATA_UNLOCK(pfxrtr->router->ifp);
+ canreach = 0;
+ if (ln != NULL) {
+ canreach = ND6_IS_LLINFO_PROBREACH(ln);
+ LLE_RUNLOCK(ln);
+ }
+ if (canreach)
+ break;
}
return (pfxrtr);
}
OpenPOWER on IntegriCloud