[PATCH] Automatic kernel routes

Ryan O'Connell (nemesis@eh.org)
Sat, 02 Jan 1999 14:35:52 -0000 (GMT)


This message is in MIME format
--_=XFMail.1.3.p0.Linux:990102143552:130=_
Content-Type: text/plain; charset=us-ascii

-----BEGIN PGP SIGNED MESSAGE-----

There's been some discussion recently on netdev about automatic kernel route
generation not always being the right thing to do. Here's a short patch that
allows you to disable kernel route generation using /proc/sys. Apologies for
using MIME, xfmail eats the formatting otherwise. :-(

Ryan O'Connell - http://complicity.olf.co.uk:8080/
<nemesis@eh.org> -- <cs95rro@brunel.ac.uk>

If the automobile had followed the same development as the computer, a
Rolls-Royce would today cost $100, get a million miles per per gallon,
and explode once a year killing everyone inside.
-- Robert Cringely, InfoWorld

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQCVAwUBNo4ux3aLBcMKBcNNAQFFegP+I08/4r/zHQcFtsM9+dj4NK+eZV30S/wK
q7yCu9b9e2wjhYv+eFmXPtL5uTiv3SBe50w/ZC5RXaNeOQkHhmXxGH3cecb+SVVh
HjRRoEWEF9gn584BAj5hldGGIPPv7v+KN08aOj+H4ITcGKNWKWKPLyHEMZYkQV+u
6Q2zRhZlvA8=
=IR4o
-----END PGP SIGNATURE-----

--_=XFMail.1.3.p0.Linux:990102143552:130=_
Content-Disposition: attachment; filename="autoroute.patch"
Content-Transfer-Encoding: none
Content-Type: text/plain;
charset=us-ascii; name=autoroute.patch; SizeOnDisk=1867

diff -ruN linux/include/linux/sysctl.h linux.new/include/linux/sysctl.h
--- linux/include/linux/sysctl.h Fri Jan 1 23:00:10 1999
+++ linux.new/include/linux/sysctl.h Fri Jan 1 19:40:39 1999
@@ -207,7 +207,8 @@
NET_IPV4_ICMP_TIMEEXCEED_RATE=61,
NET_IPV4_ICMP_PARAMPROB_RATE=62,
NET_IPV4_ICMP_ECHOREPLY_RATE=63,
- NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64
+ NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64,
+ NET_IPV4_AUTO_ROUTE_CREATE=65
};

enum {
diff -ruN linux/net/ipv4/fib_frontend.c linux.new/net/ipv4/fib_frontend.c
--- linux/net/ipv4/fib_frontend.c Fri Jan 1 23:00:10 1999
+++ linux.new/net/ipv4/fib_frontend.c Fri Jan 1 19:40:40 1999
@@ -47,6 +47,8 @@

#define FFprint(a...) printk(KERN_DEBUG a)

+int sysctl_auto_route_create = 1;
+
#ifndef CONFIG_IP_MULTIPLE_TABLES

#define RT_TABLE_MIN RT_TABLE_MAIN
@@ -425,6 +427,8 @@
u32 mask = ifa->ifa_mask;
u32 addr = ifa->ifa_local;
u32 prefix = ifa->ifa_address&mask;
+
+ if (!sysctl_auto_route_create) return;

if (ifa->ifa_flags&IFA_F_SECONDARY) {
prim = inet_ifa_byprefix(in_dev, prefix, mask);
diff -ruN linux/net/ipv4/sysctl_net_ipv4.c linux.new/net/ipv4/sysctl_net_ipv4.c
--- linux/net/ipv4/sysctl_net_ipv4.c Fri Jan 1 22:59:31 1999
+++ linux.new/net/ipv4/sysctl_net_ipv4.c Fri Jan 1 19:39:12 1999
@@ -67,6 +67,9 @@
extern int sysctl_icmp_paramprob_time;
extern int sysctl_icmp_echoreply_time;

+/* From fib_frontend.c */
+extern int sysctl_auto_route_create;
+
int tcp_retr1_max = 255;

struct ipv4_config ipv4_config;
@@ -177,6 +180,9 @@
{NET_IPV4_ICMP_ECHOREPLY_RATE, "icmp_echoreply_rate",
&sysctl_icmp_echoreply_time, sizeof(int), 0644, NULL, &proc_dointvec},
{NET_IPV4_ROUTE, "route", NULL, 0, 0555, ipv4_route_table},
+ {NET_IPV4_AUTO_ROUTE_CREATE, "ip_autoroute",
+ &sysctl_auto_route_create, sizeof(int), 0644, NULL,
+ &proc_dointvec},
{0}
};

--_=XFMail.1.3.p0.Linux:990102143552:130=_--
End of MIME message

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/