[or-cvs] [tor/master 4/4] Restrict PerConnBWRate|Burst to INT32_MAX, update manpage

nickm at torproject.org nickm at torproject.org
Thu Feb 25 19:33:48 UTC 2010


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Thu, 25 Feb 2010 12:25:57 +0100
Subject: Restrict PerConnBWRate|Burst to INT32_MAX, update manpage
Commit: 2917c0596c82a79ab814f30a43968bf78da8c3a9

All other bandwidthrate settings are restricted to INT32_MAX, but
this check was forgotten for PerConnBWRate and PerConnBWBurst. Also
update the manpage to reflect the fact that specifying a bandwidth
in terabytes does not make sense, because that value will be too
large.
---
 ChangeLog       |    2 ++
 doc/tor.1.txt   |   14 +++++++-------
 src/or/config.c |    6 ++++++
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 541d780..ea474e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@ Changes in version 0.2.2.10-alpha - 2010-??-??
     - Fix a dereference-then-NULL-check sequence when publishing
       descriptors. Bugfix on tor-0.2.1.5-alpha. Discovered by ekir,
       fixes bug 1255.
+    - Disallow values larger than INT32_MAX for PerConnBWRate|Burst
+      config option. Bugfix on 0.2.2.7-alpha.
 
 Changes in version 0.2.2.9-alpha - 2010-02-22
   o Directory authority changes:
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 04b764a..d999344 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -66,40 +66,40 @@ Other options can be specified either on the command-line (--option
     Options are case-insensitive. C-style escaped characters are allowed inside
     quoted values.
 
-**BandwidthRate** __N__ **bytes**|**KB**|**MB**|**GB**|**TB**::
+**BandwidthRate** __N__ **bytes**|**KB**|**MB**|**GB**::
     A token bucket limits the average incoming bandwidth usage on this node to
     the specified number of bytes per second, and the average outgoing
     bandwidth usage to that same value. (Default: 5 MB)
 
-**BandwidthBurst** __N__ **bytes**|**KB**|**MB**|**GB**|**TB**::
+**BandwidthBurst** __N__ **bytes**|**KB**|**MB**|**GB**::
     Limit the maximum token bucket size (also known as the burst) to the given
     number of bytes in each direction. (Default: 10 MB)
 
-**MaxAdvertisedBandwidth** __N__ **bytes**|**KB**|**MB**|**GB**|**TB**::
+**MaxAdvertisedBandwidth** __N__ **bytes**|**KB**|**MB**|**GB**::
     If set, we will not advertise more than this amount of bandwidth for our
     BandwidthRate. Server operators who want to reduce the number of clients
     who ask to build circuits through them (since this is proportional to
     advertised bandwidth rate) can thus reduce the CPU demands on their server
     without impacting network performance.
 
-**RelayBandwidthRate** __N__ **bytes**|**KB**|**MB**|**GB**|**TB**::
+**RelayBandwidthRate** __N__ **bytes**|**KB**|**MB**|**GB**::
     If defined, a separate token bucket limits the average incoming bandwidth
     usage for \_relayed traffic_ on this node to the specified number of bytes
     per second, and the average outgoing bandwidth usage to that same value.
     Relayed traffic currently is calculated to include answers to directory
     requests, but that may change in future versions. (Default: 0)
 
-**RelayBandwidthBurst** __N__ **bytes**|**KB**|**MB**|**GB**|**TB**::
+**RelayBandwidthBurst** __N__ **bytes**|**KB**|**MB**|**GB**::
     Limit the maximum token bucket size (also known as the burst) for
     \_relayed traffic_ to the given number of bytes in each direction.
     (Default: 0)
 
-**PerConnBWRate** __N__ **bytes**|**KB**|**MB**|**GB**|**TB**::
+**PerConnBWRate** __N__ **bytes**|**KB**|**MB**|**GB**::
     If set, do separate rate limiting for each connection from a non-relay.
     You should never need to change this value, since a network-wide value is
     published in the consensus and your relay will use that value. (Default: 0)
 
-**PerConnBWBurst** __N__ **bytes**|**KB**|**MB**|**GB**|**TB**::
+**PerConnBWBurst** __N__ **bytes**|**KB**|**MB**|**GB**::
     If set, do separate rate limiting for each connection from a non-relay.
     You should never need to change this value, since a network-wide value is
     published in the consensus and your relay will use that value. (Default: 0)
diff --git a/src/or/config.c b/src/or/config.c
index 5ad1d3f..c9ff921 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3228,6 +3228,12 @@ options_validate(or_options_t *old_options, or_options_t *options,
   if (ensure_bandwidth_cap(&options->RelayBandwidthBurst,
                            "RelayBandwidthBurst", msg) < 0)
     return -1;
+  if (ensure_bandwidth_cap(&options->PerConnBWRate,
+                           "PerConnBWRate", msg) < 0)
+    return -1;
+  if (ensure_bandwidth_cap(&options->PerConnBWBurst,
+                           "PerConnBWBurst", msg) < 0)
+    return -1;
 
   if (server_mode(options)) {
     if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) {
-- 
1.6.5



More information about the tor-commits mailing list