View | Details | Raw Unified | Return to bug 1307 | Differences between
and this patch

Collapse All | Expand All

(-)clientloop.c (-11 / +2 lines)
Lines 149-155 static int connection_in; /* Connection Link Here
149
static int connection_out;	/* Connection to server (output). */
149
static int connection_out;	/* Connection to server (output). */
150
static int need_rekeying;	/* Set to non-zero if rekeying is requested. */
150
static int need_rekeying;	/* Set to non-zero if rekeying is requested. */
151
static int session_closed = 0;	/* In SSH2: login session closed. */
151
static int session_closed = 0;	/* In SSH2: login session closed. */
152
static int server_alive_timeouts = 0;
153
152
154
static void client_init_dispatch(void);
153
static void client_init_dispatch(void);
155
int	session_ident = -1;
154
int	session_ident = -1;
Lines 457-478 client_check_window_change(void) Link Here
457
}
456
}
458
457
459
static void
458
static void
460
client_global_keepalive(int type, u_int32_t seq, void *ctxt)
461
{
462
	server_alive_timeouts = 0;
463
}
464
465
static void
466
client_global_request_reply(int type, u_int32_t seq, void *ctxt)
459
client_global_request_reply(int type, u_int32_t seq, void *ctxt)
467
{
460
{
468
	server_alive_timeouts = 0;
461
	keep_alive_timeouts = 0;
469
	client_global_request_reply_fwd(type, seq, ctxt);
462
	client_global_request_reply_fwd(type, seq, ctxt);
470
}
463
}
471
464
472
static void
465
static void
473
server_alive_check(void)
466
server_alive_check(void)
474
{
467
{
475
	if (++server_alive_timeouts > options.server_alive_count_max) {
468
	if (++keep_alive_timeouts > options.server_alive_count_max) {
476
		logit("Timeout, server not responding.");
469
		logit("Timeout, server not responding.");
477
		cleanup_exit(255);
470
		cleanup_exit(255);
478
	}
471
	}
Lines 2068-2075 client_init_dispatch_20(void) Link Here
2068
	/* global request reply messages */
2061
	/* global request reply messages */
2069
	dispatch_set(SSH2_MSG_REQUEST_FAILURE, &client_global_request_reply);
2062
	dispatch_set(SSH2_MSG_REQUEST_FAILURE, &client_global_request_reply);
2070
	dispatch_set(SSH2_MSG_REQUEST_SUCCESS, &client_global_request_reply);
2063
	dispatch_set(SSH2_MSG_REQUEST_SUCCESS, &client_global_request_reply);
2071
	dispatch_set(SSH2_MSG_IGNORE, &client_global_keepalive);
2072
	dispatch_set(SSH2_MSG_UNIMPLEMENTED, &client_global_keepalive);
2073
}
2064
}
2074
static void
2065
static void
2075
client_init_dispatch_13(void)
2066
client_init_dispatch_13(void)
(-)packet.c (-5 / +10 lines)
Lines 132-137 static int server_side = 0; Link Here
132
/* Set to true if we are authenticated. */
132
/* Set to true if we are authenticated. */
133
static int after_authentication = 0;
133
static int after_authentication = 0;
134
134
135
int keep_alive_timeouts = 0;
136
135
/* Session key information for Encryption and MAC */
137
/* Session key information for Encryption and MAC */
136
Newkeys *newkeys[MODE_MAX];
138
Newkeys *newkeys[MODE_MAX];
137
static struct packet_state {
139
static struct packet_state {
Lines 959-968 packet_read_expect(int expected_type) Link Here
959
 * packet_process_incoming.  If so, reads the packet; otherwise returns
961
 * packet_process_incoming.  If so, reads the packet; otherwise returns
960
 * SSH_MSG_NONE.  This does not wait for data from the connection.
962
 * SSH_MSG_NONE.  This does not wait for data from the connection.
961
 *
963
 *
962
 * SSH_MSG_DISCONNECT is handled specially here.  Also, SSH_MSG_IGNORE
964
 * SSH_MSG_DISCONNECT is handled specially here.  Also,
963
 * messages are skipped by this function and are never returned
965
 * SSH_MSG_IGNORE messages are skipped by this function and are never returned
964
 * to higher levels, although SSH2_MSG_IGNORE are since they are needed
966
 * to higher levels.
965
 * for keepalives.
966
 */
967
 */
967
968
968
static int
969
static int
Lines 1184-1192 packet_read_poll_seqnr(u_int32_t *seqnr_ Link Here
1184
	for (;;) {
1185
	for (;;) {
1185
		if (compat20) {
1186
		if (compat20) {
1186
			type = packet_read_poll2(seqnr_p);
1187
			type = packet_read_poll2(seqnr_p);
1188
			keep_alive_timeouts = 0;
1187
			if (type)
1189
			if (type)
1188
				DBG(debug("received packet type %d", type));
1190
				DBG(debug("received packet type %d", type));
1189
			switch (type) {
1191
			switch (type) {
1192
			case SSH2_MSG_IGNORE:
1193
				debug3("Received SSH2_MSG_IGNORE");
1194
				break;
1190
			case SSH2_MSG_DEBUG:
1195
			case SSH2_MSG_DEBUG:
1191
				packet_get_char();
1196
				packet_get_char();
1192
				msg = packet_get_string(NULL);
1197
				msg = packet_get_string(NULL);
Lines 1207-1213 packet_read_poll_seqnr(u_int32_t *seqnr_ Link Here
1207
				seqnr = packet_get_int();
1212
				seqnr = packet_get_int();
1208
				debug("Received SSH2_MSG_UNIMPLEMENTED for %u",
1213
				debug("Received SSH2_MSG_UNIMPLEMENTED for %u",
1209
				    seqnr);
1214
				    seqnr);
1210
				/* FALLTHROUGH */
1215
				break;
1211
			default:
1216
			default:
1212
				return type;
1217
				return type;
1213
			}
1218
			}
(-)packet.h (+1 lines)
Lines 86-91 void tty_make_modes(int, struct termios Link Here
86
void	 tty_parse_modes(int, int *);
86
void	 tty_parse_modes(int, int *);
87
87
88
extern u_int max_packet_size;
88
extern u_int max_packet_size;
89
extern int keep_alive_timeouts;
89
int	 packet_set_maxsize(u_int);
90
int	 packet_set_maxsize(u_int);
90
#define  packet_get_maxsize() max_packet_size
91
#define  packet_get_maxsize() max_packet_size
91
92
(-)serverloop.c (-5 / +2 lines)
Lines 100-106 static int connection_in; /* Connection Link Here
100
static int connection_out;	/* Connection to client (output). */
100
static int connection_out;	/* Connection to client (output). */
101
static int connection_closed = 0;	/* Connection to client closed. */
101
static int connection_closed = 0;	/* Connection to client closed. */
102
static u_int buffer_high;	/* "Soft" max buffer size. */
102
static u_int buffer_high;	/* "Soft" max buffer size. */
103
static int client_alive_timeouts = 0;
104
103
105
/*
104
/*
106
 * This SIGCHLD kludge is used to detect when the child exits.  The server
105
 * This SIGCHLD kludge is used to detect when the child exits.  The server
Lines 242-248 client_alive_check(void) Link Here
242
	int channel_id;
241
	int channel_id;
243
242
244
	/* timeout, check to see how many we have had */
243
	/* timeout, check to see how many we have had */
245
	if (++client_alive_timeouts > options.client_alive_count_max) {
244
	if (++keep_alive_timeouts > options.client_alive_count_max) {
246
		logit("Timeout, client not responding.");
245
		logit("Timeout, client not responding.");
247
		cleanup_exit(255);
246
		cleanup_exit(255);
248
	}
247
	}
Lines 857-863 server_input_keep_alive(int type, u_int3 Link Here
857
	 * even if this was generated by something other than
856
	 * even if this was generated by something other than
858
	 * the bogus CHANNEL_REQUEST we send for keepalives.
857
	 * the bogus CHANNEL_REQUEST we send for keepalives.
859
	 */
858
	 */
860
	client_alive_timeouts = 0;
859
	keep_alive_timeouts = 0;
861
}
860
}
862
861
863
static void
862
static void
Lines 1155-1162 server_init_dispatch_20(void) Link Here
1155
	dispatch_set(SSH2_MSG_CHANNEL_FAILURE, &server_input_keep_alive);
1154
	dispatch_set(SSH2_MSG_CHANNEL_FAILURE, &server_input_keep_alive);
1156
	dispatch_set(SSH2_MSG_REQUEST_SUCCESS, &server_input_keep_alive);
1155
	dispatch_set(SSH2_MSG_REQUEST_SUCCESS, &server_input_keep_alive);
1157
	dispatch_set(SSH2_MSG_REQUEST_FAILURE, &server_input_keep_alive);
1156
	dispatch_set(SSH2_MSG_REQUEST_FAILURE, &server_input_keep_alive);
1158
	dispatch_set(SSH2_MSG_IGNORE, &server_input_keep_alive);
1159
	dispatch_set(SSH2_MSG_UNIMPLEMENTED, &server_input_keep_alive);
1160
	/* rekeying */
1157
	/* rekeying */
1161
	dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit);
1158
	dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit);
1162
}
1159
}

Return to bug 1307