diff options
-rw-r--r-- | clientloop.c | 25 | ||||
-rw-r--r-- | ssh_config.5 | 5 |
2 files changed, 19 insertions, 11 deletions
diff --git a/clientloop.c b/clientloop.c index 7df941375..156a196dc 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -564,16 +564,21 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt) | |||
564 | static void | 564 | static void |
565 | server_alive_check(void) | 565 | server_alive_check(void) |
566 | { | 566 | { |
567 | if (packet_inc_alive_timeouts() > options.server_alive_count_max) { | 567 | if (compat20) { |
568 | logit("Timeout, server %s not responding.", host); | 568 | if (packet_inc_alive_timeouts() > options.server_alive_count_max) { |
569 | cleanup_exit(255); | 569 | logit("Timeout, server %s not responding.", host); |
570 | cleanup_exit(255); | ||
571 | } | ||
572 | packet_start(SSH2_MSG_GLOBAL_REQUEST); | ||
573 | packet_put_cstring("keepalive@openssh.com"); | ||
574 | packet_put_char(1); /* boolean: want reply */ | ||
575 | packet_send(); | ||
576 | /* Insert an empty placeholder to maintain ordering */ | ||
577 | client_register_global_confirm(NULL, NULL); | ||
578 | } else { | ||
579 | packet_send_ignore(0); | ||
580 | packet_send(); | ||
570 | } | 581 | } |
571 | packet_start(SSH2_MSG_GLOBAL_REQUEST); | ||
572 | packet_put_cstring("keepalive@openssh.com"); | ||
573 | packet_put_char(1); /* boolean: want reply */ | ||
574 | packet_send(); | ||
575 | /* Insert an empty placeholder to maintain ordering */ | ||
576 | client_register_global_confirm(NULL, NULL); | ||
577 | } | 582 | } |
578 | 583 | ||
579 | /* | 584 | /* |
@@ -635,7 +640,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, | |||
635 | */ | 640 | */ |
636 | 641 | ||
637 | timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ | 642 | timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ |
638 | if (options.server_alive_interval > 0 && compat20) { | 643 | if (options.server_alive_interval > 0) { |
639 | timeout_secs = options.server_alive_interval; | 644 | timeout_secs = options.server_alive_interval; |
640 | server_alive_time = now + options.server_alive_interval; | 645 | server_alive_time = now + options.server_alive_interval; |
641 | } | 646 | } |
diff --git a/ssh_config.5 b/ssh_config.5 index 447617178..dd35dd8d1 100644 --- a/ssh_config.5 +++ b/ssh_config.5 | |||
@@ -1409,7 +1409,10 @@ If, for example, | |||
1409 | .Cm ServerAliveCountMax | 1409 | .Cm ServerAliveCountMax |
1410 | is left at the default, if the server becomes unresponsive, | 1410 | is left at the default, if the server becomes unresponsive, |
1411 | ssh will disconnect after approximately 45 seconds. | 1411 | ssh will disconnect after approximately 45 seconds. |
1412 | This option applies to protocol version 2 only. | 1412 | This option applies to protocol version 2 only; in protocol version |
1413 | 1 there is no mechanism to request a response from the server to the | ||
1414 | server alive messages, so disconnection is the responsibility of the TCP | ||
1415 | stack. | ||
1413 | .It Cm ServerAliveInterval | 1416 | .It Cm ServerAliveInterval |
1414 | Sets a timeout interval in seconds after which if no data has been received | 1417 | Sets a timeout interval in seconds after which if no data has been received |
1415 | from the server, | 1418 | from the server, |