[tor-commits] [tor/master] Remove version checks for microdescriptor support

nickm at torproject.org nickm at torproject.org
Wed Apr 1 18:02:13 UTC 2015


commit 05f7336624d6a47b3cf0fe827097cd526a130873
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Mar 24 09:18:03 2015 -0400

    Remove version checks for microdescriptor support
    
    At this point, relays without microdescriptor support are no longer
    allowed on the Tor network.
---
 changes/remove_old_version_checks |    2 ++
 src/or/entrynodes.c               |   53 ++++---------------------------------
 src/or/or.h                       |    3 ---
 src/or/routerlist.c               |    3 ---
 src/or/routerparse.c              |   11 --------
 src/or/routerparse.h              |    1 -
 6 files changed, 7 insertions(+), 66 deletions(-)

diff --git a/changes/remove_old_version_checks b/changes/remove_old_version_checks
index 28cd48d..fe4dab9 100644
--- a/changes/remove_old_version_checks
+++ b/changes/remove_old_version_checks
@@ -1,3 +1,5 @@
   o Removed features:
     - Tor no longer contains workarounds for stat files generated by
       super-old versions of Tor that didn't choose guards sensibly.
+    - Tor no longer contains checks for ancient directory cache versions
+      that didn't know about microdescriptors.
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index c21caf4..aec47bf 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -141,8 +141,7 @@ entry_guard_set_status(entry_guard_t *e, const node_t *node,
   }
 
   if (node) {
-    int is_dir = node_is_dir(node) && node->rs &&
-      node->rs->version_supports_microdesc_cache;
+    int is_dir = node_is_dir(node);
     if (options->UseBridges && node_is_a_configured_bridge(node))
       is_dir = 1;
     if (e->is_dir_cache != is_dir) {
@@ -398,10 +397,7 @@ add_an_entry_guard(const node_t *chosen, int reset_status, int prepend,
         entry->bad_since = 0;
         entry->can_retry = 1;
       }
-      entry->is_dir_cache = node->rs &&
-                            node->rs->version_supports_microdesc_cache;
-      if (get_options()->UseBridges && node_is_a_configured_bridge(node))
-        entry->is_dir_cache = 1;
+      entry->is_dir_cache = node_is_dir(node);
       return NULL;
     }
   } else if (!for_directory) {
@@ -432,8 +428,7 @@ add_an_entry_guard(const node_t *chosen, int reset_status, int prepend,
            node_describe(node));
   strlcpy(entry->nickname, node_get_nickname(node), sizeof(entry->nickname));
   memcpy(entry->identity, node->identity, DIGEST_LEN);
-  entry->is_dir_cache = node_is_dir(node) && node->rs &&
-                        node->rs->version_supports_microdesc_cache;
+  entry->is_dir_cache = node_is_dir(node);
   if (get_options()->UseBridges && node_is_a_configured_bridge(node))
     entry->is_dir_cache = 1;
 
@@ -973,39 +968,6 @@ entry_list_is_constrained(const or_options_t *options)
   return 0;
 }
 
-/** Return true iff this node can answer directory questions about
- * microdescriptors. */
-static int
-node_understands_microdescriptors(const node_t *node)
-{
-  tor_assert(node);
-  if (node->rs && node->rs->version_supports_microdesc_cache)
-    return 1;
-  if (node->ri && tor_version_supports_microdescriptors(node->ri->platform))
-    return 1;
-  return 0;
-}
-
-/** Return true iff <b>node</b> is able to answer directory questions
- * of type <b>dirinfo</b>. Always returns true if <b>dirinfo</b> is
- * NO_DIRINFO (zero). */
-static int
-node_can_handle_dirinfo(const node_t *node, dirinfo_type_t dirinfo)
-{
-  /* Checking dirinfo for any type other than microdescriptors isn't required
-     yet, since we only choose directory guards that can support microdescs,
-     routerinfos, and networkstatuses, AND we don't use directory guards if
-     we're configured to do direct downloads of anything else. The only case
-     where we might have a guard that doesn't know about a type of directory
-     information is when we're retrieving directory information from a
-     bridge. */
-
-  if ((dirinfo & MICRODESC_DIRINFO) &&
-      !node_understands_microdescriptors(node))
-    return 0;
-  return 1;
-}
-
 /** Pick a live (up and listed) entry guard from entry_guards. If
  * <b>state</b> is non-NULL, this is for a specific circuit --
  * make sure not to pick this circuit's exit or any node in the
@@ -1092,9 +1054,6 @@ populate_live_entry_guards(smartlist_t *live_entry_guards,
         continue; /* don't pick the same node for entry and exit */
       if (smartlist_contains(exit_family, node))
         continue; /* avoid relays that are family members of our exit */
-      if (dirinfo_type != NO_DIRINFO &&
-          !node_can_handle_dirinfo(node, dirinfo_type))
-        continue; /* this node won't be able to answer our dir questions */
       smartlist_add(live_entry_guards, (void*)node);
       if (!entry->made_contact) {
         /* Always start with the first not-yet-contacted entry
@@ -2468,11 +2427,9 @@ any_bridge_supports_microdescriptors(void)
   SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, e) {
     node = node_get_by_id(e->identity);
     if (node && node->is_running &&
-        node_is_bridge(node) && node_is_a_configured_bridge(node) &&
-        node_understands_microdescriptors(node)) {
+        node_is_bridge(node) && node_is_a_configured_bridge(node)) {
       /* This is one of our current bridges, and we know enough about
-       * it to know that it will be able to answer our microdescriptor
-       * questions. */
+       * it to know that it will be able to answer our questions. */
        return 1;
     }
   } SMARTLIST_FOREACH_END(e);
diff --git a/src/or/or.h b/src/or/or.h
index f75e776..66692b2 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2131,9 +2131,6 @@ typedef struct routerstatus_t {
    * if the number of traits we care about ever becomes incredibly big. */
   unsigned int version_known:1;
 
-  /** True iff this router is a version that, if it caches directory info,
-   * we can get microdescriptors from. */
-  unsigned int version_supports_microdesc_cache:1;
   /** True iff this router has a version that allows it to accept EXTEND2
    * cells */
   unsigned int version_supports_extend2_cells:1;
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 98c3bb1..fd09679 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1498,9 +1498,6 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags,
     if ((type & EXTRAINFO_DIRINFO) &&
         !router_supports_extrainfo(node->identity, is_trusted_extrainfo))
       continue;
-    if ((type & MICRODESC_DIRINFO) && !is_trusted &&
-        !node->rs->version_supports_microdesc_cache)
-      continue;
     if (for_guard && node->using_as_guard)
       continue; /* Don't make the same node a guard twice. */
     if (try_excluding &&
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 5a9626f..6a47747 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -2015,10 +2015,7 @@ routerstatus_parse_entry_from_string(memarea_t *area,
     tor_assert(tok->n_args == 1);
     rs->version_known = 1;
     if (strcmpstart(tok->args[0], "Tor ")) {
-      rs->version_supports_microdesc_cache = 1;
     } else {
-      rs->version_supports_microdesc_cache =
-        tor_version_supports_microdescriptors(tok->args[0]);
       rs->version_supports_extend2_cells =
         tor_version_as_new_as(tok->args[0], "0.2.4.8-alpha");
     }
@@ -4263,14 +4260,6 @@ microdescs_parse_from_string(const char *s, const char *eos,
   return result;
 }
 
-/** Return true iff this Tor version can answer directory questions
- * about microdescriptors. */
-int
-tor_version_supports_microdescriptors(const char *platform)
-{
-  return tor_version_as_new_as(platform, "0.2.3.1-alpha");
-}
-
 /** Parse the Tor version of the platform string <b>platform</b>,
  * and compare it to the version in <b>cutoff</b>. Return 1 if
  * the router is at least as new as the cutoff, else return 0.
diff --git a/src/or/routerparse.h b/src/or/routerparse.h
index fc21cb1..e294d95 100644
--- a/src/or/routerparse.h
+++ b/src/or/routerparse.h
@@ -44,7 +44,6 @@ MOCK_DECL(addr_policy_t *, router_parse_addr_policy_item_from_string,
     (const char *s, int assume_action));
 version_status_t tor_version_is_obsolete(const char *myversion,
                                          const char *versionlist);
-int tor_version_supports_microdescriptors(const char *platform);
 int tor_version_as_new_as(const char *platform, const char *cutoff);
 int tor_version_parse(const char *s, tor_version_t *out);
 int tor_version_compare(tor_version_t *a, tor_version_t *b);





More information about the tor-commits mailing list