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

Assign ss_len if it exists. #469

Merged
merged 1 commit into from
Sep 11, 2023
Merged

Conversation

Berrysoft
Copy link
Contributor

Fixes #468

I don't remove len field because:

  • socklen_t is larger than u8.
  • It will introduce more platform-specific code.
  • Usual socket methods (at least on macOS) don't check ss_len. We still need another field to pass in and out.

Copy link
Collaborator

@Thomasdezeeuw Thomasdezeeuw left a comment

Choose a reason for hiding this comment

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

I don't really know if we need it in another places as well. For example in calls to accept? Does the OS set ss_len?

@Berrysoft
Copy link
Contributor Author

Berrysoft commented Sep 11, 2023

AFAIK, macos sets ss_len to the correct value in all syscalls, e.g., accept, getpeername, getsockname.

@Thomasdezeeuw Thomasdezeeuw merged commit 16e85d5 into rust-lang:master Sep 11, 2023
37 checks passed
@Thomasdezeeuw
Copy link
Collaborator

Thanks @Berrysoft

@Berrysoft Berrysoft deleted the fix-ss-len branch September 11, 2023 11:49
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.

Set ss_len when creating SockAddr from std
2 participants