Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jan 2012 20:35:43 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r230087 - stable/8/sys/netinet
Message-ID:  <201201132035.q0DKZh80079540@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Jan 13 20:35:43 2012
New Revision: 230087
URL: http://svn.freebsd.org/changeset/base/230087

Log:
  MFC 221891,229665,229672,229700:
  Remove the assertion from tcp_input() that rcv_nxt is always greater
  than or equal to rcv_adv and fix tcp_twstart() to handle this case by
  assuming the last window was zero rather than a negative value.
  
  The code in tcp_input() already safely handled this case.  It can happen
  due to delayed ACKs along with a remote sender that sends data beyond
  the window we previously advertised.  If we have room in our socket buffer
  for the extra data beyond the advertised window, we will accept it.
  However, if the ACK for that segment is delayed, then we will not
  effectively fixup rcv_adv to account for that extra data until the
  next segment arrives and forces out an ACK.  When that next segment
  arrives, rcv_nxt will be beyond rcv_adv.

Modified:
  stable/8/sys/netinet/tcp_input.c
  stable/8/sys/netinet/tcp_timewait.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/netinet/tcp_input.c
==============================================================================
--- stable/8/sys/netinet/tcp_input.c	Fri Jan 13 20:35:12 2012	(r230086)
+++ stable/8/sys/netinet/tcp_input.c	Fri Jan 13 20:35:43 2012	(r230087)
@@ -1776,9 +1776,6 @@ tcp_do_segment(struct mbuf *m, struct tc
 	win = sbspace(&so->so_rcv);
 	if (win < 0)
 		win = 0;
-	KASSERT(SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt),
-	    ("tcp_input negative window: tp %p rcv_nxt %u rcv_adv %u", tp,
-	    tp->rcv_adv, tp->rcv_nxt));
 	tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt));
 
 	/* Reset receive buffer auto scaling when not in bulk receive mode. */

Modified: stable/8/sys/netinet/tcp_timewait.c
==============================================================================
--- stable/8/sys/netinet/tcp_timewait.c	Fri Jan 13 20:35:12 2012	(r230086)
+++ stable/8/sys/netinet/tcp_timewait.c	Fri Jan 13 20:35:43 2012	(r230087)
@@ -228,10 +228,10 @@ tcp_twstart(struct tcpcb *tp)
 	/*
 	 * Recover last window size sent.
 	 */
-	KASSERT(SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt),
-	    ("tcp_twstart negative window: tp %p rcv_nxt %u rcv_adv %u", tp,
-	    tp->rcv_adv, tp->rcv_nxt));
-	tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale;
+	if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt))
+		tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale;
+	else
+		tw->last_win = 0;
 
 	/*
 	 * Set t_recent if timestamps are used on the connection.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201132035.q0DKZh80079540>