routing broken in 1.3.99 and newer

Andreas Koppenhoefer (koppenas@koppenas.dialup.informatik.uni-stuttgart.de)
14 May 1996 21:59:49 +0200


Hello Networker,

since 1.3.99 I've had a hard time using diald and ppp. Each time
dialing in to one of my ISPs linux drops all important network route.
I've track down the problem to changes in net/ipv4/route.c and
net/ipv4/ip_output.c. Every time user program or kernel task creating
or deleting a network interface all routes matching destination
addresses gets dropped to the floor. In case of ppp these include every
default route regardless of its gateway address or metric. This may
caused by new code which does some event handling for adding/deleting
net devices. Unfortunately routing code doesn't look at the flags
passed to ip_rt_flush() or ip_rt_update(). These routing flags do not
include RTF_UP (route.c/route.h) and therefore must not alter kernel
routing! Event handling seems to lack some code... This is very bad.

Here is a quick and dirty workaround for this...

If you see your routing table getting mangled after dynamic interface
changes (diald, pppd, slip, ...) then you may want to try this. It
should work for all kernel versions from 1.3.99 to 1.99.3 (pre2.0.3).

--- linux-1.99.3/net/ipv4/ip_output.c Wed May 8 13:19:26 1996
+++ 1.99.3/net/ipv4/ip_output.c Tue May 14 17:26:49 1996
@@ -1074,8 +1074,10 @@
struct device *dev=ptr;
if(event==NETDEV_DOWN)
{
+#ifdef THIS_WILL_BREAK_ROUTING
ip_netlink_msg(RTMSG_DELDEVICE, 0,0,0,0,0,dev->name);
ip_rt_flush(dev);
+#endif /*THIS_WILL_BREAK_ROUTING*/
}
/*
* Join the initial group if multicast.
@@ -1085,8 +1087,10 @@
#ifdef CONFIG_IP_MULTICAST
ip_mc_allhost(dev);
#endif
+#ifdef THIS_WILL_BREAK_ROUTING
ip_netlink_msg(RTMSG_NEWDEVICE, 0,0,0,0,0,dev->name);
ip_rt_update(NETDEV_UP, dev);
+#endif /*THIS_WILL_BREAK_ROUTING*/
}
return NOTIFY_DONE;
}

Be warned: this patch may break something else ... but it's working
for me. I'm pretty sure this is not "The Right Thing(tm)" to fix that!

- Andreas

PS: Sorry, my English is not very good - hope you got the message
nevertheless...

This posting is by exception not pgp signed, because pgp would break
patch integrity.

-- 
Andreas Koppenhoefer, Student der Universitaet Stuttgart, BR Deutschland 
<koppenas@informatik.uni-stuttgart.de>, <akoppenhoefer@schweinfurt.netsurf.de>
Franz-Schubert-Str. 2, 97616 Bad Neustadt, Germany, +49 9771 7943 (9-21h MEZ)