[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #32088 [Core Tor/Tor]: Proposal 308 - choose guards in sampled order



#32088: Proposal 308 - choose guards in sampled order
--------------------------------------+------------------------------------
 Reporter:  Jaym                      |          Owner:  (none)
     Type:  enhancement               |         Status:  needs_revision
 Priority:  Medium                    |      Milestone:  Tor: 0.4.4.x-final
Component:  Core Tor/Tor              |        Version:
 Severity:  Normal                    |     Resolution:
 Keywords:  tor-spec prop271 prop308  |  Actual Points:
Parent ID:                            |         Points:
 Reviewer:  nickm                     |        Sponsor:
--------------------------------------+------------------------------------

Comment (by Jaym):

 Replying to [comment:11 teor]:
 > I did a small review on this code.
 >
 > I've looked at entry_guard_parse_from_state(), and I can't work out
 where we create a dense set of indexes on load. (But I can see where we do
 it on save.)
 >
 > Creating a dense set of indexes on load is important, because qsort() is
 not stable. Therefore, the first time a legacy state is loaded, the guards
 will be sorted in arbitrary order. And the order may change, every time
 the sort is performed.
 >
 > I also wonder if we need to sort the guard list every time we select a
 guard. Instead, can we keep the list sorted when we add or delete guards?
 > Appending guards to the end of the list is just smartlist_add(). We have
 the smartlist_del_keeporder() to remove guards from the list.

 Yes, so, indeed I forgot to account for existing clients that would load
 states without any sampled_idx the first time they would use that patch. I
 need to workout a "fake" sampling order for those clients, or qsort()
 would not be stable as you mention (I guess taking the confirmed_idx
 ordering would be a good enough heuristic).

 I am going to look closer to your recommendation on ordering. Thanks for
 your thoughtful review!

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/32088#comment:13>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs