summaryrefslogtreecommitdiffstats
path: root/usr.sbin/unbound/iterator/iter_utils.c
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2017-02-17 18:53:31 +0000
committersthen <sthen@openbsd.org>2017-02-17 18:53:31 +0000
commit77079be7e74cd516ce5a60021c2a03ba383e594d (patch)
treec606f524c8cea49efc2f7d2c427cbaae6dc0c9d9 /usr.sbin/unbound/iterator/iter_utils.c
parentMany people have been complaining for a long time that ``...'' looks (diff)
downloadwireguard-openbsd-77079be7e74cd516ce5a60021c2a03ba383e594d.tar.xz
wireguard-openbsd-77079be7e74cd516ce5a60021c2a03ba383e594d.zip
Update to unbound-1.6.1rc3 - thanks millert@ and Brad for tests.
Diffstat (limited to 'usr.sbin/unbound/iterator/iter_utils.c')
-rw-r--r--usr.sbin/unbound/iterator/iter_utils.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/usr.sbin/unbound/iterator/iter_utils.c b/usr.sbin/unbound/iterator/iter_utils.c
index a5aefa9602c..0b1b456113f 100644
--- a/usr.sbin/unbound/iterator/iter_utils.c
+++ b/usr.sbin/unbound/iterator/iter_utils.c
@@ -108,7 +108,7 @@ read_fetch_policy(struct iter_env* ie, const char* str)
/** apply config caps whitelist items to name tree */
static int
-caps_white_apply_cfg(rbtree_t* ntree, struct config_file* cfg)
+caps_white_apply_cfg(rbtree_type* ntree, struct config_file* cfg)
{
struct config_strlist* p;
for(p=cfg->caps_whitelist; p; p=p->next) {
@@ -360,6 +360,39 @@ iter_filter_order(struct iter_env* iter_env, struct module_env* env,
}
}
*selected_rtt = low_rtt;
+
+ if (env->cfg->prefer_ip6) {
+ int got_num6 = 0;
+ int low_rtt6 = 0;
+ int i;
+ prev = NULL;
+ a = dp->result_list;
+ for(i = 0; i < got_num; i++) {
+ swap_to_front = 0;
+ if(a->addr.ss_family == AF_INET6) {
+ got_num6++;
+ swap_to_front = 1;
+ if(low_rtt6 == 0 || a->sel_rtt < low_rtt6) {
+ low_rtt6 = a->sel_rtt;
+ }
+ }
+ /* swap to front if IPv6, or move to next result */
+ if(swap_to_front && prev) {
+ n = a->next_result;
+ prev->next_result = n;
+ a->next_result = dp->result_list;
+ dp->result_list = a;
+ a = n;
+ } else {
+ prev = a;
+ a = a->next_result;
+ }
+ }
+ if(got_num6 > 0) {
+ got_num = got_num6;
+ *selected_rtt = low_rtt6;
+ }
+ }
return got_num;
}
@@ -499,6 +532,7 @@ causes_cycle(struct module_qstate* qstate, uint8_t* name, size_t namelen,
qinf.qname_len = namelen;
qinf.qtype = t;
qinf.qclass = c;
+ qinf.local_alias = NULL;
fptr_ok(fptr_whitelist_modenv_detect_cycle(
qstate->env->detect_cycle));
return (*qstate->env->detect_cycle)(qstate, &qinf,