aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/channel.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-10-07 08:05:40 -0400
committerNick Mathewson <nickm@torproject.org>2020-10-07 08:05:40 -0400
commit8a561fc5bfc48b3d849d62b266d323f98d509a50 (patch)
treed8e73e20c1f0108c9d1d497e10624ae6cc6ddbaa /src/core/or/channel.c
parentb5a88e8d478e553eb7c6bc022d47a084d6845e64 (diff)
parent84a5bd48e2717f29b547d9fd43d83cab3da39aaa (diff)
downloadtor-8a561fc5bfc48b3d849d62b266d323f98d509a50.tar.gz
tor-8a561fc5bfc48b3d849d62b266d323f98d509a50.zip
Merge branch 'maint-0.3.5' into maint-0.4.3
Diffstat (limited to 'src/core/or/channel.c')
-rw-r--r--src/core/or/channel.c44
1 files changed, 6 insertions, 38 deletions
diff --git a/src/core/or/channel.c b/src/core/or/channel.c
index 18940bd81f..553d6a6bf4 100644
--- a/src/core/or/channel.c
+++ b/src/core/or/channel.c
@@ -772,10 +772,9 @@ channel_check_for_duplicates(void)
connections_to_relay++;
total_relay_connections++;
- if (chan->is_canonical(chan, 0)) total_canonical++;
+ if (chan->is_canonical(chan)) total_canonical++;
- if (!chan->is_canonical_to_peer && chan->is_canonical(chan, 0)
- && chan->is_canonical(chan, 1)) {
+ if (!chan->is_canonical_to_peer && chan->is_canonical(chan)) {
total_half_canonical++;
}
}
@@ -2419,21 +2418,9 @@ channel_get_for_extend(const char *rsa_id_digest,
continue;
}
- /* Never return a non-canonical connection using a recent link protocol
- * if the address is not what we wanted.
- *
- * The channel_is_canonical_is_reliable() function asks the lower layer
- * if we should trust channel_is_canonical(). The below is from the
- * comments of the old circuit_or_get_for_extend() and applies when
- * the lower-layer transport is channel_tls_t.
- *
- * (For old link protocols, we can't rely on is_canonical getting
- * set properly if we're talking to the right address, since we might
- * have an out-of-date descriptor, and we will get no NETINFO cell to
- * tell us about the right address.)
- */
+ /* Only return canonical connections or connections where the address
+ * is the address we wanted. */
if (!channel_is_canonical(chan) &&
- channel_is_canonical_is_reliable(chan) &&
!channel_matches_target_addr_for_extend(chan, target_addr)) {
++n_noncanonical;
continue;
@@ -2575,16 +2562,12 @@ channel_dump_statistics, (channel_t *chan, int severity))
/* Handle marks */
tor_log(severity, LD_GENERAL,
- " * Channel %"PRIu64 " has these marks: %s %s %s "
- "%s %s %s",
+ " * Channel %"PRIu64 " has these marks: %s %s %s %s %s",
(chan->global_identifier),
channel_is_bad_for_new_circs(chan) ?
"bad_for_new_circs" : "!bad_for_new_circs",
channel_is_canonical(chan) ?
"canonical" : "!canonical",
- channel_is_canonical_is_reliable(chan) ?
- "is_canonical_is_reliable" :
- "!is_canonical_is_reliable",
channel_is_client(chan) ?
"client" : "!client",
channel_is_local(chan) ?
@@ -2943,22 +2926,7 @@ channel_is_canonical(channel_t *chan)
tor_assert(chan);
tor_assert(chan->is_canonical);
- return chan->is_canonical(chan, 0);
-}
-
-/**
- * Test if the canonical flag is reliable.
- *
- * This function asks if the lower layer thinks it's safe to trust the
- * result of channel_is_canonical().
- */
-int
-channel_is_canonical_is_reliable(channel_t *chan)
-{
- tor_assert(chan);
- tor_assert(chan->is_canonical);
-
- return chan->is_canonical(chan, 1);
+ return chan->is_canonical(chan);
}
/**