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

Added IpBindAddressNoPort sockopt #2244

Merged
merged 1 commit into from
Dec 2, 2023

Conversation

xonatius
Copy link
Contributor

@xonatius xonatius commented Dec 2, 2023

From man page:

IP_BIND_ADDRESS_NO_PORT (since Linux 4.2)
       Inform the kernel to not reserve an ephemeral port when
       using bind(2) with a port number of 0.  The port will
       later be automatically chosen at connect(2) time, in a way
       that allows sharing a source port as long as the 4-tuple
       is unique.

What does this PR do

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@xonatius xonatius force-pushed the ip_bind_address_no_port branch 2 times, most recently from 985c0f5 to 0b85f8e Compare December 2, 2023 09:24
Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should enable this for Android, too.

@xonatius
Copy link
Contributor Author

xonatius commented Dec 2, 2023

You should enable this for Android, too.

ah, didn't realize that linux doesn't include android. Fixed!

From [man page](https://man7.org/linux/man-pages/man7/ip.7.html):
```
IP_BIND_ADDRESS_NO_PORT (since Linux 4.2)
       Inform the kernel to not reserve an ephemeral port when
       using bind(2) with a port number of 0.  The port will
       later be automatically chosen at connect(2) time, in a way
       that allows sharing a source port as long as the 4-tuple
       is unique.
```
@asomers asomers added this pull request to the merge queue Dec 2, 2023
Merged via the queue into nix-rust:master with commit 3b1ae36 Dec 2, 2023
34 checks passed
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.

None yet

2 participants