[Bug 2918] New: ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Tue Oct 16 21:41:04 AEDT 2018


https://bugzilla.mindrot.org/show_bug.cgi?id=2918

            Bug ID: 2918
           Summary: ssh ConnectTimeout is obeyed only on 1st
                    ConnectionAttempt
           Product: Portable OpenSSH
           Version: 7.6p1
          Hardware: amd64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: ssh
          Assignee: unassigned-bugs at mindrot.org
          Reporter: vide at fastmail.com

Setting the SSH option ConnectTimeout=N only works on the first
ConnectionAttempts. So, if you set ConnectionAttempts=2 for example, it
will time out after N second on the first attempt and wait the full,
default TCP timeout on the second attempt.

Example of the error:

$ time ssh -vvvv -o ConnectTimeout=2 -o ConnectionAttempts=2 -o
StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null 1.2.3.4
OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/vide/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "1.2.3.4" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 1.2.3.4 [1.2.3.4] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 1.2.3.4 port 22: Connection timed out
debug1: Trying again...
debug1: Connecting to 1.2.3.4 [1.2.3.4] port 22.
debug1: connect to address 1.2.3.4 port 22: Connection timed out
ssh: connect to host 1.2.3.4 port 22: Connection timed out

real 2m13,670s
user 0m0,012s
sys 0m0,018s

This seems a regression from OpenSSH 7.5 where it works as expected.
OpenSSH 7.8 seems affected as well
The first timeout happens after 2 seconds, the second after ~2 minutes

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list