Subject: Re: SIOCGIFCONF wierdness
To: Alex Barclay <firstname.lastname@example.org>
From: None <email@example.com>
Date: 05/09/2001 08:11:39
>I'm having trouble accessing the list of interfaces on the machine which
>is a NetBSD-current/i386 (Kernel is a 1.5U)
>I create a socket of type PF_INET, SOCK_DGRAM
>try to use either SIOCGIFCONF or OSIOCGIFCONF and get very strange
>results. Using SIOCGIFCONF I get a few of the interface names but by no
>means all of them. Using OSIOCGIFCONF I get the interface names but no
your code is assuming that SIOCGIFCONF returns an array of fixed-length
struct (ifreq), however, the assumption is not correct. ifreq
can be bigger when sockaddr in ifreq struct is bigger.
SIOCGIFCONF is one of the most difficult-to-use ioctl.
i'd suggest you to use getifaddrs(3).