-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
net: PreferGo DNS resolver failure #56107
Comments
The go resolver is not even sending a dns request. It is rejected here: Lines 602 to 605 in 28a05f5
a.------------a.flocktory.com is not a valid hostname as specified in RFC 1035 2.3.1.
Seems like the glibc is more permissive here. |
|
|
Ah, the ghost of RFC 1035 "hostnames". May I throw in RFC 8499, the Best Current Practise RFC on DNS Terminology? Section 2 is about "Names".
Notice, how labels are made up of octets, or bytes (for those disliking the term "octet"). It's not about hostnames.
And then comes the "deadly" strike:
Bottom line: the DNS wire protocol uses length-encoded octet labels, with the end of the list represented by the empty lable ("root"). The interpretation of the label octets is up to a particular DNS resolver. As already mentioned in the cited code section above, Apple made fun of any definitions by encoding UNICODE into the labels; they are perfectly within the definitions, or the lack of them. The Go DNS stub resolver ("DNS client") thus should not make any assumption of what octets do constitute a label, as long as the wire protocol isn't violated and that means either an empty label that isn't the list termination, or an overlong label. And finally, all encoded labels must not be more than 255 (254?) octets in total. Go is often tagged as "opinionated", but its DNS stub resolver shouldn't take that description too serious. |
Duplicate of #17659 |
I don't know the exac reason on why the isDomainName() check was added, but i think that it was added to align with the glibc. I tested the code sample with cgo on debian 9 (so with an older glibc) and the cgo version also returned an |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm trying to resolve a domain with a custom dialer.
Output
What did you expect to see?
I'm expecting go dns to get the same result as the cgo version
What did you see instead?
The go version failed to resolve anything.
The text was updated successfully, but these errors were encountered: