summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clientloop.c25
-rw-r--r--ssh_config.55
2 files changed, 19 insertions, 11 deletions
diff --git a/clientloop.c b/clientloop.c
index fba1b5496..9e45d24e0 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -578,16 +578,21 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
578static void 578static void
579server_alive_check(void) 579server_alive_check(void)
580{ 580{
581 if (packet_inc_alive_timeouts() > options.server_alive_count_max) { 581 if (compat20) {
582 logit("Timeout, server %s not responding.", host); 582 if (packet_inc_alive_timeouts() > options.server_alive_count_max) {
583 cleanup_exit(255); 583 logit("Timeout, server %s not responding.", host);
584 cleanup_exit(255);
585 }
586 packet_start(SSH2_MSG_GLOBAL_REQUEST);
587 packet_put_cstring("keepalive@openssh.com");
588 packet_put_char(1); /* boolean: want reply */
589 packet_send();
590 /* Insert an empty placeholder to maintain ordering */
591 client_register_global_confirm(NULL, NULL);
592 } else {
593 packet_send_ignore(0);
594 packet_send();
584 } 595 }
585 packet_start(SSH2_MSG_GLOBAL_REQUEST);
586 packet_put_cstring("keepalive@openssh.com");
587 packet_put_char(1); /* boolean: want reply */
588 packet_send();
589 /* Insert an empty placeholder to maintain ordering */
590 client_register_global_confirm(NULL, NULL);
591} 596}
592 597
593/* 598/*
@@ -649,7 +654,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
649 */ 654 */
650 655
651 timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ 656 timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */
652 if (options.server_alive_interval > 0 && compat20) { 657 if (options.server_alive_interval > 0) {
653 timeout_secs = options.server_alive_interval; 658 timeout_secs = options.server_alive_interval;
654 server_alive_time = now + options.server_alive_interval; 659 server_alive_time = now + options.server_alive_interval;
655 } 660 }
diff --git a/ssh_config.5 b/ssh_config.5
index b2dc49b09..82dcf0c08 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -1468,7 +1468,10 @@ If, for example,
1468.Cm ServerAliveCountMax 1468.Cm ServerAliveCountMax
1469is left at the default, if the server becomes unresponsive, 1469is left at the default, if the server becomes unresponsive,
1470ssh will disconnect after approximately 45 seconds. 1470ssh will disconnect after approximately 45 seconds.
1471This option applies to protocol version 2 only. 1471This option applies to protocol version 2 only; in protocol version
14721 there is no mechanism to request a response from the server to the
1473server alive messages, so disconnection is the responsibility of the TCP
1474stack.
1472.It Cm ServerAliveInterval 1475.It Cm ServerAliveInterval
1473Sets a timeout interval in seconds after which if no data has been received 1476Sets a timeout interval in seconds after which if no data has been received
1474from the server, 1477from the server,