[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    proposed patch to netinet/tcp_input.c
From:       Luigi Rizzo <luigi () labinfo ! iet ! unipi ! it>
Date:       1996-01-31 16:05:17
[Download RAW message or body]

I would like you to evaluate, and possibly apply, the enclosed
patch to netinet/tcp_input.c

MOTIVATION:

RFC1323 and following updates (see Stevens, TCP/IP Illustrated vol.2
pg.868-870, and the code in netinet/tcp_input.c) state that:

    1. only segments which cause the receive window to advance
       can be considered to carry valid timestamps, and
       possibly cause ts_recent to be updated;
    2. timestamp echo replies in duplicate acks are not used to
       update RTT estimates (which means that they are completely
       unused, this being their only purpose).

The code in 2.1R (and possibly 2.2-current, as far as I know)
implements the above behaviour. As a result, the timestamp echo
reply field in duplicate ACKs is completely unused.

My proposal is to make this field carry useful information, in the
form of the timestamp of the most recently received segment, if
this is newer than ts_recent.

This can be used by the sender as a form of selective acknowledgement,
for which I have some code which I am already running. As far as
I can tell there are no other side effects because of #2 above. I
am currently running a kernel with the following patch applied and
it seems to behave as usual.

IMPLEMENTATION:

How to implement this: it cannot be done by simply updating ts_recent
in the tcp control block because ts_recent is also used to determine
if a segment is too old. The following patch should do what is needed -- 
set and restore the value of ts_recent around calls to tcp_output().

I know that the code is duplicated, but tcp_input() is such a messy
piece of code that I did not find a more decent way -- at least at
this stage.  Besides, given the existence of a book which documents
it in much detail, a cleanup of the code is not a good idea.

Proposed patch follows:

diff -cbwr netinet.orig/tcp_input.c netinet/tcp_input.c
*** netinet.orig/tcp_input.c	Wed Aug 23 16:52:06 1995
--- netinet/tcp_input.c	Wed Jan 31 16:12:38 1996
***************
*** 1595,1601 ****
--- 1672,1686 ----
  	 * Return any desired output.
  	 */
  	if (needoutput || (tp->t_flags & TF_ACKNOW))
+ 	{
+ 		u_long	old_ts_recent=tp->ts_recent;
+ 		if ((to.to_flag & TOF_TS) &&
+ 			TSTMP_LT(tp->ts_recent, to.to_tsval))
+ 			tp->ts_recent=to.to_tsval;
  		(void) tcp_output(tp);
+ 		tp->ts_recent=old_ts_recent;
+ 		
+ 	}
  	return;
  
  dropafterack:
***************
*** 1611,1617 ****
--- 1700,1714 ----
  #endif
  	m_freem(m);
  	tp->t_flags |= TF_ACKNOW;
+ 	{
+ 		u_long	old_ts_recent=tp->ts_recent;
+ 		if ((to.to_flag & TOF_TS) &&
+ 			TSTMP_LT(tp->ts_recent, to.to_tsval))
+ 			tp->ts_recent=to.to_tsval;
  		(void) tcp_output(tp);
+ 		tp->ts_recent=old_ts_recent;
+ 		
+ 	}
  	return;
  
  dropwithreset:
----------------

	Luigi
====================================================================
Luigi Rizzo                     Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it       Universita' di Pisa
tel: +39-50-568533              via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522              http://www.iet.unipi.it/~luigi/
====================================================================

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic