summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2016-11-20 11:46:46 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2016-11-20 11:46:46 +0000
commit98aa1ef75fbeefc833328e59c2667c193c3f032c (patch)
treead7e1a5ee1fc2b4dead444f727b912ff5b672998 /sys
parent6f3180e68d292446fa0aadf1d6823e2decb5daa4 (diff)
Make rtable_iterate(9) mpsafe by using the new SRPL_NEXT(9).
ok dlg@, jmatthew@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/rtable.c16
-rw-r--r--sys/netinet/if_ether.c4
2 files changed, 7 insertions, 13 deletions
diff --git a/sys/net/rtable.c b/sys/net/rtable.c
index 7656b943bf5..b8012deb648 100644
--- a/sys/net/rtable.c
+++ b/sys/net/rtable.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtable.c,v 1.55 2016/11/20 11:40:58 mpi Exp $ */
+/* $OpenBSD: rtable.c,v 1.56 2016/11/20 11:46:45 mpi Exp $ */
/*
* Copyright (c) 2014-2016 Martin Pieuchot
@@ -869,21 +869,17 @@ rtable_walk(unsigned int rtableid, sa_family_t af,
struct rtentry *
rtable_iterate(struct rtentry *rt0)
{
+ struct rtentry *rt = NULL;
#ifndef SMALL_KERNEL
- struct rtentry *rt;
+ struct srp_ref sr;
- KERNEL_ASSERT_LOCKED();
-
- rt = SRPL_NEXT_LOCKED(rt0, rt_next);
+ rt = SRPL_NEXT(&sr, rt0, rt_next);
if (rt != NULL)
rtref(rt);
+ SRPL_LEAVE(&sr);
+#endif /* SMALL_KERNEL */
rtfree(rt0);
-
return (rt);
-#else
- rtfree(rt0);
- return (NULL);
-#endif /* SMALL_KERNEL */
}
#ifndef SMALL_KERNEL
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index a88149bbf28..fe4630975f1 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.225 2016/11/07 09:19:46 mpi Exp $ */
+/* $OpenBSD: if_ether.c,v 1.226 2016/11/20 11:46:45 mpi Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -731,13 +731,11 @@ arplookup(struct in_addr *inp, int create, int proxy, u_int tableid)
if (proxy && !ISSET(rt->rt_flags, RTF_ANNOUNCE)) {
#ifdef ART
- KERNEL_LOCK();
while ((rt = rtable_iterate(rt)) != NULL) {
if (ISSET(rt->rt_flags, RTF_ANNOUNCE)) {
break;
}
}
- KERNEL_UNLOCK();
#endif /* ART */
}