]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
nsrep: allow inclusion of good nameservers if there's space in selection
authorMarek Vavruša <mvavrusa@cloudflare.com>
Tue, 5 Mar 2019 18:35:21 +0000 (10:35 -0800)
committerPetr Špaček <petr.spacek@nic.cz>
Tue, 12 Mar 2019 13:04:23 +0000 (13:04 +0000)
The current algorithm doesn't work if there's 3 unknown nameservers in the
address selection set, and the 4th is known working with higher score
than unknown.

lib/nsrep.c

index 2af12f2c4c91b42d27a788f7b0817d1b9acb9cae..c992194f452c5beced7a53bebb4ba88b2bb75a7d 100644 (file)
@@ -262,7 +262,7 @@ static int eval_nsrep(const knot_dname_t *owner, const pack_t *addr_set, struct
                update_nsrep_set(ns, owner, addr_choice, score);
                ns->reputation = reputation;
                return 1; /* Stop evaluation */
-       } else if (ns->score > KR_NS_MAX_SCORE) {
+       } else if (ns->score > KR_NS_MAX_SCORE || addr_choice[KR_NSREP_MAXADDR - 1] == NULL) {
                /* Check if any server was already selected.
                 * If no, pick current server and continue evaluation. */
                update_nsrep_set(ns, owner, addr_choice, score);