Add a new consensus method that removes IPv6 address lines from microdescs

Implements #23828.
This commit is contained in:
teor 2017-10-15 12:31:39 -04:00
parent 56dbba3207
commit 67eeee0c71
No known key found for this signature in database
GPG Key ID: 740D9E39025272A2
2 changed files with 11 additions and 2 deletions

View File

@ -3831,7 +3831,10 @@ dirvote_create_microdescriptor(const routerinfo_t *ri, int consensus_method)
smartlist_add_asprintf(chunks, "ntor-onion-key %s", kbuf); 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_A_LINES && if (consensus_method >= MIN_METHOD_FOR_A_LINES &&
consensus_method < MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC &&
!tor_addr_is_null(&ri->ipv6_addr) && ri->ipv6_orport) !tor_addr_is_null(&ri->ipv6_addr) && ri->ipv6_orport)
smartlist_add_asprintf(chunks, "a %s\n", smartlist_add_asprintf(chunks, "a %s\n",
fmt_addrport(&ri->ipv6_addr, ri->ipv6_orport)); fmt_addrport(&ri->ipv6_addr, ri->ipv6_orport));
@ -3940,7 +3943,9 @@ static const struct consensus_method_range_t {
{MIN_METHOD_FOR_P6_LINES, MIN_METHOD_FOR_NTOR_KEY - 1}, {MIN_METHOD_FOR_P6_LINES, MIN_METHOD_FOR_NTOR_KEY - 1},
{MIN_METHOD_FOR_NTOR_KEY, MIN_METHOD_FOR_ID_HASH_IN_MD - 1}, {MIN_METHOD_FOR_NTOR_KEY, MIN_METHOD_FOR_ID_HASH_IN_MD - 1},
{MIN_METHOD_FOR_ID_HASH_IN_MD, MIN_METHOD_FOR_ED25519_ID_IN_MD - 1}, {MIN_METHOD_FOR_ID_HASH_IN_MD, MIN_METHOD_FOR_ED25519_ID_IN_MD - 1},
{MIN_METHOD_FOR_ED25519_ID_IN_MD, MAX_SUPPORTED_CONSENSUS_METHOD}, {MIN_METHOD_FOR_ED25519_ID_IN_MD,
MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC - 1},
{MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC, MAX_SUPPORTED_CONSENSUS_METHOD},
{-1, -1} {-1, -1}
}; };

View File

@ -59,7 +59,7 @@
#define MIN_SUPPORTED_CONSENSUS_METHOD 13 #define MIN_SUPPORTED_CONSENSUS_METHOD 13
/** The highest consensus method that we currently support. */ /** The highest consensus method that we currently support. */
#define MAX_SUPPORTED_CONSENSUS_METHOD 27 #define MAX_SUPPORTED_CONSENSUS_METHOD 28
/** Lowest consensus method where microdesc consensuses omit any entry /** Lowest consensus method where microdesc consensuses omit any entry
* with no microdesc. */ * with no microdesc. */
@ -123,6 +123,10 @@
* addresses. See #23826 and #20916. */ * addresses. See #23826 and #20916. */
#define MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS 27 #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
/** Default bandwidth to clip unmeasured bandwidths to using method >= /** Default bandwidth to clip unmeasured bandwidths to using method >=
* MIN_METHOD_TO_CLIP_UNMEASURED_BW. (This is not a consensus method; do not * MIN_METHOD_TO_CLIP_UNMEASURED_BW. (This is not a consensus method; do not
* get confused with the above macros.) */ * get confused with the above macros.) */