[clue] [tech] How to get explicit notification from a network device driver?

David L. Anselmi anselmi at anselmi.us
Mon Apr 23 19:04:48 MDT 2012


Jim Ockers wrote:
> Hi everyone,
>
> The state of the art in determining ethernet link state, and taking any action based on changes,
> seems to be to run a daemon that repeatedly polls the network interface and using an ioctl
> (SIOCGMIIPHY, SIOCETHTOOL) finds out if there is an ethernet link or not.

Three ideas:

http://forum.kernelnewbies.org/read.php?15,1724 shows how to write kernel code to register for this 
kind of event.  Doesn't seem like that should go in the NIC driver but in something else that has an 
interface to user space.

Perhaps that interface is netlink(7), and maybe netplugd(8) demonstrates its use.  See 
http://linux.die.net/man/8/netplugd

Finally, if the notices need to be handled in user space, it seems like udev ought to be the thing 
that does it.  Obviously it knows about the NICs but I don't know whether it gets up/down notices.

HTH,
Dave



More information about the clue mailing list