diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2007-12-28 15:32:25 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2007-12-28 15:32:25 +0000 |
commit | 9009aada79620f1cc972c7d594f8302b778515f1 (patch) | |
tree | 4a9b0012adfee5cad1b19c3cc5c7257165f72a6f /usr.bin/ssh | |
parent | 3b72969b454e016b8b9acf61df18eb150b2e2c3f (diff) |
Make SSH2_MSG_UNIMPLEMENTED and SSH2_MSG_IGNORE messages reset the
ServerAlive and ClientAlive timers. Prevents dropping a connection
when these are enabled but the peer does not support our keepalives.
bz #1307, ok djm@.
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/clientloop.c | 10 | ||||
-rw-r--r-- | usr.bin/ssh/packet.c | 13 | ||||
-rw-r--r-- | usr.bin/ssh/serverloop.c | 4 |
3 files changed, 18 insertions, 9 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index 535a864b726..9379a97bad3 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.183 2007/11/03 00:36:14 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.184 2007/12/28 15:32:24 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -457,6 +457,12 @@ client_check_window_change(void) } static void +client_global_keepalive(int type, u_int32_t seq, void *ctxt) +{ + server_alive_timeouts = 0; +} + +static void client_global_request_reply(int type, u_int32_t seq, void *ctxt) { server_alive_timeouts = 0; @@ -2062,6 +2068,8 @@ client_init_dispatch_20(void) /* global request reply messages */ dispatch_set(SSH2_MSG_REQUEST_FAILURE, &client_global_request_reply); dispatch_set(SSH2_MSG_REQUEST_SUCCESS, &client_global_request_reply); + dispatch_set(SSH2_MSG_IGNORE, &client_global_keepalive); + dispatch_set(SSH2_MSG_UNIMPLEMENTED, &client_global_keepalive); } static void client_init_dispatch_13(void) diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c index f9449381168..c6c6af055aa 100644 --- a/usr.bin/ssh/packet.c +++ b/usr.bin/ssh/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.148 2007/06/07 19:37:34 pvalchev Exp $ */ +/* $OpenBSD: packet.c,v 1.149 2007/12/28 15:32:24 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -959,9 +959,10 @@ packet_read_expect(int expected_type) * packet_process_incoming. If so, reads the packet; otherwise returns * SSH_MSG_NONE. This does not wait for data from the connection. * - * SSH_MSG_DISCONNECT is handled specially here. Also, - * SSH_MSG_IGNORE messages are skipped by this function and are never returned - * to higher levels. + * SSH_MSG_DISCONNECT is handled specially here. Also, SSH_MSG_IGNORE + * messages are skipped by this function and are never returned + * to higher levels, although SSH2_MSG_IGNORE are since they are needed + * for keepalives. */ static int @@ -1186,8 +1187,6 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p) if (type) DBG(debug("received packet type %d", type)); switch (type) { - case SSH2_MSG_IGNORE: - break; case SSH2_MSG_DEBUG: packet_get_char(); msg = packet_get_string(NULL); @@ -1208,7 +1207,7 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p) seqnr = packet_get_int(); debug("Received SSH2_MSG_UNIMPLEMENTED for %u", seqnr); - break; + /* FALLTHROUGH */ default: return type; } diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c index 94a5fde7db0..ae649d6f2c0 100644 --- a/usr.bin/ssh/serverloop.c +++ b/usr.bin/ssh/serverloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: serverloop.c,v 1.145 2006/10/11 12:38:03 markus Exp $ */ +/* $OpenBSD: serverloop.c,v 1.146 2007/12/28 15:32:24 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1155,6 +1155,8 @@ server_init_dispatch_20(void) dispatch_set(SSH2_MSG_CHANNEL_FAILURE, &server_input_keep_alive); dispatch_set(SSH2_MSG_REQUEST_SUCCESS, &server_input_keep_alive); dispatch_set(SSH2_MSG_REQUEST_FAILURE, &server_input_keep_alive); + dispatch_set(SSH2_MSG_IGNORE, &server_input_keep_alive); + dispatch_set(SSH2_MSG_UNIMPLEMENTED, &server_input_keep_alive); /* rekeying */ dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); } |