Browse Source

Remove UseDeprecatedGuardAlgorithm.

Nick Mathewson 7 years ago
parent
commit
a31a5581ee
6 changed files with 6 additions and 67 deletions
  1. 2 9
      src/or/bridges.c
  2. 1 4
      src/or/circuitbuild.c
  3. 0 4
      src/or/config.c
  4. 3 23
      src/or/entrynodes.c
  5. 0 8
      src/or/or.h
  6. 0 19
      src/test/test_entrynodes.c

+ 2 - 9
src/or/bridges.c

@@ -761,20 +761,13 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
                    fmt_and_decorate_addr(&bridge->addr),
                    (int) bridge->port);
       }
-      if (get_options()->UseDeprecatedGuardAlgorithm) {
-        tor_assert_nonfatal_unreached();
-      } else {
-        entry_guard_learned_bridge_identity(&bridge->addrport_configured,
-                               (const uint8_t*)ri->cache_info.identity_digest);
-      }
+      entry_guard_learned_bridge_identity(&bridge->addrport_configured,
+                              (const uint8_t*)ri->cache_info.identity_digest);
 
       log_notice(LD_DIR, "new bridge descriptor '%s' (%s): %s", ri->nickname,
                  from_cache ? "cached" : "fresh", router_describe(ri));
       /* set entry->made_contact so if it goes down we don't drop it from
        * our entry node list */
-      if (get_options()->UseDeprecatedGuardAlgorithm) {
-        tor_assert_nonfatal_unreached();
-      }
       if (first) {
         routerlist_retry_directory_downloads(now);
       }

+ 1 - 4
src/or/circuitbuild.c

@@ -967,10 +967,7 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
     if (!hop) {
       /* done building the circuit. whew. */
       guard_usable_t r;
-      if (get_options()->UseDeprecatedGuardAlgorithm) {
-        // The circuit is usable; we already marked the guard as okay.
-        r = GUARD_USABLE_NOW;
-      } else if (! circ->guard_state) {
+      if (! circ->guard_state) {
         if (circuit_get_cpath_len(circ) != 1 &&
             circ->base_.purpose != CIRCUIT_PURPOSE_TESTING &&
             get_options()->UseEntryGuards) {

+ 0 - 4
src/or/config.c

@@ -308,9 +308,6 @@ static config_var_t option_vars_[] = {
   V(ExtraInfoStatistics,         BOOL,     "1"),
   V(ExtendByEd25519ID,           AUTOBOOL, "auto"),
   V(FallbackDir,                 LINELIST, NULL),
-  /* XXXX prop271 -- this has an ugly name to remind us to remove it. */
-  VAR("UseDeprecatedGuardAlgorithm_",        BOOL,
-      UseDeprecatedGuardAlgorithm, "0"),
 
   V(UseDefaultFallbackDirs,      BOOL,     "1"),
 
@@ -1578,7 +1575,6 @@ options_transition_affects_guards(const or_options_t *old,
 
   return
     (old->UseEntryGuards != new->UseEntryGuards ||
-     old->UseDeprecatedGuardAlgorithm != new->UseDeprecatedGuardAlgorithm ||
      old->UseBridges != new->UseBridges ||
      old->UseEntryGuards != new->UseEntryGuards ||
      old->ClientUseIPv4 != new->ClientUseIPv4 ||

+ 3 - 23
src/or/entrynodes.c

@@ -546,10 +546,6 @@ choose_guard_selection(const or_options_t *options,
 {
   tor_assert(options);
   tor_assert(type_out);
-  if (options->UseDeprecatedGuardAlgorithm) {
-    *type_out = GS_TYPE_LEGACY;
-    return "legacy";
-  }
 
   if (options->UseBridges) {
     *type_out = GS_TYPE_BRIDGE;
@@ -2113,9 +2109,6 @@ entry_guard_pick_for_circuit(guard_selection_t *gs,
 guard_usable_t
 entry_guard_succeeded(circuit_guard_state_t **guard_state_p)
 {
-  if (get_options()->UseDeprecatedGuardAlgorithm)
-    return GUARD_USABLE_NOW;
-
   if (BUG(*guard_state_p == NULL))
     return GUARD_USABLE_NEVER;
 
@@ -2143,8 +2136,6 @@ entry_guard_succeeded(circuit_guard_state_t **guard_state_p)
 void
 entry_guard_cancel(circuit_guard_state_t **guard_state_p)
 {
-  if (get_options()->UseDeprecatedGuardAlgorithm)
-    return;
   if (BUG(*guard_state_p == NULL))
     return;
   entry_guard_t *guard = entry_guard_handle_get((*guard_state_p)->guard);
@@ -2166,9 +2157,6 @@ entry_guard_cancel(circuit_guard_state_t **guard_state_p)
 void
 entry_guard_failed(circuit_guard_state_t **guard_state_p)
 {
-  if (get_options()->UseDeprecatedGuardAlgorithm)
-    return;
-
   if (BUG(*guard_state_p == NULL))
     return;
 
@@ -2191,8 +2179,6 @@ entry_guard_chan_failed(channel_t *chan)
 {
   if (!chan)
     return;
-  if (get_options()->UseDeprecatedGuardAlgorithm)
-    return;
 
   smartlist_t *pending = smartlist_new();
   circuit_get_all_pending_on_channel(pending, chan);
@@ -3278,10 +3264,7 @@ const node_t *
 guards_choose_guard(cpath_build_state_t *state,
                    circuit_guard_state_t **guard_state_out)
 {
-  if (get_options()->UseDeprecatedGuardAlgorithm) {
-    tor_assert_nonfatal_unreached();
-    return NULL;
-  } else {
+  if (1) {
     const node_t *r = NULL;
     const uint8_t *exit_id = NULL;
     entry_guard_restriction_t *rst = NULL;
@@ -3308,11 +3291,7 @@ const node_t *
 guards_choose_dirguard(dirinfo_type_t info,
                       circuit_guard_state_t **guard_state_out)
 {
-  if (get_options()->UseDeprecatedGuardAlgorithm) {
-    (void)info;
-    tor_assert_nonfatal_unreached();
-    return NULL;
-  } else {
+  if (1) {
     /* XXXX prop271 We don't need to look at the dirinfo_type_t here,
      * apparently. If you look at the old implementation, and you follow info
      * downwards through choose_random_dirguard(), into
@@ -3320,6 +3299,7 @@ guards_choose_dirguard(dirinfo_type_t info,
      * find out that it isn't even used, and hasn't been since 0.2.7.1-alpha,
      * when we realized that every Tor on the network would support
      * microdescriptors. -NM */
+    (void) info;
     const node_t *r = NULL;
     if (entry_guard_pick_for_circuit(get_guard_selection_info(),
                                      GUARD_USAGE_DIRGUARD,

+ 0 - 8
src/or/or.h

@@ -4574,14 +4574,6 @@ typedef struct {
    * do we enforce Ed25519 identity match? */
   /* NOTE: remove this option someday. */
   int AuthDirTestEd25519LinkKeys;
-
-  /** If 1, we use the old (pre-prop271) guard selection algorithm.
-   *
-   * XXXX prop271 This option is only here as a stopgap while we're
-   * XXXX tuning and debugging the new (post-prop271) algorithm.  Eventually
-   * we should remove it entirely.
-   */
-  int UseDeprecatedGuardAlgorithm;
 } or_options_t;
 
 /** Persistent state for an onion router, as saved to disk. */

+ 0 - 19
src/test/test_entrynodes.c

@@ -789,17 +789,6 @@ test_entry_guard_get_guard_selection_by_name(void *arg)
   tt_assert(gs3 != gs1);
   tt_assert(gs3 == get_guard_selection_info());
 
-  or_options_t *options = get_options_mutable();
-  options->UseDeprecatedGuardAlgorithm = 1;
-  update_guard_selection_choice(options);
-  guard_selection_t *gs4 = get_guard_selection_info();
-  tt_assert(gs4 != gs3);
-  tt_assert(gs4 == get_guard_selection_by_name("legacy", GS_TYPE_LEGACY, 1));
-
-  options->UseDeprecatedGuardAlgorithm = 0;
-  update_guard_selection_choice(options);
-  tt_assert(gs3 == get_guard_selection_info());
-
  done:
   entry_guards_free_all();
 }
@@ -824,14 +813,6 @@ test_entry_guard_choose_selection_initial(void *arg)
   tt_int_op(type, OP_EQ, GS_TYPE_BRIDGE);
   get_options_mutable()->UseBridges = 0;
 
-  /* If we're using legacy guards, we get the legacy selection */
-  get_options_mutable()->UseDeprecatedGuardAlgorithm = 1;
-  name = choose_guard_selection(get_options(),
-                                dummy_consensus, NULL, &type);
-  tt_str_op(name, OP_EQ, "legacy");
-  tt_int_op(type, OP_EQ, GS_TYPE_LEGACY);
-  get_options_mutable()->UseDeprecatedGuardAlgorithm = 0;
-
   /* If we discard >99% of our guards, though, we should be in the restricted
    * set. */
   tt_assert(get_options_mutable()->EntryNodes == NULL);