]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
r11944@catbus: nickm | 2007-02-25 14:43:18 -0500
authorNick Mathewson <nickm@torproject.org>
Sun, 25 Feb 2007 19:43:23 +0000 (19:43 +0000)
committerNick Mathewson <nickm@torproject.org>
Sun, 25 Feb 2007 19:43:23 +0000 (19:43 +0000)
 Add a lower-bound on MaxAdvertisedBandwidth.

svn:r9652

ChangeLog
src/or/config.c

index 1d8c09251e341b398b3790792519169a6390fe26..03732be3403671921a07cb5d9131cda760219ce5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 98922ebc6ac9beae40425b10ecb39d0930fb7478..70b4dc598d5417d76c7c36013449a10c34d3550d 100644 (file)
@@ -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.");