commit 9b9fb63276c892690d57ce5598e2e577d7e5ad9f Author: Nick Mathewson nickm@torproject.org Date: Fri Aug 26 14:14:34 2016 -0400
prop272: When voting, include no non-Valid relays in consensus
Implements ticket 20002, and part of proposal 272. --- changes/ticket20002 | 4 ++++ src/or/dirvote.c | 10 +++++++++- src/or/dirvote.h | 6 +++++- 3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/changes/ticket20002 b/changes/ticket20002 new file mode 100644 index 0000000..28eaa8d --- /dev/null +++ b/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. diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 9748f4a..ae869c9 100644 --- a/src/or/dirvote.c +++ b/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); diff --git a/src/or/dirvote.h b/src/or/dirvote.h index a1f71ce..06bfe67 100644 --- a/src/or/dirvote.h +++ b/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.) */