Date: Thu, 21 Oct 2004 05:13:55 -0300 From: Fernando Gont <fernando@gont.com.ar> To: freebsd-net@freebsd.org Subject: tcp_notify() and the connection establishment timer Message-ID: <4.3.2.7.2.20041021044818.00d5a560@server.frh.utn.edu.ar>
next in thread | raw e-mail | index | archive | help
Folks, I was trying to figure out what the BSD policy for aborting connection-establishment attempts was. According to Stevens' TCPv2, when TCP sends the first SYN for establishing a connection, a 75-seconds timer is initialized. If the connection cannot be established before that 75-second period is over, the conenction will be aborted. However, looking at the tcp_notify() function, I see the following code: static struct inpcb * tcp_notify(inp, error) struct inpcb *inp; int error; { struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb; /* * Ignore some errors if we are hooked up. * If connection hasn't completed, has retransmitted several times, * and receives a second error, give up now. This is better * than waiting a long time to establish a connection that * can never complete. */ if (tp->t_state == TCPS_ESTABLISHED && (error == EHOSTUNREACH || error == ENETUNREACH || error == EHOSTDOWN)) { return inp; } else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 && tp->t_softerror) { tcp_drop(tp, error); return (struct inpcb *)0; } else { tp->t_softerror = error; return inp; } #if 0 wakeup( &so->so_timeo); sorwakeup(so); sowwakeup(so); #endif } Maybe I'm missing something, but I get the impression that, considering the value (six seconds) to which the RTO is initialized, that part that says } else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 && tp->t_softerror) { tcp_drop(tp, error); return (struct inpcb *)0; will never be executed, as the connection-establishment timer will always timeout before the evaluated condition becomes true. Am I missing something? Or is it that this code is there just in case the initial RTO is reduced to such a value that, in that case, this code would kick in before the 75-seconds tconnection-establishment timer? Thanks! -- Fernando Gont e-mail: fernando@gont.com.ar || fgont@acm.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4.3.2.7.2.20041021044818.00d5a560>