diff options
| author | Christian Heimes <christian@python.org> | 2022-03-12 00:25:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-11 23:25:14 +0100 |
| commit | ecfff63e06e77e22035a7f7caa26986f033f3aea (patch) | |
| tree | 956166c47566051afd5f2c18bdc56863bc2f477c /Modules | |
| parent | 3b128c054885fe881c3b57a5978de3ea89c81a9c (diff) | |
| download | cpython-git-ecfff63e06e77e22035a7f7caa26986f033f3aea.tar.gz | |
bpo-40280: Disable AF_UNIX, AF_PACKET, SO_REUSE* on Emscripten (#31829)
Emscripten's socket emulation is limited. AF_UNIX, AF_PACKET, setsockopt(), and most SO_* constants are not supported.
Diffstat (limited to 'Modules')
| -rw-r--r-- | Modules/socketmodule.c | 2 | ||||
| -rw-r--r-- | Modules/socketmodule.h | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 3fca9f6851..fbdd1a164d 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -7933,7 +7933,7 @@ PyInit__socket(void) #ifdef IPPROTO_VRRP PyModule_AddIntMacro(m, IPPROTO_VRRP); #endif -#if defined(IPPROTO_SCTP) && !defined(__EMSCRIPTEN__) +#ifdef IPPROTO_SCTP PyModule_AddIntMacro(m, IPPROTO_SCTP); #endif #ifdef IPPROTO_BIP diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index db26c046c3..1b35b11cde 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -192,6 +192,21 @@ typedef int socklen_t; #endif /* HAVE_SOCKADDR_ALG */ +#ifdef __EMSCRIPTEN__ +// wasm32-emscripten sockets only support subset of IPv4 and IPv6. +// SCTP protocol crashes runtime. +#ifdef IPPROTO_SCTP +# undef IPPROTO_SCTP +#endif +// setsockopt() fails with ENOPROTOOPT, getsockopt only supports SO_ERROR. +// undef SO_REUSEADDR and SO_REUSEPORT so they cannot be used. +#ifdef SO_REUSEADDR +# undef SO_REUSEADDR +#endif +#ifdef SO_REUSEPORT +# undef SO_REUSEPORT +#endif +#endif // __EMSCRIPTEN__ #ifndef Py__SOCKET_H #define Py__SOCKET_H |
