aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2021-03-17 08:45:37 -0400
committerNick Mathewson <nickm@torproject.org>2021-03-17 08:45:37 -0400
commit2ae24d003d1d12e8e202748c4398d7438e4a65d9 (patch)
treeed28225754a655c069a9a6d5fd6b66af2fdfc205 /src/app
parent59bbf8cde9144ee5c8d060959e723a4bedfd6bb8 (diff)
downloadtor-2ae24d003d1d12e8e202748c4398d7438e4a65d9.tar.gz
tor-2ae24d003d1d12e8e202748c4398d7438e4a65d9.zip
Add a MinTimeToReportBandwidth option; make it 0 for testing networks.
This option changes the time for which a bandwidth measurement period must have been in progress before we include it when reporting our observed bandwidth in our descriptors. Without this option, we only consider a time period towards our maximum if it has been running for a full day. Obviously, that's unacceptable for testing networks, where we'd like to get results as soon as possible. For non-testing networks, I've put a (somewhat arbitrary) 2-hour minimum on the option, since there are traffic analysis concerns with immediate reporting here. Closes #40337.
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/config.c8
-rw-r--r--src/app/config/config.h7
-rw-r--r--src/app/config/or_options_st.h4
-rw-r--r--src/app/config/testnet.inc1
4 files changed, 20 insertions, 0 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index fa74907b3d..9011f36735 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -563,6 +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"),
VAR("MyFamily", LINELIST, MyFamily_lines, NULL),
V(NewCircuitPeriod, INTERVAL, "30 seconds"),
OBSOLETE("NamingAuthoritativeDirectory"),
@@ -3711,6 +3712,13 @@ 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.");
diff --git a/src/app/config/config.h b/src/app/config/config.h
index e95ef4a728..74e6942eb5 100644
--- a/src/app/config/config.h
+++ b/src/app/config/config.h
@@ -24,6 +24,13 @@
* 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)
diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h
index 4364f145ed..efecc85d66 100644
--- a/src/app/config/or_options_st.h
+++ b/src/app/config/or_options_st.h
@@ -1082,6 +1082,10 @@ struct or_options_t {
/** List of policy allowed to query the Metrics port. */
struct config_line_t *MetricsPortPolicy;
+ /** How far must we be into the current bandwidth-measurement period to
+ * report bandwidth observations from this period? */
+ int MinTimeToReportBandwidth;
+
/**
* Configuration objects for individual modules.
*
diff --git a/src/app/config/testnet.inc b/src/app/config/testnet.inc
index 00b307782b..527e0d00b1 100644
--- a/src/app/config/testnet.inc
+++ b/src/app/config/testnet.inc
@@ -19,6 +19,7 @@
{ "TestingV3AuthInitialDistDelay", "20 seconds" },
{ "TestingAuthDirTimeToLearnReachability", "0 minutes" },
{ "MinUptimeHidServDirectoryV2", "0 minutes" },
+{ "MinTimeToReportBandwidth", "0 seconds" },
{ "TestingServerDownloadInitialDelay", "0" },
{ "TestingClientDownloadInitialDelay", "0" },
{ "TestingServerConsensusDownloadInitialDelay", "0" },