Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005398OCamlplatform support (windows, cross-compilation, etc)public2011-11-14 13:572015-12-11 19:07
Assigned Toprotz 
PlatformOSOS Version
Product Version3.12.1 
Target Version4.01.0+devFixed in Version4.00.0+dev 
Summary0005398: Inadequate exception thrown when creating IPv6 socket on win32/msvc
DescriptionUnix.socket Unix.PF_INET6 Unix.SOCK_STREAM 0

fails with the following exception on win32/msvc :
Exception: Unix.Unix_error (EUNKNOWNERR 0, "socket", "")

otherlibs/win32unix/socket.c fails does not deal with PF_INET6 and happily accesses data outside the socket_type_table array.
TagsNo tags attached.
Attached Filespatch file icon pfinet6_nosupport_win32.patch [^] (891 bytes) 2011-11-14 13:58 [Show Content]

- Relationships
child of 0005676closedprotz IPv6 support under Windows 

-  Notes
ripoche (reporter)
2011-11-14 13:58

With this patch applied, the same snippet raises the following exception :
Exception: Unix.Unix_error (Unix.EPFNOSUPPORT, "socket", "")
protz (manager)
2011-12-21 14:22

So this means that OCaml is unable to open PF_INET6 sockets? How complicated would it be to make sure ipv6 sockets are supported on win32? You mention requiring Winsocks2, is that a difficult requirement to match?
ripoche (reporter)
2011-12-21 14:52
edited on: 2011-12-21 15:00

There are 2 issues with the current implementation:
* trying to create an IPv6 socket makes an out-of-bound access in
* PF_INET6 is only defined in WinSock2.h which is incompatible with WinSock.h.

I did a quick port to WinSock2 while investigating bug 0005416 to rule out issues that could stem from mixing WinSock 1 and 2. It did compile and run fine and as a nice bonus simplified a few files (socket.c and accept.c).

Note that I didn't run any extensive checks and never tried to create an IPv6 socket with the patch applied (it's not installed on my XP box anyway). I also reverted the patch to complete the investigation on bug 0005416.

xleroy (administrator)
2012-01-19 20:25

I agree the patch should be applied ASAP, to avoid the out-of-bound access.

As concerns switching to WinSock2: it's something to be considered. What is the oldest version of Windows that supports WinSock2?
ripoche (reporter)
2012-01-23 15:31

From what I gathered, the early bundled versions of Winsock2 were available starting with Win98.

According to the MSDN, the full feature set is available starting with Win2K ( [^]).
protz (manager)
2012-01-30 17:09

Applied both on trunk and on branch as r12104 and r12105

I would be happy to review and try a patch that transitions all the code to winsocks2.
ripoche (reporter)
2012-01-30 17:59

Would a patch based on the official 3.12.1 release be ok ?
protz (manager)
2012-01-30 18:42

I don't think we want such a major change to land on a release branch. 3.12.x releases are supposed to be bugfix-only releases; there is a big potential for regressions, so I do believe it's best to apply this to trunk and let it bake for a little while :)
doligez (administrator)
2012-07-10 13:47

As far as I can tell, the bug reported above is now fixed, and we are considering switching to winsock2 and supporting IPv6. If that is correct, someone please set the target version to 4.01 (protz?).
protz (manager)
2012-07-10 16:56

Ok, so I just discussed this with Damien, and supporting AF_INET6 is indeed something we want to do. However, we chose not to do it for the upcoming 4.00.0 release, since the potential for breakage seems rather high.
protz (manager)
2012-07-10 16:57

I'm marking this as resolved, since the parent report already has a patch. We'll do the upgrade to Winsock 2 in PR#5676, and this will bug will remain about the invalid AF_INET6 parameter on Windows.

- Issue History
Date Modified Username Field Change
2011-11-14 13:57 ripoche New Issue
2011-11-14 13:58 ripoche Note Added: 0006201
2011-11-14 13:58 ripoche File Added: pfinet6_nosupport_win32.patch
2011-12-21 14:22 protz Note Added: 0006445
2011-12-21 14:52 ripoche Note Added: 0006454
2011-12-21 15:00 ripoche Note Edited: 0006454 View Revisions
2012-01-19 20:25 xleroy Note Added: 0006737
2012-01-19 20:25 xleroy Status new => confirmed
2012-01-23 15:31 ripoche Note Added: 0006778
2012-01-30 17:09 protz Note Added: 0006848
2012-01-30 17:09 protz Assigned To => protz
2012-01-30 17:09 protz Status confirmed => acknowledged
2012-01-30 17:59 ripoche Note Added: 0006850
2012-01-30 18:42 protz Note Added: 0006851
2012-07-10 13:47 doligez Note Added: 0007678
2012-07-10 13:47 doligez Target Version => 4.00.0+dev
2012-07-10 16:56 protz Note Added: 0007689
2012-07-10 16:56 protz Status acknowledged => assigned
2012-07-10 16:56 protz Category OCaml general => OCaml windows
2012-07-10 16:56 protz Target Version 4.00.0+dev => 4.01.0+dev
2012-07-10 16:56 protz Relationship added child of 0005676
2012-07-10 16:57 protz Note Added: 0007690
2012-07-10 16:57 protz Status assigned => resolved
2012-07-10 16:57 protz Fixed in Version => 4.00.0+dev
2012-07-10 16:57 protz Resolution open => fixed
2015-12-11 19:07 xleroy Status resolved => closed
2017-02-23 16:46 doligez Category OCaml windows => platform support (windows, etc)
2017-02-23 17:16 doligez Category platform support (windows, etc) => platform support (windows, cross-compilation, etc)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker