From d8f15d5bef17685ec5205828a69b83ee46635763 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <238531+indutny@users.noreply.github.com> Date: Tue, 30 May 2023 16:35:06 -0700 Subject: [PATCH] net: fix address iteration with autoSelectFamily MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When `autoSelectFamily` is set to `true`, `net.connect` is supposed to try connecting to both IPv4 and IPv6, interleaving the address types. Instead, it appears that the array that holds the addresses in the order they should be attempted was never used after being populated. PR-URL: https://github.com/nodejs/node/pull/48258 Backport-PR-URL: https://github.com/nodejs/node/pull/48275 Reviewed-By: Paolo Insogna Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca Reviewed-By: Juan José Arboleda --- lib/net.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index 62cecc61d2a70e..c79e4c1bbe6f36 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1412,7 +1412,7 @@ function lookupAndConnectMultiple(self, async_id_symbol, lookup, host, options, const context = { socket: self, - addresses, + addresses: toAttempt, current: 0, port, localPort,