Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stdlib::Port should (probably) not allow 0 #1394

Open
Geod24 opened this issue Sep 8, 2023 · 1 comment
Open

Stdlib::Port should (probably) not allow 0 #1394

Geod24 opened this issue Sep 8, 2023 · 1 comment

Comments

@Geod24
Copy link
Contributor

Geod24 commented Sep 8, 2023

Describe the Bug

README description of Stdlib::Port:
Matches a valid TCP/UDP Port number.
Port 0 is reserved for both TCP and UDP and most implementations will reject it. It is now used when binding to tell the kernel to find an available port. Hence, configurations that are pedantic will want to disable it to avoid misconfiguration.

Expected Behavior

Either the description should say "any TCP/UDP port" and there is a type to represent valid port numbers (Interger[1, 65535]) or the lower bound is changed from 0 to 1. The latter change should apply to any derived type too.

Additional Context

Technically (by the original RFC), port 0 was reserved, but the behavior it now has when calling bind makes allowing the value slightly dangerous: https://www.rfc-editor.org/rfc/rfc1340#page-7

@ekohl
Copy link
Collaborator

ekohl commented Nov 16, 2023

Technically I agree this is unlikely to happen for users. Changing this would be a backwards incompatible change though. If you submit a PR, I think it could be merged when the next major version bump is being prepared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants