summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-06-02 07:46:16 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-06-02 07:46:16 +1000
commitb759c9c2efebe7b416ab81093ca8eb17836b6933 (patch)
tree41ad0279844ea8f149ab2c1015fa140061b390ac /packet.c
parent55119253c64808b0d3b2ab5d2bc67ee9dac3430b (diff)
- dtucker@cvs.openbsd.org 2013/06/01 13:15:52
[ssh-agent.c clientloop.c misc.h packet.c progressmeter.c misc.c channels.c sandbox-systrace.c] Use clock_gettime(CLOCK_MONOTONIC ...) for ssh timers so that things like keepalives and rekeying will work properly over clock steps. Suggested by markus@, "looks good" djm@.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/packet.c b/packet.c
index 84ebd81d5..b25395d4b 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.186 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.187 2013/06/01 13:15:52 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
@@ -1015,7 +1015,7 @@ packet_send2(void)
1015 /* after a NEWKEYS message we can send the complete queue */ 1015 /* after a NEWKEYS message we can send the complete queue */
1016 if (type == SSH2_MSG_NEWKEYS) { 1016 if (type == SSH2_MSG_NEWKEYS) {
1017 active_state->rekeying = 0; 1017 active_state->rekeying = 0;
1018 active_state->rekey_time = time(NULL); 1018 active_state->rekey_time = monotime();
1019 while ((p = TAILQ_FIRST(&active_state->outgoing))) { 1019 while ((p = TAILQ_FIRST(&active_state->outgoing))) {
1020 type = p->type; 1020 type = p->type;
1021 debug("dequeue packet: %u", type); 1021 debug("dequeue packet: %u", type);
@@ -1942,7 +1942,7 @@ packet_need_rekeying(void)
1942 (active_state->max_blocks_in && 1942 (active_state->max_blocks_in &&
1943 (active_state->p_read.blocks > active_state->max_blocks_in)) || 1943 (active_state->p_read.blocks > active_state->max_blocks_in)) ||
1944 (active_state->rekey_interval != 0 && active_state->rekey_time + 1944 (active_state->rekey_interval != 0 && active_state->rekey_time +
1945 active_state->rekey_interval <= time(NULL)); 1945 active_state->rekey_interval <= monotime());
1946} 1946}
1947 1947
1948void 1948void
@@ -1956,7 +1956,7 @@ packet_set_rekey_limits(u_int32_t bytes, time_t seconds)
1956 * We set the time here so that in post-auth privsep slave we count 1956 * We set the time here so that in post-auth privsep slave we count
1957 * from the completion of the authentication. 1957 * from the completion of the authentication.
1958 */ 1958 */
1959 active_state->rekey_time = time(NULL); 1959 active_state->rekey_time = monotime();
1960} 1960}
1961 1961
1962time_t 1962time_t
@@ -1965,7 +1965,7 @@ packet_get_rekey_timeout(void)
1965 time_t seconds; 1965 time_t seconds;
1966 1966
1967 seconds = active_state->rekey_time + active_state->rekey_interval - 1967 seconds = active_state->rekey_time + active_state->rekey_interval -
1968 time(NULL); 1968 monotime();
1969 return (seconds <= 0 ? 1 : seconds); 1969 return (seconds <= 0 ? 1 : seconds);
1970} 1970}
1971 1971