-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello! I implemented a patch to control the behaviour of the kernel when setting routes automatically when adding a new network address. You can select the types of routes you want to be set automatically. This enables the user - as an example - to set all routes in the local table automatically, but leave the main table untouched. (This is the special case I needed.) If you want you can disable it completly by writing 0 to /proc/sys/net/ipv4/ip_autoroute. I would like to see this in the kernel, but nobody on the netdev mailing list seems to care. Any comments or ideas about this? Stephen? Regards Sven - -- Sven Anders <anders@xxxxxxxxxx> () Ascii Ribbon Campaign /\ Support plain text e-mail ANDURAS service solutions AG Innstraße 71 - 94036 Passau - Germany Web: www.anduras.de - Tel: +49 (0)851-4 90 50-0 - Fax: +49 (0)851-4 90 50-55 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEB00Z5lKZ7Feg4EcRAobZAJ9mOQlJYDB1uky3+rmtW+CDzbIh8QCghzb0 ZoudrAS+zKag4mMxaaWlwjU= =xHTP -----END PGP SIGNATURE-----
--- linux-2.6.15.1/include/linux/sysctl.h Sun Jan 15 07:16:02 2006 +++ linux-2.6.15.1/include/linux/sysctl.h.patched Tue Jan 31 21:43:58 2006 @@ -390,6 +390,7 @@ NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, NET_TCP_CONG_CONTROL=110, NET_TCP_ABC=111, + NET_IPV4_AUTO_ROUTE_CREATE=112, }; enum { --- linux-2.6.15.1/net/ipv4/sysctl_net_ipv4.c Sun Jan 15 07:16:02 2006 +++ linux-2.6.15.1/net/ipv4/sysctl_net_ipv4.c.patched Tue Jan 31 21:53:14 2006 @@ -18,12 +18,15 @@ #include <net/route.h> #include <net/tcp.h> /* From af_inet.c */ extern int sysctl_ip_nonlocal_bind; +/* From fib_frontend.c */ +extern int sysctl_auto_route_create; + #ifdef CONFIG_SYSCTL static int tcp_retr1_max = 255; static int ip_local_port_range_min[] = { 1, 1 }; static int ip_local_port_range_max[] = { 65535, 65535 }; #endif @@ -646,12 +649,20 @@ .strategy = &sysctl_tcp_congestion_control, }, { .ctl_name = NET_TCP_ABC, .procname = "tcp_abc", .data = &sysctl_tcp_abc, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { + .ctl_name = NET_IPV4_AUTO_ROUTE_CREATE, + .procname = "ip_autoroute", + .data = &sysctl_auto_route_create, .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_dointvec, }, { .ctl_name = 0 } --- linux-2.6.15.1/net/ipv4/fib_frontend.c Tue Jan 31 21:46:19 2006 +++ linux-2.6.15.1/net/ipv4/fib_frontend.c.patched Wed Feb 1 23:13:51 2006 @@ -47,6 +47,13 @@ #define FFprint(a...) printk(KERN_DEBUG a) +/* automatically create routes? */ +#define SYSCTL_AUTO_ROUTE_LOCAL 1 +#define SYSCTL_AUTO_ROUTE_BROADCAST 2 +#define SYSCTL_AUTO_ROUTE_UNICAST 4 +#define SYSCTL_AUTO_ROUTE_ALL 7 +int sysctl_auto_route_create = SYSCTL_AUTO_ROUTE_ALL; + #ifndef CONFIG_IP_MULTIPLE_TABLES #define RT_TABLE_MIN RT_TABLE_MAIN @@ -373,6 +380,14 @@ struct rtmsg rtm; } req; struct kern_rta rta; + + if (((type == RTN_LOCAL) && + !(sysctl_auto_route_create & SYSCTL_AUTO_ROUTE_LOCAL)) || + ((type == RTN_BROADCAST) && + !(sysctl_auto_route_create & SYSCTL_AUTO_ROUTE_BROADCAST)) || + ((type == RTN_UNICAST) && + !(sysctl_auto_route_create & SYSCTL_AUTO_ROUTE_UNICAST))) + return; memset(&req.rtm, 0, sizeof(req.rtm)); memset(&rta, 0, sizeof(rta)); --- linux-2.6.15.1/Documentation/networking/ip-sysctl.txt.orig Fri Feb 3 22:03:37 2006 +++ linux-2.6.15.1/Documentation/networking/ip-sysctl.txt Fri Feb 3 22:06:25 2006 @@ -27,6 +27,16 @@ The advertised MSS depends on the first hop route MTU, but will never be lower than this setting. +ip_autoroute - INTEGER + Control the behaviour of setting automatic routes (when adding an + ip address). Implemented as a bitmask. + + 1 = Add local routes (in local table) + 2 = Add broadcast routes (in local table) + 4 = Add unicast route (in main table) + + default 7 - Set all routes + IP Fragmentation: ipfrag_high_thresh - INTEGER
Attachment:
signature.asc
Description: PGP signature
begin:vcard fn:Sven Anders n:Anders;Sven org:ANDURAS AG;Research and Development adr;quoted-printable:;;Innstra=C3=9Fe 71;Passau;Bavaria;94036;Germany email;internet:anders@xxxxxxxxxx title:Dipl. Inf. tel;work:++49 (0)851 / 490 50 - 0 tel;fax:+49 (0)851 / 4 90 50 - 55 x-mozilla-html:FALSE url:http://www.anduras.de version:2.1 end:vcard
_______________________________________________ LARTC mailing list LARTC@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc