When CanonicalizeHostname reloads ssh config, LocalForward entries end up duplicated; this causes a connection failure if ExitOnForwardFailure is set. test config: Host mini IdentityFile ~/.ssh/keys/id_rsa LocalForward localhost:8000 localhost:80 Host * CanonicalizeHostname yes ExitOnForwardFailure yes result: mghali@ernie.int.snark.net:~$ ssh -v -F tmp/config mini OpenSSH_7.1p1, OpenSSL 1.0.1j 15 Oct 2014 debug1: Reading configuration data tmp/config debug1: tmp/config line 1: Applying options for mini debug1: tmp/config line 5: Applying options for * debug1: Re-reading configuration after hostname canonicalisation debug1: Reading configuration data tmp/config debug1: tmp/config line 1: Applying options for mini debug1: tmp/config line 5: Applying options for * debug1: Connecting to mini [192.168.0.250] port 22. debug1: Connection established. [...] Authenticated to mini ([192.168.0.250]:22). debug1: Local connections to localhost:8000 forwarded to remote address localhost:80 debug1: Local forwarding listening on ::1 port 8000. debug1: channel 0: new [port listener] debug1: Local forwarding listening on 127.0.0.1 port 8000. debug1: channel 1: new [port listener] debug1: Local connections to localhost:8000 forwarded to remote address localhost:80 debug1: Local forwarding listening on ::1 port 8000. bind: Address already in use debug1: Local forwarding listening on 127.0.0.1 port 8000. bind: Address already in use channel_setup_fwd_listener_tcpip: cannot listen to port: 8000 Could not request local forwarding. Disabling CanonicalizeHostname results in a single set of port forwarding actions and success: mghali@ernie.int.snark.net:~$ ssh -v -F tmp/config -o 'CanonicalizeHostname no' mini OpenSSH_7.1p1, OpenSSL 1.0.1j 15 Oct 2014 debug1: Reading configuration data tmp/config debug1: tmp/config line 1: Applying options for mini debug1: tmp/config line 5: Applying options for * debug1: Connecting to mini [192.168.0.250] port 22. debug1: Connection established. [...] Authenticated to mini ([192.168.0.250]:22). debug1: Local connections to localhost:8000 forwarded to remote address localhost:80 debug1: Local forwarding listening on ::1 port 8000. debug1: channel 0: new [port listener] debug1: Local forwarding listening on 127.0.0.1 port 8000. debug1: channel 1: new [port listener] debug1: channel 2: new [client-session] debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session.
Created attachment 2803 [details] don't record duplicate forwards Thanks. This patch should help.
Thanks - I see this already was fixed in 7.2p2 - sorry I didn't check first!
patch is committed and will appear in openssh-7.3. Thanks!
Close all resolved bugs after 7.3p1 release