[tor-bugs] #12595 [Tor]: Think of better data structures for guard nodes

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Aug 4 12:02:34 UTC 2014


#12595: Think of better data structures for guard nodes
------------------------+--------------------------------
     Reporter:  asn     |      Owner:
         Type:  defect  |     Status:  new
     Priority:  normal  |  Milestone:  Tor: 0.2.6.x-final
    Component:  Tor     |    Version:
   Resolution:          |   Keywords:  tor-guard
Actual Points:          |  Parent ID:
       Points:          |
------------------------+--------------------------------

Comment (by asn):

 Replying to [comment:7 nickm]:
 > Replying to [comment:3 asn]:
 > > - As a further point to the paragraph above, I uploaded an image of 3
 > >   different possible entry guard lists:
 > >   https://people.torproject.org/~asn/guards2/entry_guard_list.jpg
 > >
 > >   With the current code, and if NumDirectoryGuards was 3, from the
 > >   first entry guard list we would select a directory guard between
 > >   (entry2, entry4, entry6). On the second list, we would select
 > >   between (entry1, entry4, entry6).  On the third list, the worst case
 > >   scenario, we would select between (entry4, entry5, ...).
 > >
 > >   I'd argue that we should strongly prefer the *top* directory guard
 > >   every time, and only move to the lower ones if the top one doesn't
 > >   give us what we want.
 >
 > "Strongly prefer" seems good; can we turn this into an algorithm?
 >

 My idea was the following "simple" algorithm:
 {{{
 node_t choose_live_circuit_guard(restrictions) {
   foreach guard in guard_list:
     if guard.should_be_used_as_circuit_guard():
       return guard

   # No guard was found
   find_and_add_new_guard()
   goto top
 }
 }}}

 and

 {{{
 node_t choose_live_directory_guard(restrictions) {
   foreach guard in guard_list:
     if guard.should_be_used_as_dir_guard():
       return guard

   # No guard was found
   find_and_add_new_dirguard()
   goto top
 }
 }}}

 where `should_be_used_as_circuit_guard()` is basically the requirements
 in:
 https://gitweb.torproject.org/tor.git/blob/HEAD:/src/or/entrynodes.c#l1077

 `should_be_used_as_directory_guard()` is the same requirements as above
 plus any restrictions from my previous comment (comment:8) if we decide
 it's a good idea.

 and `find_and_add_new_guard()` would basically be like tor's
 `add_an_entry_guard()` with `chosen` set to `NULL`.

 The idea is to basically use the guard list as a '''conveyor belt''', and
 if no items in the conveyor belt can satisfy us append a new one.

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


More information about the tor-bugs mailing list