Browse Source

Restrict PerConnBWRate|Burst to INT32_MAX, update manpage

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.
Sebastian Hahn 15 years ago
parent
commit
2917c0596c
3 changed files with 15 additions and 7 deletions
  1. 2 0
      ChangeLog
  2. 7 7
      doc/tor.1.txt
  3. 6 0
      src/or/config.c

+ 2 - 0
ChangeLog

@@ -5,6 +5,8 @@ Changes in version 0.2.2.10-alpha - 2010-??-??
     - Fix a dereference-then-NULL-check sequence when publishing
     - Fix a dereference-then-NULL-check sequence when publishing
       descriptors. Bugfix on tor-0.2.1.5-alpha. Discovered by ekir,
       descriptors. Bugfix on tor-0.2.1.5-alpha. Discovered by ekir,
       fixes bug 1255.
       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
 Changes in version 0.2.2.9-alpha - 2010-02-22
   o Directory authority changes:
   o Directory authority changes:

+ 7 - 7
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
     Options are case-insensitive. C-style escaped characters are allowed inside
     quoted values.
     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
     A token bucket limits the average incoming bandwidth usage on this node to
     the specified number of bytes per second, and the average outgoing
     the specified number of bytes per second, and the average outgoing
     bandwidth usage to that same value. (Default: 5 MB)
     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
     Limit the maximum token bucket size (also known as the burst) to the given
     number of bytes in each direction. (Default: 10 MB)
     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
     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
     BandwidthRate. Server operators who want to reduce the number of clients
     who ask to build circuits through them (since this is proportional to
     who ask to build circuits through them (since this is proportional to
     advertised bandwidth rate) can thus reduce the CPU demands on their server
     advertised bandwidth rate) can thus reduce the CPU demands on their server
     without impacting network performance.
     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
     If defined, a separate token bucket limits the average incoming bandwidth
     usage for \_relayed traffic_ on this node to the specified number of bytes
     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.
     per second, and the average outgoing bandwidth usage to that same value.
     Relayed traffic currently is calculated to include answers to directory
     Relayed traffic currently is calculated to include answers to directory
     requests, but that may change in future versions. (Default: 0)
     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
     Limit the maximum token bucket size (also known as the burst) for
     \_relayed traffic_ to the given number of bytes in each direction.
     \_relayed traffic_ to the given number of bytes in each direction.
     (Default: 0)
     (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.
     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
     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)
     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.
     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
     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)
     published in the consensus and your relay will use that value. (Default: 0)

+ 6 - 0
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,
   if (ensure_bandwidth_cap(&options->RelayBandwidthBurst,
                            "RelayBandwidthBurst", msg) < 0)
                            "RelayBandwidthBurst", msg) < 0)
     return -1;
     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 (server_mode(options)) {
     if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) {
     if (options->BandwidthRate < ROUTER_REQUIRED_MIN_BANDWIDTH) {