Hello community,

here is the log from the commit of package python-netifaces for 
openSUSE:Factory checked in at 2012-06-26 17:57:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-netifaces (Old)
 and      /work/SRC/openSUSE:Factory/.python-netifaces.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-netifaces", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-netifaces/python-netifaces.changes        
2012-06-18 17:35:55.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-netifaces.new/python-netifaces.changes   
2012-06-26 17:57:07.000000000 +0200
@@ -1,0 +2,10 @@
+Mon Jun 25 15:17:42 UTC 2012 - [email protected]
+
+- Update to version 0.8:
+  + Fixed bit-rot in the ioctl() code path.
+  + Fixed a problem with setup.py that might manifest itself if the
+    config.cache file was manually edited.
+  + Fixed the ioctl() code path to cope with systems that have sa_len and
+    return longer than normal struct ifreq results from SIOCG[L]IFCONF;
+
+-------------------------------------------------------------------

Old:
----
  netifaces-0.6.tar.gz

New:
----
  netifaces-0.8.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-netifaces.spec ++++++
--- /var/tmp/diff_new_pack.L8ppWF/_old  2012-06-26 17:57:08.000000000 +0200
+++ /var/tmp/diff_new_pack.L8ppWF/_new  2012-06-26 17:57:08.000000000 +0200
@@ -18,7 +18,7 @@
 
 
 Name:           python-netifaces
-Version:        0.6
+Version:        0.8
 Release:        0
 Summary:        Portable network interface information
 License:        MIT

++++++ netifaces-0.6.tar.gz -> netifaces-0.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netifaces-0.6/PKG-INFO new/netifaces-0.8/PKG-INFO
--- old/netifaces-0.6/PKG-INFO  2011-11-04 18:18:25.000000000 +0100
+++ new/netifaces-0.8/PKG-INFO  2012-01-31 12:48:39.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: netifaces
-Version: 0.6
+Version: 0.8
 Summary: Portable network interface information.
 Home-page: http://alastairs-place.net/netifaces
 Author: Alastair Houghton
@@ -11,8 +11,7 @@
         obtain the addresses of those network interfaces.
         
         The package has been tested on Mac OS X, Windows XP, Windows Vista, 
Linux
-        and Solaris.  On Windows, it is currently not able to retrieve IPv6
-        addresses, owing to shortcomings of the Windows API.
+        and Solaris.
         
         It should work on other UNIX-like systems provided they implement
         either getifaddrs() or support the SIOCGIFxxx socket options, although 
the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netifaces-0.6/netifaces.c 
new/netifaces-0.8/netifaces.c
--- old/netifaces-0.6/netifaces.c       2011-11-04 18:10:03.000000000 +0100
+++ new/netifaces-0.8/netifaces.c       2012-01-31 12:43:39.000000000 +0100
@@ -145,7 +145,10 @@
 
 #else /* defined(WIN32) */
 
+#define _WIN32_WINNT 0x0501
+
 #  include <winsock2.h>
+#  include <ws2tcpip.h>
 #  include <iphlpapi.h>
 
 #endif /* defined(WIN32) */
@@ -296,9 +299,9 @@
   }
 
   failure = getnameinfo (gniaddr, gnilen,
-                   buffer, buflen,
-                   NULL, 0,
-                   NI_NUMERICHOST);
+                         buffer, buflen,
+                         NULL, 0,
+                         NI_NUMERICHOST);
 
   if (bigaddr) {
     free(bigaddr);
@@ -306,7 +309,7 @@
   }
 
   if (failure) {
-    int n, len;
+    size_t n, len;
     char *ptr;
     const char *data;
       
@@ -352,13 +355,54 @@
     *--ptr = '\0';
   }
 
+  if (!buffer[0])
+    return -1;
+
   return 0;
 }
 #endif /* !defined(WIN32) */
 
+#if defined(WIN32)
+static int
+compare_bits (const void *pva,
+              const void *pvb,
+              unsigned bits)
+{
+  const unsigned char *pa = (const unsigned char *)pva;
+  const unsigned char *pb = (const unsigned char *)pvb;
+  unsigned char a, b;
+  static unsigned char masks[] = {
+    0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe
+  };
+  while (bits >= 8) {
+    a = *pa++;
+    b = *pb++;
+    if (a < b)
+      return -1;
+    else if (a > b)
+      return +1;
+    bits -= 8;
+  }
+
+  if (bits) {
+    a = *pa++ & masks[bits];
+    b = *pb++ & masks[bits];
+    if (a < b)
+      return -1;
+    else if (a > b)
+      return +1;
+  }
+
+  return 0;
+}
+#endif
+
 static int
 add_to_family (PyObject *result, int family, PyObject *dict)
 {
+  if (!PyDict_Size (dict))
+    return TRUE;
+
   PyObject *py_family = PyInt_FromLong (family);
   PyObject *list = PyDict_GetItem (result, py_family);
 
@@ -394,11 +438,10 @@
   PyObject *result;
   int found = FALSE;
 #if defined(WIN32)
-  PIP_ADAPTER_INFO pAdapterInfo = NULL;
-  PIP_ADAPTER_INFO pInfo = NULL;
+  PIP_ADAPTER_ADDRESSES pAdapterAddresses = NULL, pInfo = NULL;
   ULONG ulBufferLength = 0;
   DWORD dwRet;
-  PIP_ADDR_STRING str;
+  PIP_ADAPTER_UNICAST_ADDRESS pUniAddr;
 #endif
 
   if (!PyArg_ParseTuple (args, "s", &ifname))
@@ -413,14 +456,15 @@
   /* First, retrieve the adapter information.  We do this in a loop, in
      case someone adds or removes adapters in the meantime. */
   do {
-    dwRet = GetAdaptersInfo(pAdapterInfo, &ulBufferLength);
+    dwRet = GetAdaptersAddresses (AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL,
+                                  pAdapterAddresses, &ulBufferLength);
 
     if (dwRet == ERROR_BUFFER_OVERFLOW) {
-      if (pAdapterInfo)
-        free (pAdapterInfo);
-      pAdapterInfo = (PIP_ADAPTER_INFO)malloc (ulBufferLength);
+      if (pAdapterAddresses)
+        free (pAdapterAddresses);
+      pAdapterAddresses = (PIP_ADAPTER_ADDRESSES)malloc (ulBufferLength);
 
-      if (!pAdapterInfo) {
+      if (!pAdapterAddresses) {
         Py_DECREF (result);
         PyErr_SetString (PyExc_MemoryError, "Not enough memory");
         return NULL;
@@ -431,15 +475,15 @@
   /* If we failed, then fail in Python too */
   if (dwRet != ERROR_SUCCESS && dwRet != ERROR_NO_DATA) {
     Py_DECREF (result);
-    if (pAdapterInfo)
-      free (pAdapterInfo);
+    if (pAdapterAddresses)
+      free (pAdapterAddresses);
 
     PyErr_SetString (PyExc_OSError,
                      "Unable to obtain adapter information.");
     return NULL;
   }
 
-  for (pInfo = pAdapterInfo; pInfo; pInfo = pInfo->Next) {
+  for (pInfo = pAdapterAddresses; pInfo; pInfo = pInfo->Next) {
     char buffer[256];
 
     if (strcmp (pInfo->AdapterName, ifname) != 0)
@@ -448,14 +492,14 @@
     found = TRUE;
 
     /* Do the physical address */
-    if (256 >= 3 * pInfo->AddressLength) {
+    if (256 >= 3 * pInfo->PhysicalAddressLength) {
       PyObject *hwaddr, *dict;
       char *ptr = buffer;
       unsigned n;
       
       *ptr = '\0';
-      for (n = 0; n < pInfo->AddressLength; ++n) {
-        sprintf (ptr, "%02x:", pInfo->Address[n] & 0xff);
+      for (n = 0; n < pInfo->PhysicalAddressLength; ++n) {
+        sprintf (ptr, "%02x:", pInfo->PhysicalAddress[n] & 0xff);
         ptr += 3;
       }
       *--ptr = '\0';
@@ -466,7 +510,7 @@
       if (!dict) {
         Py_XDECREF (hwaddr);
         Py_DECREF (result);
-        free (pAdapterInfo);
+        free (pAdapterAddresses);
         return NULL;
       }
 
@@ -475,33 +519,202 @@
 
       if (!add_to_family (result, AF_LINK, dict)) {
         Py_DECREF (result);
-        free (pAdapterInfo);
+        free (pAdapterAddresses);
         return NULL;
       }
     }
 
-    for (str = &pInfo->IpAddressList; str; str = str->Next) {
-      PyObject *addr = PyString_FromString (str->IpAddress.String);
-      PyObject *mask = PyString_FromString (str->IpMask.String);
+    for (pUniAddr = pInfo->FirstUnicastAddress;
+         pUniAddr;
+         pUniAddr = pUniAddr->Next) {
+      DWORD dwLen = sizeof (buffer);
+      INT iRet = WSAAddressToString (pUniAddr->Address.lpSockaddr,
+                                     pUniAddr->Address.iSockaddrLength,
+                                     NULL,
+                                     (LPTSTR)buffer,
+                                     &dwLen);
+      PyObject *addr;
+      PyObject *mask = NULL;
       PyObject *bcast = NULL;
-      PyObject *dict;
+      PIP_ADAPTER_PREFIX pPrefix;
+      short family = pUniAddr->Address.lpSockaddr->sa_family;
+
+      if (iRet)
+        continue;
+
+      addr = PyString_FromString (buffer);
+
+      /* Find the netmask, where possible */
+      if (family == AF_INET) {
+         struct sockaddr_in *pAddr
+          = (struct sockaddr_in *)pUniAddr->Address.lpSockaddr;
+
+        for (pPrefix = pInfo->FirstPrefix;
+             pPrefix;
+             pPrefix = pPrefix->Next) {
+          struct sockaddr_in *pPrefixAddr
+            = (struct sockaddr_in *)pPrefix->Address.lpSockaddr;
+          struct sockaddr_in maskAddr, bcastAddr;
+          unsigned toDo;
+          unsigned wholeBytes, remainingBits;
+          unsigned char *pMaskBits, *pBcastBits;
+
+          if (pPrefixAddr->sin_family != AF_INET)
+            continue;
+          
+          if (compare_bits (&pPrefixAddr->sin_addr,
+                            &pAddr->sin_addr,
+                            pPrefix->PrefixLength) != 0)
+            continue;
+
+          memcpy (&maskAddr,
+                  pPrefix->Address.lpSockaddr,
+                  sizeof (maskAddr));
+          memcpy (&bcastAddr,
+                  pPrefix->Address.lpSockaddr,
+                  sizeof (bcastAddr));
+                  
+          wholeBytes = pPrefix->PrefixLength >> 3;
+          remainingBits = pPrefix->PrefixLength & 7;
+
+          if (wholeBytes >= 4)
+            continue;
+
+          toDo = wholeBytes;
+          pMaskBits = (unsigned char *)&maskAddr.sin_addr;
+
+          while (toDo--)
+            *pMaskBits++ = 0xff;
+
+          toDo = 4 - wholeBytes;
+
+          pBcastBits = (unsigned char *)&bcastAddr.sin_addr + wholeBytes;
+
+          if (remainingBits) {
+            static const unsigned char masks[] = {
+              0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe
+            };
+            *pMaskBits++ = masks[remainingBits];
+            *pBcastBits &= masks[remainingBits];
+            *pBcastBits++ |= ~masks[remainingBits];
+            --toDo;
+          }
+
+          while (toDo--) {
+            *pMaskBits++ = 0;
+            *pBcastBits++ = 0xff;
+          }
+
+          dwLen = sizeof (buffer);
+          iRet = WSAAddressToString ((SOCKADDR *)&maskAddr,
+                                     sizeof (maskAddr),
+                                     NULL,
+                                     (LPTSTR)buffer,
+                                     &dwLen);
+
+          if (iRet == 0)
+            mask = PyString_FromString (buffer);
+          
+          dwLen = sizeof (buffer);
+          iRet = WSAAddressToString ((SOCKADDR *)&bcastAddr,
+                                     sizeof (bcastAddr),
+                                     NULL,
+                                     (LPTSTR)buffer,
+                                     &dwLen);
+
+          if (iRet == 0)
+            bcast = PyString_FromString (buffer);
+          else
+            printf ("%d\n", iRet);
 
-      /* If this isn't the loopback interface, work out the broadcast
-         address, for better compatibility with other platforms. */
-      if (pInfo->Type != MIB_IF_TYPE_LOOPBACK) {
-        unsigned long inaddr = inet_addr (str->IpAddress.String);
-        unsigned long inmask = inet_addr (str->IpMask.String);
-        struct in_addr in;
-        char *brstr;
+          break;
+        }
+      } else if (family == AF_INET6) {
+        struct sockaddr_in6 *pAddr
+          = (struct sockaddr_in6 *)pUniAddr->Address.lpSockaddr;
+
+        for (pPrefix = pInfo->FirstPrefix;
+             pPrefix;
+             pPrefix = pPrefix->Next) {
+          struct sockaddr_in6 *pPrefixAddr
+            = (struct sockaddr_in6 *)pPrefix->Address.lpSockaddr;
+          struct sockaddr_in6 maskAddr, bcastAddr;
+          unsigned toDo;
+          unsigned wholeBytes, remainingBits;
+          unsigned char *pMaskBits, *pBcastBits;
+
+          if (pPrefixAddr->sin6_family != AF_INET6)
+            continue;
+          
+          if (compare_bits (&pPrefixAddr->sin6_addr,
+                            &pAddr->sin6_addr,
+                            pPrefix->PrefixLength) != 0)
+            continue;
+
+          memcpy (&maskAddr,
+                  pPrefix->Address.lpSockaddr,
+                  sizeof (maskAddr));
+          memcpy (&bcastAddr,
+                  pPrefix->Address.lpSockaddr,
+                  sizeof (bcastAddr));
+                  
+          wholeBytes = pPrefix->PrefixLength >> 3;
+          remainingBits = pPrefix->PrefixLength & 7;
+
+          if (wholeBytes >= 8)
+            continue;
+
+          toDo = wholeBytes;
+          pMaskBits = (unsigned char *)&maskAddr.sin6_addr;
+
+          while (toDo--)
+            *pMaskBits++ = 0xff;
+
+          toDo = 8 - wholeBytes;
+
+          pBcastBits = (unsigned char *)&bcastAddr.sin6_addr + wholeBytes;
+
+          if (remainingBits) {
+            static const unsigned char masks[] = {
+              0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe
+            };
+            *pMaskBits++ = masks[remainingBits];
+            *pBcastBits &= masks[remainingBits];
+            *pBcastBits++ |= ~masks[remainingBits];
+            --toDo;
+          }
 
-        in.S_un.S_addr = (inaddr | ~inmask) & 0xfffffffful;
+          while (toDo--) {
+            *pMaskBits++ = 0;
+            *pBcastBits++ = 0xff;
+          }
 
-        brstr = inet_ntoa (in);
+          dwLen = sizeof (buffer);
+          iRet = WSAAddressToString ((SOCKADDR *)&maskAddr,
+                                     sizeof (maskAddr),
+                                     NULL,
+                                     (LPTSTR)buffer,
+                                     &dwLen);
+
+          if (iRet == 0)
+            mask = PyString_FromString (buffer);
+          
+          dwLen = sizeof (buffer);
+          iRet = WSAAddressToString ((SOCKADDR *)&bcastAddr,
+                                     sizeof (bcastAddr),
+                                     NULL,
+                                     (LPTSTR)buffer,
+                                     &dwLen);
 
-        if (brstr)
-          bcast = PyString_FromString (brstr);
+          if (iRet == 0)
+            bcast = PyString_FromString (buffer);
+
+          break;
+        }
       }
 
+      PyObject *dict;
+
       dict = PyDict_New ();
 
       if (!dict) {
@@ -509,7 +722,7 @@
         Py_XDECREF (mask);
         Py_XDECREF (bcast);
         Py_DECREF (result);
-        free (pAdapterInfo);
+        free (pAdapterAddresses);
         return NULL;
       }
 
@@ -524,15 +737,15 @@
       Py_XDECREF (mask);
       Py_XDECREF (bcast);
 
-      if (!add_to_family (result, AF_INET, dict)) {
+      if (!add_to_family (result, family, dict)) {
         Py_DECREF (result);
-        free (pAdapterInfo);
+        free ((void *)pAdapterAddresses);
         return NULL;
       }
     }
   }
 
-  free (pAdapterInfo);
+  free ((void *)pAdapterAddresses);
 #elif HAVE_GETIFADDRS
   struct ifaddrs *addrs = NULL;
   struct ifaddrs *addr = NULL;
@@ -550,6 +763,10 @@
     if (strcmp (addr->ifa_name, ifname) != 0)
       continue;
  
+    /* We mark the interface as found, even if there are no addresses;
+       this results in sensible behaviour for these few cases. */
+    found = TRUE;
+
     /* Sometimes there are records without addresses (e.g. in the case of a
        dial-up connection via ppp, which on Linux can have a link address
        record with no actual address).  We skip these as they aren't useful.
@@ -557,8 +774,6 @@
     if (!addr->ifa_addr)
       continue;  
 
-    found = TRUE;
-
     if (string_from_sockaddr (addr->ifa_addr, buffer, sizeof (buffer)) == 0)
       pyaddr = PyString_FromString (buffer);
 
@@ -624,17 +839,13 @@
   if (ioctl (sock, SIOCGIFHWADDR, &ifr) == 0) {
     found = TRUE;
 
-    if (string_from_sockaddr (ifr->CNAME(ifr_addr), buffer, sizeof (buffer)) 
== 0) {
+    if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, 
sizeof (buffer)) == 0) {
       PyObject *hwaddr = PyString_FromString (buffer);
       PyObject *dict = PyDict_New ();
-      PyObject *list = PyList_New (1);
-      PyObject *family = PyInt_FromLong (AF_LINK);
 
-      if (!hwaddr || !dict || !list || !family) {
+      if (!hwaddr || !dict) {
         Py_XDECREF (hwaddr);
         Py_XDECREF (dict);
-        Py_XDECREF (list)
-        Py_XDECREF (family);
         Py_XDECREF (result);
         close (sock);
         return NULL;
@@ -643,11 +854,11 @@
       PyDict_SetItemString (dict, "addr", hwaddr);
       Py_DECREF (hwaddr);
 
-      PyList_SET_ITEM (list, 0, dict);
-
-      PyDict_SetItem (result, family, list);
-      Py_DECREF (family);
-      Py_DECREF (list);
+      if (!add_to_family (result, AF_LINK, dict)) {
+        Py_DECREF (result);
+        close (sock);
+        return NULL;
+      }
     }
   }
 #endif
@@ -743,35 +954,13 @@
   Py_XDECREF (braddr);
   Py_XDECREF (dstaddr);
 
-  if (!PyDict_Size (dict))
-    Py_DECREF (dict);
-  else {
-    PyObject *list = PyList_New(1);
-  
-    if (!list) {
-      Py_DECREF (dict);
-      Py_DECREF (result);
-      close (sock);
-      return NULL;
-    }
-
-    PyList_SET_ITEM (list, 0, dict);
-
-    PyObject *family = PyInt_FromLong (AF_INET);
-    if (!family) {
-      Py_DECREF (result);
-      Py_DECREF (list);
-      close (sock);
-      return NULL;
-    }
-
-    PyDict_SetItem (result, family, list);
-    Py_DECREF (family);
-    Py_DECREF (list);
+  if (!add_to_family (result, AF_INET, dict)) {
+    Py_DECREF (result);
+    close (sock);
+    return NULL;
   }
 
   close (sock);
-
 #endif /* HAVE_SOCKET_IOCTLS */
 
   if (found)
@@ -790,21 +979,21 @@
   PyObject *result;
 
 #if defined(WIN32)
-  PIP_ADAPTER_INFO pAdapterInfo = NULL;
-  PIP_ADAPTER_INFO pInfo = NULL;
+  PIP_ADAPTER_ADDRESSES pAdapterAddresses = NULL, pInfo = NULL;
   ULONG ulBufferLength = 0;
   DWORD dwRet;
 
   /* First, retrieve the adapter information */
   do {
-    dwRet = GetAdaptersInfo(pAdapterInfo, &ulBufferLength);
+    dwRet = GetAdaptersAddresses(AF_UNSPEC, 0, NULL,
+                                 pAdapterAddresses, &ulBufferLength);
 
     if (dwRet == ERROR_BUFFER_OVERFLOW) {
-      if (pAdapterInfo)
-        free (pAdapterInfo);
-      pAdapterInfo = (PIP_ADAPTER_INFO)malloc (ulBufferLength);
+      if (pAdapterAddresses)
+        free (pAdapterAddresses);
+      pAdapterAddresses = (PIP_ADAPTER_ADDRESSES)malloc (ulBufferLength);
 
-      if (!pAdapterInfo) {
+      if (!pAdapterAddresses) {
         PyErr_SetString (PyExc_MemoryError, "Not enough memory");
         return NULL;
       }
@@ -813,8 +1002,8 @@
 
   /* If we failed, then fail in Python too */
   if (dwRet != ERROR_SUCCESS && dwRet != ERROR_NO_DATA) {
-    if (pAdapterInfo)
-      free (pAdapterInfo);
+    if (pAdapterAddresses)
+      free (pAdapterAddresses);
 
     PyErr_SetString (PyExc_OSError,
                      "Unable to obtain adapter information.");
@@ -824,18 +1013,18 @@
   result = PyList_New(0);
 
   if (dwRet == ERROR_NO_DATA) {
-    free (pAdapterInfo);
+    free (pAdapterAddresses);
     return result;
   }
 
-  for (pInfo = pAdapterInfo; pInfo; pInfo = pInfo->Next) {
-    PyObject *ifname = PyString_FromString (pInfo->AdapterName);
+  for (pInfo = pAdapterAddresses; pInfo; pInfo = pInfo->Next) {
+    PyObject *ifname = (PyObject *)PyString_FromString (pInfo->AdapterName);
 
     PyList_Append (result, ifname);
     Py_DECREF (ifname);
   }
 
-  free (pAdapterInfo);
+  free (pAdapterAddresses);
 #elif HAVE_GETIFADDRS
   const char *prev_name = NULL;
   struct ifaddrs *addrs = NULL;
@@ -865,7 +1054,7 @@
   const char *prev_name = NULL;
   int fd = socket (AF_INET, SOCK_DGRAM, 0);
   struct CNAME(ifconf) ifc;
-  int len = -1, n;
+  int len = -1;
 
   if (fd < 0) {
     PyErr_SetFromErrno (PyExc_OSError);
@@ -893,7 +1082,7 @@
   if (len < 0)
     len = 64;
 
-  ifc.CNAME(ifc_len) = len * sizeof (struct CNAME(ifreq));
+  ifc.CNAME(ifc_len) = (int)(len * sizeof (struct CNAME(ifreq)));
   ifc.CNAME(ifc_buf) = malloc (ifc.CNAME(ifc_len));
 
   if (!ifc.CNAME(ifc_buf)) {
@@ -915,8 +1104,9 @@
 
   result = PyList_New (0);
   struct CNAME(ifreq) *pfreq = ifc.CNAME(ifc_req);
-  for (n = 0; n < ifc.CNAME(ifc_len)/sizeof(struct CNAME(ifreq));
-      n++,pfreq++) {
+  struct CNAME(ifreq) *pfreqend = (struct CNAME(ifreq) *)((char *)pfreq
+                                                          + 
ifc.CNAME(ifc_len));
+  while (pfreq < pfreqend) {
     if (!prev_name || strncmp (prev_name, pfreq->CNAME(ifr_name), IFNAMSIZ) != 
0) {
       PyObject *name = PyString_FromString (pfreq->CNAME(ifr_name));
 
@@ -926,6 +1116,19 @@
 
       prev_name = pfreq->CNAME(ifr_name);
     }
+
+#if !HAVE_SOCKADDR_SA_LEN
+    ++pfreq;
+#else
+    /* On some platforms, the ifreq struct can *grow*(!) if the socket address
+       is very long.  Mac OS X is such a platform. */
+    {
+      size_t len = sizeof (struct CNAME(ifreq));
+      if (pfreq->ifr_addr.sa_len > sizeof (struct sockaddr))
+        len = len - sizeof (struct sockaddr) + pfreq->ifr_addr.sa_len;
+        pfreq = (struct CNAME(ifreq) *)((char *)pfreq + len);
+    }
+#endif
   }
 
   free (ifc.CNAME(ifc_buf));
@@ -950,19 +1153,19 @@
 PyMODINIT_FUNC
 initnetifaces (void)
 {
+  PyObject *address_family_dict;
   PyObject *m;
 
 #ifdef WIN32
   WSADATA wsad;
-  int iResult;
   
-  iResult = WSAStartup(MAKEWORD (2, 2), &wsad);
+  WSAStartup(MAKEWORD (2, 2), &wsad);
 #endif
 
   m = Py_InitModule ("netifaces", methods);
 
   /* Address families (auto-detect using #ifdef) */
-  PyObject *address_family_dict = PyDict_New();
+  address_family_dict = PyDict_New();
 #ifdef AF_UNSPEC  
   PyModule_AddIntConstant (m, "AF_UNSPEC", AF_UNSPEC);
   PyDict_SetItem(address_family_dict, PyInt_FromLong(AF_UNSPEC),
@@ -1259,4 +1462,10 @@
           PyString_FromString("AF_BLUETOOTH"));
 #endif
   PyModule_AddObject(m, "address_families", address_family_dict);
+
+  // Add-in the version number from setup.py
+#define _STR(x) #x
+#define STR(x)  _STR(x)
+
+  PyModule_AddStringConstant(m, "version", STR(NETIFACES_VERSION));
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netifaces-0.6/netifaces.egg-info/PKG-INFO 
new/netifaces-0.8/netifaces.egg-info/PKG-INFO
--- old/netifaces-0.6/netifaces.egg-info/PKG-INFO       2011-11-04 
18:18:25.000000000 +0100
+++ new/netifaces-0.8/netifaces.egg-info/PKG-INFO       2012-01-31 
12:48:39.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: netifaces
-Version: 0.6
+Version: 0.8
 Summary: Portable network interface information.
 Home-page: http://alastairs-place.net/netifaces
 Author: Alastair Houghton
@@ -11,8 +11,7 @@
         obtain the addresses of those network interfaces.
         
         The package has been tested on Mac OS X, Windows XP, Windows Vista, 
Linux
-        and Solaris.  On Windows, it is currently not able to retrieve IPv6
-        addresses, owing to shortcomings of the Windows API.
+        and Solaris.
         
         It should work on other UNIX-like systems provided they implement
         either getifaddrs() or support the SIOCGIFxxx socket options, although 
the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netifaces-0.6/setup.py new/netifaces-0.8/setup.py
--- old/netifaces-0.6/setup.py  2011-11-04 18:17:17.000000000 +0100
+++ new/netifaces-0.8/setup.py  2012-01-31 12:24:29.000000000 +0100
@@ -7,8 +7,13 @@
 from distutils.errors import *
 import pickle
 
-# Disable hard links, otherwise building distributions fails
-del os.link
+__version__ = "0.8"
+
+# Disable hard links, otherwise building distributions fails on OS X
+try:
+    del os.link
+except:
+    pass
 
 # On Windows, we need ws2_32 and iphlpapi
 if getattr(sys, 'getwindowsversion', None):
@@ -21,6 +26,8 @@
         libraries = ['socket', 'nsl']
     def_macros = []
 
+def_macros.append(("NETIFACES_VERSION", __version__))
+
 iface_mod = Extension('netifaces', sources=['netifaces.c'],
                       libraries=libraries,
                       define_macros=def_macros)
@@ -33,7 +40,7 @@
         self.check_requirements()
         build_ext.build_extensions(self)
 
-    def test_build(self, contents, link=True, execute=True, libraries=None,
+    def test_build(self, contents, link=True, execute=False, libraries=None,
                    include_dirs=None, library_dirs=None):
         name = os.path.join(self.build_temp, 'conftest-%s.c' % 
self.conftestidx)
         self.conftestidx += 1
@@ -43,9 +50,6 @@
         print >>thefile, contents
         thefile.close()
 
-        tmpext = Extension('_dummy', [], libraries = libraries)
-        libraries = self.get_libraries(tmpext)
-        
         sys.stdout.flush()
         sys.stderr.flush()
         mystdout = os.dup(1)
@@ -197,6 +201,11 @@
             else:
                 cached = ''
 
+                if not os.path.exists(self.build_temp):
+                    os.makedirs(self.build_temp)
+                outname = os.path.join(self.build_temp, 'conftest3.out')
+                self.ctout = os.open(outname, os.O_RDWR | os.O_CREAT | 
os.O_TRUNC)
+
                 result = []
                 ioctls = ('SIOCGIFCONF',
                           'SIOCGSIZIFCONF',
@@ -275,7 +284,7 @@
                 int main (void) { return 0; }
                 """ % header
 
-                if self.test_build(testrig, link=False, execute=False):
+                if self.test_build(testrig, link=False):
                     result.append(header)
 
         if result:
@@ -309,7 +318,7 @@
             }
             """
 
-            result = self.test_build(testrig, execute=False)
+            result = self.test_build(testrig)
 
         if result:
             print 'yes. %s' % cached
@@ -333,6 +342,11 @@
             else:
                 cached = ''
 
+                if not os.path.exists(self.build_temp):
+                    os.makedirs(self.build_temp)
+                outname = os.path.join(self.build_temp, 'conftest4.out')
+                self.ctout = os.open(outname, os.O_RDWR | os.O_CREAT | 
os.O_TRUNC)
+
                 sockaddrs = ('at', 'ax25', 'dl', 'eon', 'in', 'in6',
                              'inarp', 'ipx', 'iso', 'ns', 'un', 'x25',
                              'rose', 'ash', 'ec', 'll', 'atmpvc', 'atmsvc',
@@ -356,7 +370,7 @@
                                                    in optional_headers]),
                             'sockaddr': sockaddr }
 
-                    if self.test_build(testrig, execute=False):
+                    if self.test_build(testrig):
                         result.append(sockaddr)
                 
             if result:
@@ -381,7 +395,7 @@
     setuptools.command.build_ext.build_ext = my_build_ext
 
 setup (name='netifaces',
-       version='0.6',
+       version=__version__,
        description="Portable network interface information.",
        license="MIT License",
        long_description="""\
@@ -390,8 +404,7 @@
 obtain the addresses of those network interfaces.
 
 The package has been tested on Mac OS X, Windows XP, Windows Vista, Linux
-and Solaris.  On Windows, it is currently not able to retrieve IPv6
-addresses, owing to shortcomings of the Windows API.
+and Solaris.
 
 It should work on other UNIX-like systems provided they implement
 either getifaddrs() or support the SIOCGIFxxx socket options, although the

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to