[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove version_supports checks for versions before 0.2.2.



commit 7988596f66874fd36d1c99bf39736e4b41609a6b
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Sep 7 23:21:18 2012 -0400

    Remove version_supports checks for versions before 0.2.2.
---
 changes/remove_old_ver_checks |    4 +++
 src/or/circuitbuild.c         |    5 +--
 src/or/directory.c            |   47 ++++++++--------------------------------
 src/or/directory.h            |    3 +-
 src/or/networkstatus.c        |    8 +------
 src/or/or.h                   |   11 +--------
 src/or/router.c               |    3 +-
 src/or/routerlist.c           |   14 +-----------
 src/or/routerparse.c          |   11 ---------
 9 files changed, 21 insertions(+), 85 deletions(-)

diff --git a/changes/remove_old_ver_checks b/changes/remove_old_ver_checks
new file mode 100644
index 0000000..7d476a1
--- /dev/null
+++ b/changes/remove_old_ver_checks
@@ -0,0 +1,4 @@
+  o Removed features:
+    - Now that all versions before 0.2.2.x are disallowed, we no longer
+      need to work around their missing features. This allows us to remove
+      a bunch of compatibility code.
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 8aa80cd..fe327ca 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -5475,9 +5475,8 @@ launch_direct_bridge_descriptor_fetch(bridge_info_t *bridge)
   address = tor_dup_addr(&bridge->addr);
 
   directory_initiate_command(address, &bridge->addr,
-                             bridge->port, 0,
-                             0, /* does not matter */
-                             1, bridge->identity,
+                             bridge->port, 0/*no dirport*/,
+                             bridge->identity,
                              DIR_PURPOSE_FETCH_SERVERDESC,
                              ROUTER_PURPOSE_BRIDGE,
                              0, "authority.z", NULL, 0, 0);
diff --git a/src/or/directory.c b/src/or/directory.c
index 40344e6..a865120 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -58,7 +58,6 @@
 static void directory_send_command(dir_connection_t *conn,
                              int purpose, int direct, const char *resource,
                              const char *payload, size_t payload_len,
-                             int supports_conditional_consensus,
                              time_t if_modified_since);
 static int directory_handle_command(dir_connection_t *conn);
 static int body_is_plausible(const char *body, size_t body_len, int purpose);
@@ -89,8 +88,6 @@ static void directory_initiate_command_rend(const char *address,
                                             const tor_addr_t *addr,
                                             uint16_t or_port,
                                             uint16_t dir_port,
-                                            int supports_conditional_consensus,
-                                            int supports_begindir,
                                             const char *digest,
                                             uint8_t dir_purpose,
                                             uint8_t router_purpose,
@@ -227,16 +224,9 @@ router_supports_extrainfo(const char *identity_digest, int is_authority)
   if (node && node->ri) {
     if (node->ri->caches_extra_info)
       return 1;
-    if (is_authority && node->ri->platform &&
-        tor_version_as_new_as(node->ri->platform,
-                              "Tor 0.2.0.0-alpha-dev (r10070)"))
-      return 1;
   }
   if (is_authority) {
-    const routerstatus_t *rs =
-      router_get_consensus_status_by_id(identity_digest);
-    if (rs && rs->version_supports_extrainfo_upload)
-      return 1;
+    return 1;
   }
   return 0;
 }
@@ -431,8 +421,6 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
        * the behavior supported by our oldest bridge; see for example
        * any_bridges_dont_support_microdescriptors().
        */
-      /* XXX024 Not all bridges handle conditional consensus downloading,
-       * so, for now, never assume the server supports that. -PP */
       const node_t *node = choose_random_entry(NULL);
       if (node && node->ri) {
         /* every bridge has a routerinfo. */
@@ -440,9 +428,8 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
         routerinfo_t *ri = node->ri;
         node_get_addr(node, &addr);
         directory_initiate_command(ri->address, &addr,
-                                   ri->or_port, 0,
-                                   0, /* don't use conditional consensus url */
-                                   1, ri->cache_info.identity_digest,
+                                   ri->or_port, 0/*no dirport*/,
+                                   ri->cache_info.identity_digest,
                                    dir_purpose,
                                    router_purpose,
                                    0, resource, NULL, 0, if_modified_since);
@@ -596,8 +583,6 @@ directory_initiate_command_routerstatus_rend(const routerstatus_t *status,
 
   directory_initiate_command_rend(address, &addr,
                              status->or_port, status->dir_port,
-                             status->version_supports_conditional_consensus,
-                             status->version_supports_begindir,
                              status->identity_digest,
                              dir_purpose, router_purpose,
                              anonymized_connection, resource,
@@ -855,16 +840,14 @@ directory_command_should_use_begindir(const or_options_t *options,
 void
 directory_initiate_command(const char *address, const tor_addr_t *_addr,
                            uint16_t or_port, uint16_t dir_port,
-                           int supports_conditional_consensus,
-                           int supports_begindir, const char *digest,
+                           const char *digest,
                            uint8_t dir_purpose, uint8_t router_purpose,
                            int anonymized_connection, const char *resource,
                            const char *payload, size_t payload_len,
                            time_t if_modified_since)
 {
   directory_initiate_command_rend(address, _addr, or_port, dir_port,
-                             supports_conditional_consensus,
-                             supports_begindir, digest, dir_purpose,
+                             digest, dir_purpose,
                              router_purpose, anonymized_connection,
                              resource, payload, payload_len,
                              if_modified_since, NULL);
@@ -889,8 +872,7 @@ is_sensitive_dir_purpose(uint8_t dir_purpose)
 static void
 directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
                                 uint16_t or_port, uint16_t dir_port,
-                                int supports_conditional_consensus,
-                                int supports_begindir, const char *digest,
+                                const char *digest,
                                 uint8_t dir_purpose, uint8_t router_purpose,
                                 int anonymized_connection,
                                 const char *resource,
@@ -901,8 +883,7 @@ directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
   dir_connection_t *conn;
   const or_options_t *options = get_options();
   int socket_error = 0;
-  int use_begindir = supports_begindir &&
-                     directory_command_should_use_begindir(options, _addr,
+  int use_begindir = directory_command_should_use_begindir(options, _addr,
                        or_port, router_purpose, anonymized_connection);
   tor_addr_t addr;
 
@@ -979,7 +960,6 @@ directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
         /* queue the command on the outbuf */
         directory_send_command(conn, dir_purpose, 1, resource,
                                payload, payload_len,
-                               supports_conditional_consensus,
                                if_modified_since);
         connection_watch_events(TO_CONN(conn), READ_EVENT | WRITE_EVENT);
         /* writable indicates finish, readable indicates broken link,
@@ -1024,7 +1004,6 @@ directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
     /* queue the command on the outbuf */
     directory_send_command(conn, dir_purpose, 0, resource,
                            payload, payload_len,
-                           supports_conditional_consensus,
                            if_modified_since);
 
     connection_watch_events(TO_CONN(conn), READ_EVENT|WRITE_EVENT);
@@ -1074,8 +1053,7 @@ _compare_strs(const void **a, const void **b)
  * If 'resource' is provided, it is the name of a consensus flavor to request.
  */
 static char *
-directory_get_consensus_url(int supports_conditional_consensus,
-                            const char *resource)
+directory_get_consensus_url(const char *resource)
 {
   char *url = NULL;
   const char *hyphen, *flavor;
@@ -1087,7 +1065,7 @@ directory_get_consensus_url(int supports_conditional_consensus,
     hyphen = "-";
   }
 
-  if (supports_conditional_consensus) {
+  {
     char *authority_id_list;
     smartlist_t *authority_digests = smartlist_new();
 
@@ -1112,9 +1090,6 @@ directory_get_consensus_url(int supports_conditional_consensus,
     SMARTLIST_FOREACH(authority_digests, char *, cp, tor_free(cp));
     smartlist_free(authority_digests);
     tor_free(authority_id_list);
-  } else {
-    tor_asprintf(&url, "/tor/status-vote/current/consensus%s%s.z",
-                 hyphen, flavor);
   }
   return url;
 }
@@ -1126,7 +1101,6 @@ static void
 directory_send_command(dir_connection_t *conn,
                        int purpose, int direct, const char *resource,
                        const char *payload, size_t payload_len,
-                       int supports_conditional_consensus,
                        time_t if_modified_since)
 {
   char proxystring[256];
@@ -1189,8 +1163,7 @@ directory_send_command(dir_connection_t *conn,
       /* resource is optional.  If present, it's a flavor name */
       tor_assert(!payload);
       httpcommand = "GET";
-      url = directory_get_consensus_url(supports_conditional_consensus,
-                                        resource);
+      url = directory_get_consensus_url(resource);
       log_info(LD_DIR, "Downloading consensus from %s using %s",
                hoststring, url);
       break;
diff --git a/src/or/directory.h b/src/or/directory.h
index 1ca1c5a..14444c0 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -51,8 +51,7 @@ int connection_dir_finished_connecting(dir_connection_t *conn);
 void connection_dir_about_to_close(dir_connection_t *dir_conn);
 void directory_initiate_command(const char *address, const tor_addr_t *addr,
                                 uint16_t or_port, uint16_t dir_port,
-                                int supports_conditional_consensus,
-                                int supports_begindir, const char *digest,
+                                const char *digest,
                                 uint8_t dir_purpose, uint8_t router_purpose,
                                 int anonymized_connection,
                                 const char *resource,
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index fadaf90..0df5c4e 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1530,13 +1530,7 @@ routerstatus_has_changed(const routerstatus_t *a, const routerstatus_t *b)
          a->is_bad_exit != b->is_bad_exit ||
          a->is_bad_directory != b->is_bad_directory ||
          a->is_hs_dir != b->is_hs_dir ||
-         a->version_known != b->version_known ||
-         a->version_supports_begindir != b->version_supports_begindir ||
-         a->version_supports_extrainfo_upload !=
-           b->version_supports_extrainfo_upload ||
-         a->version_supports_conditional_consensus !=
-           b->version_supports_conditional_consensus ||
-         a->version_supports_v3_dir != b->version_supports_v3_dir;
+         a->version_known != b->version_known;
 }
 
 /** Notify controllers of any router status entries that changed between
diff --git a/src/or/or.h b/src/or/or.h
index 3609d32..5bc4409 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1854,16 +1854,7 @@ typedef struct routerstatus_t {
    * included.)  We'll replace all these with a big tor_version_t or a char[]
    * 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 supports BEGIN_DIR cells. */
-  unsigned int version_supports_begindir:1;
-  /** True iff this router is a version that supports conditional consensus
-   *  downloads (signed by list of authorities). */
-  unsigned int version_supports_conditional_consensus:1;
-  /** True iff this router is a version that we can post extrainfo docs to. */
-  unsigned int version_supports_extrainfo_upload:1;
-  /** True iff this router is a version that, if it caches directory info,
-   * we can get v3 downloads from. */
-  unsigned int version_supports_v3_dir: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;
diff --git a/src/or/router.c b/src/or/router.c
index bb8a6e3..4e1eb2d 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -954,8 +954,7 @@ consider_testing_reachability(int test_or, int test_dir)
     /* ask myself, via tor, for my server descriptor. */
     directory_initiate_command(me->address, &addr,
                                me->or_port, me->dir_port,
-                               0, /* does not matter */
-                               0, me->cache_info.identity_digest,
+                               me->cache_info.identity_digest,
                                DIR_PURPOSE_FETCH_SERVERDESC,
                                ROUTER_PURPOSE_GENERAL,
                                1, "authority.z", NULL, 0, 0);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 3aea606..ce21e99 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -995,7 +995,7 @@ router_get_my_share_of_directory_requests(double *v2_share_out,
     }
   }
 
-  if (rs->version_supports_v3_dir) {
+  {
     sl_last_total_weighted_bw = 0;
     router_pick_directory_server(V3_DIRINFO, pds_flags);
     if (sl_last_total_weighted_bw != 0) {
@@ -1127,12 +1127,6 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags)
       continue;
     if (requireother && router_digest_is_me(node->identity))
       continue;
-    if (type & V3_DIRINFO) {
-      if (!(status->version_supports_v3_dir ||
-            router_digest_is_trusted_dir_type(node->identity,
-                                              V3_DIRINFO)))
-        continue;
-    }
     is_trusted = router_digest_is_trusted_dir(node->identity);
     if ((type & V2_DIRINFO) && !(node->rs->is_v2_dir || is_trusted))
       continue;
@@ -1155,7 +1149,6 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags)
     is_overloaded = status->last_dir_503_at + DIR_503_TIMEOUT > now;
 
     if (prefer_tunnel &&
-        status->version_supports_begindir &&
         (!fascistfirewall ||
          fascist_firewall_allows_address_or(&addr, status->or_port)))
       smartlist_add(is_trusted ? trusted_tunnel :
@@ -4159,11 +4152,6 @@ add_trusted_dir_server(const char *nickname, const char *address,
   ent->fake_status.dir_port = ent->dir_port;
   ent->fake_status.or_port = ent->or_port;
 
-  if (ent->or_port)
-    ent->fake_status.version_supports_begindir = 1;
-
-  ent->fake_status.version_supports_conditional_consensus = 1;
-
   smartlist_add(trusted_dir_servers, ent);
   router_dir_info_changed();
   return ent;
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 7bee084..6b94c6b 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -2146,20 +2146,9 @@ 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_begindir = 1;
-      rs->version_supports_extrainfo_upload = 1;
-      rs->version_supports_conditional_consensus = 1;
       rs->version_supports_microdesc_cache = 1;
       rs->version_supports_optimistic_data = 1;
     } else {
-      rs->version_supports_begindir =
-        tor_version_as_new_as(tok->args[0], "0.2.0.1-alpha");
-      rs->version_supports_extrainfo_upload =
-        tor_version_as_new_as(tok->args[0], "0.2.0.0-alpha-dev (r10070)");
-      rs->version_supports_v3_dir =
-        tor_version_as_new_as(tok->args[0], "0.2.0.8-alpha");
-      rs->version_supports_conditional_consensus =
-        tor_version_as_new_as(tok->args[0], "0.2.1.1-alpha");
       rs->version_supports_microdesc_cache =
         tor_version_supports_microdescriptors(tok->args[0]);
       rs->version_supports_optimistic_data =



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits