Date: Fri, 6 Jan 2012 03:19:29 +0300 From: Sergey Kandaurov <pluknet@freebsd.org> To: John Baldwin <jhb@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229665 - head/sys/netinet Message-ID: <CAE-mSOLsqHykxqH5DLnkr-ESbAbUbFVHzJtBFBD4m1zRimHrmg@mail.gmail.com> In-Reply-To: <201201052229.q05MTBMf059184@svn.freebsd.org> References: <201201052229.q05MTBMf059184@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 6 January 2012 02:29, John Baldwin <jhb@freebsd.org> wrote: > Author: jhb > Date: Thu Jan 5 22:29:11 2012 > New Revision: 229665 > URL: http://svn.freebsd.org/changeset/base/229665 > > Log: > 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. > > Tested by: pjd > MFC after: 1 week > > Modified: > head/sys/netinet/tcp_input.c > head/sys/netinet/tcp_timewait.c > > Modified: head/sys/netinet/tcp_input.c > ============================================================================== > --- head/sys/netinet/tcp_input.c Thu Jan 5 22:28:40 2012 (r229664) > +++ head/sys/netinet/tcp_input.c Thu Jan 5 22:29:11 2012 (r229665) > @@ -1795,9 +1795,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_nxt, tp->rcv_adv)); > tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)); > > /* Reset receive buffer auto scaling when not in bulk receive mode. */ > > Modified: head/sys/netinet/tcp_timewait.c > ============================================================================== > --- head/sys/netinet/tcp_timewait.c Thu Jan 5 22:28:40 2012 (r229664) > +++ head/sys/netinet/tcp_timewait.c Thu Jan 5 22:29:11 2012 (r229665) > @@ -242,10 +242,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_nxt, tp->rcv_adv)); > - tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale; > + if (SEQ_GE(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. Hi, Looks like a typo there: /usr/src/sys/netinet/tcp_timewait.c: In function 'tcp_twstart': /usr/src/sys/netinet/tcp_timewait.c:245: warning: implicit declaration of function 'SEQ_GE' /usr/src/sys/netinet/tcp_timewait.c:245: warning: nested extern declaration of 'SEQ_GE' [-Wnested-externs] -- wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOLsqHykxqH5DLnkr-ESbAbUbFVHzJtBFBD4m1zRimHrmg>
