http://bugs.winehq.org/show_bug.cgi?id=20368
Summary: sockaddr_in6 wrong size; causes chromium's net_unittests HostResolverImplTest.NumericIPv6Address test case to fail Product: Wine Version: 1.1.31 Platform: PC OS/Version: Linux Status: NEW Keywords: download, source, testcase Severity: normal Priority: P2 Component: winsock AssignedTo: wine-bugs@winehq.org ReportedBy: dank@kegel.com
Running chromium's base_unittests.exe fails all over the place unless it can find the source tree, but even if you put the source tree where it wants it, it fails various tests. The first one in the list is HostResolverImplTest.NumericIPv6Address which fails with [11:71:1014/112257:84976129:FATAL:address_list.cc(76)] Check failed: sizeof(sockaddr_in6) == info->ai_addrlen (28 vs. 24)
Here's the failing bit of the testcase, extracted into a nearly plain C program:
#undef NDEBUG #include <ws2tcpip.h> #include <stdio.h> #include <assert.h> #pragma comment(lib, "ws2_32.lib") int main(int argc, char **argv) { WSADATA wsaData; int err; struct addrinfo *ai = NULL; struct addrinfo hints; err = WSAStartup(MAKEWORD(2, 2), &wsaData); assert(err == 0); ZeroMemory( &hints, sizeof(hints) ); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; err = getaddrinfo("2001:db8::1", "10000", &hints, &ai); assert(err == 0); assert(ai->ai_addrlen == sizeof(struct sockaddr_in6)); freeaddrinfo(ai); WSACleanup(); return 0; } Compiled on Windows, this succeeds on Windows but fails on Wine.
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #1 from Dan Kegel dank@kegel.com 2009-10-14 14:24:54 --- Created an attachment (id=24130) --> (http://bugs.winehq.org/attachment.cgi?id=24130) Compiled test case. Aborts on Wine.
http://bugs.winehq.org/show_bug.cgi?id=20368
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #2 from Juan Lang juan_lang@yahoo.com 2009-10-15 11:41:49 --- (In reply to comment #0)
[11:71:1014/112257:84976129:FATAL:address_list.cc(76)] Check failed: sizeof(sockaddr_in6) == info->ai_addrlen (28 vs. 24)
It's not clear from this which one it is expected to be, 24 or 28. 24 is possible for struct sockaddr_in6 on Windows if it's compiled a certain way with MS headers, I believe, as this is the size of struct sockaddr_in6_old (see ws2ipdef.h). 24 is also a possible size for struct sockaddr_in6 on *ix, see in configure.ac: dnl Check for sin6_scope_id AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
It's a bug in either case, but I'm curious where it lies. Could you look at config.log to see whether your struct sockaddr_in6 has a sin6_scope_id?
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #3 from Juan Lang juan_lang@yahoo.com 2009-10-15 22:35:40 --- This fails to start for me on Vista too, btw, complaining about the assembly.
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #4 from Juan Lang juan_lang@yahoo.com 2009-10-16 13:37:19 --- Okay, I just tried it myself and it fails on Wine. My config.log shows that struct sockaddr_in6 has the sin6_scope_id field, and sizeof(struct sockaddr_in6) == 28 in Linux. Therefore, the app is compiled not to expect the scope id field.
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #5 from Juan Lang juan_lang@yahoo.com 2009-10-16 16:09:55 --- What's odd is that sizeof(struct sockaddr_in6) on Wine, compiled with our own headers, is also 28. So the question is, how is winsock supposed to know the size the app was compiled with? I suspect this bug may well be invalid. What systems have you tried it on?
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #6 from Dan Kegel dank@kegel.com 2009-10-16 16:45:16 --- The test was compiled on vista home with vs 2008 express, nothing special.
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #7 from Juan Lang juan_lang@yahoo.com 2009-10-16 17:44:28 --- Well, it doesn't run for me on Windows XP SP3, either, so I think this test is invalid.
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #8 from Juan Lang juan_lang@yahoo.com 2009-10-16 17:54:13 --- Oh, right, it fails on XP because I don't have IPv6 enabled. At least the first assert needs to be changed to an if. I modified it to check the size of sockaddr_in6, and it's 28 on XP.
So, I *believe* this is invalid. I'll upload my own compiled version in a sec. It fails for me on XP because getaddrinfo fails, but I'll have another look with Wine.
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #9 from Juan Lang juan_lang@yahoo.com 2009-10-16 17:56:10 --- Created an attachment (id=24175) --> (http://bugs.winehq.org/attachment.cgi?id=24175) Another compiled version
Compiled with VS2008 express. I also added a couple printfs to the source: printf("sizeof(struct sockaddr_in6) = %d\n", sizeof(struct sockaddr_in6)); and: printf("ai_addrlen = %d\n", ai->ai_addrlen); The second is never reached on WinXP because of lacking IPv6 support, but the first prints out: sizeof(struct sockaddr_in6) = 28
http://bugs.winehq.org/show_bug.cgi?id=20368
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #24175|0 |1 is obsolete| |
--- Comment #10 from Juan Lang juan_lang@yahoo.com 2009-10-16 18:48:43 --- Created an attachment (id=24176) --> (http://bugs.winehq.org/attachment.cgi?id=24176) Another compiled version (release build)
Oops, the last one was a debug build, which wouldn't run on Wine. The attached release build does, providing you run 'winetricks vcrun2008' first. This one produces the following output for me under Wine:
sizeof(struct sockaddr_in6) = 28 ai_addrlen = 24
I finally understand the issue: sizeof(struct sockaddr_in6) is 28, that is, it includes the scope_id, yet getaddrinfo is returning an address of size 24, even though sizeof(struct sockaddr_in6) is 28 on my Linux system too.
This bug is valid, pardon my noise from earlier.
http://bugs.winehq.org/show_bug.cgi?id=20368
--- Comment #11 from Juan Lang juan_lang@yahoo.com 2009-10-16 18:59:45 --- Patch sent: http://www.winehq.org/pipermail/wine-patches/2009-October/080114.html
Like the existing socket.c code, the app will still fail when run on systems that don't have a sin6_scope_id field as part of struct sockaddr_in6. I'm not sure whether this is incorrect, and a default scope id should be returned, or if the chromium test is invalid. I'll defer that because it appears to be a corner case anyway.
http://bugs.winehq.org/show_bug.cgi?id=20368
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #12 from Juan Lang juan_lang@yahoo.com 2009-10-19 09:59:29 --- Fixed by commit d1963ee2f19c931cbd6d7c039081440d08cb9011.
http://bugs.winehq.org/show_bug.cgi?id=20368
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #13 from Alexandre Julliard julliard@winehq.org 2009-10-23 13:19:39 --- Closing bugs fixed in 1.1.32.