Commit 6dbf4bcac98bbc76ef425b3a2b4169f31199f6c7

Authored by Stephen Hemminger
Committed by David S. Miller
1 parent 28f49d8fec

icmp: fix units for ratelimit

Convert the sysctl values for icmp ratelimit to use milliseconds instead
of jiffies which is based on kernel configured HZ.
Internal kernel jiffies are not a proper unit for any userspace API.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 10 additions and 6 deletions Side-by-side Diff

Documentation/networking/ip-sysctl.txt
... ... @@ -548,8 +548,9 @@
548 548 icmp_ratelimit - INTEGER
549 549 Limit the maximal rates for sending ICMP packets whose type matches
550 550 icmp_ratemask (see below) to specific targets.
551   - 0 to disable any limiting, otherwise the maximal rate in jiffies(1)
552   - Default: 100
  551 + 0 to disable any limiting,
  552 + otherwise the minimal space between responses in milliseconds.
  553 + Default: 1000
553 554  
554 555 icmp_ratemask - INTEGER
555 556 Mask made of ICMP types for which rates are being limited.
... ... @@ -1027,8 +1028,9 @@
1027 1028 icmp/*:
1028 1029 ratelimit - INTEGER
1029 1030 Limit the maximal rates for sending ICMPv6 packets.
1030   - 0 to disable any limiting, otherwise the maximal rate in jiffies(1)
1031   - Default: 100
  1031 + 0 to disable any limiting,
  1032 + otherwise the minimal space between responses in milliseconds.
  1033 + Default: 1000
1032 1034  
1033 1035  
1034 1036 IPv6 Update by:
net/ipv4/sysctl_net_ipv4.c
... ... @@ -793,7 +793,8 @@
793 793 .data = &init_net.ipv4.sysctl_icmp_ratelimit,
794 794 .maxlen = sizeof(int),
795 795 .mode = 0644,
796   - .proc_handler = &proc_dointvec
  796 + .proc_handler = &proc_dointvec_ms_jiffies,
  797 + .strategy = &sysctl_ms_jiffies
797 798 },
798 799 {
799 800 .ctl_name = NET_IPV4_ICMP_RATEMASK,
... ... @@ -954,7 +954,8 @@
954 954 .data = &init_net.ipv6.sysctl.icmpv6_time,
955 955 .maxlen = sizeof(int),
956 956 .mode = 0644,
957   - .proc_handler = &proc_dointvec
  957 + .proc_handler = &proc_dointvec_ms_jiffies,
  958 + .strategy = &sysctl_ms_jiffies
958 959 },
959 960 { .ctl_name = 0 },
960 961 };