dwBCastAddr is a flag, not an address

This commit is contained in:
Doug MacEachern 2006-11-05 20:18:11 +00:00
parent fc9fdb3941
commit a73e93ae91
1 changed files with 12 additions and 5 deletions

View File

@ -2399,9 +2399,17 @@ sigar_net_interface_config_get(sigar_t *sigar,
sigar_net_address_set(ifconfig->netmask, sigar_net_address_set(ifconfig->netmask,
ipaddr->dwMask); ipaddr->dwMask);
/* wtf is up w/ dwBCastAddr? */ if (ifr->dwType != MIB_IF_TYPE_LOOPBACK) {
sigar_net_address_set(ifconfig->broadcast, long bcast = ipaddr->dwAddr & ipaddr->dwMask;
ipaddr->dwAddr|0xFF000000);
if (ipaddr->dwBCastAddr) {
bcast |= ~ipaddr->dwMask;
ifconfig->flags |= SIGAR_IFF_BROADCAST;
}
sigar_net_address_set(ifconfig->broadcast,
bcast);
}
} }
/* hack for MS_LOOPBACK_ADAPTER */ /* hack for MS_LOOPBACK_ADAPTER */
@ -2417,8 +2425,7 @@ sigar_net_interface_config_get(sigar_t *sigar,
} }
else { else {
if (ipaddr) { if (ipaddr) {
ifconfig->flags |= ifconfig->flags |= SIGAR_IFF_MULTICAST;
SIGAR_IFF_BROADCAST|SIGAR_IFF_MULTICAST;
} }
SIGAR_SSTRCPY(ifconfig->type, SIGAR_SSTRCPY(ifconfig->type,