set net_interface_config.broadcast

This commit is contained in:
Doug MacEachern 2006-11-03 22:07:36 +00:00
parent ef0752391c
commit ebbabad7fb
1 changed files with 10 additions and 1 deletions

View File

@ -2264,6 +2264,7 @@ sigar_net_interface_config_get(sigar_t *sigar,
if (status == SIGAR_OK) { if (status == SIGAR_OK) {
char *addr; char *addr;
long iaddr;
IP_ADDR_STRING *ip = &adapter->IpAddressList; IP_ADDR_STRING *ip = &adapter->IpAddressList;
/* last address in the list is the primary */ /* last address in the list is the primary */
@ -2271,11 +2272,19 @@ sigar_net_interface_config_get(sigar_t *sigar,
ip = ip->Next; ip = ip->Next;
} }
addr = ip->IpAddress.String; addr = ip->IpAddress.String;
iaddr = inet_addr(addr);
sigar_net_address_set(ifconfig->address, sigar_net_address_set(ifconfig->address,
inet_addr(addr)); iaddr);
addr = ip->IpMask.String; addr = ip->IpMask.String;
sigar_net_address_set(ifconfig->netmask, sigar_net_address_set(ifconfig->netmask,
inet_addr(addr)); inet_addr(addr));
if (ifr->dwType == MIB_IF_TYPE_ETHERNET) {
ifconfig->flags |= SIGAR_IFF_BROADCAST;
sigar_net_address_set(ifconfig->broadcast,
iaddr | 0xFF000000);
}
} }
/* hack for MS_LOOPBACK_ADAPTER */ /* hack for MS_LOOPBACK_ADAPTER */