Skip to content

Commit 3fdcf7b

Browse files
KrayzeeKevdanielleadams
authored andcommitted
test: assume priv ports start at 1024 if it can't be changed
An update to test/parallel/test-cluster-bind-privileged-port.js checks the lowest privileged port to ensure 42 is privileged This only works on kernels > 4.1. On older kernels, this is locked at 1024 so the check is not needed. Fixes: #45838 PR-URL: #46536 Reviewed-By: Luigi Pinca <[email protected]>
1 parent 73be4f8 commit 3fdcf7b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/parallel/test-cluster-bind-privileged-port.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ const net = require('net');
2727
const { readFileSync } = require('fs');
2828

2929
if (common.isLinux) {
30-
const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
31-
if (unprivilegedPortStart <= 42) {
32-
common.skip('Port 42 is unprivileged');
30+
try {
31+
const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
32+
if (unprivilegedPortStart <= 42) {
33+
common.skip('Port 42 is unprivileged');
34+
}
35+
} catch {
36+
// Do nothing, feature doesn't exist, minimum is 1024 so 42 is usable.
37+
// Continue...
3338
}
3439
}
3540

0 commit comments

Comments
 (0)