Re: Get name and ip-address for each interface

From: Jeremy Jackson
Date: Wed Apr 15 2009 - 15:40:29 EST


On Wed, 2009-04-15 at 19:05 +0000, Miquel van Smoorenburg wrote:

> Use recvmsg with IP_PKTINFO. For each packet received you'll also
> get information about the destination IP address and thus the interface
> it was received on.
>
> See for example src/lib/udpfromto.c from freeradius,
> http://github.com/alandekok/freeradius-server/blob/e67f2acf5c6f5f33e6a66d4bf344931274394986/src/lib/udpfromto.c

And to track what IPs and what interfaces there are, use netlink socket
to get updates when interfaces are reconfigured/added/removed.

--
Jeremy Jackson
Coplanar Networks
(519)489-4903
http://www.coplanar.net
jerj@xxxxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html