summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-12-19 09:43:25 -0500
committerNick Mathewson <nickm@torproject.org>2019-12-19 09:43:25 -0500
commit77dea66e19404a4c07f0e738efb7710f542037ed (patch)
tree8c43ed8c3eaf6be8657ae193a64dfd47ff837deb /src/feature
parentb1d029b9a13ffd3cc69bbbebf8d7d2b381751a59 (diff)
downloadtor-77dea66e19404a4c07f0e738efb7710f542037ed.tar.gz
tor-77dea66e19404a4c07f0e738efb7710f542037ed.zip
Move MinUptimeHidServDirectoryV2 to dirauth module.
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/dirauth/dirauth_config.c12
-rw-r--r--src/feature/dirauth/dirauth_options.inc4
-rw-r--r--src/feature/dirauth/voteflags.c6
3 files changed, 13 insertions, 9 deletions
diff --git a/src/feature/dirauth/dirauth_config.c b/src/feature/dirauth/dirauth_config.c
index ccece9721d..e3f06e9e8a 100644
--- a/src/feature/dirauth/dirauth_config.c
+++ b/src/feature/dirauth/dirauth_config.c
@@ -108,12 +108,6 @@ options_validate_dirauth_mode(const or_options_t *old_options,
if (options->ClientOnly)
REJECT("Running as authoritative directory, but ClientOnly also set.");
- if (options->MinUptimeHidServDirectoryV2 < 0) {
- log_warn(LD_CONFIG, "MinUptimeHidServDirectoryV2 option must be at "
- "least 0 seconds. Changing to 0.");
- options->MinUptimeHidServDirectoryV2 = 0;
- }
-
return 0;
}
@@ -415,6 +409,12 @@ dirauth_options_pre_normalize(void *arg, char **msg_out)
"AuthDirGuardBWGuarantee", msg_out) < 0)
return -1;
+ if (options->MinUptimeHidServDirectoryV2 < 0) {
+ log_warn(LD_CONFIG, "MinUptimeHidServDirectoryV2 option must be at "
+ "least 0 seconds. Changing to 0.");
+ options->MinUptimeHidServDirectoryV2 = 0;
+ }
+
return 0;
}
diff --git a/src/feature/dirauth/dirauth_options.inc b/src/feature/dirauth/dirauth_options.inc
index ca70a51b9e..f0aadb006f 100644
--- a/src/feature/dirauth/dirauth_options.inc
+++ b/src/feature/dirauth/dirauth_options.inc
@@ -44,6 +44,10 @@ CONF_VAR(AuthDirSharedRandomness, BOOL, 0, "1")
/* NOTE: remove this option someday. */
CONF_VAR(AuthDirTestEd25519LinkKeys, BOOL, 0, "1")
+/** As directory authority, accept hidden service directories after what
+ * time? */
+CONF_VAR(MinUptimeHidServDirectoryV2, INTERVAL, 0, "96 hours")
+
/** Which versions of tor should we tell users to run? */
CONF_VAR(RecommendedVersions, LINELIST, 0, NULL)
diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c
index 8b9b8bc5c1..d0bc30d4c9 100644
--- a/src/feature/dirauth/voteflags.c
+++ b/src/feature/dirauth/voteflags.c
@@ -177,14 +177,14 @@ dirserv_thinks_router_is_hs_dir(const routerinfo_t *router,
long uptime;
/* If we haven't been running for at least
- * get_options()->MinUptimeHidServDirectoryV2 seconds, we can't
+ * MinUptimeHidServDirectoryV2 seconds, we can't
* have accurate data telling us a relay has been up for at least
* that long. We also want to allow a bit of slack: Reachability
* tests aren't instant. If we haven't been running long enough,
* trust the relay. */
if (get_uptime() >
- get_options()->MinUptimeHidServDirectoryV2 * 1.1)
+ dirauth_get_options()->MinUptimeHidServDirectoryV2 * 1.1)
uptime = MIN(rep_hist_get_uptime(router->cache_info.identity_digest, now),
real_uptime(router, now));
else
@@ -193,7 +193,7 @@ dirserv_thinks_router_is_hs_dir(const routerinfo_t *router,
return (router->wants_to_be_hs_dir &&
router->supports_tunnelled_dir_requests &&
node->is_stable && node->is_fast &&
- uptime >= get_options()->MinUptimeHidServDirectoryV2 &&
+ uptime >= dirauth_get_options()->MinUptimeHidServDirectoryV2 &&
router_is_active(router, node, now));
}