Ticket #21425: tor_guard_selection_t.patch

File tor_guard_selection_t.patch, 3.3 KB (added by neel, 2 years ago)

Patch: Make entry_list_is_constrained() use guard_selection_t

  • src/or/circuituse.c

    From eb925c9ae367b55dbf58f9ba812387b57b8cd118 Mon Sep 17 00:00:00 2001
    From: Neel Chauhan <neel@neelc.org>
    Date: Mon, 24 Apr 2017 18:05:06 -0400
    Subject: [PATCH] Make entry_list_is_constrained() use guard_selection_t
    
    ---
     src/or/circuituse.c | 2 +-
     src/or/directory.c  | 2 +-
     src/or/entrynodes.c | 9 +++------
     src/or/entrynodes.h | 3 ++-
     4 files changed, 7 insertions(+), 9 deletions(-)
    
    diff --git a/src/or/circuituse.c b/src/or/circuituse.c
    index 8d233e0cb..898352a5e 100644
    a b circuit_get_open_circ_or_launch(entry_connection_t *conn, 
    20402040    if (!connection_get_by_type(CONN_TYPE_DIR)) {
    20412041      int severity = LOG_NOTICE;
    20422042      /* Retry some stuff that might help the connection work. */
    2043       if (entry_list_is_constrained(options) &&
     2043      if (entry_list_is_constrained(options, get_guard_selection_info()) &&
    20442044          guards_retry_optimistic(options)) {
    20452045        log_fn(severity, LD_APP|LD_DIR,
    20462046               "Application request when we haven't %s. "
  • src/or/directory.c

    diff --git a/src/or/directory.c b/src/or/directory.c
    index 1b999ee7c..00dd70dcc 100644
    a b connection_dir_request_failed(dir_connection_t *conn) 
    915915  if (directory_conn_is_self_reachability_test(conn)) {
    916916    return; /* this was a test fetch. don't retry. */
    917917  }
    918   if (!entry_list_is_constrained(get_options()))
     918  if (!entry_list_is_constrained(get_options(), get_guard_selection_info()))
    919919    router_set_status(conn->identity_digest, 0); /* don't try this one again */
    920920  if (conn->base_.purpose == DIR_PURPOSE_FETCH_SERVERDESC ||
    921921             conn->base_.purpose == DIR_PURPOSE_FETCH_EXTRAINFO) {
  • src/or/entrynodes.c

    diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
    index 7a27cd0f4..77897f6dd 100644
    a b entry_guard_free(entry_guard_t *e) 
    29452945 * list already and we must stick to it.
    29462946 */
    29472947int
    2948 entry_list_is_constrained(const or_options_t *options)
     2948entry_list_is_constrained(const or_options_t *options, guard_selection_t *gs)
    29492949{
    2950   // XXXX #21425 look at the current selection.
    2951   if (options->EntryNodes)
    2952     return 1;
    2953   if (options->UseBridges)
     2950  if (gs->primary_guards_up_to_date)
    29542951    return 1;
    29552952  return 0;
    29562953}
    guards_choose_dirguard(circuit_guard_state_t **guard_state_out) 
    33413338int
    33423339guards_retry_optimistic(const or_options_t *options)
    33433340{
    3344   if (! entry_list_is_constrained(options))
     3341  if (! entry_list_is_constrained(options, get_guard_selection_info()))
    33453342    return 0;
    33463343
    33473344  mark_primary_guards_maybe_reachable(get_guard_selection_info());
  • src/or/entrynodes.h

    diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h
    index 400a84269..06164214b 100644
    a b struct bridge_info_t; 
    554554void entry_guard_learned_bridge_identity(const tor_addr_port_t *addrport,
    555555                                         const uint8_t *rsa_id_digest);
    556556
    557 int entry_list_is_constrained(const or_options_t *options);
     557int entry_list_is_constrained(const or_options_t *options,
     558                              guard_selection_t *gs);
    558559int guards_retry_optimistic(const or_options_t *options);
    559560int entry_guards_parse_state_for_guard_selection(
    560561    guard_selection_t *gs, or_state_t *state, int set, char **msg);