Yes, that ioctl is legacy and won't return IPv6. Each platform has a different way of getting the IPv6 ones:
- Linux, use NETLINK if you're crazy, use
getifaddrs
if you have a vaguely recent glibc, otherwise read/proc/net/if_inet6
(eg on Android). - Darwin or FreeBSD: use
getifaddrs
. - Solaris, use
SIOCGLIFCONF
. - AIX, use
SIOCGIFCONF
which actually returns IPv4 and IPv6 addresses (because they have ansa_len
field instruct sockaddr
they can actually support that).