From: Eric Dumazet <eric.dumazet@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: chavey@google.com, davem@davemloft.net, netdev@vger.kernel.org,
therbert@google.com
Subject: Re: [PATCH] Add sysctl to set the advertised TCP initial receive window.
Date: Wed, 09 Dec 2009 22:11:30 +0100 [thread overview]
Message-ID: <4B201282.3090800@gmail.com> (raw)
In-Reply-To: <1260392131.5351.43.camel@Joe-Laptop.home>
Le 09/12/2009 21:55, Joe Perches a écrit :
> On Wed, 2009-12-09 at 21:33 +0100, Eric Dumazet wrote:
>> Le 09/12/2009 21:13, chavey@google.com a écrit :
>>> Add a sysctl, tcp_init_rcv_wnd, to set the TCP initial receive window
>>> size advertised by passive and active TCP connections.
>>> index f1813bc..7567edd 100644
>>> --- a/net/ipv4/tcp.c
>>> +++ b/net/ipv4/tcp.c
>>> @@ -2248,6 +2248,11 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
>>> break;
>>> #endif
>>>
>>> + case TCP_INIT_RCV_WND:
>>> + val = min_t(int, val, TCP_INIT_RCV_WND_MAX);
>>> + tp->rx_opt.init_rcv_wnd = val;
>>> + break;
>>> +
>>
>> If user pass val = -1, you end with init_rcv_wnd = 255
>>
>> Is it what you want ?
>> Probably not :)
>
> I believe min_t() is superfluous now because:
> + .proc_handler = proc_dointvec_minmax,
> + .extra1 = &zero,
> + .extra2 = &tcp_init_rcv_wnd_max
>
>
It is *not* superfluous, since sysctl_tcp_init_rcv_wnd is ignored if
user called setsockopt(TCP_INIT_RCV_WND) with a non null value :
+ if (tp->rx_opt.init_rcv_wnd == 0)
+ tp->rx_opt.init_rcv_wnd = sysctl_tcp_init_rcv_wnd;
So its probably better to not silently cap user provided val but report an error.
if (val < 0 || val > TCP_INIT_RCV_WND_MAX)
err = -EINVAL
else
tp->rx_opt.init_rcv_wnd = val;
next prev parent reply other threads:[~2009-12-09 21:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-09 20:13 [PATCH] Add sysctl to set the advertised TCP initial receive window chavey
2009-12-09 20:33 ` Eric Dumazet
2009-12-09 20:55 ` Joe Perches
2009-12-09 21:11 ` Eric Dumazet [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-12-10 2:05 chavey
2009-12-10 16:57 ` Stephen Hemminger
2009-12-10 18:55 ` Joe Perches
2009-12-13 3:27 ` Eric W. Biederman
2009-12-09 0:30 chavey
2009-12-09 0:59 ` Joe Perches
2009-12-08 22:40 chavey
2009-12-08 23:00 ` Joe Perches
2009-12-09 13:26 ` Andi Kleen
2009-12-09 18:05 ` Tom Herbert
[not found] ` <65634d660912091001s44016cccq4f2422e613ba9db9@mail.gmail.com>
2009-12-10 2:21 ` David Miller
2009-12-10 21:55 ` Laurent Chavey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B201282.3090800@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=chavey@google.com \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).