Skip to content

Added IpBindAddressNoPort sockopt#2244

Merged
asomers merged 1 commit intonix-rust:masterfrom
xonatius:ip_bind_address_no_port
Dec 2, 2023
Merged

Added IpBindAddressNoPort sockopt#2244
asomers merged 1 commit intonix-rust:masterfrom
xonatius:ip_bind_address_no_port

Conversation

@xonatius
Copy link
Copy Markdown
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
Copy Markdown
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 xonatius force-pushed the ip_bind_address_no_port branch from 0b85f8e to 24cce47 Compare December 2, 2023 20:55
@xonatius
Copy link
Copy Markdown
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.
```
@xonatius xonatius force-pushed the ip_bind_address_no_port branch from 24cce47 to 0b6bb15 Compare December 2, 2023 20:57
@xonatius xonatius requested a review from asomers December 2, 2023 20:58
@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
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