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

[tor-commits] [tor/master] Remove version_known, and subtly change the meaning of protocols_known



commit 1ab641a70e1f2cc2548abfd03e62e3f8b04825d2
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Sep 22 10:21:13 2016 -0400

    Remove version_known, and subtly change the meaning of protocols_known
---
 src/or/networkstatus.c | 5 +++--
 src/or/or.h            | 8 ++------
 src/or/routerlist.c    | 5 +++--
 src/or/routerparse.c   | 2 +-
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 3299a2c..f113777 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1456,8 +1456,9 @@ routerstatus_has_changed(const routerstatus_t *a, const routerstatus_t *b)
          a->is_valid != b->is_valid ||
          a->is_possible_guard != b->is_possible_guard ||
          a->is_bad_exit != b->is_bad_exit ||
-         a->is_hs_dir != b->is_hs_dir ||
-         a->version_known != b->version_known;
+         a->is_hs_dir != b->is_hs_dir;
+  // XXXX this function needs a huge refactoring; it has gotten out
+  // XXXX of sync with routerstatus_t, and it will do so again.
 }
 
 /** Notify controllers of any router status entries that changed between
diff --git a/src/or/or.h b/src/or/or.h
index befbf71..7c7163f 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2193,12 +2193,8 @@ typedef struct routerstatus_t {
   unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
                              * or it claims to accept tunnelled dir requests.
                              */
-  /** True iff we know version info for this router. (i.e., a "v" entry was
-   * 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 we have a proto line for this router.*/
+  /** True iff we have a proto line for this router, or a versions line
+   * from which we could infer the protocols. */
   unsigned int protocols_known:1;
 
   /** True iff this router has a version or protocol list that allows it to
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 0a03f13..0e637f4 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -5526,7 +5526,8 @@ routerinfo_has_curve25519_onion_key(const routerinfo_t *ri)
 }
 
 /* Is rs running a tor version known to support ntor?
- * If allow_unknown_versions is true, return true if the version is unknown.
+ * If allow_unknown_versions is true, return true if we can't tell
+ * (from a versions line or a protocols line) whether it supports ntor.
  * Otherwise, return false if the version is unknown. */
 int
 routerstatus_version_supports_ntor(const routerstatus_t *rs,
@@ -5536,7 +5537,7 @@ routerstatus_version_supports_ntor(const routerstatus_t *rs,
     return allow_unknown_versions;
   }
 
-  if (!rs->version_known && !rs->protocols_known) {
+  if (!rs->protocols_known) {
     return allow_unknown_versions;
   }
 
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index aecf6a2..d5690c1 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -2914,13 +2914,13 @@ routerstatus_parse_entry_from_string(memarea_t *area,
   }
   if ((tok = find_opt_by_keyword(tokens, K_V))) {
     tor_assert(tok->n_args == 1);
-    rs->version_known = 1;
     if (!strcmpstart(tok->args[0], "Tor ") && !found_protocol_list) {
       /* We only do version checks like this in the case where
        * the version is a "Tor" version, and where there is no
        * list of protocol versions that we should be looking at instead. */
       rs->supports_extend2_cells =
         tor_version_as_new_as(tok->args[0], "0.2.4.8-alpha");
+      rs->protocols_known = 1;
     }
     if (vote_rs) {
       vote_rs->version = tor_strdup(tok->args[0]);



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