bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] Re: ifconfig -a on linux x86-64 + glibc


From: Chris Webb
Subject: Re: [bug-inetutils] Re: ifconfig -a on linux x86-64 + glibc
Date: Thu, 1 Jul 2010 17:39:37 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Sergey Poznyakoff <address@hidden> writes:

> Chris Webb <address@hidden> ha escrit:
> 
> > I have no idea why it is doing something like
> > 
> >   ifr = (struct ifreq *) ((caddr_t) ifr + len + IFNAMSIZ);
> 
> Because it was so documented in the description of SIOCGIFCONF.

I failed to find any decent documentation for SIOCGIFCONF on linux; I'd be
very interested if you have a pointer.

> > (which doesn't work)
> 
> It does work for me (Linux 2.6.27.7)

I'm running linux 2.6.34 with glibc 2.11.1 on x86-64. On this platform,
len + IFNAMSIZ is coming out as 32, whereas sizeof(struct ifreq) is coming
out as 40...

Are you running on an x86-64 kernel with 64-bit userspace as I am? It's
interesting if this has recently changed.

> > rather than ifr++ (which does).
> 
> Indeed, it happens to work for me as well.

It feels to me that, when iterating through an array of struct ifreqs,
incrementing by sizeof(struct ifreq) should be guaranteed to work, whereas
incrementing by something calculated differently may or may not work.

Best wishes,

Chris.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]