From 676644d8e8e1943c0a3e95146d471ff6326875a7 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 15 May 2018 07:30:53 +0000 Subject: [PATCH] - Fix low-rtt-pct to low-rtt-permil, as it is parts in one thousand. git-svn-id: file:///svn/unbound/trunk@4683 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 +++ doc/example.conf.in | 2 +- doc/unbound.conf.5.in | 6 +++--- iterator/iter_utils.c | 4 ++-- util/config_file.c | 8 +++++--- util/config_file.h | 2 +- util/configlexer.lex | 3 ++- util/configparser.y | 10 +++++----- 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 512153061..72cf0b9ee 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +15 May 2018: Wouter + - Fix low-rtt-pct to low-rtt-permil, as it is parts in one thousand. + 11 May 2018: Wouter - Fix contrib/libunbound.pc for libssl libcrypto references, from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226914 diff --git a/doc/example.conf.in b/doc/example.conf.in index 160a45d28..32b6026a5 100644 --- a/doc/example.conf.in +++ b/doc/example.conf.in @@ -725,7 +725,7 @@ server: # low-rtt: 45 # select low rtt this many times out of 1000. 0 means the fast server # select is disabled. prefetches are not sped up. - # low-rtt-pct: 0 + # low-rtt-permil: 0 # Specific options for ipsecmod. unbound needs to be configured with # --enable-ipsecmod for these to take effect. diff --git a/doc/unbound.conf.5.in b/doc/unbound.conf.5.in index 57dceeb86..7a5e9fbce 100644 --- a/doc/unbound.conf.5.in +++ b/doc/unbound.conf.5.in @@ -1315,10 +1315,10 @@ factor given. .TP 5 .B low\-rtt: \fI Set the time in millisecond that is considere a low ping time for fast -server selection with the low\-rtt\-pct option, that turns this on or off. +server selection with the low\-rtt\-permil option, that turns this on or off. The default is 45 msec, a number from IPv6 quick response documents. .TP 5 -.B low\-rtt\-pct: \fI +.B low\-rtt\-permil: \fI Specify how many times out of 1000 to pick the fast server from the low rtt band. 0 turns the feature off. A value of 900 would pick the fast server when such fast servers are available 90 percent of the time, and @@ -1328,7 +1328,7 @@ sped up, because there is no one waiting for it, and it presents a good moment to perform server exploration. The low\-rtt option can be used to specify which servers are picked for fast server selection, servers with a ping roundtrip time below that value are considered. -The default for low\-rtt\-pct is 0. +The default for low\-rtt\-permil is 0. .SS "Remote Control Options" In the .B remote\-control: diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index 752474cd8..0a8f7700f 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -329,9 +329,9 @@ 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_pct != 0 && prefetch == 0 && + 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_pct) { + 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 */ diff --git a/util/config_file.c b/util/config_file.c index 3bf5f6308..70dc09304 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -161,7 +161,7 @@ config_create(void) if(!(cfg->logfile = strdup(""))) goto error_exit; if(!(cfg->pidfile = strdup(PIDFILE))) goto error_exit; if(!(cfg->target_fetch_policy = strdup("3 2 1 0 0"))) goto error_exit; - cfg->low_rtt_pct = 0; + cfg->low_rtt_permil = 0; cfg->low_rtt = 45; cfg->donotqueryaddrs = NULL; cfg->donotquery_localhost = 1; @@ -618,7 +618,8 @@ int config_set_option(struct config_file* cfg, const char* opt, else S_NUMBER_OR_ZERO("ip-ratelimit-factor:", ip_ratelimit_factor) else S_NUMBER_OR_ZERO("ratelimit-factor:", ratelimit_factor) else S_NUMBER_OR_ZERO("low-rtt:", low_rtt) - else S_NUMBER_OR_ZERO("low-rtt-pct:", low_rtt_pct) + else S_NUMBER_OR_ZERO("low-rtt-pct:", low_rtt_permil) + else S_NUMBER_OR_ZERO("low-rtt-permil:", low_rtt_permil) else S_YNO("qname-minimisation:", qname_minimisation) else S_YNO("qname-minimisation-strict:", qname_minimisation_strict) #ifdef USE_IPSECMOD @@ -1001,7 +1002,8 @@ config_get_option(struct config_file* cfg, const char* opt, else O_DEC(opt, "ip-ratelimit-factor", ip_ratelimit_factor) else O_DEC(opt, "ratelimit-factor", ratelimit_factor) else O_DEC(opt, "low-rtt", low_rtt) - else O_DEC(opt, "low-rtt-pct", low_rtt_pct) + else O_DEC(opt, "low-rtt-pct", low_rtt_permil) + else O_DEC(opt, "low-rtt-permil", low_rtt_permil) else O_DEC(opt, "val-sig-skew-min", val_sig_skew_min) else O_DEC(opt, "val-sig-skew-max", val_sig_skew_max) else O_YNO(opt, "qname-minimisation", qname_minimisation) diff --git a/util/config_file.h b/util/config_file.h index eba60b9a1..2b49d9c6e 100644 --- a/util/config_file.h +++ b/util/config_file.h @@ -144,7 +144,7 @@ struct config_file { /** the target fetch policy for the iterator */ char* target_fetch_policy; /** percent*10, how many times in 1000 to pick low rtt destinations */ - int low_rtt_pct; + int low_rtt_permil; /** what time in msec is a low rtt destination */ int low_rtt; diff --git a/util/configlexer.lex b/util/configlexer.lex index 73dfe4bd4..00fde10aa 100644 --- a/util/configlexer.lex +++ b/util/configlexer.lex @@ -428,7 +428,8 @@ ratelimit-below-domain{COLON} { YDVAR(2, VAR_RATELIMIT_BELOW_DOMAIN) } ip-ratelimit-factor{COLON} { YDVAR(1, VAR_IP_RATELIMIT_FACTOR) } ratelimit-factor{COLON} { YDVAR(1, VAR_RATELIMIT_FACTOR) } low-rtt{COLON} { YDVAR(1, VAR_LOW_RTT) } -low-rtt-pct{COLON} { YDVAR(1, VAR_LOW_RTT_PCT) } +low-rtt-pct{COLON} { YDVAR(1, VAR_LOW_RTT_PERMIL) } +low-rtt-permil{COLON} { YDVAR(1, VAR_LOW_RTT_PERMIL) } response-ip-tag{COLON} { YDVAR(2, VAR_RESPONSE_IP_TAG) } response-ip{COLON} { YDVAR(2, VAR_RESPONSE_IP) } response-ip-data{COLON} { YDVAR(2, VAR_RESPONSE_IP_DATA) } diff --git a/util/configparser.y b/util/configparser.y index a71bf914c..a8f8027fe 100644 --- a/util/configparser.y +++ b/util/configparser.y @@ -156,7 +156,7 @@ extern struct config_parser_state* cfg_parser; %token VAR_CACHEDB_REDISHOST VAR_CACHEDB_REDISPORT VAR_CACHEDB_REDISTIMEOUT %token VAR_UDP_UPSTREAM_WITHOUT_DOWNSTREAM VAR_FOR_UPSTREAM %token VAR_AUTH_ZONE VAR_ZONEFILE VAR_MASTER VAR_URL VAR_FOR_DOWNSTREAM -%token VAR_FALLBACK_ENABLED VAR_ADDITIONAL_TLS_PORT VAR_LOW_RTT VAR_LOW_RTT_PCT +%token VAR_FALLBACK_ENABLED VAR_ADDITIONAL_TLS_PORT VAR_LOW_RTT VAR_LOW_RTT_PERMIL %token VAR_ALLOW_NOTIFY %% @@ -249,7 +249,7 @@ content_server: server_num_threads | server_verbosity | server_port | server_ipsecmod_whitelist | server_ipsecmod_strict | server_udp_upstream_without_downstream | server_aggressive_nsec | server_tls_cert_bundle | server_additional_tls_port | server_low_rtt | - server_low_rtt_pct + server_low_rtt_permil ; stubstart: VAR_STUB_ZONE { @@ -1885,12 +1885,12 @@ server_low_rtt: VAR_LOW_RTT STRING_ARG free($2); } ; -server_low_rtt_pct: VAR_LOW_RTT_PCT STRING_ARG +server_low_rtt_permil: VAR_LOW_RTT_PERMIL STRING_ARG { - OUTYY(("P(server_low_rtt_pct:%s)\n", $2)); + OUTYY(("P(server_low_rtt_permil:%s)\n", $2)); if(atoi($2) == 0 && strcmp($2, "0") != 0) yyerror("number expected"); - else cfg_parser->cfg->low_rtt_pct = atoi($2); + else cfg_parser->cfg->low_rtt_permil = atoi($2); free($2); } ; -- 2.47.3