Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPV6_V6ONLY not recognized on Windows #31

Closed
CetinSert opened this issue Apr 18, 2012 · 16 comments
Closed

IPV6_V6ONLY not recognized on Windows #31

CetinSert opened this issue Apr 18, 2012 · 16 comments

Comments

@CetinSert
Copy link

https://msdn.microsoft.com/en-us/library/windows/desktop/ms738574(v=vs.85).aspx claims a same named option is actually exported on Windows but the configure script of the network package fails to recognize this and defines HAVE_DECL_IPV6_V6ONLY 0.

@hreinhardt
Copy link
Contributor

This seems to be a bug in MingW, which doesn't define the IPV6_V6ONLY constant. Apparently there had been a patch submitted to fix this in 2008, but it was rejected due to licensing reasons: https://sourceforge.net/tracker/?func=detail&atid=302435&aid=2035902&group_id=2435

I guess we could try to build a workaround into the network library if this is an important issue to you,

@CetinSert
Copy link
Author

(Very high quality answer. I was expecting I would first be asked to post all sorts of intricate details and excerpts before someone got to say anything on the matter.)

As I see no other way on Windows to have a single listening socket accept both IPv4 and IPv6 connections, I do believe it is a very important issue for me. If there is any other way to accept both IPv4 and IPv6 connections at the same port, I might use it as a temporary solution waiting for the workaround in the network library.

@hreinhardt
Copy link
Contributor

I've created and pushed a patch to my repo: https://github.com/hreinhardt/network

To test it you have to:

  • clone my repository
  • switch to the 'stable' branch
  • run 'autoreconf' (which is included with MSys/MingW)
  • run 'cabal install'

@CetinSert
Copy link
Author

I just had time to test this and can confirm that it is working and leads to the expected behavior of being able to handle both IPv4 and IPv6 using a single socket.

What is the chance this ends up in network-2.3.0.12 or above? Is there anything I can do on my end to make sure that it does? How did you know the socket option value of IPV6_V6ONLY to be 27?

@hreinhardt
Copy link
Contributor

I've created a pull request so if Johan is happy with the patch, he will probably merge it in a few days.

(I got the socket option number 27 from the SourceForge page I linked to above)

@tibbe
Copy link
Member

tibbe commented Apr 23, 2012

Fixed in d646278 and f68a808. Released as v.2.3.0.12

@tibbe tibbe closed this as completed Apr 23, 2012
@CetinSert
Copy link
Author

2.3.0.12 fails to build on Windows due to catchIOError not being in scope:

checking whether IPV6_V6ONLY is declared... yes
checking for sendfile in sys/sendfile.h... no
checking for sendfile in sys/socket.h... no
checking for gethostent... no
configure: creating ./config.status
config.status: creating network.buildinfo
config.status: creating include/HsNetworkConfig.h
Preprocessing library network-2.3.0.12...
Preprocessing test suites for network-2.3.0.12...
Building network-2.3.0.12...
[1 of 8] Compiling Network.URI      ( Network\URI.hs, dist\build\Network\URI.o )
[2 of 8] Compiling Network.Socket.ByteString.Internal ( Network\Socket\ByteString\Internal.hs, dist\build\Network\Socket\ByteString\Internal.o )
[3 of 8] Compiling Network.Socket.Internal ( dist\build\Network\Socket\Internal.hs, dist\build\Network\Socket\Internal.o )

Network\Socket\Internal.hsc:81:1:
    Warning: Module `GHC.IOBase' is deprecated: use GHC.IO instead
[4 of 8] Compiling Network.Socket   ( dist\build\Network\Socket.hs, dist\build\Network\Socket.o )

Network\Socket.hsc:431:13: Not in scope: `catchIOError'
cabal: Error: some packages failed to install:
network-2.3.0.12 failed during the building phase. The exception was:
ExitFailure 1

@tibbe
Copy link
Member

tibbe commented Apr 23, 2012

Gah! We need a Windows build bot! Anyone feel like setting one up? In the mean time I'll fix this.

@tibbe
Copy link
Member

tibbe commented Apr 23, 2012

@CetinSert Fixed on the stable branch. If you test it I'll make another release.

@CetinSert
Copy link
Author

@tibbe I already have a Windows server I use for testing software. I am also meaning to set up build bots for Haskell projects targeting Windows, Linux and FreeBSD. Is there any build automation software already used by others on other operating systems?

@tibbe
Copy link
Member

tibbe commented Apr 23, 2012

@CetinSert I build all my packages on the latest 3 versions of GHC on my Linux buildbot at https://ci.johantibell.com/ using Jenkins CI.

@CetinSert
Copy link
Author

@tibbe Your fix 87c3baa came a bit too hasty, I was analyzing a possible fix here: #34.

What needs to be done now:

  1. Revert 87c3baa: System.IO.Error was already imported wholly further up the same file.
  2. Rename catchIOError to catch: catchIOError is only availabe in base >= 4.4.0; using catch satisfies the whole dependency range on base >= 3 && < 4.6 without any warnings.

Sorry for being a bit late with #34 causing 87c3baa and not knowing git enough to send pull requests ^_^". Thank you for your patience with this fix.

@CetinSert
Copy link
Author

@tibbe Jenkins seems to support all systems I can support today and even Mac OS X. Thanks a lot for your tip!

@tibbe
Copy link
Member

tibbe commented Apr 24, 2012

@CetinSert Try now.

@CetinSert
Copy link
Author

@tibbe Builds and works without any hiccups! Tested with GHC 7.4 + base-4.5.0.0 and GHC 7 + base-4.3.1.0 from Haskell Platform for Windows 2011.4.0.0.

@tibbe
Copy link
Member

tibbe commented Apr 24, 2012

2.3.0.13 uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants