mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Remove MIN_METHOD_FOR and MIN_METHOD_FOR_A_LINES
Also, in networkstatus.c, remove client code for recognizing pre- MIN_METHOD_FOR_A_LINES consensuses, and corresponding unit tests in test_dir.c.
This commit is contained in:
parent
69347f48e0
commit
08373467b1
@ -549,12 +549,12 @@ compute_routerstatus_consensus(smartlist_t *votes, int consensus_method,
|
||||
|
||||
tor_assert(most);
|
||||
|
||||
/* If we're producing "a" lines, vote on potential alternative (sets
|
||||
* of) OR port(s) in the winning routerstatuses.
|
||||
/* Vote on potential alternative (sets of) OR port(s) in the winning
|
||||
* routerstatuses.
|
||||
*
|
||||
* XXX prop186 There's at most one alternative OR port (_the_ IPv6
|
||||
* port) for now. */
|
||||
if (consensus_method >= MIN_METHOD_FOR_A_LINES && best_alt_orport_out) {
|
||||
if (best_alt_orport_out) {
|
||||
smartlist_t *alt_orports = smartlist_new();
|
||||
const tor_addr_port_t *most_alt_orport = NULL;
|
||||
|
||||
@ -1890,10 +1890,8 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
||||
rs_out.published_on = rs->status.published_on;
|
||||
rs_out.dir_port = rs->status.dir_port;
|
||||
rs_out.or_port = rs->status.or_port;
|
||||
if (consensus_method >= MIN_METHOD_FOR_A_LINES) {
|
||||
tor_addr_copy(&rs_out.ipv6_addr, &alt_orport.addr);
|
||||
rs_out.ipv6_orport = alt_orport.port;
|
||||
}
|
||||
tor_addr_copy(&rs_out.ipv6_addr, &alt_orport.addr);
|
||||
rs_out.ipv6_orport = alt_orport.port;
|
||||
rs_out.has_bandwidth = 0;
|
||||
rs_out.has_exitsummary = 0;
|
||||
|
||||
@ -3846,8 +3844,7 @@ dirvote_create_microdescriptor(const routerinfo_t *ri, int consensus_method)
|
||||
|
||||
/* 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 &&
|
||||
consensus_method < MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC &&
|
||||
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));
|
||||
|
@ -61,13 +61,6 @@
|
||||
/** The highest consensus method that we currently support. */
|
||||
#define MAX_SUPPORTED_CONSENSUS_METHOD 28
|
||||
|
||||
/** Lowest consensus method where microdesc consensuses omit any entry
|
||||
* with no microdesc. */
|
||||
#define MIN_METHOD_FOR_MANDATORY_MICRODESC 13
|
||||
|
||||
/** Lowest consensus method that contains "a" lines. */
|
||||
#define MIN_METHOD_FOR_A_LINES 14
|
||||
|
||||
/** Lowest consensus method where microdescs may include a "p6" line. */
|
||||
#define MIN_METHOD_FOR_P6_LINES 15
|
||||
|
||||
|
@ -1528,7 +1528,7 @@ networkstatus_consensus_has_ipv6(const or_options_t* options)
|
||||
return
|
||||
cons->consensus_method >= MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS;
|
||||
} else {
|
||||
return cons->consensus_method >= MIN_METHOD_FOR_A_LINES;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5771,22 +5771,10 @@ test_dir_networkstatus_consensus_has_ipv6(void *arg)
|
||||
/* Test the bounds for A lines in the NS consensus */
|
||||
mock_options->UseMicrodescriptors = 0;
|
||||
|
||||
mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES;
|
||||
mock_networkstatus->consensus_method = MIN_SUPPORTED_CONSENSUS_METHOD;
|
||||
has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
|
||||
tt_assert(has_ipv6);
|
||||
|
||||
mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES + 1;
|
||||
has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
|
||||
tt_assert(has_ipv6);
|
||||
|
||||
mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES + 20;
|
||||
has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
|
||||
tt_assert(has_ipv6);
|
||||
|
||||
mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES - 1;
|
||||
has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
|
||||
tt_assert(!has_ipv6);
|
||||
|
||||
/* Test the bounds for A lines in the microdesc consensus */
|
||||
mock_options->UseMicrodescriptors = 1;
|
||||
|
||||
@ -5795,6 +5783,10 @@ test_dir_networkstatus_consensus_has_ipv6(void *arg)
|
||||
has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
|
||||
tt_assert(has_ipv6);
|
||||
|
||||
mock_networkstatus->consensus_method = MAX_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());
|
||||
|
Loading…
Reference in New Issue
Block a user