From: Dan Williams <dcbw@redhat.com>
To: "Nico Schümann" <dev@nico22.de>
Cc: David Miller <davem@davemloft.net>,
chris.friesen@genband.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: Network link detection
Date: Mon, 07 Mar 2011 13:49:08 -0600 [thread overview]
Message-ID: <1299527350.3269.11.camel@dcbw.foobar.com> (raw)
In-Reply-To: <20110303222957.GA30472@svh.nico22.de>
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
next prev parent reply other threads:[~2011-03-07 19:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 19:30 Network link detection Nico Schümann
2011-03-03 20:03 ` Jesper Juhl
2011-03-03 20:45 ` richard -rw- weinberger
2011-03-03 21:38 ` Chris Friesen
2011-03-03 22:01 ` David Miller
2011-03-03 22:29 ` Nico Schümann
2011-03-07 19:49 ` Dan Williams [this message]
2011-03-03 23:54 ` Chris Friesen
2011-03-03 22:07 ` Stephen Hemminger
2011-03-04 6:35 ` Nico Schümann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299527350.3269.11.camel@dcbw.foobar.com \
--to=dcbw@redhat.com \
--cc=chris.friesen@genband.com \
--cc=davem@davemloft.net \
--cc=dev@nico22.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox