From owner-freebsd-net@FreeBSD.ORG Fri Nov 30 12:52:24 2007 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1E1816A418 for ; Fri, 30 Nov 2007 12:52:24 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 9114313C478 for ; Fri, 30 Nov 2007 12:52:24 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 392655666D; Fri, 30 Nov 2007 07:52:24 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Fri, 30 Nov 2007 07:52:24 -0500 X-Sasl-enc: y3cKF7fmaH0uM1NWz+NbGyPZ0nxud7gyCp5z2hyMgko+ 1196427143 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTP id B9D932DA5; Fri, 30 Nov 2007 07:52:23 -0500 (EST) Message-ID: <47500786.9050902@FreeBSD.org> Date: Fri, 30 Nov 2007 12:52:22 +0000 From: "Bruce M. Simpson" User-Agent: Thunderbird 2.0.0.6 (X11/20070928) MIME-Version: 1.0 To: Andrew Alcheyev References: <1736192477.20071130155032@telenet.ru> In-Reply-To: <1736192477.20071130155032@telenet.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: Re: per-socket keep-alive options for TCP X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2007 12:52:24 -0000 Andrew Alcheyev wrote: > I have recently examined the keep-alive mechanism in FreeBSD's TCP > stack and found out that it has no tunable variables for keep-alive on > a per-socket basis. > Is anyone interested in a patch like this one? > http://mail-index.netbsd.org/tech-net/2007/06/19/0001.html > > Alternatively, a patch for FreeBSD may introduce a new kernel option. > I would appreciate any suggestions. > Seems reasonable. This thread talks about the Solaris implementation and the general background to keep-alives: http://jj.tingiris.net/archives/6-TCP_KEEPALIVE-and-SO_KEEPALIVE-on-Solaris.html And this thread mentions its use in PostgreSQL: http://qaix.com/postgresql-database-development/336-230-re-implement-support-for-tcp-keepcnt-tcp-keepidle-tcp-keepintvl-read.shtml I'm a bit wary of importing new features into a sensitive and heavily used module like TCP without regression tests, though, and it should probably default to the current sysctl defaults in use (default to keepalives on for each new tcp socket) for traversing stateful firewalls on the path. However in this case we are merely introducing new knobs for fine-tuning the keep-alive behaviour, so no big worry here. Being able to tune on a per-socket basis is *somewhat* useful, however what would be useful in the bigger picture is the ability to tune TCP behaviour based on path selection, where the path currently chosen has radically different characteristics from the general case (e.g. GPRS, UMTS, satellite systems). Cheers, BMS