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

net: LookupIP and LookupHost on empty string use domain name #8271

Closed
gopherbot opened this issue Jun 23, 2014 · 5 comments

Comments

Projects
None yet
4 participants
@gopherbot
Copy link

commented Jun 23, 2014

by david@mindcry.org:

What does 'go version' print?
go version devel +ee11f19bc514 Mon Jun 23 18:46:01 2014 +0900 openbsd/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

package main

import (
        "fmt"
        "net"
)

func main() {
        s, err := net.LookupHost("")
        fmt.Printf("%v %v\n", s, err)

        ip, err := net.LookupIP("")
        fmt.Printf("%v %v\n", ip, err)

        mx, err := net.LookupMX("")
        fmt.Printf("%v %v\n", mx, err)
}

What happened?
[2001:470:c049::162 24.247.20.162] <nil>
[2001:470:c049::162 24.247.20.162] <nil>
[] lookup : invalid domain name


What should have happened instead?

All Lookup's should have failed with invalid hostname/domainname

Please provide any additional information below.
OpenBSD fog.mindcry.org 5.5 GENERIC.MP#0 amd64
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 23, 2014

Comment 1:

Labels changed: added repo-main, release-go1.4.

@4a6f656c

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2014

Comment 2:

I highly doubt that this is a Go specific issue - the net package is only calling
C.getaddrinfo via cgo. My guess is that a pure C program will behave in the same manner
(most likely related to the new OpenBSD ASR, combined with your resolv.conf
configuration).

Owner changed to @4a6f656c.

Status changed to WaitingForReply.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2014

Comment 3:

Is that your local IP address, 24.247.20.162?
I think that's semi-standard for putting no host in.
It's the same reason that listening to ":12345" really means "listen to local IP address
on that port".
It's a bit odd but I think it's correct.
@gopherbot

This comment has been minimized.

Copy link
Author

commented Sep 16, 2014

Comment 4 by david@mindcry.org:

OK.
This can be closed anyhow; it was fixed in OpenBSD.
@4a6f656c

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2014

Comment 5:

This was a bug/change in behaviour in the new OpenBSD ASR that has since been fixed (in
OpenBSD). From a Go perspective things were working as intended.

Status changed to WorkingAsIntended.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015

@rsc rsc removed the release-go1.4 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 25, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.