IPv6: Sysctl for ICMPv6 Rate Limitation
Subsystems (2)
PATCH 1/1 IPv6: Sysctl for ICMPv6 Rate Limitation
Hi!
This patch add sysctl for icmp6 rate limit.
This patch is against 2.4.20-pre11 (see below).
Thanks in advance.
Note: This inlined patch conflicts with IPV6_V6ONLY patch.
So, I attach another patch depend on the IPV6_V6ONLY patch.
-------------------------------------------------------------------
Patch-Name: Sysctl for ICMPv6 Rate Limitation
Patch-Id: FIX_2_4_20_pre11_ICMP_SYSCTL-20021024
Patch-Author: YOSHIFUJI Hideaki / USAGI Project <[email protected]>
Credit: YOSHIFUJI Hideaki / USAGI Project <[email protected]>
-------------------------------------------------------------------
Index: Documentation/networking/ip-sysctl.txt
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/Documentation/networking/ip-sysctl.txt,v retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.44.1
networking/ip-sysctl.txt +8 -2
@@ -560,8 +560,14 @@ routers are present. Default: 3 +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 + IPv6 Update by: -Pekka Savola [email protected] +Pekka Savola <[email protected]> +YOSHIFUJI Hideaki / USAGI Project <[email protected]> $Id: ip-sysctl.txt,v 1.19.2.1 2001/12/13 08:59:27 davem Exp $
Index: include/linux/sysctl.h
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/include/linux/sysctl.h,v retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.18.1
linux/sysctl.h +7 -1
@@ -345,7 +345,8 @@enum {NET_IPV6_CONF =16 ,NET_IPV6_NEIGH =17 , -NET_IPV6_ROUTE =18 +NET_IPV6_ROUTE =18 , +NET_IPV6_ICMP =19 };enum {
@@ -371,6 +372,11 @@NET_IPV6_RTR_SOLICITS =8 ,NET_IPV6_RTR_SOLICIT_INTERVAL =9 , NET_IPV6_RTR_SOLICIT_DELAY=10 +}; + +/* /proc/sys/net/ipv6/icmp */ +enum { +NET_IPV6_ICMP_RATELIMIT =1 };/* /proc/sys/net/<protocol>/neigh/<dev> */
Index: net/ipv6/icmp.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/net/ipv6/icmp.c,v retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.14.1
ipv6/icmp.c +14 -0
@@ -25,6 +25,7 @@* add more length checks and other fixes. * yoshfuji : ensure to sent parameter problem for * fragments. +* YOSHIFUJI Hideaki @USAGI: added sysctl for icmp rate limit. */ #define __NO_VERSION__
@@ -40,6 +41,10 @@#include <linux/skbuff.h> #include <linux/init.h> +#ifdef CONFIG_SYSCTL +#include <linux/sysctl.h> +#endif +#include <linux/inet.h> #include <linux/netdevice.h> #include <linux/icmpv6.h>
@@ -715,3 +720,12 @@return fatal; } + +#ifdef CONFIG_SYSCTL +ctl_table ipv6_icmp_table[] = { + {NET_IPV6_ICMP_RATELIMIT ,"ratelimit" , + &sysctl_icmpv6_time,sizeof (int ),0644 ,NULL , &proc_dointvec}, + {0 }, +}; +#endif +
Index: net/ipv6/sysctl_net_ipv6.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/net/ipv6/sysctl_net_ipv6.c,v retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.42.1
ipv6/sysctl_net_ipv6.c +5 -0
@@ -1,5 +1,8 @@/* * sysctl_net_ipv6.c: sysctl interface to net IPV6 subsystem. +* +* Changes: +* YOSHIFUJI Hideaki @USAGI: added icmp sysctl table. */ #include <linux/mm.h>
@@ -12,11 +15,13 @@#include <net/addrconf.h> extern ctl_table ipv6_route_table[]; +extern ctl_table ipv6_icmp_table[];#ifdef CONFIG_SYSCTL ctl_table ipv6_table[] = { {NET_IPV6_ROUTE ,"route" ,NULL ,0 ,0555 , ipv6_route_table}, + {NET_IPV6_ICMP ,"icmp" ,NULL ,0 ,0500 , ipv6_icmp_table}, {0 } };
Index: Documentation/networking/ip-sysctl.txt
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/Documentation/networking/ip-sysctl.txt,v retrieving revision 1.1.1.1.42.1
retrieving revision 1.1.1.1.42.1.2.1
networking/ip-sysctl.txt +8 -2
@@ -569,8 +569,14 @@ routers are present. Default: 3 +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 + IPv6 Update by: -Pekka Savola [email protected] +Pekka Savola <[email protected]> +YOSHIFUJI Hideaki / USAGI Project <[email protected]> $Id: ip-sysctl.txt,v 1.19.2.1 2001/12/13 08:59:27 davem Exp $
Index: include/linux/sysctl.h
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/include/linux/sysctl.h,v retrieving revision 1.1.1.2.16.1
retrieving revision 1.1.1.2.16.1.2.2
linux/sysctl.h +7 -1
@@ -346,7 +346,8 @@NET_IPV6_CONF =16 ,NET_IPV6_NEIGH =17 ,NET_IPV6_ROUTE =18 , - NET_IPV6_BINDV6ONLY=20, +NET_IPV6_ICMP =19 , +NET_IPV6_BINDV6ONLY =20 }; enum {
@@ -372,6 +373,11 @@NET_IPV6_RTR_SOLICITS =8 ,NET_IPV6_RTR_SOLICIT_INTERVAL =9 , NET_IPV6_RTR_SOLICIT_DELAY=10 +}; + +/* /proc/sys/net/ipv6/icmp */ +enum { +NET_IPV6_ICMP_RATELIMIT =1 };/* /proc/sys/net/<protocol>/neigh/<dev> */
Index: net/ipv6/icmp.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/net/ipv6/icmp.c,v retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.16.1
ipv6/icmp.c +14 -0
@@ -25,6 +25,7 @@* add more length checks and other fixes. * yoshfuji : ensure to sent parameter problem for * fragments. +* YOSHIFUJI Hideaki @USAGI: added sysctl for icmp rate limit. */ #define __NO_VERSION__
@@ -40,6 +41,10 @@#include <linux/skbuff.h> #include <linux/init.h> +#ifdef CONFIG_SYSCTL +#include <linux/sysctl.h> +#endif +#include <linux/inet.h> #include <linux/netdevice.h> #include <linux/icmpv6.h>
@@ -715,3 +720,12 @@return fatal; } + +#ifdef CONFIG_SYSCTL +ctl_table ipv6_icmp_table[] = { + {NET_IPV6_ICMP_RATELIMIT ,"ratelimit" , + &sysctl_icmpv6_time,sizeof (int ),0644 ,NULL , &proc_dointvec}, + {0 }, +}; +#endif +
Index: net/ipv6/sysctl_net_ipv6.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/net/ipv6/sysctl_net_ipv6.c,v retrieving revision 1.1.1.1.40.1
retrieving revision 1.1.1.1.40.1.2.1
ipv6/sysctl_net_ipv6.c +5 -0
@@ -1,5 +1,8 @@/* * sysctl_net_ipv6.c: sysctl interface to net IPV6 subsystem. +* +* Changes: +* YOSHIFUJI Hideaki @USAGI: added icmp sysctl table. */ #include <linux/mm.h>
@@ -12,11 +15,13 @@#include <net/addrconf.h> extern ctl_table ipv6_route_table[]; +extern ctl_table ipv6_icmp_table[];#ifdef CONFIG_SYSCTL ctl_table ipv6_table[] = { {NET_IPV6_ROUTE ,"route" ,NULL ,0 ,0555 , ipv6_route_table}, + {NET_IPV6_ICMP ,"icmp" ,NULL ,0 ,0500 , ipv6_icmp_table}, {NET_IPV6_BINDV6ONLY ,"bindv6only" , &sysctl_ipv6_bindv6only,sizeof (int ),0644 ,NULL , &proc_dointvec}, {0}
Quoted 2 lines · On Thu, 24 Oct 2002, YOSHIFUJI Hideaki / [iso-2022-jp] $B5HF#1QL@(B wrote:
This patch add sysctl for icmp6 rate limit.
This patch is against 2.4.20-pre11 (see below).
...
networking/ip-sysctl.txt line 568
Quoted 6 lines
networking/ip-sysctl.txt +6
-0+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 +
Does this rate-limit all ICMPv6 packets or just ICMPv6 error messages (as specified in ICMPv6 specifications).
If all, I believe the default of rate-limiting everything is unacceptable.
Note that in the patch does not seem to add the rate-limit sysctl to any functions -- was that to happen in some other patch?
Signature · 3 lines
Pekka Savola "Tell me of difficulties surmounted, Netcore Oy not those you stumble over and fall" Systems. Networks. Security. -- Robert Jordan: A Crown of Swords
In article <[email protected]> (at Thu, 24 Oct 2002 08:50:25 +0300 (EEST)), Pekka Savola <[email protected]> says:
Quoted 11 lines
networking/ip-sysctl.txt line 568
Quoted 6 lines
networking/ip-sysctl.txt +6
-0+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 +Does this rate-limit all ICMPv6 packets or just ICMPv6 error messages (as specified in ICMPv6 specifications).
If all, I believe the default of rate-limiting everything is unacceptable.
This patch just adds sysctl. It is my documentation error... is s/ICMPv6 packets/ICMPv6 error packets/ ok?
(I need to do s/100/HZ/, too; This also lives in ICMP(v4)).
--yoshfuji
Quoted 12 lines · On Thu, 24 Oct 2002, YOSHIFUJI Hideaki / [iso-2022-jp] $B5HF#1QL@(B wrote:
In article <[email protected]> (at Thu, 24 Oct 2002 08:50:25 +0300 (EEST)), Pekka Savola <[email protected]> says:
Quoted 10 lines
networking/ip-sysctl.txt line 568
Quoted 6 lines
networking/ip-sysctl.txt +6
-0+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 +Does this rate-limit all ICMPv6 packets or just ICMPv6 error messages (as specified in ICMPv6 specifications).
Quoted 6 lines
Quoted 1 line
If all, I believe the default of rate-limiting everything is unacceptable.
This patch just adds sysctl. It is my documentation error... is s/ICMPv6 packets/ICMPv6 error packets/ ok?
(I need to do s/100/HZ/, too; This also lives in ICMP(v4)).
That change fine with me, thanks.
Signature · 3 lines
Pekka Savola "Tell me of difficulties surmounted, Netcore Oy not those you stumble over and fall" Systems. Networks. Security. -- Robert Jordan: A Crown of Swords
In article <[email protected]> (at Thu, 24 Oct 2002 08:59:16 +0300 (EEST)), Pekka Savola <[email protected]> says:
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines
Does this rate-limit all ICMPv6 packets or just ICMPv6 error messages (as specified in ICMPv6 specifications).
If all, I believe the default of rate-limiting everything is unacceptable.
This patch just adds sysctl. It is my documentation error... is s/ICMPv6 packets/ICMPv6 error packets/ ok?
(I need to do s/100/HZ/, too; This also lives in ICMP(v4)).
That change fine with me, thanks.
Please apply the following patch on top of the previous "Sysctl for ICMPv6 Rate Limitation" patch. Thanks.
Index: Documentation/networking/ip-sysctl.txt
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux24/Documentation/networking/ip-sysctl.txt,v retrieving revision 1.1.1.1.44.1
retrieving revision 1.1.1.1.44.1.2.2
networking/ip-sysctl.txt +3 -3
@@ -316,7 +316,7 @@ 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 + Default: HZ icmp_ratemask - INTEGER Mask made of ICMP types for which rates are being limited.
@@ -562,9 +562,9 @@ icmp/*: ratelimit - INTEGER - Limit the maximal rates for sending ICMPv6 packets. + Limit the maximal rates for sending ICMPv6 error packets. 0 to disable any limiting, otherwise the maximal rate in jiffies(1) - Default: 100 + Default: HZ IPv6 Update by: Pekka Savola <[email protected]>
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
David S. Miller
AppliedQuoted 2 lines · YOSHIFUJI Hideaki / 吉藤英明
This patch add sysctl for icmp6 rate limit.
This patch is against 2.4.20-pre11 (see below).
I've applied this patch to my 2.4.x and 2.5.x trees, thank you.