-
Notifications
You must be signed in to change notification settings - Fork 185
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
socket raises exception (un)setting IPv6Only #180
Comments
@kazu-yamamoto By the way, (the C equivalent of) the above example is in the iputils ping6 implementation:
|
I don't think it is wise to ignore errors. |
I agree with Kazu. Unconditionally ignoring all errors is not a good idea. |
I would like to change the code like this:
Is there any way to check Vista or later? |
Why |
I also agree that ignoring errors is a bad idea. I have updated the pull request with code like Kazu's: I guess that simply removing the |
In the current pull request, it seems to me that |
I think that closing a socket on errors is a good idea. |
That is my mistake; thank you for catching it! I now better understand the reasoning behind this code. The It is indeed strange if I am unable to find a flag that could be used to indicate the Windows version. (GHC documentation) In my pull request, I am reverting to error suppression for Windows, as I assume that it was there for a reason and am unable to test it myself. I also added an |
LGTM. @tibbe Let's merge this. |
Pinging @tibbe |
In Network.Socket:socket, the
IPv6Only
socket option is set to0
so that both IPv4 and IPv6 can be handled with one socket, when the address family isAF_INET6
. This is not always desired, and some parameters cause an exception to be raised.For example, ICMPv6 (protocol number 58) is a protocol that is specifically for IPv6. The issue can be reproduced in GHCi on Linux as follows:
The code already suppresses
setSocketOption
errors on Windows platforms. A simple fix would be to do so on all platforms, and I am preparing a pull request for this. Personally, I feel that it would be preferable to not set the option insocket
, especially since its appropriateness is application-specific and will likely change as IPv4 becomes less prominent.The text was updated successfully, but these errors were encountered: