bugzilla-daemon at bugzilla.mindrot.org
2018-Oct-16 10:41 UTC
[Bug 2918] New: ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
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.
bugzilla-daemon at bugzilla.mindrot.org
2019-Feb-01 03:27 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918
Darren Tucker <dtucker at dtucker.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dtucker at dtucker.net
--- Comment #1 from Darren Tucker <dtucker at dtucker.net> ---
Comparing sshconnect.c between the two versions, I think I see what
happened: 7.6 added waitrfd(), which writes the remaining timeout back
to timeoutp. After the 1st timeout, this does not get reset on the 2nd
and subsequent connection attempts, and a timeout of 0 means "no
timeout".
--
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2019-Feb-01 03:31 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918 --- Comment #2 from Darren Tucker <dtucker at dtucker.net> --- Created attachment 3233 --> https://bugzilla.mindrot.org/attachment.cgi?id=3233&action=edit Save initial timeout and reused for 2nd and subsequent connection attempts -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2019-Feb-01 03:32 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918
Darren Tucker <dtucker at dtucker.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |2915
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2915
[Bug 2915] Tracking bug for 8.0 release
--
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2019-Feb-01 03:32 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918
Darren Tucker <dtucker at dtucker.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |djm at mindrot.org
Attachment #3233| |ok?(djm at mindrot.org)
Flags| |
--
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2019-Feb-01 03:39 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918 --- Comment #3 from Darren Tucker <dtucker at dtucker.net> --- Test case with patch: $ time ssh/obj/ssh -vvv -o ConnectTimeout=2 -o ConnectionAttempts=2 -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null 1.2.3.4 [...] debug2: ssh_connect_direct 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: Operation timed out debug1: Trying again... 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: Operation timed out ssh: connect to host 1.2.3.4 port 22: Operation timed out real 0m5.077s user 0m0.010s sys 0m0.030s -- You are receiving this mail because: You are watching someone on the CC list of the bug. You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2019-Feb-01 03:56 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918
Darren Tucker <dtucker at dtucker.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #4 from Darren Tucker <dtucker at dtucker.net> ---
Patch has been applied and will be in the 8.0 release. Thanks for the
report and especially specifying exactly the versions where it changed.
--
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2019-May-03 04:42 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #5 from Damien Miller <djm at mindrot.org> ---
Move resolved bugs -> CLOSED after 8.0 release
--
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2019-Sep-06 02:51 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jik at kamens.us
--- Comment #6 from Damien Miller <djm at mindrot.org> ---
*** Bug 3066 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2023-Jan-13 02:26 UTC
[Bug 2918] ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt
https://bugzilla.mindrot.org/show_bug.cgi?id=2918
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #3233|ok?(djm at mindrot.org) |
Flags| |
--
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.