| Summary: | ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Vide <vide> | ||||
| Component: | ssh | Assignee: | Assigned to nobody <unassigned-bugs> | ||||
| Status: | CLOSED FIXED | ||||||
| Severity: | normal | CC: | djm, dtucker, jik | ||||
| Priority: | P5 | ||||||
| Version: | 7.6p1 | ||||||
| Hardware: | amd64 | ||||||
| OS: | Linux | ||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 2915 | ||||||
| Attachments: |
|
||||||
|
Description
Vide
2018-10-16 21:41:04 AEDT
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". Created attachment 3233 [details]
Save initial timeout and reused for 2nd and subsequent connection attempts
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 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. Move resolved bugs -> CLOSED after 8.0 release |