kern/76504: Keep-alives doesn't work on half-closed sockets.

Dmitrij Tejblum tejblum at yandex-team.ru
Thu Jan 20 07:00:41 PST 2005


>Number:         76504
>Category:       kern
>Synopsis:       Keep-alives doesn't work on half-closed sockets.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 20 15:00:40 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Dmitrij Tejblum
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:

>Description:
When a TCP socket is shutdown for writing, but isn't closed and isn't shutdown
for reading, then keep-alives does not work on this socket. 

>How-To-Repeat:

Set sysctl net.inet.tcp.keepintvl to several seconds, create a half-closed
connection, and look with tcpdump. Half-closed connection may be create by
e.g. rsh -n.

>Fix:

--- tcp_timer.c	Mon Jan 17 15:06:36 2005
+++ tcp_timer.c	Thu Jan 20 16:24:11 2005
@@ -336,7 +336,7 @@
 	if (tp->t_state < TCPS_ESTABLISHED)
 		goto dropit;
 	if ((always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) &&
-	    tp->t_state <= TCPS_CLOSING) {
+	    (tp->t_state <= TCPS_CLOSING || tp->t_state == TCPS_FIN_WAIT_2)) {
 		if ((ticks - tp->t_rcvtime) >= tcp_keepidle + tcp_maxidle)
 			goto dropit;
 		/*


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list