aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 658e26aca..33065427c 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -216,6 +216,8 @@ static config_var_t _option_vars[] = {
VAR("RecommendedClientVersions", LINELIST, RecommendedClientVersions, NULL),
VAR("RecommendedServerVersions", LINELIST, RecommendedServerVersions, NULL),
VAR("RedirectExit", LINELIST, RedirectExit, NULL),
+ VAR("RelayBandwidthBurst", MEMUNIT, RelayBandwidthBurst, "0"),
+ VAR("RelayBandwidthRate", MEMUNIT, RelayBandwidthRate, "0"),
VAR("RendExcludeNodes", STRING, RendExcludeNodes, NULL),
VAR("RendNodes", STRING, RendNodes, NULL),
VAR("RendPostPeriod", INTERVAL, RendPostPeriod, "1 hour"),
@@ -2666,6 +2668,19 @@ options_validate(or_options_t *old_options, or_options_t *options,
*msg = tor_strdup(r >= 0 ? buf : "internal error");
return -1;
}
+ if (options->RelayBandwidthRate > options->RelayBandwidthBurst)
+ REJECT("RelayBandwidthBurst must be at least equal "
+ "to RelayBandwidthRate.");
+ if (options->RelayBandwidthRate &&
+ options->RelayBandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) {
+ r = tor_snprintf(buf, sizeof(buf),
+ "RelayBandwidthRate is set to %d bytes/second. "
+ "For servers, it must be at least %d.",
+ (int)options->RelayBandwidthRate,
+ ROUTER_REQUIRED_MIN_BANDWIDTH);
+ *msg = tor_strdup(r >= 0 ? buf : "internal error");
+ return -1;
+ }
}
if (options->BandwidthRate > options->BandwidthBurst)