Browse Source

prop272: When voting, include no non-Valid relays in consensus

Implements ticket 20002, and part of proposal 272.
Nick Mathewson 7 years ago
parent
commit
9b9fb63276
3 changed files with 18 additions and 2 deletions
  1. 4 0
      changes/ticket20002
  2. 9 1
      src/or/dirvote.c
  3. 5 1
      src/or/dirvote.h

+ 4 - 0
changes/ticket20002

@@ -0,0 +1,4 @@
+  o Minor features (directory authority):
+    - After voting, if the authorities decide that a relay is not "Valid",
+      they no longer include it in the consensus at all. Closes ticket
+      20002; implements part of proposal 272.

+ 9 - 1
src/or/dirvote.c

@@ -1582,7 +1582,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
       const char *chosen_version;
       const char *chosen_name = NULL;
       int exitsummary_disagreement = 0;
-      int is_named = 0, is_unnamed = 0, is_running = 0;
+      int is_named = 0, is_unnamed = 0, is_running = 0, is_valid = 0;
       int is_guard = 0, is_exit = 0, is_bad_exit = 0;
       int naming_conflict = 0;
       int n_listing = 0;
@@ -1733,6 +1733,8 @@ networkstatus_compute_consensus(smartlist_t *votes,
               is_running = 1;
             else if (!strcmp(fl, "BadExit"))
               is_bad_exit = 1;
+            else if (!strcmp(fl, "Valid"))
+              is_valid = 1;
           }
         }
       } SMARTLIST_FOREACH_END(fl);
@@ -1742,6 +1744,12 @@ networkstatus_compute_consensus(smartlist_t *votes,
       if (!is_running)
         continue;
 
+      /* Starting with consensus method 24, we don't list servers
+       * that are not valid in a consensus.  See Proposal 272 */
+      if (!is_valid &&
+          consensus_method >= MIN_METHOD_FOR_EXCLUDING_INVALID_NODES)
+        continue;
+
       /* Pick the version. */
       if (smartlist_len(versions)) {
         sort_version_list(versions, 0);

+ 5 - 1
src/or/dirvote.h

@@ -55,7 +55,7 @@
 #define MIN_SUPPORTED_CONSENSUS_METHOD 13
 
 /** The highest consensus method that we currently support. */
-#define MAX_SUPPORTED_CONSENSUS_METHOD 23
+#define MAX_SUPPORTED_CONSENSUS_METHOD 24
 
 /** Lowest consensus method where microdesc consensuses omit any entry
  * with no microdesc. */
@@ -99,6 +99,10 @@
  * value(s). */
 #define MIN_METHOD_FOR_SHARED_RANDOM 23
 
+/** Lowest consensus method where authorities drop all nodes that don't get
+ * the Valid flag. */
+#define MIN_METHOD_FOR_EXCLUDING_INVALID_NODES 24
+
 /** Default bandwidth to clip unmeasured bandwidths to using method >=
  * MIN_METHOD_TO_CLIP_UNMEASURED_BW.  (This is not a consensus method; do not
  * get confused with the above macros.) */