need for getifaddrs in uclibc

Natanael Copa natanael.copa at gmail.com
Fri Nov 9 10:24:42 UTC 2007


On Thu, 2007-11-08 at 19:32 +0100, Jason Curl wrote:
> Natanael Copa wrote:
> > On Wed, 2007-11-07 at 19:39 +0100, Jason Curl wrote:
> >   
> >> Natanael Copa wrote:
> >>     
> >>> Hi,
> >>>
> >>> Does anyone know a susv3/POSIX compliant way to list all ipv6
> >>> interfaces? I bet there are no. ioctl(SIOCGIFCONF) ignores ipv6
> >>> interfaces, I just tested.
> >>>       
> Reading through UNP (Stevens, et. al.) suggests it will work. I notice 
> the socket is opened as AF_INET. 

It does not on linux
see attached test prog. I changed AF_INET to AF_INET6.

> Do you open AF_INET or AF_INET6?

tried both.

> Granted, I haven't tested and I'm only working with IPv4 at the moment 
> with uClic.

googled around yesterday. ioctl and ipv6 on linux does not seem to work.
netlink is the new buzzword in linux.

> Then "sysctl()" is supposed to be the successor of "ioctl()". UNP talks 
> about using the routing sockets to get the information for each 
> interface (sounds similar to netlink, but different enough).

in linux they tend to drop sysctl in favor for /proc.

   
> Personally, I found it almost easier to write code for each intended 
> target and wrap it with a common API.

sight...

For the moment i think I can drop checking the ipv6 address. Interface
name from if_nameindex is enough.

-nc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifenum.c
Type: text/x-csrc
Size: 1336 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20071109/534fc910/attachment-0002.c 


More information about the uClibc mailing list