Messages in this thread |  | | Date | Tue, 12 Feb 2002 10:58:24 -0500 | | From | Chris Friesen <> | | Subject | Re: Interface operative status detection |
| |
"David L. Parsley" wrote:
> 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
-- 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: cfriesen@nortelnetworks.com - 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/
|  |