summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-04-04 11:17:04 +0000
committerphk <phk@FreeBSD.org>1996-04-04 11:17:04 +0000
commit8fad3d6dbca480451b498d8ab35d29929a194d5f (patch)
treefda454e760993a83660c9825d732e2aed6a6da3a /sys
parent1eff72b85f01104f3e70df608fae3fa61f8e8489 (diff)
downloadFreeBSD-src-8fad3d6dbca480451b498d8ab35d29929a194d5f.zip
FreeBSD-src-8fad3d6dbca480451b498d8ab35d29929a194d5f.tar.gz
Add a sysctl (net.inet.tcp.always_keepalive: 0) that when set will force
keepalive on all tcp sessions. Setsockopt(2) cannot override this setting. Maybe another one is needed that just changes the default for SO_KEEPALIVE ? Requested by: Joe Greco <jgreco@brasil.moneng.mei.com>
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_timer.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 66691ea..f9c89b7 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95
- * $Id: tcp_timer.c,v 1.13 1996/01/04 21:34:21 olah Exp $
+ * $Id: tcp_timer.c,v 1.14 1996/03/11 15:13:35 davidg Exp $
*/
#ifndef TUBA_INCLUDE
@@ -72,6 +72,10 @@ static int tcp_keepintvl = TCPTV_KEEPINTVL;
SYSCTL_INT(_net_inet_tcp, TCPCTL_KEEPINTVL, keepintvl,
CTLFLAG_RW, &tcp_keepintvl , 0, "");
+static int always_keepalive = 0;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, always_keepalive,
+ CTLFLAG_RW, &always_keepalive , 0, "");
+
static int tcp_keepcnt = TCPTV_KEEPCNT;
/* max idle probes */
static int tcp_maxpersistidle = TCPTV_KEEP_IDLE;
@@ -314,7 +318,8 @@ tcp_timers(tp, timer)
tcpstat.tcps_keeptimeo++;
if (tp->t_state < TCPS_ESTABLISHED)
goto dropit;
- if (tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE &&
+ if ((always_keepalive ||
+ tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) &&
tp->t_state <= TCPS_CLOSE_WAIT) {
if (tp->t_idle >= tcp_keepidle + tcp_maxidle)
goto dropit;
OpenPOWER on IntegriCloud