Skip to content
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

std::net lacks reverse DNS lookup #22608

Closed
murarth opened this issue Feb 21, 2015 · 2 comments · Fixed by #23419
Closed

std::net lacks reverse DNS lookup #22608

murarth opened this issue Feb 21, 2015 · 2 comments · Fixed by #23419

Comments

@murarth
Copy link
Contributor

murarth commented Feb 21, 2015

std::old_io::net::addrinfo::get_address_name accepts an IpAddr and attempts to resolve it to a hostname String. No such functionality exists (as far as I can tell) in the new std::net module.

I know that the std::net module is incomplete and, perhaps, this was already a planned addition. I'm just hoping to make sure that it's not forgotten.

@murarth
Copy link
Contributor Author

murarth commented Mar 15, 2015

So, it turns out that the default behavior of getnameinfo is to return the given IP address as a string when it can't resolve to a hostname. This seems undesirable to me. There's a flag NI_NAMEREQD that will cause it to return an error instead, but the value of this flag differs by platform.

So, I'm wondering whether I should accept the default behavior and document it or collect values of NI_NAMEREQD on all supported platforms. I have these so far:

Platform Value Source
Linux 8 /usr/include/netdb.h on my system
Windows 4 header provided by wine-dev
Mac OS X 4 here

@murarth
Copy link
Contributor Author

murarth commented Mar 16, 2015

I had another idea: Attempt to parse the result of getnameinfo as an IpAddr to identify this case. Not the ugliest workaround, I think.

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 a pull request may close this issue.

2 participants