summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_timer.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_timer.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_timer.c')
-rw-r--r--sys/netinet/tcp_timer.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 79d318637b9..591dc18d7d1 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_timer.c,v 1.14 1999/09/01 21:38:21 provos Exp $ */
+/* $OpenBSD: tcp_timer.c,v 1.15 1999/11/15 05:50:59 hugh Exp $ */
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
/*
@@ -177,7 +177,7 @@ tcp_timers(tp, timer)
register struct tcpcb *tp;
int timer;
{
- register int rexmt;
+ short rto;
#ifdef TCP_SACK
struct sackhole *p, *q;
/*
@@ -229,8 +229,11 @@ tcp_timers(tp, timer)
break;
}
tcpstat.tcps_rexmttimeo++;
- rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
- TCPT_RANGESET((long) tp->t_rxtcur, rexmt,
+ rto = TCP_REXMTVAL(tp);
+ if (rto < tp->t_rttmin)
+ rto = tp->t_rttmin;
+ TCPT_RANGESET((long) tp->t_rxtcur,
+ rto * tcp_backoff[tp->t_rxtshift],
tp->t_rttmin, TCPTV_REXMTMAX);
tp->t_timer[TCPT_REXMT] = tp->t_rxtcur;
/*
@@ -306,9 +309,12 @@ tcp_timers(tp, timer)
* (no responses to probes) reaches the maximum
* backoff that we would use if retransmitting.
*/
+ rto = TCP_REXMTVAL(tp);
+ if (rto < tp->t_rttmin)
+ rto = tp->t_rttmin;
if (tp->t_rxtshift == TCP_MAXRXTSHIFT &&
(tp->t_idle >= tcp_maxpersistidle ||
- tp->t_idle >= TCP_REXMTVAL(tp) * tcp_totbackoff)) {
+ tp->t_idle >= rto * tcp_totbackoff)) {
tcpstat.tcps_persistdrop++;
tp = tcp_drop(tp, ETIMEDOUT);
break;