]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
don't build preemptive conflux circuits if no predicted ports
authorRoger Dingledine <arma@torproject.org>
Tue, 15 Oct 2024 06:54:27 +0000 (02:54 -0400)
committerRoger Dingledine <arma@torproject.org>
Tue, 15 Oct 2024 19:59:25 +0000 (15:59 -0400)
Conflux circuit building was ignoring the "predicted ports" feature,
which aims to make Tor stop building circuits if there have been
no user requests lately. This bug led to every idle Tor on the
network building and discarding circuits every 30 seconds, which
added overall load to the network, used bandwidth and battery from
clients that weren't actively using their Tor, and kept sockets open
on guards which added connection padding essentially forever.

Bug went in on commit 39c2927d when we added preemptive conflux circuit
pools.

Fixes bug 40981; bugfix on 0.4.8.1-alpha.

changes/bug40981 [new file with mode: 0644]
src/core/or/circuituse.c

diff --git a/changes/bug40981 b/changes/bug40981
new file mode 100644 (file)
index 0000000..7979685
--- /dev/null
@@ -0,0 +1,9 @@
+  o Major bugfixes (circuit building):
+    - Conflux circuit building was ignoring the "predicted ports" feature,
+      which aims to make Tor stop building circuits if there have been
+      no user requests lately. This bug led to every idle Tor on the
+      network building and discarding circuits every 30 seconds, which
+      added overall load to the network, used bandwidth and battery from
+      clients that weren't actively using their Tor, and kept sockets open
+      on guards which added connection padding essentially forever. Fixes
+      bug 40981; bugfix on 0.4.8.1-alpha;
index ac9005e1d4280671b2ba27cc8d4030be806ab6ac..abfb51c662a84bbfaf56a3cc6c6ec02c9b9fff96 100644 (file)
@@ -1202,8 +1202,13 @@ circuit_predict_and_launch_new(void)
   int flags = 0;
 
   /* Attempt to launch predicted conflux circuits. This is outside the HS or
-   * Exit preemptive circuit set. */
-  conflux_predict_new(now);
+   * Exit preemptive circuit set.
+   * As with the other types of preemptive circuits, we only want to
+   * launch them if we have predicted ports. (If we haven't needed a
+   * circuit for a while, maybe we won't need one soon either.) */
+  if (predicted_ports_prediction_time_remaining(now)) {
+    conflux_predict_new(now);
+  }
 
   /* Count how many of each type of circuit we currently have. */
   SMARTLIST_FOREACH_BEGIN(circuit_get_global_list(), circuit_t *, circ) {