diff options
author | dtucker@openbsd.org@openbsd.org <dtucker@openbsd.org@openbsd.org> | 2017-11-25 07:46:22 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-11-28 02:01:49 +0100 |
commit | 5db6fbf1438b108e5df3e79a1b4de544373bc2d4 (patch) | |
tree | 95f5df8248cca30df3ab00e70e80d28410be760c /packet.c | |
parent | upstream commit (diff) | |
download | openssh-5db6fbf1438b108e5df3e79a1b4de544373bc2d4.tar.xz openssh-5db6fbf1438b108e5df3e79a1b4de544373bc2d4.zip |
upstream commit
Add monotime_ts and monotime_tv that return monotonic
timespec and timeval respectively. Replace calls to gettimeofday() in packet
timing with monotime_tv so that the callers will work over a clock step.
Should prevent integer overflow during clock steps reported by wangle6 at
huawei.com. "I like" markus@
OpenBSD-Commit-ID: 74d684264814ff806f197948b87aa732cb1b0b8a
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.266 2017/10/25 00:17:08 djm Exp $ */ +/* $OpenBSD: packet.c,v 1.267 2017/11/25 06:46:22 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1332,7 +1332,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p) for (;;) { if (state->packet_timeout_ms != -1) { ms_to_timeval(&timeout, ms_remain); - gettimeofday(&start, NULL); + monotime_tv(&start); } if ((r = select(state->connection_in + 1, setp, NULL, NULL, timeoutp)) >= 0) @@ -1959,7 +1959,7 @@ ssh_packet_write_wait(struct ssh *ssh) for (;;) { if (state->packet_timeout_ms != -1) { ms_to_timeval(&timeout, ms_remain); - gettimeofday(&start, NULL); + monotime_tv(&start); } if ((ret = select(state->connection_out + 1, NULL, setp, NULL, timeoutp)) >= 0) |