summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_output.c13
-rw-r--r--sys/netinet/tcp_timer.c19
-rw-r--r--sys/netinet/tcp_var.h3
3 files changed, 28 insertions, 7 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 600f6bad8d5..d4192defcd5 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.3 1996/03/14 08:06:57 tholo Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.4 1996/09/12 06:19:56 tholo Exp $ */
/* $NetBSD: tcp_output.c,v 1.14 1996/02/13 23:43:53 christos Exp $ */
/*
@@ -154,15 +154,18 @@ again:
* but we haven't been called to retransmit,
* len will be -1. Otherwise, window shrank
* after we sent into it. If window shrank to 0,
- * cancel pending retransmit and pull snd_nxt
- * back to (closed) window. We will enter persist
- * state below. If the window didn't close completely,
- * just wait for an ACK.
+ * calcel pending retransmit, pull snd_nxt back
+ * to (closed) window, and set the persist timer
+ * if it isn't already running. If the window
+ * didn't close completely, just wait for an ACK.
*/
len = 0;
if (win == 0) {
tp->t_timer[TCPT_REXMT] = 0;
+ tp->t_rxtshift = 0;
tp->snd_nxt = tp->snd_una;
+ if (tp->t_timer[TCPT_PERSIST] == 0)
+ tcp_setpersist(tp);
}
}
if (len > tp->t_maxseg) {
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index dd075c0d120..14e8d42ca7b 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_timer.c,v 1.5 1996/07/29 22:01:51 niklas Exp $ */
+/* $OpenBSD: tcp_timer.c,v 1.6 1996/09/12 06:19:57 tholo Exp $ */
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
/*
@@ -63,6 +63,7 @@
int tcp_keepidle = TCPTV_KEEP_IDLE;
int tcp_keepintvl = TCPTV_KEEPINTVL;
+int tcp_maxpersistidle = TCPTV_KEEP_IDLE; /* max idle time in persist */
int tcp_maxidle;
#endif /* TUBA_INCLUDE */
/*
@@ -165,6 +166,8 @@ tcp_canceltimers(tp)
int tcp_backoff[TCP_MAXRXTSHIFT + 1] =
{ 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 };
+int tcp_totbackoff = 511; /* sum of tcp_backoff[] */
+
/*
* TCP timer processing.
*/
@@ -268,6 +271,20 @@ tcp_timers(tp, timer)
*/
case TCPT_PERSIST:
tcpstat.tcps_persisttimeo++;
+ /*
+ * Hack: if the peer is dead/unreachable, we do not
+ * time out if the window is closed. After a full
+ * backoff, drop the connection if the idle time
+ * (no responses to probes) reaches the maximum
+ * backoff that we would use if retransmitting.
+ */
+ if (tp->t_rxtshift == TCP_MAXRXTSHIFT &&
+ (tp->t_idle >= tcp_maxpersistidle ||
+ tp->t_idle >= TCP_REXMTVAL(tp) * tcp_totbackoff)) {
+ tcpstat.tcps_persistdrop++;
+ tp = tcp_drop(tp, ETIMEDOUT);
+ break;
+ }
tcp_setpersist(tp);
tp->t_force = 1;
(void) tcp_output(tp);
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index ecae9f2469d..dde7c1b1e77 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.3 1996/03/03 22:30:50 niklas Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.4 1996/09/12 06:19:57 tholo Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -181,6 +181,7 @@ struct tcpstat {
u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */
u_long tcps_rexmttimeo; /* retransmit timeouts */
u_long tcps_persisttimeo; /* persist timeouts */
+ u_long tcps_persistdrop; /* connections dropped in persist */
u_long tcps_keeptimeo; /* keepalive timeouts */
u_long tcps_keepprobe; /* keepalive probes sent */
u_long tcps_keepdrops; /* connections dropped in keepalive */