iphlpapi patch 2 - Filter out no-ip addresses when building ip address table

Gavriel State gav at transgaming.com
Thu Jan 25 19:15:58 CST 2007


Author: Mark Adams <mark at transgaming.com>

ChangeLog:
- Filter out no-ip addresses when building ip address table

-- 
Gavriel State 
Founder & CTO
TransGaming Technologies Inc.
gav at transgaming.com
http://www.transgaming.com

Broadening The Playing Field

-------------- next part --------------
? dlls/iphlpapi/.ifenum.c.swp
? dlls/iphlpapi/interface_count_clarify.diff
? dlls/iphlpapi/mac_support.diff
? dlls/iphlpapi/no_ip.diff
Index: dlls/iphlpapi/ifenum.c
===================================================================
RCS file: /home/wine/wine/dlls/iphlpapi/ifenum.c,v
retrieving revision 1.25
diff -u -r1.25 ifenum.c
--- dlls/iphlpapi/ifenum.c	21 Dec 2006 16:37:51 -0000	1.25
+++ dlls/iphlpapi/ifenum.c	26 Jan 2007 01:07:46 -0000
@@ -695,7 +695,11 @@
     if (ioctlRet == 0) {
       ifPtr = ifc->ifc_buf;
       while (ifPtr && ifPtr < ifc->ifc_buf + ifc->ifc_len) {
-        numAddresses++;
+        struct ifreq *ifr = (struct ifreq *)ifPtr;
+
+        if (ifr->ifr_addr.sa_family == AF_INET)
+          numAddresses++;
+
         ifPtr += ifreq_len((struct ifreq *)ifPtr);
       }
     }
@@ -751,6 +755,11 @@
         while (!ret && ifPtr && ifPtr < ifc.ifc_buf + ifc.ifc_len) {
           struct ifreq *ifr = (struct ifreq *)ifPtr;
 
+          ifPtr += ifreq_len(ifr);
+
+          if (ifr->ifr_addr.sa_family != AF_INET)
+             continue;
+
           ret = getInterfaceIndexByName(ifr->ifr_name,
            &(*ppIpAddrTable)->table[i].dwIndex);
           memcpy(&(*ppIpAddrTable)->table[i].dwAddr, ifr->ifr_addr.sa_data + 2,
@@ -769,7 +778,6 @@
 
           (*ppIpAddrTable)->table[i].unused1 = 0;
           (*ppIpAddrTable)->table[i].wType = 0;
-          ifPtr += ifreq_len(ifr);
           i++;
         }
       }


More information about the wine-patches mailing list