(SIGAR-140) interface aliases are valid in sigar_net_interface_config_primary_get

This commit is contained in:
Doug MacEachern 2009-03-25 11:18:04 -07:00
parent f7b590cf27
commit 891f30bf0d
1 changed files with 7 additions and 3 deletions

View File

@ -1823,19 +1823,23 @@ sigar_net_interface_config_primary_get(sigar_t *sigar,
if ((status != SIGAR_OK) || if ((status != SIGAR_OK) ||
(ifconfig->flags & SIGAR_IFF_LOOPBACK) || (ifconfig->flags & SIGAR_IFF_LOOPBACK) ||
!ifconfig->hwaddr.addr.in || /* no mac address */ !ifconfig->hwaddr.addr.in) /* no mac address */
strchr(iflist.data[i], ':')) /* alias */
{ {
continue; continue;
} }
if (!possible_config.flags) { if (!possible_config.flags) {
/* save for later for use if we're not connected to the net */ /* save for later for use if we're not connected to the net
* or all interfaces are aliases (e.g. solaris zone)
*/
memcpy(&possible_config, ifconfig, sizeof(*ifconfig)); memcpy(&possible_config, ifconfig, sizeof(*ifconfig));
} }
if (!ifconfig->address.addr.in) { if (!ifconfig->address.addr.in) {
continue; /* no ip address */ continue; /* no ip address */
} }
if (strchr(iflist.data[i], ':')) {
continue; /* alias */
}
found = 1; found = 1;
break; break;