diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2022-06-27 21:26:47 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2022-06-27 21:26:47 +0000 |
commit | c4250726b57a7607cefdd46e2ea281c65379dde1 (patch) | |
tree | baf7b36b4b79ba9bfa6a99c0eb9d2cdf4417fa45 /sys/net/rtsock.c | |
parent | f455c3dad1866ad13f4d9f35d94b392948daa33d (diff) |
Rework the rttimer code. Instead of a global queue and a global timeout
use a per rttimer struct timeout. On enqueue the struct rttimer belongs
to the timeout, in case the route is removed before the timer fires
cleanup based on the timeout_del() return value. If the timeout currently
running then just clear the rtt_rt pointer and let the timeout handle the
cleanup. This should hopefully fix the icmp_pmtu_timeout crashes reported
by some people.
OK bluhm@
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r-- | sys/net/rtsock.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 31fd8f8322b..7b4e544fced 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.332 2022/06/27 17:15:35 bluhm Exp $ */ +/* $OpenBSD: rtsock.c,v 1.333 2022/06/27 21:26:46 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -132,7 +132,7 @@ int rtm_xaddrs(caddr_t, caddr_t, struct rt_addrinfo *); int rtm_validate_proposal(struct rt_addrinfo *); void rtm_setmetrics(u_long, const struct rt_metrics *, struct rt_kmetrics *); -void rtm_getmetrics(const struct rt_kmetrics *, +void rtm_getmetrics(const struct rtentry *, struct rt_metrics *); int sysctl_iflist(int, struct walkarg *); @@ -674,7 +674,7 @@ rtm_report(struct rtentry *rt, u_char type, int seq, int tableid) rtm->rtm_flags = rt->rt_flags; rtm->rtm_pid = curproc->p_p->ps_pid; rtm->rtm_seq = seq; - rtm_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx); + rtm_getmetrics(rt, &rtm->rtm_rmx); rtm->rtm_addrs = info.rti_addrs; #ifdef MPLS rtm->rtm_mpls = info.rti_mpls; @@ -1391,11 +1391,14 @@ rtm_setmetrics(u_long which, const struct rt_metrics *in, } void -rtm_getmetrics(const struct rt_kmetrics *in, struct rt_metrics *out) +rtm_getmetrics(const struct rtentry *rt, struct rt_metrics *out) { + const struct rt_kmetrics *in = &rt->rt_rmx; int64_t expire; expire = in->rmx_expire; + if (expire == 0) + expire = rt_timer_get_expire(rt); if (expire != 0) { expire -= getuptime(); expire += gettime(); @@ -1998,7 +2001,7 @@ sysctl_dumpentry(struct rtentry *rt, void *v, unsigned int id) rtm->rtm_pid = curproc->p_p->ps_pid; rtm->rtm_flags = RTF_DONE | rt->rt_flags; rtm->rtm_priority = rt->rt_priority & RTP_MASK; - rtm_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx); + rtm_getmetrics(rt, &rtm->rtm_rmx); /* Do not account the routing table's reference. */ rtm->rtm_rmx.rmx_refcnt = rt->rt_refcnt - 1; rtm->rtm_index = rt->rt_ifidx; |