netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Getting a network interface list from within the kernel
@ 2007-04-12 20:51 David Howells
  2007-04-12 20:59 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2007-04-12 20:51 UTC (permalink / raw)
  To: netdev


I need to get a list of the IPv4 addresses bound to network interfaces from
within the kernel to be able to present it to an AFS server when it asks.
This is handled by the AFS client filesystem.

I also need to be able to get the netmasks and MTUs for those interfaces.

What's the best way of doing this, assuming it's possible at all?

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Getting a network interface list from within the kernel
  2007-04-12 20:51 Getting a network interface list from within the kernel David Howells
@ 2007-04-12 20:59 ` David Miller
  2007-04-13 11:37   ` David Howells
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2007-04-12 20:59 UTC (permalink / raw)
  To: dhowells; +Cc: netdev

From: David Howells <dhowells@redhat.com>
Date: Thu, 12 Apr 2007 21:51:50 +0100

> What's the best way of doing this, assuming it's possible at all?

Issue a RTM_GETLINK rtnetlink request, and parse the response.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Getting a network interface list from within the kernel
  2007-04-12 20:59 ` David Miller
@ 2007-04-13 11:37   ` David Howells
  0 siblings, 0 replies; 3+ messages in thread
From: David Howells @ 2007-04-13 11:37 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

David Miller <davem@davemloft.net> wrote:

> Issue a RTM_GETLINK rtnetlink request, and parse the response.

Okay, I've managed to find code that does this.  However, RTM_GETLINK does not
appear to return any IPv4 addressing information.  It does, however, contain
the MTU details which is one of the three things I wanted.

I found that RTM_GETADDR will give me the IPv4 address and something from
which I can calculate the netmask.

I don't suppose there's a single op that will allow me to get all three in one
go?

Oh, and can I assume that the interface index numbers returned by RTM_GETLINK
match those returned by RTM_GETADDR?  Even if an interface is removed between
issuing the two calls?  Alternatively, do I need to compare interface names as
those are available between both?

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-04-13 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-12 20:51 Getting a network interface list from within the kernel David Howells
2007-04-12 20:59 ` David Miller
2007-04-13 11:37   ` David Howells

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).