http://bugs.winehq.org/show_bug.cgi?id=6767
Summary: failure enumerating interfaces on NetBSD Product: Wine Version: 0.9.25. Platform: PC OS/Version: NetBSD Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-net AssignedTo: wine-bugs@winehq.org ReportedBy: jmmikkel@mit.edu
I'm running wine on NetBSD 4-BETA. I am getting the following error:
err:winsock:WSAIoctl Unable to get interface table!
I traced this down to dlls/iphlpapi/ifenum.c. The enumIPAddresses() function uses the SIOCGIFCONF ioctl to get a list of interfaces on the system. It has the comment "there is no way to know the interface count beforehand, so we need to loop ... until returned < max". Unfortunately the algorithm is failing because the ioctl is returning the _required_ length in ifc_len, even when that is larger than the provided buffer.
So on NetBSD there actually is a way to know how much to allocate, but I figure there might have to be a special configure test written just for this. A simpler solution that fixed my problem and I think will work in general:
--- ifenum.c~ 2006-11-10 11:32:16.000000000 -0500 +++ ifenum.c 2006-11-24 21:40:36.000000000 -0500 @@ -690,7 +690,7 @@ ifc->ifc_buf = HeapAlloc(GetProcessHeap(), 0, ifc->ifc_len); ioctlRet = ioctl(fd, SIOCGIFCONF, ifc); } while (ioctlRet == 0 && - ifc->ifc_len == (sizeof(struct ifreq) * guessedNumAddresses)); + ifc->ifc_len >= (sizeof(struct ifreq) * guessedNumAddresses));
if (ioctlRet == 0) { ifPtr = ifc->ifc_buf;