TCP keepalive does not work for half-close connections

hanoh haim hhaim.hanoh at gmail.com
Fri May 4 15:28:32 UTC 2018


Hi Expert,

Regarding the folwoing code,
Is there a reason that keepalive timer does not protect from half-close
socket (e.g. other side crash after this step)?

example

C    S

FIN->
  <-ACK

server crash here, the Client is not protected by keepalive

     <-FIN
 ->ACK


I think that this condition should be removed.
"tp->t_state <= TCPS_CLOSIN "


if ((tcp_always_keepalive ||
inp->inp_socket->so_options & SO_KEEPALIVE) &&
tp->t_state <= TCPS_CLOSING) {
thanks
Hanoh


More information about the freebsd-net mailing list