Mark Adams : iphlpapi: Filter out no-ip addresses when building ip address table.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 26 07:47:02 CST 2007


Module: wine
Branch: master
Commit: 1e263e663bbeacfa3b79bf894cd071438e617465
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e263e663bbeacfa3b79bf894cd071438e617465

Author: Mark Adams <mark at transgaming.com>
Date:   Thu Jan 25 20:15:58 2007 -0500

iphlpapi: Filter out no-ip addresses when building ip address table.

---

 dlls/iphlpapi/ifenum.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c
index c1d1a0a..9590032 100644
--- a/dlls/iphlpapi/ifenum.c
+++ b/dlls/iphlpapi/ifenum.c
@@ -696,7 +696,11 @@ static DWORD enumIPAddresses(PDWORD pcAd
     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);
       }
     }
@@ -752,6 +756,11 @@ DWORD getIPAddrTable(PMIB_IPADDRTABLE *p
         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,
@@ -770,7 +779,6 @@ DWORD getIPAddrTable(PMIB_IPADDRTABLE *p
 
           (*ppIpAddrTable)->table[i].unused1 = 0;
           (*ppIpAddrTable)->table[i].wType = 0;
-          ifPtr += ifreq_len(ifr);
           i++;
         }
       }




More information about the wine-cvs mailing list