Re: Removing the route when Ethernet link goes down

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Mon Nov 04 2002 - 11:18:01 EST


On Mon, 4 Nov 2002, Helio Fujimoto wrote:

> Please answer this e-mail with copy to me, for I am not subscribed to the
> list.
>
> I am debugging an Ethernet driver in the kernel 2.4.17, which is able to
> recognize when the Ethernet link is up or down. When the link is up, I am
> setting the bit IFF_RUNNING to the dev->flag parameter, and when it is down
> this bit is reset. Besides this, I am calling the routines netif_carrier_on
> and netif_carrier_off, respectively. This makes the interface status change
> (when I call ifconfig eth0).
>
> However, the routing table doesn't change when link goes up or down, though
> they do change when I set the interface up and down. I couldn't find out what
> I could do to make the Ethernet driver work in this way, so that the routes
> to the Ethernet link would appear only if the interface was up and running.
> Do you have an easy (or maybe difficult) way to do this? Any routine, any
> magic?
>
> Thanks in advance,
>
> Helio Fujimoto.
>
User-mode code will reset the RTF_UP bit in the rt_flags member
of struct rtentry. This is the SIOCDELRT ioctl call. I have found
that, at least for 2.4.18 and previous, you need to delete any
previous route with the same parameters before setting any new one.
It seems that a default route ends up being set by merely setting
parameters for the interface.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
   Bush : The Fourth Reich of America

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



This archive was generated by hypermail 2b29 : Thu Nov 07 2002 - 22:00:33 EST