Get IPv6 addresses in linux using ioctl

Viewed 9209

I trying to get IPv6 addresses in my linux OS like following:

sd = Socket_m(AF_INET6_m, SOCK_DGRAM_m, 0);

ifc.ifc_buf = buffer_p;
ifc.ifc_len = buffSize;
Ioctl_m(sd, SIOCGIFCONF, &ifc);

It works succesfully if any IPv4 address are configured for interface, but if interface has only one IPv6 address it is not returned by ioctl.

For example, I unable to get IPv6 address of the followith interface because only IPv6 address is configured:

br1       Link encap:Ethernet  HWaddr 00:10:18:2D:BB:34  
          inet6 addr: fe80::210:18ff:fe2d:be54/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:194244850 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72005 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:12331900995 (11760.6 Mb)  TX bytes:6192406 (5.9 Mb)
2 Answers
Related