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 =A05 22:29:11 2012 > New Revision: 229665 > URL: http://svn.freebsd.org/changeset/base/229665 > > Log: > =A0Remove the assertion from tcp_input() that rcv_nxt is always greater > =A0than or equal to rcv_adv and fix tcp_twstart() to handle this case by > =A0assuming the last window was zero rather than a negative value. > > =A0The code in tcp_input() already safely handled this case. =A0It can ha= ppen > =A0due to delayed ACKs along with a remote sender that sends data beyond > =A0the window we previously advertised. =A0If we have room in our socket = buffer > =A0for the extra data beyond the advertised window, we will accept it. > =A0However, if the ACK for that segment is delayed, then we will not > =A0effectively fixup rcv_adv to account for that extra data until the > =A0next segment arrives and forces out an ACK. =A0When that next segment > =A0arrives, rcv_nxt will be beyond rcv_adv. > > =A0Tested by: =A0 =A0pjd > =A0MFC after: =A0 =A01 week > > Modified: > =A0head/sys/netinet/tcp_input.c > =A0head/sys/netinet/tcp_timewait.c > > Modified: head/sys/netinet/tcp_input.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/tcp_input.c =A0 =A0 =A0 =A0Thu Jan =A05 22:28:40 201= 2 =A0 =A0 =A0 =A0(r229664) > +++ head/sys/netinet/tcp_input.c =A0 =A0 =A0 =A0Thu Jan =A05 22:29:11 201= 2 =A0 =A0 =A0 =A0(r229665) > @@ -1795,9 +1795,6 @@ tcp_do_segment(struct mbuf *m, struct tc > =A0 =A0 =A0 =A0win =3D sbspace(&so->so_rcv); > =A0 =A0 =A0 =A0if (win < 0) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0win =3D 0; > - =A0 =A0 =A0 KASSERT(SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt), > - =A0 =A0 =A0 =A0 =A0 ("tcp_input negative window: tp %p rcv_nxt %u rcv_a= dv %u", tp, > - =A0 =A0 =A0 =A0 =A0 tp->rcv_nxt, tp->rcv_adv)); > =A0 =A0 =A0 =A0tp->rcv_wnd =3D imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)= ); > > =A0 =A0 =A0 =A0/* Reset receive buffer auto scaling when not in bulk rece= ive mode. */ > > Modified: head/sys/netinet/tcp_timewait.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/tcp_timewait.c =A0 =A0 Thu Jan =A05 22:28:40 2012 = =A0 =A0 =A0 =A0(r229664) > +++ head/sys/netinet/tcp_timewait.c =A0 =A0 Thu Jan =A05 22:29:11 2012 = =A0 =A0 =A0 =A0(r229665) > @@ -242,10 +242,10 @@ tcp_twstart(struct tcpcb *tp) > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * Recover last window size sent. > =A0 =A0 =A0 =A0 */ > - =A0 =A0 =A0 KASSERT(SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt), > - =A0 =A0 =A0 =A0 =A0 ("tcp_twstart negative window: tp %p rcv_nxt %u rcv= _adv %u", tp, > - =A0 =A0 =A0 =A0 =A0 tp->rcv_nxt, tp->rcv_adv)); > - =A0 =A0 =A0 tw->last_win =3D (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_sca= le; > + =A0 =A0 =A0 if (SEQ_GE(tp->rcv_adv, tp->rcv_nxt)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 tw->last_win =3D (tp->rcv_adv - tp->rcv_nxt= ) >> tp->rcv_scale; > + =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 tw->last_win =3D 0; > > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * 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] --=20 wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOLsqHykxqH5DLnkr-ESbAbUbFVHzJtBFBD4m1zRimHrmg>