ports/lang/node/patches/patch-lib_net_js

42 lines
1.3 KiB
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
- If an address is not specified, for the "any address" bind,
node was trying to bind to v6 out of preference and dropping back
to v4 if that fails.
OpenBSD doesn't permit v4 connections to sockets bound to a v6
address, change to binding to v4 for "any address" so this is a
better match for typical expectations.
(Ideally it would create two separate binds to 0.0.0.0 and ::
for "any address" but that's not really a straightforward change).
Index: lib/net.js
--- lib/net.js.orig
+++ lib/net.js
2023-08-18 18:38:43 +00:00
@@ -1713,22 +1713,12 @@ function setupListenHandle(address, port, addressType,
2023-08-16 22:26:55 +00:00
let rval = null;
- // Try to bind to the unspecified IPv6 address, see if IPv6 is available
if (!address && typeof fd !== 'number') {
- rval = createServerHandle(DEFAULT_IPV6_ADDR, port, 6, fd, flags);
-
- if (typeof rval === 'number') {
- rval = null;
- address = DEFAULT_IPV4_ADDR;
- addressType = 4;
- } else {
- address = DEFAULT_IPV6_ADDR;
- addressType = 6;
- }
+ address = DEFAULT_IPV4_ADDR;
+ addressType = 4;
}
- if (rval === null)
- rval = createServerHandle(address, port, addressType, fd, flags);
+ rval = createServerHandle(address, port, addressType, fd, flags);
if (typeof rval === 'number') {
const error = uvExceptionWithHostPort(rval, 'listen', address, port);