]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/nsrep: revert some changes from commit 5581cf9b
authorGrigorii Demidov <grigorii.demidov@nic.cz>
Fri, 21 Apr 2017 12:30:05 +0000 (14:30 +0200)
committerGrigorii Demidov <grigorii.demidov@nic.cz>
Fri, 21 Apr 2017 12:30:05 +0000 (14:30 +0200)
lib/nsrep.c

index 1bf27048d7bca453cd70e9c58607ca7c5cd24908..8139a223cfdef81d50b0378d41e71ee576344d2c 100644 (file)
@@ -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 {