-/* $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 $ */
/*
* 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) {
-/* $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 $ */
/*
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 */
/*
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.
*/
*/
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);
-/* $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 $ */
/*
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 */