(svn r5295) Handle a quirk in the Windows interface detection code and fix a typo in r5293 (thanks to Darkvater for testing)
authortron
Sat, 17 Jun 2006 12:11:17 +0000
changeset 4036 627aca47ae76
parent 4035 f468417d21b9
child 4037 cac65872c4c1
(svn r5295) Handle a quirk in the Windows interface detection code and fix a typo in r5293 (thanks to Darkvater for testing)
network.c
--- a/network.c	Sat Jun 17 10:37:20 2006 +0000
+++ b/network.c	Sat Jun 17 12:11:17 2006 +0000
@@ -399,10 +399,16 @@
 		return;
 	}
 
-	// Now walk through all IPs and list them
+	i = 0;
 	for (j = 0; j < len / sizeof(*ifo); j++) {
+		if (ifo[j].iiFlags & IFF_LOOPBACK) continue;
 		if (!(ifo[j].iiFlags & IFF_BROADCAST)) continue;
-		_broadcast_list[i++] = ifo[j].iiBroadcastAddress.AddressIn.sin_addr.s_addr;
+		/* iiBroadcast is unusable, because it always seems to be set to
+		 * 255.255.255.255.
+		 */
+		_broadcast_list[i++] =
+			 ifo[j].iiAddress.AddressIn.sin_addr.s_addr |
+			~ifo[j].iiNetmask.AddressIn.sin_addr.s_addr;
 	}
 #else
 	ifconf.ifc_len = sizeof(buf);