Ticket #2355: tor-02-strict_usebridges.patch

File tor-02-strict_usebridges.patch, 1.2 KB (added by anonym, 8 years ago)

When bridges should be used, allow only configured bridges as entries.

  • src/or/circuitbuild.c

    diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
    index 2c16334..c6000e9 100644
    a b choose_random_entry(cpath_build_state_t *state) 
    40964096  smartlist_clear(live_entry_guards);
    40974097  SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry) {
    40984098      const char *msg;
    4099       node = entry_is_live(entry, need_uptime, need_capacity, 0, &msg);
     4099      int assmume_reachable =  options->EffectiveUseBridges ? 1 : 0;
     4100      node = entry_is_live(entry, need_uptime, need_capacity,
     4101                           assmume_reachable, &msg);
    41004102      if (!node)
    41014103        continue; /* down, no point */
    41024104      if (node == chosen_exit)
    41034105        continue; /* don't pick the same node for entry and exit */
    41044106      if (consider_exit_family && smartlist_isin(exit_family, node))
    41054107        continue; /* avoid relays that are family members of our exit */
     4108      if (options->EffectiveUseBridges &&
     4109          !routerinfo_is_a_configured_bridge(node->ri))
     4110        continue; /* if we're using bridges we ignore non-bridge entries */
    41064111#if 0 /* since EntryNodes is always strict now, this clause is moot */
    41074112      if (options->EntryNodes &&
    41084113          !routerset_contains_node(options->EntryNodes, node)) {