From owner-freebsd-bugs@FreeBSD.ORG Mon Jul 25 04:50:06 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4ECF3106564A for ; Mon, 25 Jul 2011 04:50:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3DE5C8FC1A for ; Mon, 25 Jul 2011 04:50:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p6P4o5j2061212 for ; Mon, 25 Jul 2011 04:50:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p6P4o59f061211; Mon, 25 Jul 2011 04:50:05 GMT (envelope-from gnats) Date: Mon, 25 Jul 2011 04:50:05 GMT Message-Id: <201107250450.p6P4o59f061211@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "Alexander V. Chernikov" Cc: Subject: Re: kern/159099: [ioctl] ioctl SIOCGIFCONF reports interface names which are blank X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Alexander V. Chernikov" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 04:50:06 -0000 The following reply was made to PR kern/159099; it has been noted by GNATS. From: "Alexander V. Chernikov" 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.