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
Nicer handling of PTR queries #50
Comments
You should use @bwoebi Didn't we have a protection that restricts |
|
Yes, I know that it works, but it's not supposed to work. I think we had a restriction in there before. |
Do you have any suggestion for a better function name? I'm not sure what to do with an invalid IP, probably throw an exception, but not sure which one. function ip2arpa($ip) {
$packedIp = inet_pton($ip);
if ($packedIp === false) {
return null; // FIXME
}
if (isset($packedIp[5])) { // IPv6
return wordwrap(strrev(bin2hex($packedIp)), 1, ".", true) . ".ip6.arpa";
}
return inet_ntop(strrev($packedIp)) . ".in-addr.arpa";
} |
I created a PR now. It doesn't use a separate function, see #52. |
It's now included in https://github.com/amphp/dns/releases/tag/v0.8.14. |
amphp DNS doesn't handle calls like this:
Currently, you need to manually convert the IP address to the right PTR query:
The legacy Net_DNS library has some code to handle PTR queries correctly, when the input looks like an IP address:
https://github.com/pear/Net_DNS/blob/5786b8c6f21c3cc8915fe251dac1571fa524a417/Net/DNS/Resolver.php#L552-L559
It would be nice for amphp to do this too.
The text was updated successfully, but these errors were encountered: