Operating System - Tru64 Unix
1829159 Members
2314 Online
109986 Solutions
New Discussion

IPV6 Interface enumeration broken?

 
Andrew Schnable
New Member

IPV6 Interface enumeration broken?

I am attempting to use SIOCGIFCONF to enumerate the available interfaces - I am getting both IPV4 and IPV6 entries, but when I try to extract the IPV6 addresses, they are incorrect. Here is the innerloop:

if (pcur->IFR_ADDR.SA_FAMILY == AF_INET6)
{
struct sockaddr_in *addr =
addr = reinterpret_cast (&pcur->IFR_ADDR);
if (!IN6_IS_ADDR_UNSPECIFIED(&reinterpret_cast(addr)->sin6_addr))
{
addrs[count].set(addr, sizeof(struct sockaddr_in6));
count++;
}
}


Odd thing is that the leading bytes seem okay, but every thing is wrong after that... For example - ifconfig for one of the interfaces shows:

fe80::20f:20ff:fed8:d361

but the ioctl(SIOCGIFCONF..) returns

fe80::6565:3100:0:0\

Does anyone have any code fragments or pointers on how to do this? Can I get a peek at the ipconfig implementation?