]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make MinTimeToReportBandwidth a testing-only option (and rename it)
authorNick Mathewson <nickm@torproject.org>
Tue, 11 May 2021 19:49:00 +0000 (15:49 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 11 May 2021 19:49:00 +0000 (15:49 -0400)
changes/ticket40337
doc/man/tor.1.txt
src/app/config/config.c
src/app/config/config.h
src/app/config/or_options_st.h
src/app/config/testnet.inc
src/feature/stats/bwhist.c

index f8f136a74043c6b13f0512da2bae7e5cb6ab185f..02ea29ffc11830cd253f3bcc5dacda7b8ec6e57f 100644 (file)
@@ -1,5 +1,6 @@
-  o Minor features (bandwidth reporting):
-    - Relays can now use the MinTimeToReportBandwidth option to change
+  o Minor features (testing):
+    - On a testing network, relays can now use the
+      TestingMinTimeToReportBandwidth option to change
       the smallest amount of time over which they're willing to report
       their observed maximum bandwidth.  Previously, this was fixed
       at 1 day.  For safety, values under 2 hours are only supported on
index af4ee494ef642aa9ae7857eda835b8576a472d6f..209900832f7f6014292ea009f0116a361ae1a8a2 100644 (file)
@@ -2448,13 +2448,6 @@ is non-zero):
     If we have more onionskins queued for processing than we can process in
     this amount of time, reject new ones. (Default: 1750 msec)
 
-[[MinTimeToReportBandwidth]] **MinTimeToReportBandwidth** __N__ **seconds**|**minutes**|**hours**::
-    Do not report our measurements for our maximum observed bandwidth for any
-    time period that has lasted for less than this amount of time.
-    Setting this option too low can enable traffic analysis, and is
-    not permitted except on testing networks.  Values over 1 day have
-    no effect. (Default: 1 day)
-
 [[MyFamily]] **MyFamily** __fingerprint__,__fingerprint__,...::
     Declare that this Tor relay is controlled or administered by a group or
     organization identical or similar to that of the other relays, defined by
@@ -3602,6 +3595,11 @@ The following options are used for running a testing Tor network.
     Minimum value for the Fast flag.  Overrides the ordinary minimum taken
     from the consensus when TestingTorNetwork is set. (Default: 0.)
 
+[[TestingMinTimeToReportBandwidth]] **TestingMinTimeToReportBandwidth** __N__ **seconds**|**minutes**|**hours**::
+    Do not report our measurements for our maximum observed bandwidth for any
+    time period that has lasted for less than this amount of time.
+    Values over 1 day have no effect. (Default: 1 day)
+
 [[TestingServerConsensusDownloadInitialDelay]] **TestingServerConsensusDownloadInitialDelay** __N__::
     Initial delay in seconds for when servers should download consensuses. Changing this
     requires that **TestingTorNetwork** is set. (Default: 0)
index 9011f36735766f58f6508018305f4d461aef5774..88da7a0aa71f90f564cb7436ed14b9282f613bee 100644 (file)
@@ -563,7 +563,7 @@ static const config_var_t option_vars_[] = {
   V(MaxUnparseableDescSizeToLog, MEMUNIT, "10 MB"),
   VPORT(MetricsPort),
   V(MetricsPortPolicy,           LINELIST, NULL),
-  V(MinTimeToReportBandwidth,    INTERVAL, "1 day"),
+  V(TestingMinTimeToReportBandwidth,    INTERVAL, "1 day"),
   VAR("MyFamily",                LINELIST, MyFamily_lines,       NULL),
   V(NewCircuitPeriod,            INTERVAL, "30 seconds"),
   OBSOLETE("NamingAuthoritativeDirectory"),
@@ -3712,13 +3712,6 @@ options_validate_cb(const void *old_options_, void *options_, char **msg)
     options->HeartbeatPeriod = MIN_HEARTBEAT_PERIOD;
   }
 
-  if (options->MinTimeToReportBandwidth < MIN_MIN_TIME_TO_REPORT_BW &&
-      !options->TestingTorNetwork) {
-    log_warn(LD_CONFIG, "MinTimeToReportBandwidth is too short; "
-             "raising to %d seconds.", MIN_MIN_TIME_TO_REPORT_BW);
-    options->MinTimeToReportBandwidth = MIN_MIN_TIME_TO_REPORT_BW;
-  }
-
   if (options->KeepalivePeriod < 1)
     REJECT("KeepalivePeriod option must be positive.");
 
@@ -3994,6 +3987,7 @@ options_validate_cb(const void *old_options_, void *options_, char **msg)
     CHECK_DEFAULT(TestingSigningKeySlop);
     CHECK_DEFAULT(TestingAuthKeySlop);
     CHECK_DEFAULT(TestingLinkKeySlop);
+    CHECK_DEFAULT(TestingMinTimeToReportBandwidth);
     or_options_free(dflt_options);
   }
 #undef CHECK_DEFAULT
index 74e6942eb5fd8b1cc445d9ed30e18fc5804b2f71..e95ef4a72852ef16de3bfa3a6723bdcceaeb5ed6 100644 (file)
  * expose more information than we're comfortable with. */
 #define MIN_HEARTBEAT_PERIOD (30*60)
 
-/**
- * Lowest allowable value for MinTimeToReportBandwidth on a non-testing
- * network; if this is too low we might report detail that is too
- * fine-grained.
- **/
-#define MIN_MIN_TIME_TO_REPORT_BW (2*60*60)
-
 /** Maximum default value for MaxMemInQueues, in bytes. */
 #if SIZEOF_VOID_P >= 8
 #define MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(8) << 30)
index efecc85d662f0dd090f66b7546a232e6ec9c87a3..440c98736526d961de97166d72075a14627dc6da 100644 (file)
@@ -1084,7 +1084,7 @@ struct or_options_t {
 
   /** How far must we be into the current bandwidth-measurement period to
    * report bandwidth observations from this period? */
-  int MinTimeToReportBandwidth;
+  int TestingMinTimeToReportBandwidth;
 
   /**
    * Configuration objects for individual modules.
index 527e0d00b179bb8f85123fff07be5e62a25b846a..039454a0d0b912f08bdc7c313fde8e476b885ade 100644 (file)
@@ -19,7 +19,7 @@
 { "TestingV3AuthInitialDistDelay", "20 seconds" },
 { "TestingAuthDirTimeToLearnReachability", "0 minutes" },
 { "MinUptimeHidServDirectoryV2", "0 minutes" },
-{ "MinTimeToReportBandwidth", "0 seconds" },
+{ "TestingMinTimeToReportBandwidth", "0 seconds" },
 { "TestingServerDownloadInitialDelay", "0" },
 { "TestingClientDownloadInitialDelay", "0" },
 { "TestingServerConsensusDownloadInitialDelay", "0" },
index 55a8f7c747f480488b2a7aaca4ef6ed2d49747c9..06ad48e5c3c9f0e26af640840a70e6333f5814a0 100644 (file)
@@ -241,7 +241,7 @@ MOCK_IMPL(int,
 bwhist_bandwidth_assess,(void))
 {
   uint64_t w,r;
-  int min_obs_time = get_options()->MinTimeToReportBandwidth;
+  int min_obs_time = get_options()->TestingMinTimeToReportBandwidth;
   r = find_largest_max(read_array, min_obs_time);
   w = find_largest_max(write_array, min_obs_time);
   if (r>w)