Re: looking for help with scanning of IPv6 interfaces
From: Andi Kleen <hidden>
Date: 2002-11-15 19:00:51
On Fri, Nov 15, 2002 at 12:38:12PM -0500, Michael Richardson wrote:
1) Awhile ago there was a flame war about using SIOCGIFCONF/SIOCGLIFCONF to get lists of interfaces. This was suggested as being a bad way. 2) bind 9.3snapshot is able to get a list of IPv4 addresses with SIOCGIFCONF, 3) it is not able to get IPv6 addresses with SIOCGLIFCONF. Marc Andrews, sitting next to me, asked if I knew what the offical magic was. Can someone point me that officially blessed way to do this?
Physical devices are read using /proc/net/dev If you want IPv6 addresses you can read and parse /proc/net/if_inet6 That is the old fashioned way. The new fashioned one is to query them using rtnetlink. You use a RTM_GETADDR NLM_F_REQUEST query with wildcard (NLM_F_ROOT) to get a full list. See the netlink,rtnetlink, libnetlink manpages and iproute2 as an example. It is easier when you use libnetlink. -Andi