All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] [RFC] Controlling the auto-route setting behaviour of the
@ 2006-03-02 19:52 Sven Anders
  0 siblings, 0 replies; only message in thread
From: Sven Anders @ 2006-03-02 19:52 UTC (permalink / raw)
  To: lartc

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

-----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@anduras.de>                 () 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-----

[-- Attachment #2: ip_autoroute.patch --]
[-- Type: text/x-diff, Size: 2926 bytes --]

--- 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 #3: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Attachment #4: anders.vcf --]
[-- Type: text/x-vcard, Size: 339 bytes --]

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@anduras.de
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


[-- Attachment #5: Type: text/plain, Size: 143 bytes --]

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-02 19:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-02 19:52 [LARTC] [RFC] Controlling the auto-route setting behaviour of the Sven Anders

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.