netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: drepper@redhat.com
Cc: netdev@vger.kernel.org
Subject: Re: network interface state
Date: Wed, 14 Nov 2007 15:31:03 -0800 (PST)	[thread overview]
Message-ID: <20071114.153103.230463871.davem@davemloft.net> (raw)
In-Reply-To: <473B61C8.3030302@redhat.com>

From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 14 Nov 2007 12:59:52 -0800

> Just FYI, with the current getaddrinfo code it is even more critical to
> get to a point where I can cache network interface information and query
> the kernel whether it changed.  We now have to read the RTM_GETADDR
> tables for every lookup.  It was more limited with the old, incomplete
> implementation.
> 
> Even if it's something as simple as a RTM_SEQUENCE request which returns
> a number that is bumped at every interface change.

This sounds like a useful feature.  Essentially you want a generation
ID that increments every time a configuration change is made?

Most daemons handle this by listening for events on the netlink
socket, but I understand how that might not be practical for
glibc.

> Related: I need to know about the device type (the ARPHRD_* values) to
> determine whether a device is for a native transport or a tunnel.  What
> I currently do is:
> 
> - - at the beginning I get information about all interfaces using
> RTM_GETADDR
> 
> - - them later I have to find the device type by
> 
>   + reading the RTM_GETLINK data to get to the device name
> 
>   + then using the name and ioctl(SIOCGIFHWADDR) I get the device type
> 
> 
> It would be so much nicer if the device type would be part of the
> RTM_GETADDR data, or at least the RTM_GETLINK data.

It's part of the link information, Look in ifinfomsg->ifi_type

In general be suspicious if it seems netlink isn't providing
the same information available via the old ioctls :-)

  reply	other threads:[~2007-11-14 23:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14 20:59 network interface state Ulrich Drepper
2007-11-14 23:31 ` David Miller [this message]
2007-11-15  0:12   ` Ulrich Drepper
2007-11-15  0:22     ` David Miller
2007-11-15  2:11       ` Herbert Xu
2007-11-15  3:39         ` David Miller
2007-11-15 13:58         ` jamal
2008-01-04 20:58   ` Milan Kocian

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=20071114.153103.230463871.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=drepper@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).