Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Feb 2000 19:50:58 -0800
From:      jayanth <jayanth@yahoo-inc.com>
To:        fbsdnet <freebsd-net@FreeBSD.ORG>
Subject:   tcpsendspace and tcprecvspace issue ?
Message-ID:  <38ACC1A2.A830B26C@yahoo-inc.com>

next in thread | raw e-mail | index | archive | help
There seems to be a certain condition where tcp advertises the
wrong window size when the tcpsendspace and
tcprecvspace value are set to a value = 65536(>65000 )
Assume rfc1323 is off.

Scenario:
Turn keepalive on and open a connection.
Send some data and let the connection be idle.
let the  keepalive timer expire at the server end.
tcp now advertises a window size of 164 instead
of the original window size.

I went through the code and found that
in tcp_input.c in tcp_mss() the following code
bumps the value from 65536 to 65700

tcp_mss()
---------
#ifdef RTV_RPIPE
        if ((bufsize = rt->rt_rmx.rmx_recvpipe) == 0)
#endif
                bufsize = so->so_rcv.sb_hiwat;
        if (bufsize > mss) {
                bufsize = roundup(bufsize, mss);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                if (bufsize > sb_max)
                        bufsize = sb_max;
                (void)sbreserve(&so->so_rcv, bufsize);


If the keepalive timer expires the tcp_respond()
uses the sbspace(so->so_rcv) to determine the
window  size.

tcp_respond()
------------
    ti->ti_win = htons((u_short) (win >> tp->rcv_scale));
else
    ti->ti_win = htons((u_short)win);

ti->ti_win is cast to a unsigned short resulting in the wrap around
65700 - 65336 = 164 which is the advertised window size..
The problem occurs if the roundup result is greater than 65536.

Is this a bug ?

The fix is either not do a roundup() if rfc1323 is off
or not to allow this value to exceed 65535 if rfc1323 is off.

Hope I am making sense.

cheers
jayanth




















To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




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