From owner-freebsd-net@FreeBSD.ORG Thu Oct 21 08:03:45 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9D6DC16A4CE for ; Thu, 21 Oct 2004 08:03:45 +0000 (GMT) Received: from server.frh.utn.edu.ar (server.frh.utn.edu.ar [170.210.17.146]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1892343D2D for ; Thu, 21 Oct 2004 08:03:44 +0000 (GMT) (envelope-from fernando@gont.com.ar) Received: (qmail 24766 invoked from network); 21 Oct 2004 08:02:36 -0000 Received: from customer123-155-32.iplannetworks.net (HELO fernando.gont.com.ar) (gont-fernando@200.123.155.32) by server.frh.utn.edu.ar with SMTP; 21 Oct 2004 08:02:36 -0000 Message-Id: <4.3.2.7.2.20041021044818.00d5a560@server.frh.utn.edu.ar> X-Sender: gont-fernando@server.frh.utn.edu.ar X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Thu, 21 Oct 2004 05:13:55 -0300 To: freebsd-net@freebsd.org From: Fernando Gont Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: tcp_notify() and the connection establishment timer X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Oct 2004 08:03:45 -0000 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