Red Hat Bugzilla – Bug 113637
ioctl SIOCGIFCONF returns incorrect value/count
Last modified: 2007-11-30 17:10:35 EST
Description of problem:
I am trying to get nessus to build and run correctly on an AMD64
system ... you Red Hat folks may want to try this, it sure seems to
Anyway, one of the routines gets the names, etc. of the network
interfaces. A key is using ioctl with the SIOCGIFCONF parameter.
When this is compiled and run on an ia32 system (Athlon in my case) it
prints out the correct number and names of the network interfaces.
When it is compiled and run on an AMD64 (Opteron)_ system, it only has
the first(?) interface: lo.
The correct component may or may not be named.
Version-Release number of selected component (if applicable):
FC-1 preview with kernel-2.4.22-1.2135.nptl
Steps to Reproduce:
compile and run the attached test program on a IA32 and AMD64 system.
the compile command was gcc -O2 -o testxx test.c
Created attachment 97047 [details]
test program to demonstrate problem
Oops ... just realized that since the 32 bit test application ran OK
on the 64 bit kernel, the problem could not be the kernel ... but
instead glibc. I have changed the component and assignment.
No, this has nothing to do with glibc, but neither with kernel.
The test program is broken.
Look at how is struct ifreq defined. Among other things it contains
ifr_map field, and on 64-bit machines struct ifmap is bigger than
struct sockaddr (the former 24 bytes (16 bytes on 32-bits), the
latter 16 bytes (the same as on 32-bit)).
So struct ifreq is 40 bytes on AMD64, while
sizeof (ifr->ifr_name) + sizeof (struct sockaddr) is 32.