-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Avoid calling getnameinfo
when formatting IPv6 addresses in CNetAddr::ToStringIP
#21756
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
Avoid calling getnameinfo
when formatting IPv6 addresses in CNetAddr::ToStringIP
#21756
Conversation
Concept ACK |
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.
ACK 54548ba
ACK c10f27f I've reviewed the code and it looks good. Also ran unit tests and |
@shobitb Thanks a lot for reviewing! I think you might have gotten the commit id wrong when ACK:ing. The last commit id in the sequence of commits is the one used when ACK:ing a PR assuming one ACK:s the entire PR and not just a subset of it :) |
Code review ACK 54548ba |
socklen_t socklen = sizeof(sockaddr); | ||
if (serv.GetSockAddr((struct sockaddr*)&sockaddr, &socklen)) { | ||
char name[1025] = ""; | ||
if (!getnameinfo((const struct sockaddr*)&sockaddr, socklen, name, |
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.
Was removing link-local scoped id functionality an intended consequence of this PR?
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.
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.
If we want to restore that functionality we could pass m_scope_id
to IPv6ToString
and append it if non-zero.
According to #21982 (comment), no longer returning scoped ids was an intentional part of this PR. Maybe that wasn't obvious to reviewers. After test coverage was removed by #21689, no other tests signalled the change. It would be good to be more explicit in the PR description regarding why make the change, and straightforward about what support was being dropped. |
There seems to be two "functionalities" being discussed together, it took me some time to figure it out:
For reference, here is the FreeBSD implementation of |
Exactly. Thanks for bringing some sense to this. What this entire discussion boils down to is if the expectation is that
|
Indeed. What does not make sense to me is why this PR was not upfront about this, nor the reasons that were given to have the only test coverage removed willy-nilly allowing this to be changed without tests warning about it, nor why we should break user space to follow the rustlang version without discussion. If those questions do not make sense, then I apologize. |
The comment I referred to above in #21982 (comment):
Yes, as the removed test and as #21690 showed, macOS returns a different getnameinfo format for scoped ids, without the zone id, from all the other platforms that do provide support for it. Why should we align with the macOS exception without discussing it? Does it not make sense to call attention to this change? |
Avoid calling
getnameinfo
when formatting IPv6 addresses inCNetAddr::ToStringIP
.Fixes #21466.
Fixes #21967.
The IPv4 case was fixed in #21564.