diff options
author | 1996-09-12 06:19:56 +0000 | |
---|---|---|
committer | 1996-09-12 06:19:56 +0000 | |
commit | db011c5bc0920cb435c571d01c766f4612755593 (patch) | |
tree | 56a596733e9c96928f9c57a689234928293c1e9a /sys/netinet/tcp_timer.c | |
parent | Don't assume other subnets than our own are local to us; from Luigi Rizzo (diff) | |
download | wireguard-openbsd-db011c5bc0920cb435c571d01c766f4612755593.tar.xz wireguard-openbsd-db011c5bc0920cb435c571d01c766f4612755593.zip |
TCP Persist handling; from 4.4BSD Lite2 (via NetBSD PR 2335)
Diffstat (limited to 'sys/netinet/tcp_timer.c')
-rw-r--r-- | sys/netinet/tcp_timer.c | 19 |
1 files changed, 18 insertions, 1 deletions
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); |