Skip to content

Assign ss_len if it exists.#469

Merged
Thomasdezeeuw merged 1 commit intorust-lang:masterfrom
Berrysoft:fix-ss-len
Sep 11, 2023
Merged

Assign ss_len if it exists.#469
Thomasdezeeuw merged 1 commit intorust-lang:masterfrom
Berrysoft:fix-ss-len

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
@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