Subject: minor bug in rfc 1323 patch for BSD net 2
From: [email-masked] (Thomas Skibo)
To: [email-masked]
Date: Mon, 6 Jul 92 21:41:43 -0700

Folks:

I thought I'd let everyone in on a small bug I've found in my BSD Net 2
implementation of the RFC 1323 TCP extensions.  It's kind of intriguing.

There is a test to see if the range of sequence numbers of a segment
contains the value in Last.ACK.sent at line 812 of tcp_input.c.  If
the test succeeds, TS.recent should be updated.  I forgot to take
into account that SYN and FIN take up a sequence number.  So, TS.recent
isn't updated on a FIN segment (unless it carries other data).

The implication is subtle.  The time-stamp reply on the segment that
ACK's the FIN will not reflect the value of the time-stamp of the FIN.
But, the acknowledgement number is increased and so the receiver (the TCP
that sent the FIN) uses the echo reply to calculate a round-trip time sample.

If the connection was idle for quite a while (idle in the direction
that the FIN was sent), the calculated round-trip time can be HUGE and
really throw off the smoothed round-trip time.  This wouldn't be a
problem (the connection is closed in that direction and so the
retransmit timer isn't used anymore) except that on Reno systems
the srtt and rttvar values might be merged into the routing entry.
So the final result could be inflated rtt values in routing entries.

I've attached a patch that I'm 99% sure will work but it's untested.
I think I'll attach this letter to the README file in the shar
file on uxc.cso.uiuc.edu (/pub/tcplw.shar.Z) as well.

-Thomas

-------------------------------------cut here-------------------------
*** tcp_input.c.orig	Mon Jul  6 23:07:49 1992
--- tcp_input.c	Mon Jul  6 23:08:03 1992
***************
*** 810,817 ****
  	/* If last ACK falls within this segments sequence numbers,
  	 * record its time-stamp.
  	 */
! 	if ( ts_val &&  SEQ_LEQ( ti->ti_seq, tp->last_ack_sent ) &&
! 	   SEQ_LT( tp->last_ack_sent, ti->ti_seq+ti->ti_len) ) {
  		tp->ts_recent_age = 0;
  		tp->ts_recent = ts_val;
  	}
--- 810,818 ----
  	/* If last ACK falls within this segments sequence numbers,
  	 * record its time-stamp.
  	 */
! 	if ( ts_present &&  SEQ_LEQ( ti->ti_seq, tp->last_ack_sent ) &&
! 	   SEQ_LT( tp->last_ack_sent, ti->ti_seq+ti->ti_len+
! 			((tiflags&(TH_SYN|TH_FIN))!=0) ) ) {
  		tp->ts_recent_age = 0;
  		tp->ts_recent = ts_val;
  	}

Thomas Skibo		Advanced Networking Group, Silicon Graphics, Inc.
[email-masked]