linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: make tcp_notsent_lowat sysctl knob behave as true unsigned int
@ 2016-12-29 14:35 Pavel Tikhomirov
  2016-12-30 20:23 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Tikhomirov @ 2016-12-29 14:35 UTC (permalink / raw)
  To: David S . Miller
  Cc: Eric Dumazet, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, netdev, linux-kernel, Konstantin Khorenko,
	Pavel Tikhomirov

> cat /proc/sys/net/ipv4/tcp_notsent_lowat
-1
> echo 4294967295 > /proc/sys/net/ipv4/tcp_notsent_lowat
-bash: echo: write error: Invalid argument
> echo -2147483648 > /proc/sys/net/ipv4/tcp_notsent_lowat
> cat /proc/sys/net/ipv4/tcp_notsent_lowat
-2147483648

but in documentation we have "tcp_notsent_lowat - UNSIGNED INTEGER"

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 net/ipv4/sysctl_net_ipv4.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 80bc36b..5361373 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -41,6 +41,7 @@ static int tcp_syn_retries_min = 1;
 static int tcp_syn_retries_max = MAX_TCP_SYNCNT;
 static int ip_ping_group_range_min[] = { 0, 0 };
 static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
+static unsigned int uint_max = UINT_MAX;
 
 /* Update system visible IP port range */
 static void set_local_port_range(struct net *net, int range[2])
@@ -958,7 +959,9 @@ static struct ctl_table ipv4_net_table[] = {
 		.data		= &init_net.ipv4.sysctl_tcp_notsent_lowat,
 		.maxlen		= sizeof(unsigned int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_doulongvec_minmax,
+		.extra1		= &zero,
+		.extra2		= &uint_max,
 	},
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
 	{
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipv4: make tcp_notsent_lowat sysctl knob behave as true unsigned int
  2016-12-29 14:35 [PATCH] ipv4: make tcp_notsent_lowat sysctl knob behave as true unsigned int Pavel Tikhomirov
@ 2016-12-30 20:23 ` David Miller
  2017-01-09  7:45   ` [PATCH v2] " Pavel Tikhomirov
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2016-12-30 20:23 UTC (permalink / raw)
  To: ptikhomirov
  Cc: edumazet, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel,
	khorenko

From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Date: Thu, 29 Dec 2016 17:35:07 +0300

> @@ -958,7 +959,9 @@ static struct ctl_table ipv4_net_table[] = {
>  		.data		= &init_net.ipv4.sysctl_tcp_notsent_lowat,
>  		.maxlen		= sizeof(unsigned int),
>  		.mode		= 0644,
> -		.proc_handler	= proc_dointvec,
> +		.proc_handler	= proc_doulongvec_minmax,
> +		.extra1		= &zero,
> +		.extra2		= &uint_max,

It seems much simpler to use "proc_douintvec()" to fix this bug.

Doesn't it?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] ipv4: make tcp_notsent_lowat sysctl knob behave as true unsigned int
  2016-12-30 20:23 ` David Miller
@ 2017-01-09  7:45   ` Pavel Tikhomirov
  2017-01-09 21:38     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Tikhomirov @ 2017-01-09  7:45 UTC (permalink / raw)
  To: David S . Miller
  Cc: Eric Dumazet, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, netdev, linux-kernel, Konstantin Khorenko,
	Pavel Tikhomirov

> cat /proc/sys/net/ipv4/tcp_notsent_lowat
-1
> echo 4294967295 > /proc/sys/net/ipv4/tcp_notsent_lowat
-bash: echo: write error: Invalid argument
> echo -2147483648 > /proc/sys/net/ipv4/tcp_notsent_lowat
> cat /proc/sys/net/ipv4/tcp_notsent_lowat
-2147483648

but in documentation we have "tcp_notsent_lowat - UNSIGNED INTEGER"

v2: simplify to just proc_douintvec
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 net/ipv4/sysctl_net_ipv4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 80bc36b..566cfc5 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -958,7 +958,7 @@ static struct ctl_table ipv4_net_table[] = {
 		.data		= &init_net.ipv4.sysctl_tcp_notsent_lowat,
 		.maxlen		= sizeof(unsigned int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_douintvec,
 	},
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
 	{
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ipv4: make tcp_notsent_lowat sysctl knob behave as true unsigned int
  2017-01-09  7:45   ` [PATCH v2] " Pavel Tikhomirov
@ 2017-01-09 21:38     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-01-09 21:38 UTC (permalink / raw)
  To: ptikhomirov
  Cc: edumazet, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel,
	khorenko

From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Date: Mon,  9 Jan 2017 10:45:49 +0300

>> cat /proc/sys/net/ipv4/tcp_notsent_lowat
> -1
>> echo 4294967295 > /proc/sys/net/ipv4/tcp_notsent_lowat
> -bash: echo: write error: Invalid argument
>> echo -2147483648 > /proc/sys/net/ipv4/tcp_notsent_lowat
>> cat /proc/sys/net/ipv4/tcp_notsent_lowat
> -2147483648
> 
> but in documentation we have "tcp_notsent_lowat - UNSIGNED INTEGER"
> 
> v2: simplify to just proc_douintvec
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-09 21:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-29 14:35 [PATCH] ipv4: make tcp_notsent_lowat sysctl knob behave as true unsigned int Pavel Tikhomirov
2016-12-30 20:23 ` David Miller
2017-01-09  7:45   ` [PATCH v2] " Pavel Tikhomirov
2017-01-09 21:38     ` David Miller

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).