Browse Source

Update prop264 implementation to split HSMid->HS{Intro,Rend}

Nick Mathewson 7 years ago
parent
commit
4cbfee14d4
3 changed files with 23 additions and 13 deletions
  1. 8 8
      src/or/dirserv.c
  2. 13 4
      src/or/protover.c
  3. 2 1
      src/or/protover.h

+ 8 - 8
src/or/dirserv.c

@@ -2922,17 +2922,17 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
 
   /* These are hardwired, to avoid disaster. */
   v3_out->recommended_relay_protocols =
-    tor_strdup("Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSMid=1 Link=4 "
-               "LinkAuth=1 Microdesc=1-2 Relay=2");
+    tor_strdup("Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSIntro=3 HSRend=1 "
+               "Link=4 LinkAuth=1 Microdesc=1-2 Relay=2");
   v3_out->recommended_client_protocols =
-    tor_strdup("Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSMid=1 Link=4 "
-               "LinkAuth=1 Microdesc=1-2 Relay=2");
+    tor_strdup("Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSIntro=3 HSRend=1 "
+               "Link=4 LinkAuth=1 Microdesc=1-2 Relay=2");
   v3_out->required_client_protocols =
-    tor_strdup("Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSMid=1 Link=4 "
-               "LinkAuth=1 Microdesc=1-2 Relay=2");
+    tor_strdup("Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSIntro=3 HSRend=1 "
+               "Link=4 LinkAuth=1 Microdesc=1-2 Relay=2");
   v3_out->required_relay_protocols =
-    tor_strdup("Cons=1 Desc=1 DirCache=1 HSDir=1 HSMid=1 Link=3-4 "
-               "LinkAuth=1 Microdesc=1 Relay=1-2");
+    tor_strdup("Cons=1 Desc=1 DirCache=1 HSDir=1 HSIntro=3 HSRend=1 "
+               "Link=3-4 LinkAuth=1 Microdesc=1 Relay=1-2");
 
   v3_out->package_lines = smartlist_new();
   {

+ 13 - 4
src/or/protover.c

@@ -17,9 +17,10 @@ static const struct {
   { PRT_LINK, "Link" },
   { PRT_LINKAUTH, "LinkAuth" },
   { PRT_RELAY, "Relay" },
-  { PRT_HSMID, "HSMid" },
   { PRT_DIRCACHE, "DirCache" },
   { PRT_HSDIR, "HSDir" },
+  { PRT_HSINTRO, "HSIntro" },
+  { PRT_HSREND, "HSRend" },
   { PRT_DESC, "Desc" },
   { PRT_MICRODESC, "Microdesc"},
   { PRT_CONS, "Cons" }
@@ -267,7 +268,8 @@ protover_get_supported_protocols(void)
     "Desc=1-2 "
     "DirCache=1 "
     "HSDir=1 "
-    "HSMid=1 "
+    "HSIntro=3 "
+    "HSRend=1-2 "
     "Link=1-4 "
     "LinkAuth=1 "
     "Microdesc=1-2 "
@@ -673,16 +675,23 @@ protover_compute_for_old_tor(const char *version)
   if (tor_version_as_new_as(version,
                             FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS)) {
     return "";
+  } else if (tor_version_as_new_as(version, "0.2.7.5")) {
+    /* 0.2.9.1-alpha HSRend=2 */
+    return "Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSIntro=3 HSRend=1-2 "
+      "Link=1-4 LinkAuth=1 "
+      "Microdesc=1-2 Relay=1-2";
   } else if (tor_version_as_new_as(version, "0.2.7.5")) {
     /* 0.2.7-stable added Desc=2, Microdesc=2, Cons=2, which indicate
      * ed25519 support.  We'll call them present only in "stable" 027,
      * though. */
-    return "Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSMid=1 Link=1-4 LinkAuth=1 "
+    return "Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSIntro=3 HSRend=1 "
+      "Link=1-4 LinkAuth=1 "
       "Microdesc=1-2 Relay=1-2";
   } else if (tor_version_as_new_as(version, "0.2.4.19")) {
     /* No currently supported Tor server versions are older than this, or
      * lack these protocols. */
-    return "Cons=1 Desc=1 DirCache=1 HSDir=1 HSMid=1 Link=1-4 LinkAuth=1 "
+    return "Cons=1 Desc=1 DirCache=1 HSDir=1 HSIntro=3 HSRend=1 "
+      "Link=1-4 LinkAuth=1 "
       "Microdesc=1 Relay=1-2";
   } else {
     /* Cannot infer protocols. */

+ 2 - 1
src/or/protover.h

@@ -15,9 +15,10 @@ typedef enum protocol_type_t {
   PRT_LINK,
   PRT_LINKAUTH,
   PRT_RELAY,
-  PRT_HSMID,
   PRT_DIRCACHE,
   PRT_HSDIR,
+  PRT_HSINTRO,
+  PRT_HSREND,
   PRT_DESC,
   PRT_MICRODESC,
   PRT_CONS,