From 84624cb151fe5a1b15f1facdb0896bc6f88f3359 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 28 Jan 2021 07:34:34 +0000 Subject: [PATCH] A new resolver can be created while we currently run a check with the old configuration. We will then request another check that runs in parallel to the old check. If the new check finishes earlier, the current check result will be overwritten by an outdated check result which is likely wrong. While here fix some whitespace. OK phessler --- sbin/unwind/resolver.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c index 49f51d8a9ab..feeb6c2f27a 100644 --- a/sbin/unwind/resolver.c +++ b/sbin/unwind/resolver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolver.c,v 1.137 2021/01/27 08:30:50 florian Exp $ */ +/* $OpenBSD: resolver.c,v 1.138 2021/01/28 07:34:34 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -1513,8 +1513,6 @@ check_resolver(struct uw_resolver *resolver_to_check) evtimer_add(&resolver_to_check->check_ev, &resolver_to_check->check_tv); } - - } void @@ -1529,6 +1527,12 @@ check_resolver_done(struct uw_resolver *res, void *arg, int rcode, checked_resolver->check_running--; + if (checked_resolver != resolvers[checked_resolver->type]) { + log_debug("%s: %s: ignoring late check result", __func__, + uw_resolver_type_str[checked_resolver->type]); + goto out; + } + prev_state = checked_resolver->state; if (answer_len < LDNS_HEADER_SIZE) { -- 2.20.1