x/crypto/ssh: listening on remote address blocks indefinitely when address doesn't contain a host part #33227
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Created an SSH connection using ssh.Dial, and opened a Listener to listen on a port without specifying a host address. Then connected to that port (i.e. using telnet).
This program demonstrates the issue:
What did you expect to see?
What did you see instead?
Additional Info
It seems that if the local address is not specified in ssh.Client.Listen, the Accept call blocks indefinitely. For example this line fails in the above program:
But when changed to this it succeeds:
The host may be omitted in net.Listen, so there is precedent for using no host. From net.Listen: "For TCP networks, if the host in the address parameter is empty or a literal unspecified IP address, Listen listens on all available unicast and anycast IP addresses of the local system."
I think at a minimum if host may not be omitted, the documentation should mention that it is not supported, and the Listen call should return an error.
The text was updated successfully, but these errors were encountered: