aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-08-14 20:19:40 +0000
committerNick Mathewson <nickm@torproject.org>2007-08-14 20:19:40 +0000
commit42fa1de58514023a0a16f30745120ec6f4e35fed (patch)
treeddde8e848acc0834b11f6dc3b06767fe0399a194 /src/or/config.c
parent8839d57ab5fdfd5bdb609fe62ff5509fb3b67cea (diff)
downloadtor-42fa1de58514023a0a16f30745120ec6f4e35fed.tar
tor-42fa1de58514023a0a16f30745120ec6f4e35fed.tar.gz
r14017@Kushana: nickm | 2007-08-14 15:13:14 -0400
Enable more code for v3 voting timing information. Also, spec clarification. svn:r11107
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 30ead7f40..a12ca86ef 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -271,7 +271,6 @@ static config_var_t _option_vars[] = {
VAR("V1AuthoritativeDirectory",BOOL, V1AuthoritativeDir, "0"),
VAR("V2AuthoritativeDirectory",BOOL, V2AuthoritativeDir, "0"),
VAR("V3AuthoritativeDirectory",BOOL, V3AuthoritativeDir, "0"),
- /* XXXX020 check these for sanity. */
VAR("V3AuthVotingInterval",INTERVAL, V3AuthVotingInterval, "1 hour"),
VAR("V3AuthVoteDelay", INTERVAL, V3AuthVoteDelay, "5 minutes"),
VAR("V3AuthDistDelay", INTERVAL, V3AuthDistDelay, "5 minutes"),
@@ -1090,7 +1089,9 @@ options_act(or_options_t *old_options)
if (dns_reset())
return -1;
}
- /* XXXX020 init_keys() again if v3authoritativedir is newly set. */
+
+ if (options->V3AuthoritativeDir && !old_options->V3AuthoritativeDir)
+ init_keys();
}
/* Check if we need to parse and add the EntryNodes config option. */
@@ -2999,6 +3000,23 @@ options_validate(or_options_t *old_options, or_options_t *options,
}
}
+ if (options->V3AuthVoteDelay + options->V3AuthDistDelay >=
+ options->V3AuthVotingInterval/2) {
+ REJECT("V3AuthVoteDelay and V3AuthDistDelay must be no more than half "
+ "V3AuthVotingInterval");
+ }
+ if (options->V3AuthNIntervalsValid < 2) {
+ REJECT("V3AuthNIntervalsValid must be at least 2.");
+ }
+
+ if (options->V3AuthVotingInterval < 300) {
+ REJECT("V3AuthVotingInterval is insanely low.");
+ } else if (options->V3AuthVotingInterval > 24*60*60) {
+ REJECT("V3AuthVotingInterval is insanely high.");
+ } else if (((24*60*60) % options->V3AuthVotingInterval) != 0) {
+ COMPLAIN("V3AuthVotingInterval does not divide evenly into 24 hours.");
+ }
+
if (rend_config_services(options, 1) < 0)
REJECT("Failed to configure rendezvous options. See logs for details.");