This is a discussion on Re: Problems with connecting SSH.com's client to a OpenSSH sshd within the mailing.openbsd.tech forums, part of the OpenBSD category; --> On Sun, Jan 13, 2008 at 09:56:02AM +1100, Darren Tucker wrote: [...] > The patch below reverts the entire ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Sun, Jan 13, 2008 at 09:56:02AM +1100, Darren Tucker wrote: [...] > The patch below reverts the entire original change and reimplements it > differently. It also resolves the original problem, could you please > test if it resolves the problem you found? For reference, this is the same change as I just posted but relative to the code before the problematic change for bz #1307. Basically it just moves the keepalive counters to a single variable in the packet code and updates it as necessary, without changing the way any of the packet types are handled. diff -ru ../ssh.packet/clientloop.c ./clientloop.c --- ../ssh.packet/clientloop.c Sun Jan 13 09:48:18 2008 +++ ./clientloop.c Sun Jan 13 09:00:54 2008 @@ -149,7 +149,6 @@ static int connection_out; /* Connection to server (output). */ static int need_rekeying; /* Set to non-zero if rekeying is requested. */ static int session_closed = 0; /* In SSH2: login session closed. */ -static int server_alive_timeouts = 0; static void client_init_dispatch(void); int session_ident = -1; @@ -459,14 +458,14 @@ static void client_global_request_reply(int type, u_int32_t seq, void *ctxt) { - server_alive_timeouts = 0; + keep_alive_timeouts = 0; client_global_request_reply_fwd(type, seq, ctxt); } static void server_alive_check(void) { - if (++server_alive_timeouts > options.server_alive_count_max) { + if (++keep_alive_timeouts > options.server_alive_count_max) { logit("Timeout, server not responding."); cleanup_exit(255); } diff -ru ../ssh.packet/packet.c ./packet.c --- ../ssh.packet/packet.c Sun Jan 13 09:48:18 2008 +++ ./packet.c Sun Jan 13 09:09:36 2008 @@ -132,6 +132,8 @@ /* Set to true if we are authenticated. */ static int after_authentication = 0; +int keep_alive_timeouts = 0; + /* Session key information for Encryption and MAC */ Newkeys *newkeys[MODE_MAX]; static struct packet_state { @@ -1183,10 +1185,12 @@ for (; if (compat20) { type = packet_read_poll2(seqnr_p); + keep_alive_timeouts = 0; if (type) DBG(debug("received packet type %d", type)); switch (type) { case SSH2_MSG_IGNORE: + debug3("Received SSH2_MSG_IGNORE"); break; case SSH2_MSG_DEBUG: packet_get_char(); diff -ru ../ssh.packet/packet.h ./packet.h --- ../ssh.packet/packet.h Sun Jan 13 09:46:00 2008 +++ ./packet.h Sun Jan 13 09:02:36 2008 @@ -86,6 +86,7 @@ void tty_parse_modes(int, int *); extern u_int max_packet_size; +extern int keep_alive_timeouts; int packet_set_maxsize(u_int); #define packet_get_maxsize() max_packet_size diff -ru ../ssh.packet/serverloop.c ./serverloop.c --- ../ssh.packet/serverloop.c Sun Jan 13 09:48:18 2008 +++ ./serverloop.c Sun Jan 13 09:01:49 2008 @@ -100,7 +100,6 @@ static int connection_out; /* Connection to client (output). */ static int connection_closed = 0; /* Connection to client closed. */ static u_int buffer_high; /* "Soft" max buffer size. */ -static int client_alive_timeouts = 0; /* * This SIGCHLD kludge is used to detect when the child exits. The server @@ -242,7 +241,7 @@ int channel_id; /* timeout, check to see how many we have had */ - if (++client_alive_timeouts > options.client_alive_count_max) { + if (++keep_alive_timeouts > options.client_alive_count_max) { logit("Timeout, client not responding."); cleanup_exit(255); } @@ -857,7 +856,7 @@ * even if this was generated by something other than * the bogus CHANNEL_REQUEST we send for keepalives. */ - client_alive_timeouts = 0; + keep_alive_timeouts = 0; } static void -- Darren Tucker (dtucker at zip.com.au) GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement. |