summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorhugh <hugh@openbsd.org>1999-11-15 05:50:59 +0000
committerhugh <hugh@openbsd.org>1999-11-15 05:50:59 +0000
commit20014d98fec8e465734b37b00b8822a6f58786e3 (patch)
tree366eb1c42e54e1a8a6b15ad5add03f9410b05499 /sys/netinet/tcp_input.c
parentConsistify DHCP man page titles somewhat; d@, sebastion@irelandmail.com (diff)
downloadwireguard-openbsd-20014d98fec8e465734b37b00b8822a6f58786e3.tar.xz
wireguard-openbsd-20014d98fec8e465734b37b00b8822a6f58786e3.zip
Fix tcp retransmit/persist timers, provos@ OK.
Adapted from NetBSD: Fix a retransmission bug introduced by the Brakmo and Peterson RTO estimation changes. Under some circumstances it would return a value of 0, while the old Van Jacobson RTO code would return a minimum of 3. This would result in 12 retransmissions, each 1 second apart. This takes care of those instances, and ensures that t_rttmin is used everywhere as a lower bound.
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 142452d0849..e2a6b6136d3 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.50 1999/11/04 11:24:23 ho Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.51 1999/11/15 05:50:59 hugh Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -2551,6 +2551,7 @@ tcp_xmit_timer(tp, rtt)
short rtt;
{
register short delta;
+ short rttmin;
tcpstat.tcps_rttupdated++;
--rtt;
@@ -2603,8 +2604,11 @@ tcp_xmit_timer(tp, rtt)
* statistical, we have to test that we don't drop below
* the minimum feasible timer (which is 2 ticks).
*/
- TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp),
- rtt + 2, TCPTV_REXMTMAX);
+ if (tp->t_rttmin > rtt + 2)
+ rttmin = tp->t_rttmin;
+ else
+ rttmin = rtt + 2;
+ TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp), rttmin, TCPTV_REXMTMAX);
/*
* We received an ack for a packet that wasn't retransmitted;
@@ -2704,7 +2708,9 @@ tcp_mss(tp, offer)
* is also a minimum value; this is subject to time.
*/
if (rt->rt_rmx.rmx_locks & RTV_RTT)
- tp->t_rttmin = rtt / (RTM_RTTUNIT / PR_SLOWHZ);
+ TCPT_RANGESET(tp->t_rttmin,
+ rtt / (RTM_RTTUNIT / PR_SLOWHZ),
+ TCPTV_MIN, TCPTV_REXMTMAX);
tp->t_srtt = rtt / (RTM_RTTUNIT / (PR_SLOWHZ * TCP_RTT_SCALE));
if (rt->rt_rmx.rmx_rttvar)
tp->t_rttvar = rt->rt_rmx.rmx_rttvar /