-
Notifications
You must be signed in to change notification settings - Fork 18k
net: LookupCNAME returns empty string if entry from /etc/hosts is used #44741
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
Comments
I think this works as intended, an entry in |
* See golang/go#44741 * When "pure go" resolver is used and host is present in /etc/hosts net.LookupCNAME() can return an empty string whitout any error
* See golang/go#44741 * When "pure go" resolver is used and host is present in /etc/hosts net.LookupCNAME() can return an empty string whitout any error
CC @bradfitz, @ianlancetaylor via owners. |
Change https://golang.org/cl/382996 mentions this issue: |
The result of With the I think that it makes sense to align the |
Over in #50101 we decided to change I'm not immediately sure how that affects this issue. |
Fixes: golang#44741, adds explicit error if domain not found in /etc/hosts while using hostLookupFiles mode
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 name that is present in my
/etc/hosts
usingLookupCNAME
The simple program I'm using is:
The content of my
/etc/hosts
is:(the behavior exists with other domains / adresses)
What did you expect to see?
Same behavior using
cgo
resolver and pure go resolver:with
cgo
resolver`with
pure go
resolver`What did you see instead?
with
cgo
resolver`with
pure go
resolver`Pure GO returns an empty string while
cgo
resolves the name properly.Extra informations
It seems that this behavior is from the
dnsmessage.Name{}
returned from https://github.com/golang/go/blob/go1.16/src/net/dnsclient_unix.go#L569 .As soon as the
/etc/hosts
entry is removed, the behavior difference disappears.Thanks in advance for helping me understand this.
The text was updated successfully, but these errors were encountered: