commit 373950340488123fb18c49f8a126a3ef9affb1e6 Author: Nick Mathewson nickm@torproject.org Date: Thu Dec 19 10:14:09 2019 -0500
Move TestingMin{Exit,Fast}FlagThreshold to dirauth module. --- src/app/config/config.c | 2 -- src/app/config/or_options_st.h | 6 ------ src/feature/dirauth/dirauth_options.inc | 6 ++++++ src/feature/dirauth/voteflags.c | 7 ++++--- 4 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/app/config/config.c b/src/app/config/config.c index 3e1549b70..81e5e6a8e 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -596,8 +596,6 @@ static const config_var_t option_vars_[] = { V(PerConnBWRate, MEMUNIT, "0"), V_IMMUTABLE(PidFile, FILENAME, NULL), V_IMMUTABLE(TestingTorNetwork, BOOL, "0"), - V(TestingMinExitFlagThreshold, MEMUNIT, "0"), - V(TestingMinFastFlagThreshold, MEMUNIT, "0"),
V(TestingLinkCertLifetime, INTERVAL, "2 days"), V(TestingAuthKeyLifetime, INTERVAL, "2 days"), diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index a38eae40f..f9aa0e5cd 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -764,12 +764,6 @@ struct or_options_t { * of certain configuration options. */ int TestingTorNetwork;
- /** Minimum value for the Exit flag threshold on testing networks. */ - uint64_t TestingMinExitFlagThreshold; - - /** Minimum value for the Fast flag threshold on testing networks. */ - uint64_t TestingMinFastFlagThreshold; - /** Relays in a testing network which should be voted Exit * regardless of exit policy. */ routerset_t *TestingDirAuthVoteExit; diff --git a/src/feature/dirauth/dirauth_options.inc b/src/feature/dirauth/dirauth_options.inc index e1550a6e9..82954a992 100644 --- a/src/feature/dirauth/dirauth_options.inc +++ b/src/feature/dirauth/dirauth_options.inc @@ -70,6 +70,12 @@ CONF_VAR(RecommendedServerVersions, LINELIST, 0, NULL) * altered on testing networks. */ CONF_VAR(TestingAuthDirTimeToLearnReachability, INTERVAL, 0, "30 minutes")
+/** Minimum value for the Exit flag threshold on testing networks. */ +CONF_VAR(TestingMinExitFlagThreshold, MEMUNIT, 0, "0") + +/** Minimum value for the Fast flag threshold on testing networks. */ +CONF_VAR(TestingMinFastFlagThreshold, MEMUNIT, 0, "0") + /** Boolean: is this an authoritative directory that's willing to recommend * versions? */ CONF_VAR(VersioningAuthoritativeDirectory, BOOL, 0, "0") diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c index 757bc3594..975b3e2cf 100644 --- a/src/feature/dirauth/voteflags.c +++ b/src/feature/dirauth/voteflags.c @@ -147,7 +147,7 @@ router_is_active(const routerinfo_t *ri, const node_t *node, time_t now) * if TestingTorNetwork, and TestingMinExitFlagThreshold is non-zero */ if (!ri->bandwidthcapacity) { if (get_options()->TestingTorNetwork) { - if (get_options()->TestingMinExitFlagThreshold > 0) { + if (dirauth_get_options()->TestingMinExitFlagThreshold > 0) { /* If we're in a TestingTorNetwork, and TestingMinExitFlagThreshold is, * then require bandwidthcapacity */ return 0; @@ -216,9 +216,10 @@ router_counts_toward_thresholds(const node_t *node, time_t now, dirserv_has_measured_bw(node->identity); uint64_t min_bw_kb = ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB; const or_options_t *options = get_options(); + const dirauth_options_t *dirauth_options = dirauth_get_options();
if (options->TestingTorNetwork) { - min_bw_kb = (int64_t)options->TestingMinExitFlagThreshold / 1000; + min_bw_kb = (int64_t)dirauth_options->TestingMinExitFlagThreshold / 1000; }
return node->ri && router_is_active(node->ri, node, now) && @@ -341,7 +342,7 @@ dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil) ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG, INT32_MAX); if (options->TestingTorNetwork) { - min_fast = (int32_t)options->TestingMinFastFlagThreshold; + min_fast = (int32_t)dirauth_options->TestingMinFastFlagThreshold; } max_fast = networkstatus_get_param(NULL, "FastFlagMaxThreshold", INT32_MAX, min_fast, INT32_MAX);
tor-commits@lists.torproject.org