-
Notifications
You must be signed in to change notification settings - Fork 135
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
Recognize "localhost" as special and resolve to the loopback address. #4830
Recognize "localhost" as special and resolve to the loopback address. #4830
Conversation
3ed7159
to
5c634f6
Compare
afe4aff
to
40e3df2
Compare
Note: Only the last single commit "Recognize localhost before handing off to system" is new for this PR, the others are from #4827 that this PR depends on. |
This adds more combinations of parameters for LocalHost and SunnyDay PosixSocketResolveTest tests, including insuring that lookups work as expected with address family, socket type, and protocol hints. This will ensure that PosixSocketResolveTest will also detect systems where IPv6 localhost lookups don't work. b/369361511
Make SunnyDayFlags more forgiving, as well as the error return value for Starboard < 16 and be a little more forgiving for hint flags returned with the results.
6d6cb62
to
db4f461
Compare
db4f461
to
d4e78c3
Compare
Removed on-device label. The only remaining failures were issues not related to this PR. |
d4e78c3
to
14884a5
Compare
14884a5
to
9e440b7
Compare
struct sockaddr_in6* address = | ||
reinterpret_cast<struct sockaddr_in6*>(musl_ai->ai_addr); | ||
address->sin6_addr = IN6ADDR_LOOPBACK_INIT; | ||
// address->sin6_addr.__in6_u.__u6_addr8[0] = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the comments here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in followup #4883.
Avoid using the system resolver to lookup localhost. This ensures that the application is free to use the localhost hostname and assume that both IPv4 and IPv6 adddress queries for localhost names will always resolve to the respective IP loopback address (https://datatracker.ietf.org/doc/html/rfc6761#section-6.3).
This fixes IPv6 localhost not resolving for devices where /etc/hosts is misconfigured.
b/369361511
b/377982714