[tor-bugs] #25885 [Core Tor/Tor]: count_acceptable_nodes() would be more accurate using node_has_preferred_descriptor()

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Apr 22 16:22:27 UTC 2018


#25885: count_acceptable_nodes() would be more accurate using
node_has_preferred_descriptor()
------------------------------+------------------------------
     Reporter:  nickm         |      Owner:  (none)
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: unspecified
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+------------------------------
 On a github review for #25691, Teor notes about count_acceptable_nodes():


 >I think this code is correct, but it's not obvious:
 >
 >  1.  new_route_len() is the only caller
 >  2.  new_route_len() will fail if count_acceptable_nodes() is less than
 the route length.
 >  3.  later functions will fail if there is no guard
 >  4.  later functions will fail if there are not enough subsequent nodes
 for the rest of the route
 >
 >So this check can spuriously succeed when we have no guards, or when we
 have many bridges, and no subsequent nodes. But it can never fail when
 there are actually enough nodes for the path. So this is just an
 optimisation to stop us trying to build lots of circuits when we have no
 descriptors.
 >
 > We could return the number that pass for_direct_connect = 1 and
 for_direct_connect = 0, but that seems unnecessarily complicated.

 I think that we should probably adjust this function to do the careful
 count, but it's safe to defer.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25885>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list