SIOCGIFCONF vs sysctl to retrieve interface list

SIOCGIFCONF vs sysctl to retrieve interface list

Post by Mike DiClaudi » Wed, 10 May 2000 04:00:00

I need to retreive the MAC addresses of the ethernet interfaces on my
FreeBSD system.  FreeBSD supports both sysctl(NET_RT_IFLIST) and
ioctl(SIOCGIFCONF) to get the interface list.  Portability isn't a concern,
so does it matter which call I use?



1. ioctl SIOCGIFCONF fails when there are >32 virtual interfaces

This one has me tearing my hair out....

Solaris 2.5 on Sparc, latest recommended patches.

When I added my 31st virtual interface, thereby giving me 32 in total
from le0, to le0:31, quite a collection of programs started throwing up

One of the main programs that is completely broken by this is Solstice
Backup (networker) 4.1.2, which gives a set of errors such as :

get_myaddress: ioctl (get interface configuration): Invalid argument
is_myaddr: Invalid argument

With a bit of digging and examining some other programs which I DO have
source for which were also broken, it seems that the ioctl call
SIOCGIFCONF is now failing with EINVAL, and logical deduction would
suggest that this is what get_myaddress is using behind the scenes.

I'm assuming that there is some nasty bug in the code implementing
ioctl SIOCGIFCONF which doesn't like there being more than 31
interfaces, as the problem disappears the moment I remove that 32nd

I've looked in the FAQ, and I've looked at the current public patches.
I don't have a SunSolve account, coz my company hasn't yet 'seen the
need' to purchase a support contract, so I haven't been through all the
stuff on SunSolve.  So I can't find anything about it.

So basically I'm stumped, and wonder if a) this is a known problem, and
b) if there's a patch/workaround/dead chicken for it?

Thanks in advance...

Sam Eaton             System Administrator, Cocoon Internet Services Ltd
        "Fortified with essential bitterness and sarcasm"
Version: 3.1

X+(-) R(+) tv+ b+++>++++ DI++>+++ D---() G>+++ e++>++++ h r(++) y+(*)

2. Interested in purchasing a Linux OS

3. Enumerating network interfaces SIOCGIFCONF/CSIOCGIFCONF docs??

4. COMMERCIAL: Polo/Sweatshirt/T-Shirt with "Tux" and slogan

5. sysctl interface

6. DAT tape drives reading or writing audio DATs.

7. sysctl interface to bootflags?

8. Why is it leaving home?

9. kNFS Patch to export grace period control of lockd via sysctl interface?

10. java interface vs web interface : Snort

11. Linux vs OS2 vs NT vs Win95 vs Multics vs PDP11 vs BSD geeks

12. Q: "OPTION GATEWAY" vs. "sysctl net.inet.ip.forewarding"

13. ipchains vs. sysctl set kernel parameters