[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4B201282.3090800@gmail.com>
Date: Wed, 09 Dec 2009 22:11:30 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Joe Perches <joe@...ches.com>
CC: chavey@...gle.com, davem@...emloft.net, netdev@...r.kernel.org,
therbert@...gle.com
Subject: Re: [PATCH] Add sysctl to set the advertised TCP initial receive
window.
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@...gle.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;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists