Marco d'Itri reports in http://bugs.debian.org/738693 that "ssh -W" has started causing "getsockname failed: Bad file descriptor" errors; these are new in 6.5p1 and reported via error(). I think this was triggered by the new calls to get_sock_port from port_open_helper in https://anongit.mindrot.org/openssh.git/commit/?id=4def184; gdb shows that c->sock is -1 here. Full -vvv output in the Debian bug; relevant-looking excerpt: debug3: ssh_init_stdio_forwarding: server2.example.net:22 debug1: channel_connect_stdio_fwd server2.example.net:22 debug1: channel 0: new [stdio-forward] debug2: fd 4 setting O_NONBLOCK debug3: fd 5 is O_NONBLOCK getsockname failed: Bad file descriptor debug1: getpeername failed: Bad file descriptor It looks like it still works fine, but the extra non-debug error is annoying.
Created attachment 2407 [details] Skip get_sock_port call for c->sock==-1 Thanks for the detailed report as always. This should fix it.
Thanks, that indeed seems to solve the problem here.
applied - thanks.
Close all bugs left open from 6.6 and 6.7 releases.