aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-12-17 22:32:17 +0000
committerRoger Dingledine <arma@torproject.org>2008-12-17 22:32:17 +0000
commit048f2a179b628ff717484912f452ba4d9bc4a3c3 (patch)
tree4a8c595d4b7cc20e5ce34f635e09ad07a1fe9594 /src/or/config.c
parent33e2053ebca5d3152c401f1394adeaab862b1988 (diff)
downloadtor-048f2a179b628ff717484912f452ba4d9bc4a3c3.tar.gz
tor-048f2a179b628ff717484912f452ba4d9bc4a3c3.zip
Clip the MaxCircuitDirtiness config option to a minimum of 10
seconds. Warn the user if lower values are given in the configuration. Bugfix on 0.1.0.1-rc. Patch by Sebastian. Clip the CircuitBuildTimeout to a minimum of 30 seconds. Warn the user if lower values are given in the configuration. Bugfix on 0.1.1.17-rc. Patch by Sebastian. svn:r17657
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c
index f35c180068..3c224eee62 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -2841,6 +2841,15 @@ compute_publishserverdescriptor(or_options_t *options)
/** Highest allowable value for RendPostPeriod. */
#define MAX_DIR_PERIOD (MIN_ONION_KEY_LIFETIME/2)
+/** Lowest allowable value for CircuitBuildTimeout; values too low will
+ * increase network load because of failing connections being retried, and
+ * might prevent users from connecting to the network at all. */
+#define MIN_CIRCUIT_BUILD_TIMEOUT 30
+
+/** Lowest allowable value for MaxCircuitDirtiness; if this is too low, Tor
+ * will generate too many circuits and potentially overload the network. */
+#define MIN_MAX_CIRCUIT_DIRTINESS 10
+
/** Return 0 if every setting in <b>options</b> is reasonable, and a
* permissible transition from <b>old_options</b>. Else return -1.
* Should have no side effects, except for normalizing the contents of
@@ -3241,8 +3250,8 @@ options_validate(or_options_t *old_options, or_options_t *options,
}
if (options->RendPostPeriod < MIN_REND_POST_PERIOD) {
- log(LOG_WARN,LD_CONFIG,"RendPostPeriod option must be at least %d seconds."
- " Clipping.", MIN_REND_POST_PERIOD);
+ log(LOG_WARN,LD_CONFIG,"RendPostPeriod option is too short; "
+ "raising to %d seconds.", MIN_REND_POST_PERIOD);
options->RendPostPeriod = MIN_REND_POST_PERIOD;
}
@@ -3252,6 +3261,18 @@ options_validate(or_options_t *old_options, or_options_t *options,
options->RendPostPeriod = MAX_DIR_PERIOD;
}
+ if (options->CircuitBuildTimeout < MIN_CIRCUIT_BUILD_TIMEOUT) {
+ log(LOG_WARN, LD_CONFIG, "CircuitBuildTimeout option is too short; "
+ "raising to %d seconds.", MIN_CIRCUIT_BUILD_TIMEOUT);
+ options->CircuitBuildTimeout = MIN_CIRCUIT_BUILD_TIMEOUT;
+ }
+
+ if (options->MaxCircuitDirtiness < MIN_MAX_CIRCUIT_DIRTINESS) {
+ log(LOG_WARN, LD_CONFIG, "MaxCircuitDirtiness option is too short; "
+ "raising to %d seconds.", MIN_MAX_CIRCUIT_DIRTINESS);
+ options->MaxCircuitDirtiness = MIN_MAX_CIRCUIT_DIRTINESS;
+ }
+
if (options->KeepalivePeriod < 1)
REJECT("KeepalivePeriod option must be positive.");