kern/159099: [ioctl] ioctl SIOCGIFCONF reports interface names which are blank

Alexander V. Chernikov melifaro at ipfw.ru
Mon Jul 25 04:50:06 UTC 2011


The following reply was made to PR kern/159099; it has been noted by GNATS.

From: "Alexander V. Chernikov" <melifaro at ipfw.ru>
To: bug-followup at FreeBSD.org, sreeramabs at netapp.com
Cc:  
Subject: Re: kern/159099: [ioctl] ioctl SIOCGIFCONF reports interface names
 which are blank
Date: Mon, 25 Jul 2011 08:38:12 +0400

 Data returned by SIOCGIFCONF is correct. It just has to be read another
 way. General struct sockaddr was planned to be enough for holding
 AF_INET/AF_INET6 address. It is not enough large to hold AF_LINK address
 (sockaddr_dl), for example. There is also traditional 4.3BSD socket
 interface with sa_len field contained within struct sockaddr. *BSD, AIX,
  Darwin, QNX are using it. Linux, Solaris, Cygwin does not. This really
 leads to portability problems for many people.
 On all systems supporting sa_len real ifreq length is calculated using
 sa_len field.
 sa_len support should be checked before compilation (usually done by
 autoconf)
 
 Please see /usr/src/contrib/traceroute/ifaddrlist.c for example of doing
 this really portable way.


More information about the freebsd-bugs mailing list