Commit 6ede110c authored by Roger Dingledine's avatar Roger Dingledine
Browse files

When choosing an entry guard for our circuit, avoid using guards

that are in the same family as the chosen exit -- not just guards
that are exactly the chosen exit. (Reported by lodger.)


svn:r10240
parent 5741739a
Loading
Loading
Loading
Loading
+3 −0
Changes for ChangeLog: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -156,6 +156,9 @@ Changes in version 0.2.0.1-alpha - 2007-??-??
    - Make the NodeFamilies config option work. (Reported by
      lodger -- it has never actually worked, even though we added it
      in Oct 2004.)
    - When choosing an entry guard for our circuit, avoid using guards
      that are in the same family as the chosen exit -- not just guards
      that are exactly the chosen exit. (Reported by lodger.)

  o Minor bugfixes (controller):
    - Make 'getinfo fingerprint' return a 551 error if we're not a
+5 −1
Changes for src/or/circuitbuild.c: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2339,11 +2339,14 @@ choose_random_entry(cpath_build_state_t *state)
{
  or_options_t *options = get_options();
  smartlist_t *live_entry_guards = smartlist_create();
  smartlist_t *exit_family = smartlist_create();
  routerinfo_t *chosen_exit = build_state_get_exit_router(state);
  routerinfo_t *r = NULL;
  int need_uptime = state->need_uptime;
  int need_capacity = state->need_capacity;

  routerlist_add_family(exit_family, chosen_exit);

  if (!entry_guards)
    entry_guards = smartlist_create();

@@ -2360,7 +2363,7 @@ choose_random_entry(cpath_build_state_t *state)
  SMARTLIST_FOREACH(entry_guards, entry_guard_t *, entry,
    {
      r = entry_is_live(entry, need_uptime, need_capacity, 0);
      if (r && r != chosen_exit) {
      if (r && !smartlist_isin(exit_family, r)) {
        smartlist_add(live_entry_guards, r);
        if (smartlist_len(live_entry_guards) >= options->NumEntryGuards)
          break; /* we have enough */
@@ -2397,6 +2400,7 @@ choose_random_entry(cpath_build_state_t *state)

  r = smartlist_choose(live_entry_guards);
  smartlist_free(live_entry_guards);
  smartlist_free(exit_family);
  return r;
}