From fa2609d583d05e8c18a775fc58e6276e67e392e2 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 23 Oct 2021 07:25:20 +0000 Subject: [PATCH] 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 --- sbin/unwind/resolver.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; -- 2.20.1