Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net: go/cgo resolvers report malformed domains differently #12421
Given the following program:
A different error message is produced, depending on whether the go or cgo resolver is used:
This discrepancy exists because
I think it's debatable whether this qualifies as a bug, but in theory it could be fixed by having the cgo implementation check
Fixing this seems easy, but we need a Decider to pick the right fix.
The only restrictions on domain names imposed by DNS are: labels must be 1 to 63 bytes, and total name length (including label length bytes and terminating zero byte) must be <= 255 bytes (or 256 for mDNS). When comparing names for equality, labels are compared ASCII case-insensitively, but otherwise they can contain arbitrary byte values. For example, running
Beyond that, it's not uncommon for DNS utilities to support escape sequences:
On the other hand, RFC 952 restricts domain names to match the grammar:
RFC 1123 relaxes the initial
mDNS relaxes the rules for .local names to allow UTF-8 in RFC 6762 section 16.
I'd rather have more time to think about the best solution for Go. Punting to 1.8.
There are two questions here:
So I would suggest for Go 1.8 we simply change the path that fails on isDomainName to return 'no such host' instead of 'invalid domain name', to match netdns=cgo mode.
I personally don't put my oar in, but a bit.
There are use cases of Net-Unicode for unicast DNS in the wild. I noticed that "ah, Active Directory and a few directory service implementations do support Net-Unicode for unicast DNS" when I saw #16739. As far as I know, https://tools.ietf.org/html/draft-ietf-dnssd-mdns-dns-interop is the active informational document that addresses interoperability issues with multiple types of DNS-labels. Of course, the existing built-in DNS stub resolver doesn't support unicast DNS labels encoded in Net-Unicode from its brith. So just FYI.
referenced this issue
Oct 22, 2016