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

x/crypto/ssh: TestHostKeyCert fails with: netPipe: dial tcp [::]:54283: connectex: The requested address is not valid in its context. #19996

Closed
alexbrainman opened this Issue Apr 16, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@alexbrainman
Copy link
Member

alexbrainman commented Apr 16, 2017

What version of Go are you using (go version)?

go version go1.7 windows/amd64

What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=c:\users\alex\dev
set GORACE=
set GOROOT=c:\users\alex\dev\go1.7
set GOTOOLDIR=c:\users\alex\dev\go1.7\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\Alex\AppData\Local\Temp\go-build434466894=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1

What did you do?

I run:

go test -v -run=TestHostKeyCert golang.org/x/crypto/ssh

What did you expect to see?

I expect test pass.

What did you see instead?

Test fails:

=== RUN   TestHostKeyCert
--- FAIL: TestHostKeyCert (0.00s)
        certs_test.go:184: netPipe: dial tcp [::]:54283: connectex: The requested address is not val
id in its context.
FAIL
exit status 1
FAIL    golang.org/x/crypto/ssh 0.674s

The code

$ sed '/func.netPipe/,+5!d' handshake_test.go
func netPipe() (net.Conn, net.Conn, error) {
        listener, err := net.Listen("tcp", ":0")
        if err != nil {
                return nil, nil, err
        }
        defer listener.Close()
$

seems to do what documentation recomends - see https://golang.org/pkg/net/#Dial

If the host is empty, as in ":80", the local system is assumed.

So I do not know how to fix this.

Discovered while investigating failed build of crypto release-branch.go1.7 on openbsd, plan9 and windows:
https://build.golang.org/log/2e657fbd75f7b1ca0e52e551af2c90bf56c1b3b9
https://build.golang.org/log/ea5b593440872582438c912aa7c4d5ecdfe32f5c
https://build.golang.org/log/e086a54ad3c3ff1c7dc65d4803e48850253720c5

Alex

@gopherbot gopherbot added this to the Unreleased milestone Apr 16, 2017

@kevinburke kevinburke changed the title x/crypto/ssh: TestHostKeyCert fails with: netPipe: dial tcp [::]:54283: connectex: The requested address is not val id in its context. x/crypto/ssh: TestHostKeyCert fails with: netPipe: dial tcp [::]:54283: connectex: The requested address is not valid in its context. Apr 16, 2017

@hanwen

This comment has been minimized.

Copy link
Contributor

hanwen commented Jun 7, 2017

Is this a bug in ssh? Looks like Dial doesn't handle IPv6 localhost addresses on some platforms.

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Mar 15, 2019

@alexbrainman

This comment has been minimized.

Copy link
Member Author

alexbrainman commented Mar 16, 2019

ping @alexbrainman

Thanks @agnivade I have forgotten about this.

Fortunately this issue is already fixed by @bradfitz in

https://go-review.googlesource.com/42496

So closing this issue.

Alex

PS: Brad, why fix needs to be so complicated? Why there is no single net package function that will listen on a TCP/IP port?

@bradfitz

This comment has been minimized.

Copy link
Member

bradfitz commented Mar 16, 2019

PS: Brad, why fix needs to be so complicated? Why there is no single net package function that will listen on a TCP/IP port?

Yeah, tell me about it. See my #24778

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