diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-02-25 19:43:23 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-02-25 19:43:23 +0000 |
commit | 333bf44471acbccf896774e6cfe6041356da5879 (patch) | |
tree | 0f64a5f54618115468e3f3ad21864b6d9fd1c205 | |
parent | 938de88e3bc259535856c1571003ad0c9e00e897 (diff) | |
download | tor-333bf44471acbccf896774e6cfe6041356da5879.tar.gz tor-333bf44471acbccf896774e6cfe6041356da5879.zip |
r11944@catbus: nickm | 2007-02-25 14:43:18 -0500
Add a lower-bound on MaxAdvertisedBandwidth.
svn:r9652
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/or/config.c | 29 |
2 files changed, 21 insertions, 9 deletions
@@ -102,6 +102,7 @@ Changes in version 0.1.2.8-rc - 2007-02-?? - Always remove expired routers and networkstatus docs before checking whether we have enough information to build circuits. (Fixes bug 373.) + - Put a lower-bound on MaxAdvertisedBandwidth. Changes in version 0.1.2.7-alpha - 2007-02-06 diff --git a/src/or/config.c b/src/or/config.c index 98922ebc6a..70b4dc598d 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -2647,16 +2647,27 @@ options_validate(or_options_t *old_options, or_options_t *options, *msg = tor_strdup(r >= 0 ? buf : "internal error"); return -1; } - if (server_mode(options) && - options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH*2) { - r = tor_snprintf(buf, sizeof(buf), - "BandwidthRate is set to %d bytes/second. " - "For servers, it must be at least %d.", - (int)options->BandwidthRate, - ROUTER_REQUIRED_MIN_BANDWIDTH*2); - *msg = tor_strdup(r >= 0 ? buf : "internal error"); - return -1; + if (server_mode(options)) { + if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH*2) { + r = tor_snprintf(buf, sizeof(buf), + "BandwidthRate is set to %d bytes/second. " + "For servers, it must be at least %d.", + (int)options->BandwidthRate, + ROUTER_REQUIRED_MIN_BANDWIDTH*2); + *msg = tor_strdup(r >= 0 ? buf : "internal error"); + return -1; + } else if (options->MaxAdvertisedBandwidth < + ROUTER_REQUIRED_MIN_BANDWIDTH) { + r = tor_snprintf(buf, sizeof(buf), + "MaxAdvertisedBandwidth is set to %d bytes/second. " + "For servers, it must be at least %d.", + (int)options->MaxAdvertisedBandwidth, + ROUTER_REQUIRED_MIN_BANDWIDTH); + *msg = tor_strdup(r >= 0 ? buf : "internal error"); + return -1; + } } + if (options->BandwidthRate > options->BandwidthBurst) REJECT("BandwidthBurst must be at least equal to BandwidthRate."); |