[lkml]   [1999]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Routing Table (Feature)
On Wed, 17 Feb 1999, Paul Jakma wrote:

> On Tue, 16 Feb 1999, Richard B. Johnson wrote:
> The `ifconfig` command only deletes one. The command has to be executed
> twice to delete the second one. The problem is that when my ppp link
> is shut down, I do not add two identical routes back (nor should I).
> The result is that the second time the ppp link is established, I will
> get an error if I try to delete two routes. So, a work-around of
> always deleting two identical routes doesn't work very well.

Well I meant `route del...`

> and if we change route to delete all the routes, then you'll nuke
> your ppp route.
> maybe we should build some heuristics into the route command to
> try and figure out when we should delete all duplicate routes,
> and when not to.

I think it's just a BUG plain and simple........
if((s = socket(AF_INET, SOCK_RAW, proto->p_proto)) != -1)
memset(&rt, 0x00, sizeof(rt));
rt.rt_metric = METRIC;
rt.rt_mss = MTU;
rt.rt_irtt = 255;
rt.rt_flags = RTF_GATEWAY | RTF_UP | RTF_MSS;
rt.rt_dst.sa_family = AF_INET;
rt.rt_gateway.sa_family = AF_INET;
rt.rt_genmask.sa_family = AF_INET;
memset(&rt.rt_genmask.sa_data[2], 0xff, 0x03);
makeaddr(ADDR(rt.rt_dst), network);
makeaddr(ADDR(rt.rt_gateway), gateway);
(void)ioctl(s, SIOCDELRT, &rt); <---- Temp fix
(void)ioctl(s, SIOCDELRT, &rt); <---- Temp fix
(void)ioctl(s, SIOCADDRT, &rt); <---- Temp fix


while route -n | egrep ${MASK} >/dev/null ;
route del -net ${NET} netmask ${MASK} dev ${DEV}
route add -net ${NET} netmask ${MASK} dev ${DEV}
These are BUG work-arounds.

> or perhaps an "-amount_of_devices" parameter to route would be
> more practical.
> or maybe we should try put some AI stuff into the kernel to
> always get the route that the user wants added in. surely an
> improvement on the current kernel auto route add stuff.

Heuistics always produce more problems than they solve.
The fix is:
ioctl(s, SIOCDELRT, &rt);

...must delete the route, not (a, some, or first) routing table
entry. Once the function-call works correctly, everything will
be fine.

Dick Johnson
Penguin : Linux version 2.2.1 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
Wisdom : It's not a Y2K problem. It's a Y2Day problem.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:50    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean