Skip to content

Conversation

@joboet
Copy link
Member

@joboet joboet commented Feb 7, 2025

Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed.

I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a sockaddr_storage resulted in unsound usage inside LookupHost::next, which could create a reference to a structure smaller than sockaddr_storage. Thus I've replaced the argument type with a pointer and made the function unsafe.

@rustbot
Copy link
Collaborator

rustbot commented Feb 7, 2025

r? @cuviper

rustbot has assigned @cuviper.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added O-solid Operating System: SOLID S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 7, 2025
@cuviper
Copy link
Member

cuviper commented Feb 10, 2025

LGTM!

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 10, 2025

📌 Commit 68ff0f1 has been approved by cuviper

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 10, 2025
@workingjubilee
Copy link
Member

@bors r-

I think this failed here? UEFI #136887 (comment)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 12, 2025
…e conversion functions

Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed.

I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside  `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
@joboet joboet force-pushed the netaddr_from_inner branch from 68ff0f1 to 80c60fe Compare February 12, 2025 13:14
@joboet
Copy link
Member Author

joboet commented Feb 12, 2025

I've rebased this to include #136615 and removed the stub C definitions there as well.
@bors r=@cuviper

@bors
Copy link
Collaborator

bors commented Feb 12, 2025

📌 Commit 80c60fe has been approved by cuviper

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 12, 2025
@bors bors merged commit 4ce473c into rust-lang:master Feb 13, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-solid Operating System: SOLID S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants