summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-12-22 11:05:54 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-12-22 11:05:54 +0000
commit913d07a8a95d832e748b2bd4816f5f04bd59e659 (patch)
tree1fdcba23a5a8e6fea470c103c1c41d7ee203917c /sys/netinet
parentccd463551e9127d41faa349158468bbd523682d3 (diff)
Make sure rtrequest1(9) is called under splsoftnet().
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_icmp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index d6ee15c9a17..640a2f1c374 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.128 2014/12/08 10:51:00 mpi Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.129 2014/12/22 11:05:53 mpi Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -1026,11 +1026,13 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r)
{
if (rt == NULL)
panic("icmp_mtudisc_timeout: bad route to timeout");
+
if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
(RTF_DYNAMIC | RTF_HOST)) {
void *(*ctlfunc)(int, struct sockaddr *, u_int, void *);
struct sockaddr_in sa;
struct rt_addrinfo info;
+ int s;
memset(&info, 0, sizeof(info));
info.rti_info[RTAX_DST] = rt_key(rt);
@@ -1039,6 +1041,8 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r)
info.rti_flags = rt->rt_flags;
sa = *(struct sockaddr_in *)rt_key(rt);
+
+ s = splsoftnet();
rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL,
r->rtt_tableid);
@@ -1047,6 +1051,7 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r)
if (ctlfunc)
(*ctlfunc)(PRC_MTUINC,(struct sockaddr *)&sa,
r->rtt_tableid, NULL);
+ splx(s);
} else
if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0)
rt->rt_rmx.rmx_mtu = 0;
@@ -1075,9 +1080,11 @@ icmp_redirect_timeout(struct rtentry *rt, struct rttimer *r)
{
if (rt == NULL)
panic("icmp_redirect_timeout: bad route to timeout");
+
if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
(RTF_DYNAMIC | RTF_HOST)) {
struct rt_addrinfo info;
+ int s;
memset(&info, 0, sizeof(info));
info.rti_info[RTAX_DST] = rt_key(rt);
@@ -1085,8 +1092,10 @@ icmp_redirect_timeout(struct rtentry *rt, struct rttimer *r)
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
info.rti_flags = rt->rt_flags;
+ s = splsoftnet();
rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL,
r->rtt_tableid);
+ splx(s);
}
}