[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Remove support for now-obsolete consensus methods before 28.
commit 441a048a3a135a9405f4fb8463fb60a0f11e42d2
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Thu Jan 9 12:41:56 2020 -0500
Remove support for now-obsolete consensus methods before 28.
Closes ticket 32695.
---
changes/ticket32695 | 6 ++++++
src/feature/dirauth/dirvote.c | 18 +++---------------
src/feature/dirauth/dirvote.h | 22 +---------------------
src/feature/nodelist/fmt_routerstatus.c | 8 ++------
src/feature/nodelist/networkstatus.c | 10 +++-------
src/test/test_dir.c | 13 ++++---------
6 files changed, 19 insertions(+), 58 deletions(-)
diff --git a/changes/ticket32695 b/changes/ticket32695
new file mode 100644
index 000000000..2df53144e
--- /dev/null
+++ b/changes/ticket32695
@@ -0,0 +1,6 @@
+ o Removed features:
+ - We no longer support consensus methods before method 28; these
+ methods were only used by authorities running versions of Tor that
+ are now at end-of-life. In effect, this means that clients and
+ relays, and authorities now assume that authorities will be
+ running version 0.3.5.x or later. Closes ticket 32695.
diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c
index 9889170a2..c1d4ff1a7 100644
--- a/src/feature/dirauth/dirvote.c
+++ b/src/feature/dirauth/dirvote.c
@@ -1540,14 +1540,11 @@ networkstatus_compute_consensus(smartlist_t *votes,
consensus_method = MAX_SUPPORTED_CONSENSUS_METHOD;
}
- if (consensus_method >= MIN_METHOD_FOR_INIT_BW_WEIGHTS_ONE) {
+ {
/* It's smarter to initialize these weights to 1, so that later on,
* we can't accidentally divide by zero. */
G = M = E = D = 1;
T = 4;
- } else {
- /* ...but originally, they were set to zero. */
- G = M = E = D = T = 0;
}
/* Compute medians of time-related things, and figure out how many
@@ -2268,8 +2265,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
smartlist_add_strdup(chunks, chosen_version);
}
smartlist_add_strdup(chunks, "\n");
- if (chosen_protocol_list &&
- consensus_method >= MIN_METHOD_FOR_RS_PROTOCOLS) {
+ if (chosen_protocol_list) {
smartlist_add_asprintf(chunks, "pr %s\n", chosen_protocol_list);
}
/* Now the weight line. */
@@ -3805,13 +3801,6 @@ dirvote_create_microdescriptor(const routerinfo_t *ri, int consensus_method)
smartlist_add_asprintf(chunks, "ntor-onion-key %s", kbuf);
}
- /* We originally put a lines in the micrdescriptors, but then we worked out
- * that we needed them in the microdesc consensus. See #20916. */
- if (consensus_method < MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC &&
- !tor_addr_is_null(&ri->ipv6_addr) && ri->ipv6_orport)
- smartlist_add_asprintf(chunks, "a %s\n",
- fmt_addrport(&ri->ipv6_addr, ri->ipv6_orport));
-
if (family) {
if (consensus_method < MIN_METHOD_FOR_CANONICAL_FAMILIES_IN_MICRODESCS) {
smartlist_add_asprintf(chunks, "family %s\n", family);
@@ -3917,8 +3906,7 @@ static const struct consensus_method_range_t {
int low;
int high;
} microdesc_consensus_methods[] = {
- {MIN_SUPPORTED_CONSENSUS_METHOD, MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC - 1},
- {MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC,
+ {MIN_SUPPORTED_CONSENSUS_METHOD,
MIN_METHOD_FOR_CANONICAL_FAMILIES_IN_MICRODESCS - 1},
{MIN_METHOD_FOR_CANONICAL_FAMILIES_IN_MICRODESCS,
MAX_SUPPORTED_CONSENSUS_METHOD},
diff --git a/src/feature/dirauth/dirvote.h b/src/feature/dirauth/dirvote.h
index 063977d02..b614f303d 100644
--- a/src/feature/dirauth/dirvote.h
+++ b/src/feature/dirauth/dirvote.h
@@ -54,31 +54,11 @@
#define ROUTERSTATUS_FORMAT_NO_CONSENSUS_METHOD 0
/** The lowest consensus method that we currently support. */
-#define MIN_SUPPORTED_CONSENSUS_METHOD 25
+#define MIN_SUPPORTED_CONSENSUS_METHOD 28
/** The highest consensus method that we currently support. */
#define MAX_SUPPORTED_CONSENSUS_METHOD 29
-/** Lowest consensus method where authorities vote on required/recommended
- * protocols. */
-#define MIN_METHOD_FOR_RECOMMENDED_PROTOCOLS 25
-
-/** Lowest consensus method where authorities add protocols to routerstatus
- * entries. */
-#define MIN_METHOD_FOR_RS_PROTOCOLS 25
-
-/** Lowest consensus method where authorities initialize bandwidth weights to 1
- * instead of 0. See #14881 */
-#define MIN_METHOD_FOR_INIT_BW_WEIGHTS_ONE 26
-
-/** Lowest consensus method where the microdesc consensus contains relay IPv6
- * addresses. See #23826 and #20916. */
-#define MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS 27
-
-/** Lowest consensus method where microdescriptors do not contain relay IPv6
- * addresses. See #23828 and #20916. */
-#define MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC 28
-
/**
* Lowest consensus method where microdescriptor lines are put in canonical
* form for improved compressibility and ease of storage. See proposal 298.
diff --git a/src/feature/nodelist/fmt_routerstatus.c b/src/feature/nodelist/fmt_routerstatus.c
index 8dde0088d..e9b00939e 100644
--- a/src/feature/nodelist/fmt_routerstatus.c
+++ b/src/feature/nodelist/fmt_routerstatus.c
@@ -50,6 +50,8 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
int consensus_method,
const vote_routerstatus_t *vrs)
{
+ (void) consensus_method;
+
char *summary;
char *result = NULL;
@@ -78,12 +80,6 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
* networkstatus_type_t values, with an additional control port value
* added -MP */
- /* V3 microdesc consensuses only have "a" lines in later consensus methods
- */
- if (format == NS_V3_CONSENSUS_MICRODESC &&
- consensus_method < MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS)
- goto done;
-
/* Possible "a" line. At most one for now. */
if (!tor_addr_is_null(&rs->ipv6_addr)) {
smartlist_add_asprintf(chunks, "a %s\n",
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index 786802047..f88b5e6d6 100644
--- a/src/feature/nodelist/networkstatus.c
+++ b/src/feature/nodelist/networkstatus.c
@@ -1585,6 +1585,7 @@ networkstatus_consensus_is_already_downloading(const char *resource)
int
networkstatus_consensus_has_ipv6(const or_options_t* options)
{
+ (void) options;
const networkstatus_t *cons = networkstatus_get_reasonably_live_consensus(
approx_time(),
usable_consensus_flavor());
@@ -1594,13 +1595,8 @@ networkstatus_consensus_has_ipv6(const or_options_t* options)
return 0;
}
- /* Different flavours of consensus gained IPv6 at different times */
- if (we_use_microdescriptors_for_circuits(options)) {
- return
- cons->consensus_method >= MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS;
- } else {
- return 1;
- }
+ /* All supported consensus methods have IPv6 addresses. */
+ return 1;
}
/** Given two router status entries for the same router identity, return 1 if
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 3a7ba4292..535c7bb69 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -7108,7 +7108,7 @@ test_dir_networkstatus_consensus_has_ipv6(void *arg)
mock_options->UseMicrodescriptors = 1;
mock_networkstatus->consensus_method =
- MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS;
+ MIN_SUPPORTED_CONSENSUS_METHOD;
has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
tt_assert(has_ipv6);
@@ -7117,24 +7117,19 @@ test_dir_networkstatus_consensus_has_ipv6(void *arg)
tt_assert(has_ipv6);
mock_networkstatus->consensus_method =
- MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS + 1;
+ MIN_SUPPORTED_CONSENSUS_METHOD + 1;
has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
tt_assert(has_ipv6);
mock_networkstatus->consensus_method =
- MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS + 20;
+ MIN_SUPPORTED_CONSENSUS_METHOD + 20;
has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
tt_assert(has_ipv6);
- mock_networkstatus->consensus_method =
- MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS - 1;
- has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
- tt_assert(!has_ipv6);
-
/* Test the edge cases */
mock_options->UseMicrodescriptors = 1;
mock_networkstatus->consensus_method =
- MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS;
+ MIN_SUPPORTED_CONSENSUS_METHOD;
/* Reasonably live */
mock_networkstatus->valid_until = approx_time() - 60;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits