From: florian Date: Sat, 23 Oct 2021 07:25:20 +0000 (+0000) Subject: unwind(8) gives the most preferred resolver strategy a bit more time X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fa2609d583d05e8c18a775fc58e6276e67e392e2;p=openbsd unwind(8) gives the most preferred resolver strategy a bit more time (200ms) to answer before trying the next strategy. However, we need to skip strategies that are not available. In the default configuration, without a config file unwind(8) would give DoT 200ms more time, but no DoT forwarders are known, so this is useless. OK kn --- diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c index 81485b230fa..42730213f9b 100644 --- a/sbin/unwind/resolver.c +++ b/sbin/unwind/resolver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolver.c,v 1.149 2021/08/31 20:18:03 kn Exp $ */ +/* $OpenBSD: resolver.c,v 1.150 2021/10/23 07:25:20 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -772,6 +772,7 @@ try_next_resolver(struct running_query *rq) struct timespec tp, elapsed; struct timeval tv = {0, 0}; int64_t ms; + int i; while(rq->next_resolver < rq->res_pref.len && ((res = resolvers[rq->res_pref.types[rq->next_resolver]]) == NULL || @@ -804,7 +805,12 @@ try_next_resolver(struct running_query *rq) ms = res->median; if (ms > NEXT_RES_MAX) ms = NEXT_RES_MAX; - if (res->type == resolver_conf->res_pref.types[0]) + + /* skip over unavailable resolvers in preferences */ + for (i = 0; i < resolver_conf->res_pref.len && + resolvers[resolver_conf->res_pref.types[i]] == NULL; i++) + ; + if (res->type == resolver_conf->res_pref.types[i]) tv.tv_usec = 1000 * (PREF_RESOLVER_MEDIAN_SKEW + ms); else tv.tv_usec = 1000 * ms;