[tor-commits] [tor/master] More fixes to rip out all of the v2 directory code.

nickm at torproject.org nickm at torproject.org
Mon Feb 3 18:36:13 UTC 2014


commit 00ec6e6af0775cd693e12e56eb6df3cbefe57daa
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Thu Jan 30 12:48:49 2014 +0100

    More fixes to rip out all of the v2 directory code.
    
    (This was a squash commit, but I forgot to squash it. Sorry! --Nick)
---
 src/or/config.c      |   23 +++++++++++++----------
 src/or/dirserv.c     |    7 +------
 src/or/or.h          |    2 --
 src/or/routerlist.c  |    8 +++-----
 src/or/routerparse.c |    5 ++---
 src/test/test_dir.c  |    6 ++++--
 6 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 8a2c903..b76243b 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -841,30 +841,30 @@ add_default_trusted_dir_authorities(dirinfo_type_t type)
 {
   int i;
   const char *authorities[] = {
-    "moria1 orport=9101 no-v2 "
+    "moria1 orport=9101 "
       "v3ident=D586D18309DED4CD6D57C18FDB97EFA96D330566 "
       "128.31.0.39:9131 9695 DFC3 5FFE B861 329B 9F1A B04C 4639 7020 CE31",
     "tor26 v1 orport=443 v3ident=14C131DFC5C6F93646BE72FA1401C02A8DF2E8B4 "
       "86.59.21.38:80 847B 1F85 0344 D787 6491 A548 92F9 0493 4E4E B85D",
     "dizum orport=443 v3ident=E8A9C45EDE6D711294FADF8E7951F4DE6CA56B58 "
       "194.109.206.212:80 7EA6 EAD6 FD83 083C 538F 4403 8BBF A077 587D D755",
-    "Tonga orport=443 bridge no-v2 82.94.251.203:80 "
+    "Tonga orport=443 bridge 82.94.251.203:80 "
       "4A0C CD2D DC79 9508 3D73 F5D6 6710 0C8A 5831 F16D",
-    "turtles orport=9090 no-v2 "
+    "turtles orport=9090 "
       "v3ident=27B6B5996C426270A5C95488AA5BCEB6BCC86956 "
       "76.73.17.194:9030 F397 038A DC51 3361 35E7 B80B D99C A384 4360 292B",
-    "gabelmoo orport=443 no-v2 "
+    "gabelmoo orport=443 "
       "v3ident=ED03BB616EB2F60BEC80151114BB25CEF515B226 "
       "212.112.245.170:80 F204 4413 DAC2 E02E 3D6B CF47 35A1 9BCA 1DE9 7281",
-    "dannenberg orport=443 no-v2 "
+    "dannenberg orport=443 "
       "v3ident=585769C78764D58426B8B52B6651A5A71137189A "
       "193.23.244.244:80 7BE6 83E6 5D48 1413 21C5 ED92 F075 C553 64AC 7123",
-    "urras orport=80 no-v2 v3ident=80550987E1D626E3EBA5E5E75A458DE0626D088C "
+    "urras orport=80 v3ident=80550987E1D626E3EBA5E5E75A458DE0626D088C "
       "208.83.223.34:443 0AD3 FA88 4D18 F89E EA2D 89C0 1937 9E0E 7FD9 4417",
-    "maatuska orport=80 no-v2 "
+    "maatuska orport=80 "
       "v3ident=49015F787433103580E3B66A1707A00E60F2D15B "
       "171.25.193.9:443 BD6A 8292 55CB 08E6 6FBE 7D37 4836 3586 E46B 3810",
-    "Faravahar orport=443 no-v2 "
+    "Faravahar orport=443 "
       "v3ident=EFCBE720AB3A82B99F9E953CD5BF50F7EEFC7B97 "
       "154.35.32.5:80 CF6D 0AAF B385 BE71 B8E1 11FC 5CFF 4B47 9237 33BC",
     NULL
@@ -2345,7 +2345,7 @@ ensure_bandwidth_cap(uint64_t *value, const char *desc, char **msg)
 
 /** Parse an authority type from <b>options</b>-\>PublishServerDescriptor
  * and write it to <b>options</b>-\>PublishServerDescriptor_. Treat "1"
- * as "v2,v3" unless BridgeRelay is 1, in which case treat it as "bridge".
+ * as "v3" unless BridgeRelay is 1, in which case treat it as "bridge".
  * Treat "0" as "".
  * Return 0 on success or -1 if not a recognized authority type (in which
  * case the value of PublishServerDescriptor_ is undefined). */
@@ -2598,7 +2598,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
           options->V1AuthoritativeDir ||
           options->V3AuthoritativeDir))
       REJECT("AuthoritativeDir is set, but none of "
-             "(Bridge/HS/V1/V2/V3)AuthoritativeDir is set.");
+             "(Bridge/HS/V1/V3)AuthoritativeDir is set.");
     /* If we have a v3bandwidthsfile and it's broken, complain on startup */
     if (options->V3BandwidthsFile && !old_options) {
       dirserv_read_measured_bandwidths(options->V3BandwidthsFile, NULL);
@@ -5048,6 +5048,9 @@ parse_dir_authority_line(const char *line, dirinfo_type_t required_type,
       is_not_hidserv_authority = 1;
     } else if (!strcasecmp(flag, "bridge")) {
       type |= BRIDGE_DIRINFO;
+    } else if (!strcasecmp(flag, "no-v2")) {
+      /* obsolete, but may still be contained in DirAuthority lines generated
+         by various tools */;
     } else if (!strcasecmpstart(flag, "orport=")) {
       int ok;
       char *portstring = flag + strlen("orport=");
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 80a35c4..c0e000c 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -56,9 +56,6 @@ static time_t the_directory_is_dirty = 1;
 /** Do we need to regenerate the v1 runningrouters document when somebody
  * asks for it? */
 static time_t runningrouters_is_dirty = 1;
-/** Do we need to regenerate our v2 networkstatus document when somebody asks
- * for it? */
-static time_t the_v2_networkstatus_is_dirty = 1;
 
 /** Most recently generated encoded signed v1 directory. (v1 auth dirservers
  * only.) */
@@ -929,8 +926,6 @@ directory_set_dirty(void)
     if (!runningrouters_is_dirty)
       runningrouters_is_dirty = now;
   }
-  if (!the_v2_networkstatus_is_dirty)
-    the_v2_networkstatus_is_dirty = now;
 }
 
 /**
@@ -1477,7 +1472,7 @@ dirserv_clear_old_v1_info(time_t now)
   }
 }
 
-/** Helper: If we're an authority for the right directory version (v1 or v2)
+/** Helper: If we're an authority for the right directory version (v1)
  * (based on <b>auth_type</b>), try to regenerate
  * auth_src as appropriate and return it, falling back to cache_src on
  * failure.  If we're a cache, simply return cache_src.
diff --git a/src/or/or.h b/src/or/or.h
index 29ec320..40fc567 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -4677,8 +4677,6 @@ typedef enum {
   GEOIP_CLIENT_CONNECT = 0,
   /** We've served a networkstatus consensus as a directory server. */
   GEOIP_CLIENT_NETWORKSTATUS = 1,
-  /** We've served a v2 networkstatus consensus as a directory server. */
-  GEOIP_CLIENT_NETWORKSTATUS_V2 = 2,
 } geoip_client_action_t;
 /** Indicates either a positive reply or a reason for rejectng a network
  * status request that will be included in geoip statistics. */
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 159f3ff..164b32d 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3682,11 +3682,9 @@ routerlist_remove_old_routers(void)
           digestset_add(retain, rs->descriptor_digest));
   }
 
-  /* If we have a consensus,
-   * we should consider pruning current routers that are too old and that
-   * nobody recommends.  (If we don't have a consensus or enough v2
-   * networkstatuses, then we should get more before we decide to kill
-   * routers.) */
+  /* If we have a consensus, we should consider pruning current routers that
+   * are too old and that nobody recommends.  (If we don't have a consensus,
+   * then we should get one before we decide to kill routers.) */
 
   if (consensus) {
     cutoff = now - ROUTER_MAX_AGE;
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index ba0bdfb..4ad316c 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -339,7 +339,7 @@ static token_rule_t extrainfo_token_table[] = {
   END_OF_TABLE
 };
 
-/** List of tokens recognized in the body part of v2 and v3 networkstatus
+/** List of tokens recognized in the body part of v3 networkstatus
  * documents. */
 static token_rule_t rtrstatus_token_table[] = {
   T01("p",                   K_P,               CONCAT_ARGS, NO_OBJ ),
@@ -461,8 +461,7 @@ static token_rule_t networkstatus_consensus_token_table[] = {
   END_OF_TABLE
 };
 
-/** List of tokens recognized in the footer of v1/v2 directory/networkstatus
- * footers. */
+/** List of tokens recognized in the footer of v1 directory footers. */
 static token_rule_t networkstatus_vote_footer_token_table[] = {
   T01("directory-footer",    K_DIRECTORY_FOOTER,    NO_ARGS,   NO_OBJ ),
   T01("bandwidth-weights",   K_BW_WEIGHTS,          ARGS,      NO_OBJ ),
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 1df597f..7c625ce 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -1065,7 +1065,8 @@ test_vrs_for_v3ns(vote_routerstatus_t *vrs, int voter, time_t now)
     test_eq(rs->addr, 0x99008801);
     test_eq(rs->or_port, 443);
     test_eq(rs->dir_port, 8000);
-    test_eq(vrs->flags, U64_LITERAL(80)); // no flags except "running"
+    /* no flags except "running" (16) and "v2dir" (64) */
+    test_eq(vrs->flags, U64_LITERAL(80));
   } else if (tor_memeq(rs->identity_digest,
                        "\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5"
                        "\x5\x5\x5\x5",
@@ -1090,7 +1091,8 @@ test_vrs_for_v3ns(vote_routerstatus_t *vrs, int voter, time_t now)
     test_assert(tor_addr_eq(&rs->ipv6_addr, &addr_ipv6));
     test_eq(rs->ipv6_orport, 4711);
     if (voter == 1) {
-      test_eq(vrs->flags, U64_LITERAL(190)); // all except "authority","v2dir"
+      /* all except "authority" (1) and "v2dir" (64) */
+      test_eq(vrs->flags, U64_LITERAL(190));
     } else {
       /* 1023 - authority(1) - madeofcheese(16) - madeoftin(32) - v2dir(256) */
       test_eq(vrs->flags, U64_LITERAL(718));



More information about the tor-commits mailing list