From 31652ab97f103692a3b70b385d54d0ae8e9a3c30 Mon Sep 17 00:00:00 2001 From: Abdirahim Musse <33973272+abmusse@users.noreply.github.com> Date: Wed, 8 Mar 2023 12:51:39 -0600 Subject: [PATCH 1/3] test: fallback to IPv4 if IPv6 is unavailable openssl seems to default to use IPv6. This change adds a checks if IPv6 is unavailable and uses IPv4 instead. On the Node.js CI IBM i build system IPv6 is currently disabled. This change should resolve the following test case failures: - https://ci.nodejs.org/job/node-test-commit-ibmi/nodes=ibmi73-ppc64/1085/testReport/(root)/test/sequential_test_tls_psk_client_/ - https://ci.nodejs.org/job/node-test-commit-ibmi/nodes=ibmi73-ppc64/1085/testReport/(root)/test/sequential_test_tls_securepair_client_/ --- test/sequential/test-tls-psk-client.js | 2 ++ test/sequential/test-tls-securepair-client.js | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/sequential/test-tls-psk-client.js b/test/sequential/test-tls-psk-client.js index cb15acd01fcccb..8b0585ff739a19 100644 --- a/test/sequential/test-tls-psk-client.js +++ b/test/sequential/test-tls-psk-client.js @@ -14,6 +14,7 @@ const { spawn } = require('child_process'); const CIPHERS = 'PSK+HIGH'; const KEY = 'd731ef57be09e5204f0b205b60627028'; const IDENTITY = 'Client_identity'; // Hardcoded by `openssl s_server` +const useIPv4 = common.hasIPv6 ? false : true; const server = spawn(common.opensslCli, [ 's_server', @@ -23,6 +24,7 @@ const server = spawn(common.opensslCli, [ '-psk_hint', IDENTITY, '-nocert', '-rev', + ...(useIPv4 ? ['-4'] : []), ], { encoding: 'utf8' }); let serverErr = ''; let serverOut = ''; diff --git a/test/sequential/test-tls-securepair-client.js b/test/sequential/test-tls-securepair-client.js index c9215c43ad6ddb..a376bebb738e65 100644 --- a/test/sequential/test-tls-securepair-client.js +++ b/test/sequential/test-tls-securepair-client.js @@ -38,6 +38,8 @@ const fixtures = require('../common/fixtures'); const tls = require('tls'); const spawn = require('child_process').spawn; +const useIPv4 = common.hasIPv6 ? false : true; + test1(); // simple/test-tls-securepair-client @@ -64,7 +66,9 @@ function test(keyPath, certPath, check, next) { const server = spawn(common.opensslCli, ['s_server', '-accept', 0, '-cert', fixtures.path(certPath), - '-key', fixtures.path(keyPath)]); + '-key', fixtures.path(keyPath), + ...(useIPv4 ? ['-4'] : []), + ]); server.stdout.pipe(process.stdout); server.stderr.pipe(process.stdout); From 534765f82ca4ec19f05edeb75e00b76aab7903f8 Mon Sep 17 00:00:00 2001 From: Abdirahim Musse <33973272+abmusse@users.noreply.github.com> Date: Thu, 9 Mar 2023 09:35:56 -0600 Subject: [PATCH 2/3] fixup! test: fallback to IPv4 if IPv6 is unavailable Co-authored-by: Mohammed Keyvanzadeh --- test/sequential/test-tls-psk-client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-tls-psk-client.js b/test/sequential/test-tls-psk-client.js index 8b0585ff739a19..ddebc8f8cc9807 100644 --- a/test/sequential/test-tls-psk-client.js +++ b/test/sequential/test-tls-psk-client.js @@ -14,7 +14,7 @@ const { spawn } = require('child_process'); const CIPHERS = 'PSK+HIGH'; const KEY = 'd731ef57be09e5204f0b205b60627028'; const IDENTITY = 'Client_identity'; // Hardcoded by `openssl s_server` -const useIPv4 = common.hasIPv6 ? false : true; +const useIPv4 = !common.hasIPv6; const server = spawn(common.opensslCli, [ 's_server', From cd34ba35b7626a9e4c2450f107204ed75d7d3a52 Mon Sep 17 00:00:00 2001 From: Abdirahim Musse <33973272+abmusse@users.noreply.github.com> Date: Thu, 9 Mar 2023 09:36:23 -0600 Subject: [PATCH 3/3] fixup! fixup! test: fallback to IPv4 if IPv6 is unavailable Co-authored-by: Mohammed Keyvanzadeh --- test/sequential/test-tls-securepair-client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sequential/test-tls-securepair-client.js b/test/sequential/test-tls-securepair-client.js index a376bebb738e65..f3ca42ad6edfb0 100644 --- a/test/sequential/test-tls-securepair-client.js +++ b/test/sequential/test-tls-securepair-client.js @@ -38,7 +38,7 @@ const fixtures = require('../common/fixtures'); const tls = require('tls'); const spawn = require('child_process').spawn; -const useIPv4 = common.hasIPv6 ? false : true; +const useIPv4 = !common.hasIPv6; test1();