Skip to content

Set IP_BIND_ADDRESS_NO_PORT on outbound tcp sockets #668

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

Merged
merged 1 commit into from
Jul 4, 2022
Merged

Set IP_BIND_ADDRESS_NO_PORT on outbound tcp sockets #668

merged 1 commit into from
Jul 4, 2022

Conversation

crrodriguez
Copy link
Contributor

When bound to a local address the kernel does not know if the socket
will listen() or connect() and must reserve a port inmediately after
bind() effectively limiting the random port range to ~32k.
when IP_BIND_ADDRESS_NO_PORT is set, the kernel delays source port
allocation until the time the complete 4-tuple is known allowing
a much larger number of combinations

When bound to a local address the kernel does not know if the socket
will listen() or connect() and must reserve a port inmediately after
bind() effectively limiting the random port range to ~32k.
when IP_BIND_ADDRESS_NO_PORT is set, the kernel delays source port
allocation until the time the complete 4-tuple is known allowing
a much larger number of combinations
gthess added a commit that referenced this pull request Jul 4, 2022
@gthess gthess merged commit 0f4c4c1 into NLnetLabs:master Jul 4, 2022
@gthess gthess self-assigned this Jul 4, 2022
@gthess
Copy link
Member

gthess commented Jul 4, 2022

Thanks for this! I relocated and made the code more portable.

@crrodriguez crrodriguez deleted the IP_BIND_ADDRESS_NO_PORT branch July 4, 2022 14:23
@crrodriguez
Copy link
Contributor Author

Thanks for this! I relocated and made the code more portable.

ok, I noticed the code already needs c99 so i didnt bothered with the c89 version.

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

Successfully merging this pull request may close these issues.

2 participants