-/* $OpenBSD: art.c,v 1.21 2016/07/04 08:11:48 mpi Exp $ */
+/* $OpenBSD: art.c,v 1.22 2016/07/19 10:51:44 mpi Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
{
int error = 0;
- KERNEL_ASSERT_LOCKED();
-
if ((an != NULL) && (an != next)) {
/* this assumes an->an_dst is not used by f */
+ KERNEL_UNLOCK();
error = (*f)(an, arg);
+ KERNEL_LOCK();
}
return (error);
-/* $OpenBSD: rtable.c,v 1.49 2016/07/04 08:11:48 mpi Exp $ */
+/* $OpenBSD: rtable.c,v 1.50 2016/07/19 10:51:44 mpi Exp $ */
/*
* Copyright (c) 2014-2015 Martin Pieuchot
int
rtable_walk_helper(struct art_node *an, void *xrwc)
{
+ struct srp_ref sr;
struct rtable_walk_cookie *rwc = xrwc;
- struct rtentry *rt, *nrt;
+ struct rtentry *rt;
int error = 0;
- KERNEL_ASSERT_LOCKED();
-
- SRPL_FOREACH_SAFE_LOCKED(rt, &an->an_rtlist, rt_next, nrt) {
- KERNEL_UNLOCK();
- error = (*rwc->rwc_func)(rt, rwc->rwc_arg, rwc->rwc_rid);
- KERNEL_LOCK();
- if (error)
+ SRPL_FOREACH(rt, &sr, &an->an_rtlist, rt_next) {
+ if ((error = (*rwc->rwc_func)(rt, rwc->rwc_arg, rwc->rwc_rid)))
break;
}
+ SRPL_LEAVE(&sr);
return (error);
}