aren't protected by the NET_LOCK().
While here change lock assertions in rt_{set,put}gwroute(), the NET_LOCK()
is enough.
Tested by Hrvoje Popovski.
ok jmatthew@, claudio@
-/* $OpenBSD: route.c,v 1.357 2017/05/27 09:51:18 claudio Exp $ */
+/* $OpenBSD: route.c,v 1.358 2017/06/07 13:28:02 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
{
struct rtentry *nhrt;
- KERNEL_ASSERT_LOCKED();
+ NET_ASSERT_LOCKED();
KASSERT(ISSET(rt->rt_flags, RTF_GATEWAY));
{
struct rtentry *nhrt = rt->rt_gwroute;
- KERNEL_ASSERT_LOCKED();
+ NET_ASSERT_LOCKED();
if (!ISSET(rt->rt_flags, RTF_GATEWAY) || nhrt == NULL)
return;
info.rti_info[RTAX_DST] = dst;
info.rti_info[RTAX_GATEWAY] = gateway;
info.rti_info[RTAX_AUTHOR] = src;
+ KERNEL_LOCK();
rtm_miss(RTM_REDIRECT, &info, flags, prio, ifidx, error, rdomain);
+ KERNEL_UNLOCK();
}
/*
info.rti_flags = rt->rt_flags;
ifidx = rt->rt_ifidx;
error = rtrequest_delete(&info, rt->rt_priority, ifp, &rt, tableid);
+ KERNEL_LOCK();
rtm_miss(RTM_DELETE, &info, info.rti_flags, rt->rt_priority, ifidx,
error, tableid);
+ KERNEL_UNLOCK();
if (error == 0)
rtfree(rt);
return (error);
-/* $OpenBSD: in_pcb.c,v 1.220 2017/03/07 16:59:40 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.221 2017/06/07 13:28:02 mpi Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
info.rti_info[RTAX_DST] = &inp->inp_route.ro_dst;
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask);
+
+ KERNEL_LOCK();
rtm_miss(RTM_LOSING, &info, rt->rt_flags, rt->rt_priority,
rt->rt_ifidx, 0, inp->inp_rtableid);
+ KERNEL_UNLOCK();
if (rt->rt_flags & RTF_DYNAMIC)
(void)rtrequest(RTM_DELETE, &info, rt->rt_priority,
NULL, inp->inp_rtableid);
-/* $OpenBSD: nd6_rtr.c,v 1.159 2017/05/30 08:58:34 florian Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.160 2017/06/07 13:28:02 mpi Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
error = rtrequest(RTM_ADD, &info, RTP_DEFAULT, &rt,
new->ifp->if_rdomain);
if (error == 0) {
+ KERNEL_LOCK();
rtm_send(rt, RTM_ADD, new->ifp->if_rdomain);
+ KERNEL_UNLOCK();
rtfree(rt);
new->installed = 1;
}
error = rtrequest(RTM_DELETE, &info, RTP_DEFAULT, &rt,
dr->ifp->if_rdomain);
if (error == 0) {
+ KERNEL_LOCK();
rtm_send(rt, RTM_DELETE, dr->ifp->if_rdomain);
+ KERNEL_UNLOCK();
rtfree(rt);
}