if_nameindex() does not return all network interfaces
I am using 'if_nameindex()' to get the list of network interface names. Apparently, on RHEL 4, this does not return the network interfaces having secondary ip address (ie eth0:1, eth1:1 ….). However on RHEL3, it works fine. On RHEL3, it returns lo, eth0, eth0:1, eth1…
Not sure why the behavior is different on RHEL4. Does anybody have any clue ?
here is the code
-------------------------------------------------
// open a socket for ioctls
if ((fd = socket(PF_PACKET,
SOCK_PACKET,
htons(ETH_P_ALL))) == -1)
{
// print failed
}
// get list of network interface names
if ((pIFList = if_nameindex()) == NULL)
{
close(fd);
// print failed
}
------------------------------------------------------
|