Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-0]: src/sys/netinet Apply patch (requested by christos in ticke...



details:   https://anonhg.NetBSD.org/src/rev/2c0db8067060
branches:  netbsd-2-0
changeset: 564746:2c0db8067060
user:      tron <tron%NetBSD.org@localhost>
date:      Wed Apr 06 13:48:34 2005 +0000

description:
Apply patch (requested by christos in ticket #1401):
If an echoed RFC 1323 time stamp appears to be later than the current time,
ignore it and fall back to old-style RTT calculation.  This prevents ending
up with a negative RTT and panicking later.

diffstat:

 sys/netinet/tcp_input.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 9b92e36c3d78 -r 2c0db8067060 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Wed Apr 06 11:46:33 2005 +0000
+++ b/sys/netinet/tcp_input.c   Wed Apr 06 13:48:34 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.190.2.6 2004/09/19 15:38:01 he Exp $   */
+/*     $NetBSD: tcp_input.c,v 1.190.2.7 2005/04/06 13:48:34 tron Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.190.2.6 2004/09/19 15:38:01 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.190.2.7 2005/04/06 13:48:34 tron Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1445,6 +1445,21 @@
        if (optp)
                tcp_dooptions(tp, optp, optlen, th, &opti);
 
+       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;
+       }
+
        /*
         * Header prediction: check for the two common cases
         * of a uni-directional data xfer.  If the packet has



Home | Main Index | Thread Index | Old Index