From ab0c462315e40d83764117b87ecb85cbf564b0b0 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 30 Mar 2008 20:39:01 +0000 Subject: [PATCH] It's frankly long past time that we turn net.inet.tcp.always_keepalive on by default. The default test internal is 2 hours of idle (left unchanged). I am not going to make it shorter but I will note that while you might not have wanted to have the feature enabled 15 years ago (because many people were using demand-dial), these days you actually almost universally want the feature enabled for a multitude of reasons: (1) Because you will often be running over a NAT and can lose the NAT entry if the connection stays idle with no traffic at all for too long a period of time. (2) Because you will often be running over stateful filters which can also get confused and lose the table entry if they see no traffic for too long a period of time. (3) Because having this turned on guarantees that stuck tcp connections, especially those generated through batch operations, will eventually get unstuck. A TCP connection can become stuck if it is waiting on data and the remote end has closed the connection, but the RST got lost. Without this feature such connections can remain stuck literally forever. In some cases you might even need a far shorter interval but that is another issue not addressed by this commit. --- sys/netinet/tcp_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 936277346..92332c143 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -65,7 +65,7 @@ * * @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/tcp_timer.c,v 1.34.2.14 2003/02/03 02:33:41 hsu Exp $ - * $DragonFly: src/sys/netinet/tcp_timer.c,v 1.16 2007/03/04 18:51:59 swildner Exp $ + * $DragonFly: src/sys/netinet/tcp_timer.c,v 1.17 2008/03/30 20:39:01 dillon Exp $ */ #include "opt_compat.h" @@ -155,7 +155,7 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_slop, CTLTYPE_INT|CTLFLAG_RW, &tcp_rexmit_slop, 0, sysctl_msec_to_ticks, "I", "Retransmission Timer Slop"); -static int always_keepalive = 0; +static int always_keepalive = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, always_keepalive, CTLFLAG_RW, &always_keepalive , 0, "Assume SO_KEEPALIVE on all TCP connections"); -- 2.11.4.GIT