Skip to contentSkip to conversation

Interface operative status detection

DISCUSSION Andi Kleen 4 participants 5 messages Jan 19, 2002 – Feb 12, 2002 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw
Quoted 4 lines · Stefan Rompf

while playing with the Zebra routing daemon, I realized that neither Linux nor Zebra are capable of detecting the operative state of an interface, f.e. the ethernet link beat. This is a major show stopper against using Linux for "serious" IP routing.

It's only when you assume that the link beat is a "serious" sign for link healthiness. Unfortunately there are many error cases where a link can fail, but the link beat is still there - for example the software on the other machine crashing but the NIC still working fine. These seem to be the majority of the cases in fact except for demo situations where people pull cables on purpose. To handle all the other cases you need a separate heartbeat protocol that actually checks if the higher layers above the networking card are alive on the peer too. Most routing protocols do this already in fact, e.g. OSPF or RIP with their 'hello' packets. The Linux IP stack does it also using ARP probes. When a probe is not answered the routing daemon eventually notices and takes action. While waiting for probes is a bit slower (30-60s usually), checking the link beat only handles such a small subset of cases that it is not worth it to optimize these rare ones.

Commercial vendors seem to like it because it looks good in demos ;), but linux fortunately doesn't have to be concerned with such marketing reasoning.

In short - Linux doesn't have this feature because it's not needed. If your routing protocol relies on link state checking without other probing it's broken. Zebra isn't.

-Andi

#2 lore raw
In reply to a message not in the archive
Quoted 6 lines · Andi Kleen

It's only when you assume that the link beat is a "serious" sign for link healthiness. Unfortunately there are many error cases where a link can fail, but the link beat is still there - for example the software on the other machine crashing but the NIC still working fine. These seem to be the majority of the cases in fact except for demo situations where people pull cables on purpose.

I disagree. There are two very real situations that come to my mind spontaneously:

-Many telecom providers loop back a synchronous serial line whenever the connection fails somewhere on the WAN. While this actually isn't a link beat, it can be detected as an interface failure instantly (!IFF_RUNNING) and is therefore much faster than any (even highly tuned) routing protocol.

-You have two redundant routers pointing into an ethernet segment, and if the NIC of one router starts failing, the switch might decide to turn off the port in question because of excessive errors (many switches do). Or the switch may simply lose power. Without link beat detection, the router in question cannot see these situations and will happily continue advertising the connected network, making the automated backup mechanism fail. ARP probing is no solution as it can only detect a host on the network going down, not the interface.

Of course, link beat detection is not the magic lantern making all networking problems vanish, but from my networking experience it is important enough to support it.

Stefan

#3 lore raw
In reply to a message not in the archive

Andi,

Quoted 3 lines

In short - Linux doesn't have this feature because it's not needed. If your routing protocol relies on link state checking without other probing it's broken. Zebra isn't.

Link state checking _would_ be nice, though, for stuff like laptops using dhcp. Right now, if I start my laptop without being plugged into the network, I have to wait for DHCP to time out before it'll finish booting - about 1 minute. (yech!)

Is there a good way for a dhcp daemon to find out whether the laptop is connected to the network or not? It'd be really sweet if dhcpcd could:

- down the interface and remove routes whenever the network cable was unplugged
- wait for the interface to get link beat again, and send a new request

This would greatly enhance desktop usability. I'd be happy to do the dhcpcd hacking if the right kernel interfaces were available.

regards,
David

Signature · 4 lines
David L. Parsley
Network Administrator, Roanoke College
"If I have seen further it is by standing on ye shoulders of Giants."
--Isaac Newton
#4 lore raw
In reply to a message not in the archive
Quoted 9 lines · David L. Parsley

Is there a good way for a dhcp daemon to find out whether the laptop is connected to the network or not? It'd be really sweet if dhcpcd could:

- down the interface and remove routes whenever the network cable was unplugged
- wait for the interface to get link beat again, and send a new request

This would greatly enhance desktop usability. I'd be happy to do the dhcpcd hacking if the right kernel interfaces were available.

If the network driver supports querying of the MII registers (usually done with the private ioctl stuff) then you can query the link beat from userspace.

Depending on the driver/chip this may be a very fast query, or it may take upwards of 100us with interrupts disabled.

I can post example code if you like...

Now what I would *really* like to see would be a way to get asynchronous
notification of userspace processes on link beat change. Of course, depending
on NIC this would require an interrupt handler or a kernel thread periodically checking the link state, as well as some way to pass that information to the user (netlink socket, interrupt...not sure what the best would be).

Chris

Signature · 4 lines
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: [email protected]
#5 lore raw
In reply to a message not in the archive

Hi,

Quoted 5 lines

Now what I would *really* like to see would be a way to get asynchronous
notification of userspace processes on link beat change. Of course, depending
on NIC this would require an interrupt handler or a kernel thread periodically checking the link state, as well as some way to pass that information to the user (netlink socket, interrupt...not sure what the best would be).

I have already written code that sends a link state notification via netlink socket, but still have to create the patches for 2.5, maybe 2.4ac and later 2.4. Just give me some more days, if you're working as a software developer in your daily job, you are not always motivated to run straight to your private computer afterworks, at least I am not ;-)

Stefan