diff options
| author | 2017-11-25 06:46:22 +0000 | |
|---|---|---|
| committer | 2017-11-25 06:46:22 +0000 | |
| commit | 04b1c7a250035d28aee67ac8e1b1ca3414231a01 (patch) | |
| tree | fda385b3b00c3495240b5f218df3b23db51dc8f2 /usr.bin/ssh/ssh-keyscan.c | |
| parent | Remove get_current_time() and replace with calls to monotime_double() (diff) | |
| download | wireguard-openbsd-04b1c7a250035d28aee67ac8e1b1ca3414231a01.tar.xz wireguard-openbsd-04b1c7a250035d28aee67ac8e1b1ca3414231a01.zip | |
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@
Diffstat (limited to 'usr.bin/ssh/ssh-keyscan.c')
| -rw-r--r-- | usr.bin/ssh/ssh-keyscan.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/ssh/ssh-keyscan.c b/usr.bin/ssh/ssh-keyscan.c index 52191d156f7..0afc71729ba 100644 --- a/usr.bin/ssh/ssh-keyscan.c +++ b/usr.bin/ssh/ssh-keyscan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keyscan.c,v 1.115 2017/06/30 04:17:23 dtucker Exp $ */ +/* $OpenBSD: ssh-keyscan.c,v 1.116 2017/11/25 06:46:22 dtucker Exp $ */ /* * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. * @@ -357,7 +357,7 @@ conalloc(char *iname, char *oname, int keytype) fdcon[s].c_len = 4; fdcon[s].c_off = 0; fdcon[s].c_keytype = keytype; - gettimeofday(&fdcon[s].c_tv, NULL); + monotime_tv(&fdcon[s].c_tv); fdcon[s].c_tv.tv_sec += timeout; TAILQ_INSERT_TAIL(&tq, &fdcon[s], c_link); FD_SET(s, read_wait); @@ -391,7 +391,7 @@ static void contouch(int s) { TAILQ_REMOVE(&tq, &fdcon[s], c_link); - gettimeofday(&fdcon[s].c_tv, NULL); + monotime_tv(&fdcon[s].c_tv); fdcon[s].c_tv.tv_sec += timeout; TAILQ_INSERT_TAIL(&tq, &fdcon[s], c_link); } @@ -525,7 +525,7 @@ conloop(void) con *c; int i; - gettimeofday(&now, NULL); + monotime_tv(&now); c = TAILQ_FIRST(&tq); if (c && (c->c_tv.tv_sec > now.tv_sec || |
