From f8e0d0cb8e77672526baf211bda0b4baae557d33 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 5 Mar 2004 11:14:29 +0000 Subject: Implement SSH1 support for ServerAliveInterval using SSH_MSG_IGNORE. As documented in ssh_config(5), it's not as good as the SSH2 version. --- clientloop.c | 19 ++++++++++++------- debian/changelog | 2 ++ ssh_config.5 | 7 ++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/clientloop.c b/clientloop.c index 626b29a5a..a13d06ddf 100644 --- a/clientloop.c +++ b/clientloop.c @@ -324,12 +324,17 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt) static void server_alive_check(void) { - if (++server_alive_timeouts > options.server_alive_count_max) - packet_disconnect("Timeout, server not responding."); - packet_start(SSH2_MSG_GLOBAL_REQUEST); - packet_put_cstring("keepalive@openssh.com"); - packet_put_char(1); /* boolean: want reply */ - packet_send(); + if (compat20) { + if (++server_alive_timeouts > options.server_alive_count_max) + packet_disconnect("Timeout, server not responding."); + packet_start(SSH2_MSG_GLOBAL_REQUEST); + packet_put_cstring("keepalive@openssh.com"); + packet_put_char(1); /* boolean: want reply */ + packet_send(); + } else { + packet_send_ignore(0); + packet_send(); + } } /* @@ -388,7 +393,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, * event pending. */ - if (options.server_alive_interval == 0 || !compat20) + if (options.server_alive_interval == 0) tvp = NULL; else { tv.tv_sec = options.server_alive_interval; diff --git a/debian/changelog b/debian/changelog index 5a05d0f3e..2bb0f227a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,8 @@ openssh (1:3.8p1-1) UNRELEASED; urgency=low * ServerAliveInterval implemented upstream, so ProtocolKeepAlives is now a compatibility alias. The semantics differ slightly, though; see ssh_config(5) for details. + * Implement SSH1 support for ServerAliveInterval using SSH_MSG_IGNORE. As + documented in ssh_config(5), it's not as good as the SSH2 version. * Remove -fno-builtin-log, -DHAVE_MMAP_ANON_SHARED, and -D__FILE_OFFSET_BITS=64 compiler options, which are no longer necessary. * Update config.guess and config.sub from autotools-dev 20040105.1. diff --git a/ssh_config.5 b/ssh_config.5 index 25485f3da..72ad6d512 100644 --- a/ssh_config.5 +++ b/ssh_config.5 @@ -570,7 +570,8 @@ is 0, indicating that these messages will not be sent to the server, or 300 if the .Cm BatchMode option is set. -This option applies to protocol version 2 only. +.Cm ProtocolKeepAlives +is a Debian-specific compatibility alias for this option. .It Cm ServerAliveCountMax Sets the number of server alive messages (see above) which may be sent without @@ -598,6 +599,10 @@ If, for example, .Cm ServerAliveCountMax is left at the default, if the server becomes unresponsive ssh will disconnect after approximately 45 seconds. +This option works when using protocol version 2 only; in protocol version +1 there is no mechanism to request a response from the server to the +server alive messages, so disconnection is the responsibility of the TCP +stack. .It Cm SetupTimeOut Normally, .Nm ssh -- cgit v1.2.3