* Re: Network link detection [not found] ` <4D700A5B.2000807@genband.com> @ 2011-03-03 22:01 ` David Miller 2011-03-03 22:29 ` Nico Schümann 2011-03-03 23:54 ` Chris Friesen 0 siblings, 2 replies; 4+ messages in thread From: David Miller @ 2011-03-03 22:01 UTC (permalink / raw) To: chris.friesen; +Cc: dev, linux-kernel, netdev From: Chris Friesen <chris.friesen@genband.com> 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 :-/ 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. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Network link detection 2011-03-03 22:01 ` Network link detection David Miller @ 2011-03-03 22:29 ` Nico Schümann 2011-03-07 19:49 ` Dan Williams 2011-03-03 23:54 ` Chris Friesen 1 sibling, 1 reply; 4+ messages in thread From: Nico Schümann @ 2011-03-03 22:29 UTC (permalink / raw) To: David Miller; +Cc: chris.friesen, linux-kernel, netdev On Thu, Mar 03, 2011 at 02:01:06PM -0800, David Miller wrote: > From: Chris Friesen <chris.friesen@genband.com> > 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 :-/ > Thank you for CC. > 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. That really looks like what I'm looking for. I was already wondering where NetworkManager gets the link state changes from, but I just expected it to poll. So now I'll read a bit of documentation and hopefully get it work. Thanks to everyone, Nico ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Network link detection 2011-03-03 22:29 ` Nico Schümann @ 2011-03-07 19:49 ` Dan Williams 0 siblings, 0 replies; 4+ messages in thread From: Dan Williams @ 2011-03-07 19:49 UTC (permalink / raw) To: Nico Schümann; +Cc: David Miller, chris.friesen, linux-kernel, netdev On Thu, 2011-03-03 at 23:29 +0100, Nico Schümann wrote: > On Thu, Mar 03, 2011 at 02:01:06PM -0800, David Miller wrote: > > From: Chris Friesen <chris.friesen@genband.com> > > 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 :-/ > > > > Thank you for CC. > > > 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. > > That really looks like what I'm looking for. I was already wondering > where NetworkManager gets the link state changes from, but I just > expected it to poll. So now I'll read a bit of documentation and > hopefully get it work. http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/src/nm-netlink-monitor.c NM uses libnl as the basic library for parsing netlink messages and handling communication with the kernel. Which is why you'll see a lot of nl_* calls in there. NM sets up the netlink connection using libnl, then creates a GIOChannel to handle communication over the netlink socket. When something comes in (to event_handler()) the code handles error conditions on the socket, then dispatches to libnl for processing. libnl then calls back into NM to handle the actual message in event_msg_ready(). Dan ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Network link detection 2011-03-03 22:01 ` Network link detection David Miller 2011-03-03 22:29 ` Nico Schümann @ 2011-03-03 23:54 ` Chris Friesen 1 sibling, 0 replies; 4+ messages in thread From: Chris Friesen @ 2011-03-03 23:54 UTC (permalink / raw) To: David Miller; +Cc: dev, linux-kernel, netdev On 03/03/2011 04:01 PM, David Miller wrote: > From: Chris Friesen <chris.friesen@genband.com> > 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 chris.friesen@genband.com www.genband.com ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-07 19:49 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20110303193006.GA29129@svh.nico22.de> [not found] ` <4D700A5B.2000807@genband.com> 2011-03-03 22:01 ` Network link detection David Miller 2011-03-03 22:29 ` Nico Schümann 2011-03-07 19:49 ` Dan Williams 2011-03-03 23:54 ` Chris Friesen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).