From: Wouter Wijngaards Date: Fri, 6 Jul 2018 14:14:19 +0000 (+0000) Subject: Fix round robin for failed addresses with prefer-ip6: yes X-Git-Tag: release-1.8.0rc1~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86f16bef93b33de4c916458f3c7a4f14eb0f5925;p=thirdparty%2Funbound.git Fix round robin for failed addresses with prefer-ip6: yes git-svn-id: file:///svn/unbound/trunk@4775 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index 0a8f7700f..df66776ae 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -375,12 +375,20 @@ iter_filter_order(struct iter_env* iter_env, struct module_env* env, int got_num6 = 0; int low_rtt6 = 0; int i; + int attempt = -1; /* filter to make sure addresses have + less attempts on them than the first, to force round + robin when all the IPv6 addresses fail */ prev = NULL; a = dp->result_list; for(i = 0; i < got_num; i++) { swap_to_front = 0; - if(a->addr.ss_family == AF_INET6) { + if(a->addr.ss_family != AF_INET6 && attempt == -1) + attempt = a->attempts; + if(a->addr.ss_family == AF_INET6 && + (attempt==-1 || a->attempts<=attempt)) { got_num6++; + if(attempt == -1) + attempt = a->attempts; swap_to_front = 1; if(low_rtt6 == 0 || a->sel_rtt < low_rtt6) { low_rtt6 = a->sel_rtt;