Skip to content

Commit

Permalink
Merge pull request #10185 from MisterDA/windows-ipv6
Browse files Browse the repository at this point in the history
Consider that IPv6 is always enabled in Windows code
  • Loading branch information
dra27 committed Feb 10, 2021
2 parents a0f1c39 + b9b7b12 commit 3813e7d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ Working version
directory.
(Nicolás Ojeda Bär, review by Gabriel Scherer and Xavier Leroy)

- #10185: Consider that IPv6 is always enabled on Windows.
(Antonin Décimo, review by David Allsopp and Xavier Leroy)

### Tools:

- #10139: Remove confusing navigation bar from stdlib documentation.
Expand Down
4 changes: 2 additions & 2 deletions otherlibs/unix/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ int socket_domain_table[] = {
PF_UNIX, PF_INET,
#if defined(HAS_IPV6)
PF_INET6
#elif defined(PF_UNDEF)
PF_UNDEF
#elif defined(PF_UNSPEC)
PF_UNSPEC
#else
0
#endif
Expand Down
15 changes: 1 addition & 14 deletions otherlibs/win32unix/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
#include "unixsupport.h"

int socket_domain_table[] = {
PF_UNIX, PF_INET,
#if defined(HAS_IPV6)
PF_INET6
#else
0
#endif
PF_UNIX, PF_INET, PF_INET6
};

int socket_type_table[] = {
Expand All @@ -33,14 +28,6 @@ CAMLprim value unix_socket(value cloexec, value domain, value type, value proto)
{
SOCKET s;

#ifndef HAS_IPV6
/* IPv6 requires WinSock2, we must raise an error on PF_INET6 */
if (Int_val(domain) >= sizeof(socket_domain_table)/sizeof(int)) {
win32_maperr(WSAEPFNOSUPPORT);
uerror("socket", Nothing);
}
#endif

s = socket(socket_domain_table[Int_val(domain)],
socket_type_table[Int_val(type)],
Int_val(proto));
Expand Down
2 changes: 0 additions & 2 deletions otherlibs/win32unix/unixsupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
#include <process.h>
#include <sys/types.h>
#include <winsock2.h>
#ifdef HAS_IPV6
#include <ws2tcpip.h>
#include <wspiapi.h>
#endif

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit 3813e7d

Please sign in to comment.