diff options
author | Nick Mathewson <nickm@torproject.org> | 2021-11-15 08:55:47 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2021-11-15 08:55:47 -0500 |
commit | dd085d42f96e39f9387aa1d7a306100c0d7df305 (patch) | |
tree | 01d83804e8c071e9d347060317ada34a573f69b3 /src/feature/client | |
parent | 882fd1f0d45656e0535e70b5e115281b39ac6307 (diff) | |
download | tor-dd085d42f96e39f9387aa1d7a306100c0d7df305.tar.gz tor-dd085d42f96e39f9387aa1d7a306100c0d7df305.zip |
Do not count controller-selected paths towards path bias.
As a side effect, this fixes a "Bug" warning.
Closes #40515. Bugfix on 0.2.4.10-alpha.
Diffstat (limited to 'src/feature/client')
-rw-r--r-- | src/feature/client/circpathbias.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/feature/client/circpathbias.c b/src/feature/client/circpathbias.c index 4d27553926..29264135f9 100644 --- a/src/feature/client/circpathbias.c +++ b/src/feature/client/circpathbias.c @@ -363,6 +363,17 @@ pathbias_should_count(origin_circuit_t *circ) return 0; } + /* Ignore circuits where the controller helped choose the path. When + * this happens, we can't be sure whether the path was chosen randomly + * or not. */ + if (circ->any_hop_from_controller) { + /* (In this case, we _don't_ check to see if shouldcount is changing, + * since it's possible that an already-created circuit later gets extended + * by the controller. */ + circ->pathbias_shouldcount = PATHBIAS_SHOULDCOUNT_IGNORED; + return 0; + } + /* Completely ignore one hop circuits */ if (circ->build_state->onehop_tunnel || circ->build_state->desired_path_len == 1) { |