Subject: Re: netinet/tcp_input.c - 1323 timestamp handling broken
To: None <tech-net@netbsd.org>
From: Rui Paulo <rpaulo@netbsd-pt.org>
List: tech-net
Date: 04/17/2005 22:51:54
On 2005-04-17, David Brownlee <abs@absd.org> wrote:
>  	2.0_STABLE has the following change to netinet/tcp_input.c
>  	(compared to 2.0.2 which does not exhibit this problem)
>
> +       if (opti.ts_present && opti.ts_ecr) {
> +               u_int32_t now;
> +
> +               /*
> +                * Calculate the RTT from the returned time stamp and the
> +                * connection's time base.  If the time stamp is later than
> +                * the current time, fall back to non-1323 RTT calculation.
> +                */
> +               now = TCP_TIMESTAMP(tp);
> +               if (SEQ_GEQ(now, opti.ts_ecr))
> +                       opti.ts_ecr = now - opti.ts_ecr + 1;
> +               else
> +                       opti.ts_ecr = 0;
> +       }
> +
>
>  	When sending many small packets on a LAN from a fast host
>  	to a slow host, with rfc1323 enabled the tcp session will
>  	occasionally stall for between ~5 seconds and several
>  	minutes. With rfc1323 disabled, or with the above removed
>  	the stalls are for less than a second.
>
>  	The test case is 'dmesg | dd bs=1'.
>
>  	Putting in printf() indicate the 'else' does not appear to
>  	fire.

This is somewhat a problem. This patch closes a bug when two TCP packets
come in with the same timestamp (see PR/22551), so removing that code is
also a problem.

Just FYI, if you don't already know this.

-- 
 Rui Paulo <rpaulo@netbsd-pt.org>        http://www.netbsd-pt.org/users/rpaulo/