From: Grigorii Demidov Date: Fri, 21 Apr 2017 12:30:05 +0000 (+0200) Subject: lib/nsrep: revert some changes from commit 5581cf9b X-Git-Tag: v1.2.6~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcc75a1ee27d3ed340d88599fb80a7ffb3184387;p=thirdparty%2Fknot-resolver.git lib/nsrep: revert some changes from commit 5581cf9b --- diff --git a/lib/nsrep.c b/lib/nsrep.c index 1bf27048d..8139a223c 100644 --- a/lib/nsrep.c +++ b/lib/nsrep.c @@ -139,16 +139,16 @@ static int eval_nsrep(const char *k, void *v, void *baton) /* If the server doesn't have IPv6, give it disadvantage. */ if (reputation & KR_NS_NOIP6) { score += FAVOUR_IPV6; + /* If the server is unknown but has rep record, treat it as timeouted */ if (reputation & KR_NS_NOIP4) { - /* Server is unknown but has rep record. - * We can not distinguish if it happens either - * due to timeout or due to other circumstances - * (for example, we have ipv6-only network and - * we are dealing with ipv4-only NS). - * Don't use it for now. - * TODO - - * add explicit flag for timeouted servers */ - score = KR_NS_MAX_SCORE + 1; + score = KR_NS_UNKNOWN; + /* Try to start with clean slate */ + if (!(ctx->options & QUERY_NO_IPV6)) { + reputation &= ~KR_NS_NOIP6; + } + if (!(ctx->options & QUERY_NO_IPV4)) { + reputation &= ~KR_NS_NOIP4; + } } } } else {