[tor-commits] [tor/master] Merge branch 'ticket40081_035' into ticket40081_044

asn at torproject.org asn at torproject.org
Wed Aug 12 10:24:30 UTC 2020


commit aef9c0f5809d2978f16f08ada1f3e482bd4dbb6f
Merge: 18d2c7c5d7 435f31aed3
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Aug 3 11:49:09 2020 -0400

    Merge branch 'ticket40081_035' into ticket40081_044
    
    Resolves conflicts:
            src/core/or/channel.c
            src/test/test_channel.c

 changes/ticket40081        |  6 ++++++
 src/core/or/channel.c      | 46 +++++++---------------------------------------
 src/core/or/channel.h      |  9 +++------
 src/core/or/channeltls.c   | 32 ++++++++++----------------------
 src/core/or/circuitbuild.c |  2 ++
 src/test/test_channel.c    | 12 +++++-------
 6 files changed, 33 insertions(+), 74 deletions(-)

diff --cc src/core/or/channel.c
index 09986df404,b3a2d7122b..5ed6bb9272
--- a/src/core/or/channel.c
+++ b/src/core/or/channel.c
@@@ -784,13 -771,10 +784,12 @@@ channel_check_for_duplicates(void
  
        connections_to_relay++;
        total_relay_connections++;
 +      if (is_dirauth)
 +        total_dirauth_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++;
        }
      }
@@@ -2457,21 -2430,10 +2456,9 @@@ channel_get_for_extend,(const char *rsa
        continue;
      }
  
-     /* If the connection is using a recent link protocol, only return canonical
-      * connections, when the address is one of the addresses we wanted.
-      *
-      * The channel_is_canonical_is_reliable() function asks the lower layer
-      * if we should trust channel_is_canonical(). It only 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.
-      */
-     if (!channel_is_canonical(chan) &&
-          channel_is_canonical_is_reliable(chan) &&
-         !matches_target) {
+     /* Only return canonical connections or connections where the address
+      * is the address we wanted. */
 -    if (!channel_is_canonical(chan) &&
 -        !channel_matches_target_addr_for_extend(chan, target_addr)) {
++    if (!channel_is_canonical(chan) && !matches_target) {
        ++n_noncanonical;
        continue;
      }
diff --cc src/test/test_channel.c
index 849cc497fc,afb7db813c..83b69cc80b
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@@ -1463,10 -1473,9 +1461,10 @@@ test_channel_for_extend(void *arg
    chan2->is_bad_for_new_circs = 0;
  
    /* Non canonical channels. */
+   test_chan_should_be_canonical = 0;
    test_chan_should_match_target = 0;
-   test_chan_canonical_should_be_reliable = 1;
 -  ret_chan = channel_get_for_extend(digest, &ed_id, &addr, &msg, &launch);
 +  ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
 +                                    &msg, &launch);
    tt_assert(!ret_chan);
    tt_str_op(msg, OP_EQ, "Connections all too old, or too non-canonical. "
                          " Launching a new one.");





More information about the tor-commits mailing list