Add getaddrinfo and freeaddrinfo shims#4984
Conversation
|
Thank you for contributing to Miri! A reviewer will take a look at your PR, typically within a week or two. |
Can't we at least return something generic, like what our |
|
Yeah we can do that. |
|
Unlike And we also have the problem that Lines 249 to 260 in 3f8007e Are there any other shims which needed to circumvent this method? |
What are the errnums you are getting? |
|
Well, we only get a an The problem is that the |
|
Ah so the actual problem is that
There's no standard Unix errnum involved here ever, std just shoves this into an |
|
No, we get standard UNIX error codes back -- they are just DNS specific: And the standard library has by far not all UNIX error codes mapped to |
These are not standard unix error codes. This is basically a separate error enum specifically for |
No, But that's only for "normal" host error codes, not for this other kind of error code that |
This comment has been minimized.
This comment has been minimized.
ad84f51 to
378d89c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
378d89c to
d811aaf
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Here's the first proper round of comments. :)
@rustbot author
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
There was a problem hiding this comment.
Just a few minor things (and that discussion about the type for the sockname* helpers)
@rustbot author
|
@rustbot ready |
There was a problem hiding this comment.
Thanks, looks great! Two last minor comments, and then please squash the commits.
@rustbot author
18efa43 to
72b7fe7
Compare
This comment has been minimized.
This comment has been minimized.
72b7fe7 to
a5e33c0
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot ready |
Using those shims socket addresses can be created directly from hostnames (e.g. using `ToSocketAddrs` from the standard library)
a5e33c0 to
5948639
Compare
Hi,
This pull request adds shims for the
getaddrinfoandfreeaddrinfosyscalls. They are used by theToSocketAddrstrait in the standard library to resolve hostnames to socket addresses.Because the abstraction of the standard library is very tight, we're pretty much only able to shim the exact use case of the standard library.
Also, we cannot shim
gai_strerrorbecause the standard library doesn't haveErrorKinds for the DNS errors. This is a bit unfortunate because Miri will throw an unsupported error when there is a resolution error (e.g. hostname doesn't exist).