netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net-tcp: /proc/sys/net/ipv4/tcp_probe_interval is a u32 not int
@ 2018-09-26  0:41 Maciej Żenczykowski
  2018-09-26  2:53 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej Żenczykowski @ 2018-09-26  0:41 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller, Eric Dumazet; +Cc: netdev

From: Maciej Żenczykowski <maze@google.com>

(fix documentation and sysctl access to treat it as such)

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 Documentation/networking/ip-sysctl.txt | 2 +-
 net/ipv4/sysctl_net_ipv4.c             | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 8313a636dd53..960de8fe3f40 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -425,7 +425,7 @@ tcp_mtu_probing - INTEGER
 	  1 - Disabled by default, enabled when an ICMP black hole detected
 	  2 - Always enabled, use initial MSS of tcp_base_mss.
 
-tcp_probe_interval - INTEGER
+tcp_probe_interval - UNSIGNED INTEGER
 	Controls how often to start TCP Packetization-Layer Path MTU
 	Discovery reprobe. The default is reprobing every 10 minutes as
 	per RFC4821.
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index b92f422f2fa8..c8fa935c3cdb 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -745,9 +745,9 @@ static struct ctl_table ipv4_net_table[] = {
 	{
 		.procname	= "tcp_probe_interval",
 		.data		= &init_net.ipv4.sysctl_tcp_probe_interval,
-		.maxlen		= sizeof(int),
+		.maxlen		= sizeof(u32),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_douintvec,
 	},
 	{
 		.procname	= "igmp_link_local_mcast_reports",
-- 
2.19.0.605.g01d371f741-goog

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

* Re: [PATCH] net-tcp: /proc/sys/net/ipv4/tcp_probe_interval is a u32 not int
  2018-09-26  0:41 [PATCH] net-tcp: /proc/sys/net/ipv4/tcp_probe_interval is a u32 not int Maciej Żenczykowski
@ 2018-09-26  2:53 ` Eric Dumazet
  2018-09-26  4:59   ` Maciej Żenczykowski
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2018-09-26  2:53 UTC (permalink / raw)
  To: Maciej Żenczykowski, Maciej Żenczykowski,
	David S . Miller, Eric Dumazet
  Cc: netdev



On 09/25/2018 05:41 PM, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> (fix documentation and sysctl access to treat it as such)
> 
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---

While we are at it, we probably should add sane limits,
given tcp_mtu_check_reprobe() does :

u32 interval = net->ipv4.sysctl_tcp_probe_interval;
...
if (unlikely(delta >= interval * HZ)) {

A limit of UINT_MAX / HZ would avoid an overflow I guess.

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

* [PATCH] net-tcp: /proc/sys/net/ipv4/tcp_probe_interval is a u32 not int
  2018-09-26  2:53 ` Eric Dumazet
@ 2018-09-26  4:59   ` Maciej Żenczykowski
  2018-09-27  3:34     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej Żenczykowski @ 2018-09-26  4:59 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller, Eric Dumazet; +Cc: netdev

From: Maciej Żenczykowski <maze@google.com>

(fix documentation and sysctl access to treat it as such)

Tested:
  # zcat /proc/config.gz | egrep ^CONFIG_HZ
  CONFIG_HZ_1000=y
  CONFIG_HZ=1000
  # echo $[(1<<32)/1000 + 1] | tee /proc/sys/net/ipv4/tcp_probe_interval
  4294968
  tee: /proc/sys/net/ipv4/tcp_probe_interval: Invalid argument
  # echo $[(1<<32)/1000] | tee /proc/sys/net/ipv4/tcp_probe_interval
  4294967
  # echo 0 | tee /proc/sys/net/ipv4/tcp_probe_interval
  # echo -1 | tee /proc/sys/net/ipv4/tcp_probe_interval
  -1
  tee: /proc/sys/net/ipv4/tcp_probe_interval: Invalid argument

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 Documentation/networking/ip-sysctl.txt | 2 +-
 net/ipv4/sysctl_net_ipv4.c             | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 8313a636dd53..960de8fe3f40 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -425,7 +425,7 @@ tcp_mtu_probing - INTEGER
 	  1 - Disabled by default, enabled when an ICMP black hole detected
 	  2 - Always enabled, use initial MSS of tcp_base_mss.
 
-tcp_probe_interval - INTEGER
+tcp_probe_interval - UNSIGNED INTEGER
 	Controls how often to start TCP Packetization-Layer Path MTU
 	Discovery reprobe. The default is reprobing every 10 minutes as
 	per RFC4821.
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index b92f422f2fa8..891ed2f91467 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -48,6 +48,7 @@ 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 int comp_sack_nr_max = 255;
+static u32 u32_max_div_HZ = UINT_MAX / HZ;
 
 /* obsolete */
 static int sysctl_tcp_low_latency __read_mostly;
@@ -745,9 +746,10 @@ static struct ctl_table ipv4_net_table[] = {
 	{
 		.procname	= "tcp_probe_interval",
 		.data		= &init_net.ipv4.sysctl_tcp_probe_interval,
-		.maxlen		= sizeof(int),
+		.maxlen		= sizeof(u32),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_douintvec_minmax,
+		.extra2		= &u32_max_div_HZ,
 	},
 	{
 		.procname	= "igmp_link_local_mcast_reports",
-- 
2.19.0.605.g01d371f741-goog

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

* Re: [PATCH] net-tcp: /proc/sys/net/ipv4/tcp_probe_interval is a u32 not int
  2018-09-26  4:59   ` Maciej Żenczykowski
@ 2018-09-27  3:34     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-09-27  3:34 UTC (permalink / raw)
  To: zenczykowski; +Cc: maze, edumazet, netdev

From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Date: Tue, 25 Sep 2018 21:59:28 -0700

> From: Maciej Żenczykowski <maze@google.com>
> 
> (fix documentation and sysctl access to treat it as such)
> 
> Tested:
>   # zcat /proc/config.gz | egrep ^CONFIG_HZ
>   CONFIG_HZ_1000=y
>   CONFIG_HZ=1000
>   # echo $[(1<<32)/1000 + 1] | tee /proc/sys/net/ipv4/tcp_probe_interval
>   4294968
>   tee: /proc/sys/net/ipv4/tcp_probe_interval: Invalid argument
>   # echo $[(1<<32)/1000] | tee /proc/sys/net/ipv4/tcp_probe_interval
>   4294967
>   # echo 0 | tee /proc/sys/net/ipv4/tcp_probe_interval
>   # echo -1 | tee /proc/sys/net/ipv4/tcp_probe_interval
>   -1
>   tee: /proc/sys/net/ipv4/tcp_probe_interval: Invalid argument
> 
> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Applied.

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

end of thread, other threads:[~2018-09-27  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-26  0:41 [PATCH] net-tcp: /proc/sys/net/ipv4/tcp_probe_interval is a u32 not int Maciej Żenczykowski
2018-09-26  2:53 ` Eric Dumazet
2018-09-26  4:59   ` Maciej Żenczykowski
2018-09-27  3:34     ` 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).