[tor-bugs] #18873 [Core Tor/Tor]: Refactor circuit_predict_and_launch_new()

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Nov 2 18:06:09 UTC 2016


#18873: Refactor circuit_predict_and_launch_new()
--------------------------+------------------------------------
 Reporter:  asn           |          Owner:
     Type:  defect        |         Status:  needs_revision
 Priority:  Low           |      Milestone:  Tor: 0.3.0.x-final
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:  refactoring   |  Actual Points:
Parent ID:                |         Points:
 Reviewer:  dgoulet       |        Sponsor:
--------------------------+------------------------------------
Changes (by dgoulet):

 * status:  needs_review => needs_revision


Comment:

 Replying to [comment:15 chelseakomlo]:
 [snip]
 > > * This condition has disappeared which is not good as
 `TO_ORIGIN_CIRCUIT()` in `circuit_is_available_for_use()` will explode if
 it's not an origin circuit.
 > > {{{
 > > -    if (!CIRCUIT_IS_ORIGIN(circ))
 > > -      continue;
 > > }}}
 > >
 > >  and furthermore, this also could explode:
 > >  {{{
 > > cpath_build_state_t *build_state =
 TO_ORIGIN_CIRCUIT(circ)->build_state;
 > >  }}}
 >
 > Hey! Ok, here is my understanding:
 >
 > A circuit with purpose CIRCUIT_PURPOSE_C_GENERAL will always be an
 origin circuit, because:
 >
 > in or.h
 > {{{
 > #define CIRCUIT_IS_ORIGIN(c) (CIRCUIT_PURPOSE_IS_ORIGIN((c)->purpose))
 > #define CIRCUIT_PURPOSE_IS_ORIGIN(p) ((p)>CIRCUIT_PURPOSE_OR_MAX_)
 > #define CIRCUIT_PURPOSE_OR_MAX_ 4
 > #define CIRCUIT_PURPOSE_C_GENERAL 5
 > }}}
 >

 I see that `CIRCUIT_IS_ORIGIN(c)` translates to `if c >
 CIRCUIT_PURPOSE_OR_MAX_ then circ is origin`. We have lots of purposes
 that are above `CIRCUIT_PURPOSE_C_GENERAL = 5` in values like a client
 doing an HS introduction to a relay `CIRCUIT_PURPOSE_C_INTRODUCING = 6`.
 Am I missing something here?

 Origin circuits means that we (tor) initiated them and just with the HS,
 there are lots of purposes.

 I think you missed this syntax fix as well:

 {{{
 #define CBT_MAX_UNUSED_OPEN_CIRCUITS (MAX_UNUSED_OPEN_CIRCUITS- \
     CBT_MIN_REMAINING_PREEMPTIVE_CIRCUITS)
 }}}

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


More information about the tor-bugs mailing list