Controlling the auto-route setting behaviour of the
Subsystems (4)
RFC 1/1 Controlling the auto-route setting behaviour of the
-----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 <[email protected]> () 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-----
include/linux/sysctl.h.patched renamed from include/linux/sysctl.h +1 -0
@@ -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 {
net/ipv4/sysctl_net_ipv4.c.patched renamed from net/ipv4/sysctl_net_ipv4.c +11 -0
@@ -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 }
net/ipv4/fib_frontend.c.patched renamed from net/ipv4/fib_frontend.c +15 -0
@@ -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));
Documentation/networking/ip-sysctl.txt renamed from Documentation/networking/ip-sysctl.txt.orig +10 -0
@@ -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
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:[email protected]
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
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc