From owner-freebsd-hackers Wed Jan 31 08:09:26 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id IAA12172 for hackers-outgoing; Wed, 31 Jan 1996 08:09:26 -0800 (PST) Received: from who.cdrom.com (who.cdrom.com [192.216.222.3]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id IAA12157 for ; Wed, 31 Jan 1996 08:09:24 -0800 (PST) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by who.cdrom.com (8.6.12/8.6.11) with ESMTP id IAA09520 for ; Wed, 31 Jan 1996 08:08:40 -0800 Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id RAA10351; Wed, 31 Jan 1996 17:05:17 +0100 From: Luigi Rizzo Message-Id: <199601311605.RAA10351@labinfo.iet.unipi.it> Subject: proposed patch to netinet/tcp_input.c To: hackers@freebsd.org Date: Wed, 31 Jan 1996 17:05:17 +0100 (MET) Cc: luigi@labinfo.iet.unipi.it (Luigi Rizzo) X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-hackers@freebsd.org Precedence: bulk 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/ ====================================================================