summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2019-11-30 16:14:03 +0000
committerotto <otto@openbsd.org>2019-11-30 16:14:03 +0000
commit1977fc687a897bc56d167475c1acb72f744a73f5 (patch)
tree4c8df996c139f5993288646243f96e9204abb1e8
parentThe message sent in config_setmode starts the handshake in the ikev2 process (diff)
downloadwireguard-openbsd-1977fc687a897bc56d167475c1acb72f744a73f5.tar.xz
wireguard-openbsd-1977fc687a897bc56d167475c1acb72f744a73f5.zip
make sure we only pass normalized timevals for the next resolver interval;
ok florian@
-rw-r--r--sbin/unwind/resolver.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c
index 32e3f341935..667be55a41d 100644
--- a/sbin/unwind/resolver.c
+++ b/sbin/unwind/resolver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolver.c,v 1.85 2019/11/30 11:09:14 florian Exp $ */
+/* $OpenBSD: resolver.c,v 1.86 2019/11/30 16:14:03 otto Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -756,12 +756,18 @@ try_next_resolver(struct running_query *rq)
memcpy(query_imsg, rq->query_imsg, sizeof(*query_imsg));
clock_gettime(CLOCK_MONOTONIC, &query_imsg->tp);
+ ms = histogram_median(res->latest_histogram);
+ if (ms == INT64_MAX)
+ ms = 2000;
if (res->type == resolver_conf->res_pref.types[0])
- tv.tv_usec = 1000 * (PREF_RESOLVER_MEDIAN_SKEW +
- histogram_median(res->latest_histogram));
+ tv.tv_usec = 1000 * (PREF_RESOLVER_MEDIAN_SKEW + ms);
else
- tv.tv_usec = 1000 * histogram_median(res->latest_histogram);
+ tv.tv_usec = 1000 * ms;
+ while (tv.tv_usec >= 1000000) {
+ tv.tv_sec++;
+ tv.tv_usec -= 1000000;
+ }
evtimer_add(&rq->timer_ev, &tv);
if (resolve(res, query_imsg->qname, query_imsg->t,