Repository navigation
test: check net.ipv4.ip_unprivileged_port_start in parallel/test-cluster-bind-privileged-port #45838
Description
Activity
- addedtestIssues and PRs related to Node.js core tests and test infrastructure.Issues and PRs related to Node.js core tests and test infrastructure.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.linuxIssues and PRs related to the Linux platform.Issues and PRs related to the Linux platform.
on Dec 13, 2022 $ sysctl net.ipv4.ip_unprivileged_port_start net.ipv4.ip_unprivileged_port_start = 1024Here's the output for me on Ubuntu 22.04.1
Yes, that's the default (and traditional UNIX behavior.) The test starts failing when it's <= 42.
So, you're saying the test should be modified to check the range of reserved ports on the current system, rather than assuming that it will always be 42?
The test should bail out with
common.skip('...')if port 42 is unprivileged, yes.Can I take a try at this? I would write a function to find the first unprivileged port and then try to attach a process to the port just before the first unprivileged port. Then basically the same checks as before (making sure the exit code is 0, etc) Is this implementation fine?
@bnoordhuisGo for it but I'd rather it just exits if port 42 is unprivileged. Principle of least surprise and all that.
That makes sense, I'll send in a PR in some time!
@bnoordhuis PTAL.
Please ignore the second PR, I think it got added due to me changing branches locally and pushing.
Can you link me to your PR? I can't find it for some reason.
@bnoordhuis I messed up my Git locally and had to create a new PR. I hope you can see it now?
- added a commit that references this issue
on Jan 18, 2023 - added a commit that references this issue
on Jan 20, 2023 - added 2 commits that reference this issue
on Jan 26, 2023 This "fix" has meant that the test suite can not run on Linux kernels < 4.1 because that sysctl feature does not exist.
I'm building for CentOS 7 which is kernel 3.10 - And the reason I'm building is that the official build moved to RHEL 8. NodeJS itself does not need this kernel feature, only the guard case in the test.
I'm going to work on a fix for this that assumed that the priv port limit is 1024 if that sysctl fails (which seems like a reasonable presumption)I've put in the above PR #46536 - to fix v18 as well, do I just do another branch with a
-t upstream/v18.x?- added a commit that references this issue
on Mar 2, 2023 - added 2 commits that reference this issue
on Mar 13, 2023 - added a commit that references this issue
on Apr 11, 2023 - added 2 commits that reference this issue
on May 5, 2024
test/parallel/test-cluster-bind-privileged-port.jsexpects binding to port 42 to fail but that's not an always-correct assumption.Check the output of
sysctl net.ipv4.ip_unprivileged_port_startbecause it's possible (albeit unlikely) for that port to be unprivileged.Example output: