- 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@.
diff --git a/packet.c b/packet.c
index 84ebd81..b25395d 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.186 2013/05/17 00:13:13 djm Exp $ */
+/* $OpenBSD: packet.c,v 1.187 2013/06/01 13:15:52 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1015,7 +1015,7 @@
/* after a NEWKEYS message we can send the complete queue */
if (type == SSH2_MSG_NEWKEYS) {
active_state->rekeying = 0;
- active_state->rekey_time = time(NULL);
+ active_state->rekey_time = monotime();
while ((p = TAILQ_FIRST(&active_state->outgoing))) {
type = p->type;
debug("dequeue packet: %u", type);
@@ -1942,7 +1942,7 @@
(active_state->max_blocks_in &&
(active_state->p_read.blocks > active_state->max_blocks_in)) ||
(active_state->rekey_interval != 0 && active_state->rekey_time +
- active_state->rekey_interval <= time(NULL));
+ active_state->rekey_interval <= monotime());
}
void
@@ -1956,7 +1956,7 @@
* We set the time here so that in post-auth privsep slave we count
* from the completion of the authentication.
*/
- active_state->rekey_time = time(NULL);
+ active_state->rekey_time = monotime();
}
time_t
@@ -1965,7 +1965,7 @@
time_t seconds;
seconds = active_state->rekey_time + active_state->rekey_interval -
- time(NULL);
+ monotime();
return (seconds <= 0 ? 1 : seconds);
}