Skip to content

Commit

Permalink
icmp: fix units for ratelimit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jul 2, 2008
1 parent 28f49d8 commit 6dbf4bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Documentation/networking/ip-sysctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,9 @@ icmp_echo_ignore_broadcasts - BOOLEAN
icmp_ratelimit - INTEGER
Limit the maximal rates for sending ICMP packets whose type matches
icmp_ratemask (see below) to specific targets.
0 to disable any limiting, otherwise the maximal rate in jiffies(1)
Default: 100
0 to disable any limiting,
otherwise the minimal space between responses in milliseconds.
Default: 1000

icmp_ratemask - INTEGER
Mask made of ICMP types for which rates are being limited.
Expand Down Expand Up @@ -1027,8 +1028,9 @@ max_addresses - INTEGER
icmp/*:
ratelimit - INTEGER
Limit the maximal rates for sending ICMPv6 packets.
0 to disable any limiting, otherwise the maximal rate in jiffies(1)
Default: 100
0 to disable any limiting,
otherwise the minimal space between responses in milliseconds.
Default: 1000


IPv6 Update by:
Expand Down
3 changes: 2 additions & 1 deletion net/ipv4/sysctl_net_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,8 @@ static struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_ratelimit,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
.proc_handler = &proc_dointvec_ms_jiffies,
.strategy = &sysctl_ms_jiffies
},
{
.ctl_name = NET_IPV4_ICMP_RATEMASK,
Expand Down
3 changes: 2 additions & 1 deletion net/ipv6/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,8 @@ ctl_table ipv6_icmp_table_template[] = {
.data = &init_net.ipv6.sysctl.icmpv6_time,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
.proc_handler = &proc_dointvec_ms_jiffies,
.strategy = &sysctl_ms_jiffies
},
{ .ctl_name = 0 },
};
Expand Down

0 comments on commit 6dbf4bc

Please sign in to comment.