diff options
author | 2018-09-17 09:46:12 +0000 | |
---|---|---|
committer | 2018-09-17 09:46:12 +0000 | |
commit | 20237c5596ac37c947fe7dc6b504ad5cf4d698eb (patch) | |
tree | 658beab9d39c73edf6089912574577fe1e0a9a55 /usr.sbin/unbound/iterator/iter_utils.c | |
parent | import unbound 1.7.3, testing from benno@ and Brad. (diff) | |
download | wireguard-openbsd-20237c5596ac37c947fe7dc6b504ad5cf4d698eb.tar.xz wireguard-openbsd-20237c5596ac37c947fe7dc6b504ad5cf4d698eb.zip |
merge conflicts
Diffstat (limited to 'usr.sbin/unbound/iterator/iter_utils.c')
-rw-r--r-- | usr.sbin/unbound/iterator/iter_utils.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/usr.sbin/unbound/iterator/iter_utils.c b/usr.sbin/unbound/iterator/iter_utils.c index 70cab40faa8..0a8f7700fcf 100644 --- a/usr.sbin/unbound/iterator/iter_utils.c +++ b/usr.sbin/unbound/iterator/iter_utils.c @@ -312,9 +312,9 @@ static int iter_filter_order(struct iter_env* iter_env, struct module_env* env, uint8_t* name, size_t namelen, uint16_t qtype, time_t now, struct delegpt* dp, int* selected_rtt, int open_target, - struct sock_list* blacklist) + struct sock_list* blacklist, time_t prefetch) { - int got_num = 0, low_rtt = 0, swap_to_front; + int got_num = 0, low_rtt = 0, swap_to_front, rtt_band = RTT_BAND; struct delegpt_addr* a, *n, *prev=NULL; /* fillup sel_rtt and find best rtt in the bunch */ @@ -329,6 +329,16 @@ iter_filter_order(struct iter_env* iter_env, struct module_env* env, return 0 to force the caller to fetch more */ } + if(env->cfg->low_rtt_permil != 0 && prefetch == 0 && + low_rtt < env->cfg->low_rtt && + ub_random_max(env->rnd, 1000) < env->cfg->low_rtt_permil) { + /* the query is not prefetch, but for a downstream client, + * there is a low_rtt (fast) server. We choose that x% of the + * time */ + /* pick rtt numbers from 0..LOWBAND_RTT */ + rtt_band = env->cfg->low_rtt - low_rtt; + } + got_num = 0; a = dp->result_list; while(a) { @@ -340,10 +350,10 @@ iter_filter_order(struct iter_env* iter_env, struct module_env* env, } /* classify the server address and determine what to do */ swap_to_front = 0; - if(a->sel_rtt >= low_rtt && a->sel_rtt - low_rtt <= RTT_BAND) { + if(a->sel_rtt >= low_rtt && a->sel_rtt - low_rtt <= rtt_band) { got_num++; swap_to_front = 1; - } else if(a->sel_rtt<low_rtt && low_rtt-a->sel_rtt<=RTT_BAND) { + } else if(a->sel_rtt<low_rtt && low_rtt-a->sel_rtt<=rtt_band) { got_num++; swap_to_front = 1; } @@ -400,13 +410,14 @@ struct delegpt_addr* iter_server_selection(struct iter_env* iter_env, struct module_env* env, struct delegpt* dp, uint8_t* name, size_t namelen, uint16_t qtype, int* dnssec_lame, - int* chase_to_rd, int open_target, struct sock_list* blacklist) + int* chase_to_rd, int open_target, struct sock_list* blacklist, + time_t prefetch) { int sel; int selrtt; struct delegpt_addr* a, *prev; int num = iter_filter_order(iter_env, env, name, namelen, qtype, - *env->now, dp, &selrtt, open_target, blacklist); + *env->now, dp, &selrtt, open_target, blacklist, prefetch); if(num == 0) return NULL; @@ -625,7 +636,7 @@ iter_dp_is_useless(struct query_info* qinfo, uint16_t qflags, } int -iter_indicates_dnssec_fwd(struct module_env* env, struct query_info *qinfo) +iter_qname_indicates_dnssec(struct module_env* env, struct query_info *qinfo) { struct trust_anchor* a; if(!env || !env->anchors || !qinfo || !qinfo->qname) |