Currently, when IPv6 is disabled by the kernel, attempting to use the 'WebRequest' API with .NET native causes a crash. This can be recreated using the following gist: https://gist.github.com/redmcg/7d81ef833c77bee6965b5f441006f697
This patch fixes the crash by returning WSAEAFNOSUPPORT, as expected by .NET. See: https://referencesource.microsoft.com/#System/net/System/Net/Sockets/Socket....
Signed-off-by: Brendan McGrath brendan@redmandi.com ---
Changes since v2: - Add the 'Signed-off-by' tag
dlls/ws2_32/socket.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index df068fe8527..956ead2e9d5 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -7646,6 +7646,8 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol, /* invalid combination of valid parameters, like SOCK_STREAM + IPPROTO_UDP */ if (err == WSAEINVAL) err = WSAESOCKTNOSUPPORT; + else if (err == WSAEOPNOTSUPP && (unixaf == AF_INET || unixaf == AF_INET6)) + err = WSAEAFNOSUPPORT; else if (err == WSAEOPNOTSUPP) err = WSAEPROTONOSUPPORT; }