[tor-commits] [tor/master] Remove MIN_METHOD_{FOR_P6_LINES, FOR_NTOR_KEY, TO_CLIP_UNMEASURED_BW}

nickm at torproject.org nickm at torproject.org
Mon Apr 23 00:01:16 UTC 2018


commit 93380db8333609b8613a1e987894c6f1fd8be6aa
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Apr 9 14:51:36 2018 -0400

    Remove MIN_METHOD_{FOR_P6_LINES,FOR_NTOR_KEY,TO_CLIP_UNMEASURED_BW}
    
    Also remove a unit test for pre-MIN_METHOD_FOR_NTOR_KEY consensuses.
---
 src/or/dirvote.c          | 14 +++++---------
 src/or/dirvote.h          | 11 -----------
 src/test/test_microdesc.c | 11 -----------
 3 files changed, 5 insertions(+), 31 deletions(-)

diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 1985d9067..334ebfb7f 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -1601,7 +1601,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
     smartlist_free(dir_sources);
   }
 
-  if (consensus_method >= MIN_METHOD_TO_CLIP_UNMEASURED_BW) {
+  {
     char *max_unmeasured_param = NULL;
     /* XXXX Extract this code into a common function.  Or don't!  see #19011 */
     if (params) {
@@ -1989,8 +1989,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
         rs_out.has_bandwidth = 1;
         rs_out.bw_is_unmeasured = 1;
         rs_out.bandwidth_kb = median_uint32(bandwidths_kb, num_bandwidths);
-        if (consensus_method >= MIN_METHOD_TO_CLIP_UNMEASURED_BW &&
-            n_authorities_measuring_bandwidth > 2) {
+        if (n_authorities_measuring_bandwidth > 2) {
           /* Cap non-measured bandwidths. */
           if (rs_out.bandwidth_kb > max_unmeasured_bw_kb) {
             rs_out.bandwidth_kb = max_unmeasured_bw_kb;
@@ -2130,8 +2129,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
       /*     Now the weight line. */
       if (rs_out.has_bandwidth) {
         char *guardfraction_str = NULL;
-        int unmeasured = rs_out.bw_is_unmeasured &&
-          consensus_method >= MIN_METHOD_TO_CLIP_UNMEASURED_BW;
+        int unmeasured = rs_out.bw_is_unmeasured;
 
         /* If we have guardfraction info, include it in the 'w' line. */
         if (rs_out.has_guardfraction) {
@@ -3833,8 +3831,7 @@ dirvote_create_microdescriptor(const routerinfo_t *ri, int consensus_method)
 
   smartlist_add_asprintf(chunks, "onion-key\n%s", key);
 
-  if (consensus_method >= MIN_METHOD_FOR_NTOR_KEY &&
-      ri->onion_curve25519_pkey) {
+  if (ri->onion_curve25519_pkey) {
     char kbuf[128];
     base64_encode(kbuf, sizeof(kbuf),
                   (const char*)ri->onion_curve25519_pkey->public_key,
@@ -3855,8 +3852,7 @@ dirvote_create_microdescriptor(const routerinfo_t *ri, int consensus_method)
   if (summary && strcmp(summary, "reject 1-65535"))
     smartlist_add_asprintf(chunks, "p %s\n", summary);
 
-  if (consensus_method >= MIN_METHOD_FOR_P6_LINES &&
-      ri->ipv6_exit_policy) {
+  if (ri->ipv6_exit_policy) {
     /* XXXX+++ This doesn't match proposal 208, which says these should
      * be taken unchanged from the routerinfo.  That's bogosity, IMO:
      * the proposal should have said to do this instead.*/
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
index 9c7916a9b..311bc61e1 100644
--- a/src/or/dirvote.h
+++ b/src/or/dirvote.h
@@ -61,17 +61,6 @@
 /** The highest consensus method that we currently support. */
 #define MAX_SUPPORTED_CONSENSUS_METHOD 28
 
-/** Lowest consensus method where microdescs may include a "p6" line. */
-#define MIN_METHOD_FOR_P6_LINES 15
-
-/** Lowest consensus method where microdescs may include an onion-key-ntor
- * line */
-#define MIN_METHOD_FOR_NTOR_KEY 16
-
-/** Lowest consensus method that ensures that authorities output an
- * Unmeasured=1 flag for unmeasured bandwidths */
-#define MIN_METHOD_TO_CLIP_UNMEASURED_BW 17
-
 /** Lowest consensus method where authorities may include an "id" line in
  * microdescriptors. */
 #define MIN_METHOD_FOR_ID_HASH_IN_MD 18
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 59b28f758..c0eced1bb 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -385,15 +385,6 @@ static const char test_ri2[] =
   "cf34GXHv61XReJF3AlzNHFpbrPOYmowmhrTULKyMqow=\n"
   "-----END SIGNATURE-----\n";
 
-static const char test_md_8[] =
-  "onion-key\n"
-  "-----BEGIN RSA PUBLIC KEY-----\n"
-  "MIGJAoGBANBJz8Vldl12aFeSMPLiA4nOetLDN0oxU8bB1SDhO7Uu2zdWYVYAF5J0\n"
-  "st7WvrVy/jA9v/fsezNAPskBanecHRSkdMTpkcgRPMHE7CTGEwIy1Yp1X4bPgDlC\n"
-  "VCnbs5Pcts5HnWEYNK7qHDAUn+IlmjOO+pTUY8uyq+GQVz6H9wFlAgMBAAE=\n"
-  "-----END RSA PUBLIC KEY-----\n"
-  "p reject 25,119,135-139,445,563,1214,4661-4666,6346-6429,6699,6881-6999\n";
-
 static const char test_md_16[] =
   "onion-key\n"
   "-----BEGIN RSA PUBLIC KEY-----\n"
@@ -444,8 +435,6 @@ test_md_generate(void *arg)
 
   ri = router_parse_entry_from_string(test_ri, NULL, 0, 0, NULL, NULL);
   tt_assert(ri);
-  md = dirvote_create_microdescriptor(ri, 8);
-  tt_str_op(md->body, OP_EQ, test_md_8);
 
   /* XXXX test family lines. */
   /* XXXX test method 14 for A lines. */





More information about the tor-commits mailing list