Subject: Re: Network link detection

From: Chris Friesen <[email-masked]>
Date: Thu, 03 Mar 2011 17:54:12 -0600

On 03/03/2011 04:01 PM, David Miller wrote:
> From: Chris Friesen <[email-masked]>
> Date: Thu, 03 Mar 2011 15:38:35 -0600
> 
>> You might look at whether you could write a kernel module to register
>> for NETDEV_CHANGE notifications and pass that back to userspace.
> 
> This is the kind of responses you get when you ask networking specific
> questions and don't CC: netdev :-/

My apologies for misleading the original poster.  I can only claim a
brain fart since I've actually used rtnetlink for other things.

> There is this thing called netlink, you can listen for arbitrary
> network state change events on a socket, and get the link state
> notifications you are looking for.  It's in use by many real
> applications like NetworkManager and co.

For future reference then, to listen for link state notifications you'd
use NETLINK_ROUTE with nl_groups set to RTMGRP_LINK, and the link state
will be signaled in the if_flags field of received messages?

Chris

-- 
Chris Friesen
Software Developer
GENBAND
[email-masked]
www.genband.com