summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-06-13 06:42:45 +1000
committerDarren Tucker <dtucker@zip.com.au>2008-06-13 06:42:45 +1000
commit3fc464efdc5111334f42213891521fcd42c0e7a1 (patch)
treee48491c53689ac119109005b3f5bbf84b57bbdcd /sshconnect.c
parentf09e825329d13c5fc31a97fc7ea2312dd4fb5405 (diff)
- dtucker@cvs.openbsd.org 2008/06/12 20:38:28
[sshd.c sshconnect.c packet.h misc.c misc.h packet.c] Make keepalive timeouts apply while waiting for a packet, particularly during key renegotiation (bz #1363). With djm and Matt Day, ok djm@
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 7602da340..c99874285 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.206 2008/06/12 00:13:55 grunk Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.207 2008/06/12 20:38:28 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -77,23 +77,6 @@ extern pid_t proxy_command_pid;
77static int show_other_keys(const char *, Key *); 77static int show_other_keys(const char *, Key *);
78static void warn_changed_key(Key *); 78static void warn_changed_key(Key *);
79 79
80static void
81ms_subtract_diff(struct timeval *start, int *ms)
82{
83 struct timeval diff, finish;
84
85 gettimeofday(&finish, NULL);
86 timersub(&finish, start, &diff);
87 *ms -= (diff.tv_sec * 1000) + (diff.tv_usec / 1000);
88}
89
90static void
91ms_to_timeval(struct timeval *tv, int ms)
92{
93 tv->tv_sec = ms / 1000;
94 tv->tv_usec = (ms % 1000) * 1000;
95}
96
97/* 80/*
98 * Connect to the given ssh server using a proxy command. 81 * Connect to the given ssh server using a proxy command.
99 */ 82 */
@@ -178,6 +161,8 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
178 161
179 /* Set the connection file descriptors. */ 162 /* Set the connection file descriptors. */
180 packet_set_connection(pout[0], pin[1]); 163 packet_set_connection(pout[0], pin[1]);
164 packet_set_timeout(options.server_alive_interval,
165 options.server_alive_count_max);
181 166
182 /* Indicate OK return */ 167 /* Indicate OK return */
183 return 0; 168 return 0;
@@ -422,6 +407,8 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
422 407
423 /* Set the connection. */ 408 /* Set the connection. */
424 packet_set_connection(sock, sock); 409 packet_set_connection(sock, sock);
410 packet_set_timeout(options.server_alive_interval,
411 options.server_alive_count_max);
425 412
426 return 0; 413 return 0;
427} 414}