Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread Graham Wheeler
Hi all I am attempting to port the cheops network mapping/diagnostic program from Linux to FreeBSD (see www.marko.net/cheops). One of the first snags I have hit comes in using SIOCGIFCONF to queries the network interface names and addresses. The cheops code assumes that the buffer returned will

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread Graham Wheeler
Just a follow up on this: on Stevens vol 2 pg 117, code line 299, is the implication that the returned buffer DOES hold an array of struct ifreq elements. So this does seem to indicate that something may be broken on FreeBSD. At the very least there is some ambiguity - is this an array of struct

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread David Malone
On Tue, Jan 09, 2001 at 12:21:11PM +0200, Graham Wheeler wrote: I am attempting to port the cheops network mapping/diagnostic program from Linux to FreeBSD (see www.marko.net/cheops). One of the first snags I have hit comes in using SIOCGIFCONF to queries the network interface names and

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread David Malone
On Tue, Jan 09, 2001 at 12:30:44PM +0200, Graham Wheeler wrote: Just a follow up on this: on Stevens vol 2 pg 117, code line 299, is the implication that the returned buffer DOES hold an array of struct ifreq elements. So this does seem to indicate that something may be broken on FreeBSD. At

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread Graham Wheeler
David Malone wrote: On Tue, Jan 09, 2001 at 12:21:11PM +0200, Graham Wheeler wrote: I am attempting to port the cheops network mapping/diagnostic program from Linux to FreeBSD (see www.marko.net/cheops). One of the first snags I have hit comes in using SIOCGIFCONF to queries the

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread Graham Wheeler
David Malone wrote: If you read the paragraph below that code, it notes that the ifreq structures are of variable length. The spacing depends on the size of the returned info. That's true. In which case the cheops code is wrong, as it iterates through the list by incrementing a pointer to a

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread Graham Wheeler
David Malone wrote: If you read the paragraph below that code, it notes that the ifreq structures are of variable length. The spacing depends on the size of the returned info. David. Something that isn't clear to me - do you know (Mark for Linux, Dave or someone else for FreeBSD)

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread David Malone
Something that isn't clear to me - do you know (Mark for Linux, Dave or someone else for FreeBSD) whether it is reasonable to assume the ifr_name if the struct ifreq will be NUL terminated? I know that the name in a struct sockaddr_dl is not necessarily so terminated, but for the ifr_name

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread David Malone
Marko - does Linux have getifaddrs()? I somehow doubt it... Linux should have getifaddrs() if it has support for IPv6 in userland libraries. There is an implimentation of it at: http://www.linux-ipv6.org/cvsweb/libinet6/?cvsroot=usagi-libc David. To Unsubscribe: send mail to [EMAIL

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread Mike E. Matsnev
On Tue, Jan 09, 2001 at 03:39:22PM +0200, Graham Wheeler wrote: David Malone wrote: If you read the paragraph below that code, it notes that the ifreq structures are of variable length. The spacing depends on the size of the returned info. That's true. In which case the cheops code

Re: Size of struct ifreq/returned buffer of SIOCGIFCONF

2001-01-09 Thread Dennis
At 10:51 AM 01/09/2001, David Malone wrote: Marko - does Linux have getifaddrs()? I somehow doubt it... Linux should have getifaddrs() if it has support for IPv6 in userland libraries. There is an implimentation of it at: http://www.linux-ipv6.org/cvsweb/libinet6/?cvsroot=usagi-libc