Re: kern/159099: [ioctl] ioctl SIOCGIFCONF reports interface nam
The following reply was made to PR kern/159099; it has been noted by GNATS.
From: "Alexander V. Chernikov" <melifaro@ipfw.ru>
To: bug-followup@FreeBSD.org, sreeramabs@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.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):