Created attachment 2482 [details] Patch to make ssh_connect_direct use port parameter. To reproduce: -- # ~/.ssh/config CanonicalizeHostname yes CanonicalDomains mynet.local Host *.mynet.local Port 99 -- $ ssh -vvv somedomain ... debug1: Canonicalized hostname "somedomain" => "somedomain.mynet.local" debug1: Hostname has changed; re-reading configuration debug1: Reading configuration data /home/user/.ssh/config debug1: /home/user/.ssh/config line 4: Applying options for *.mynet.local debug1: Reading configuration data /etc/ssh_config debug2: ssh_connect: needpriv 0 debug1: Connecting to somedomain.mynet.local [127.0.0.1] port 22. ... Expected result: Connection attempted on port 99 Actual result: Connection attempted on port 22. More info: The correct port is passed to ssh_connect_direct, but it is not used. ssh_proxy_connect works as expected. Attached patch just sets the port inside the addrinfo struct before trying to connect. Workaround: Port 99 ProxyCommand nc %h %p
Created attachment 2483 [details] Reset port number in canonicalised address list Nice catch. The problem is that the canonicalisation code resolves the addresses before the second config pass and never updates them with the possibly-changed port number. This patch makes the update immediately after the post-canonicalisation config pass.
Patch applied - this will be in openssh-6.8
openssh-6.8 is released