diff options
author | George Kadianakis <desnacked@riseup.net> | 2020-08-12 13:23:33 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2020-08-12 13:23:33 +0300 |
commit | c591a0d2466cdc644fd82519f6f1ec32da764287 (patch) | |
tree | 8ca4a3798b167d056439a3219e0b11f396f0744d /src/core/or/channeltls.c | |
parent | 2f708079cd912eb70384002ff3ab29ff2d224ed4 (diff) | |
parent | 8e9edb93be7771e44352c539abdf0b269ac56fab (diff) | |
download | tor-c591a0d2466cdc644fd82519f6f1ec32da764287.tar.gz tor-c591a0d2466cdc644fd82519f6f1ec32da764287.zip |
Merge branch 'maint-0.4.4'
Diffstat (limited to 'src/core/or/channeltls.c')
-rw-r--r-- | src/core/or/channeltls.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c index ae60038c34..51b772728e 100644 --- a/src/core/or/channeltls.c +++ b/src/core/or/channeltls.c @@ -109,7 +109,7 @@ static int channel_tls_get_transport_name_method(channel_t *chan, char **transport_out); static const char *channel_tls_describe_peer_method(const channel_t *chan); static int channel_tls_has_queued_writes_method(channel_t *chan); -static int channel_tls_is_canonical_method(channel_t *chan, int req); +static int channel_tls_is_canonical_method(channel_t *chan); static int channel_tls_matches_extend_info_method(channel_t *chan, extend_info_t *extend_info); @@ -627,12 +627,11 @@ channel_tls_has_queued_writes_method(channel_t *chan) /** * Tell the upper layer if we're canonical. * - * This implements the is_canonical method for channel_tls_t; if req is zero, - * it returns whether this is a canonical channel, and if it is one it returns - * whether that can be relied upon. + * This implements the is_canonical method for channel_tls_t: + * it returns whether this is a canonical channel. */ static int -channel_tls_is_canonical_method(channel_t *chan, int req) +channel_tls_is_canonical_method(channel_t *chan) { int answer = 0; channel_tls_t *tlschan = BASE_CHAN_TO_TLS(chan); @@ -640,24 +639,13 @@ channel_tls_is_canonical_method(channel_t *chan, int req) tor_assert(tlschan); if (tlschan->conn) { - switch (req) { - case 0: - answer = tlschan->conn->is_canonical; - break; - case 1: - /* - * Is the is_canonical bit reliable? In protocols version 2 and up - * we get the canonical address from a NETINFO cell, but in older - * versions it might be based on an obsolete descriptor. - */ - answer = (tlschan->conn->link_proto >= 2); - break; - default: - /* This shouldn't happen; channel.c is broken if it does */ - tor_assert_nonfatal_unreached_once(); - } + /* If this bit is set to 0, and link_proto is sufficiently old, then we + * can't actually _rely_ on this being a non-canonical channel. + * Nonetheless, we're going to believe that this is a non-canonical + * channel in this case, since nobody should be using these link protocols + * any more. */ + answer = tlschan->conn->is_canonical; } - /* else return 0 for tlschan->conn == NULL */ return answer; } |