mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Remove MIN_METHOD_FOR_{SHARED_RANDOM,EXCLUDING_INVALID_NODES}
Also remove client detection for pre-EXCLUDING_INVALID_NODES consensuses, and a test for that detection.
This commit is contained in:
parent
73c9c16faa
commit
5f90d28c01
@ -1524,7 +1524,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
|||||||
smartlist_add_strdup(chunks, "\n");
|
smartlist_add_strdup(chunks, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consensus_method >= MIN_METHOD_FOR_SHARED_RANDOM) {
|
{
|
||||||
int num_dirauth = get_n_authorities(V3_DIRINFO);
|
int num_dirauth = get_n_authorities(V3_DIRINFO);
|
||||||
/* Default value of this is 2/3 of the total number of authorities. For
|
/* Default value of this is 2/3 of the total number of authorities. For
|
||||||
* instance, if we have 9 dirauth, the default value is 6. The following
|
* instance, if we have 9 dirauth, the default value is 6. The following
|
||||||
@ -1935,8 +1935,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
|||||||
|
|
||||||
/* Starting with consensus method 24, we don't list servers
|
/* Starting with consensus method 24, we don't list servers
|
||||||
* that are not valid in a consensus. See Proposal 272 */
|
* that are not valid in a consensus. See Proposal 272 */
|
||||||
if (!is_valid &&
|
if (!is_valid)
|
||||||
consensus_method >= MIN_METHOD_FOR_EXCLUDING_INVALID_NODES)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Pick the version. */
|
/* Pick the version. */
|
||||||
|
@ -61,14 +61,6 @@
|
|||||||
/** The highest consensus method that we currently support. */
|
/** The highest consensus method that we currently support. */
|
||||||
#define MAX_SUPPORTED_CONSENSUS_METHOD 28
|
#define MAX_SUPPORTED_CONSENSUS_METHOD 28
|
||||||
|
|
||||||
/** Lowest consensus method where authorities may include a shared random
|
|
||||||
* 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
|
|
||||||
|
|
||||||
/** Lowest consensus method where authorities vote on required/recommended
|
/** Lowest consensus method where authorities vote on required/recommended
|
||||||
* protocols. */
|
* protocols. */
|
||||||
#define MIN_METHOD_FOR_RECOMMENDED_PROTOCOLS 25
|
#define MIN_METHOD_FOR_RECOMMENDED_PROTOCOLS 25
|
||||||
|
@ -2743,8 +2743,7 @@ routerstatus_parse_entry_from_string(memarea_t *area,
|
|||||||
/* These are implied true by having been included in a consensus made
|
/* These are implied true by having been included in a consensus made
|
||||||
* with a given method */
|
* with a given method */
|
||||||
rs->is_flagged_running = 1; /* Starting with consensus method 4. */
|
rs->is_flagged_running = 1; /* Starting with consensus method 4. */
|
||||||
if (consensus_method >= MIN_METHOD_FOR_EXCLUDING_INVALID_NODES)
|
rs->is_valid = 1; /* Starting with consensus method 24. */
|
||||||
rs->is_valid = 1;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const char *protocols = NULL, *version = NULL;
|
const char *protocols = NULL, *version = NULL;
|
||||||
|
@ -5617,9 +5617,8 @@ test_dir_assumed_flags(void *arg)
|
|||||||
memarea_t *area = memarea_new();
|
memarea_t *area = memarea_new();
|
||||||
routerstatus_t *rs = NULL;
|
routerstatus_t *rs = NULL;
|
||||||
|
|
||||||
/* First, we should always assume that the Running flag is set, even
|
/* We can assume that consensus method is higher than 24, so Running and
|
||||||
* when it isn't listed, since the consensus method is always
|
* Valid are always implicitly set */
|
||||||
* higher than 4. */
|
|
||||||
const char *str1 =
|
const char *str1 =
|
||||||
"r example hereiswhereyouridentitygoes 2015-08-30 12:00:00 "
|
"r example hereiswhereyouridentitygoes 2015-08-30 12:00:00 "
|
||||||
"192.168.0.1 9001 0\n"
|
"192.168.0.1 9001 0\n"
|
||||||
@ -5627,17 +5626,6 @@ test_dir_assumed_flags(void *arg)
|
|||||||
"s Fast Guard Stable\n";
|
"s Fast Guard Stable\n";
|
||||||
|
|
||||||
const char *cp = str1;
|
const char *cp = str1;
|
||||||
rs = routerstatus_parse_entry_from_string(area, &cp, tokens, NULL, NULL,
|
|
||||||
23, FLAV_MICRODESC);
|
|
||||||
tt_assert(rs);
|
|
||||||
tt_assert(rs->is_flagged_running);
|
|
||||||
tt_assert(! rs->is_valid);
|
|
||||||
tt_assert(! rs->is_exit);
|
|
||||||
tt_assert(rs->is_fast);
|
|
||||||
routerstatus_free(rs);
|
|
||||||
|
|
||||||
/* With method 24 or later, we can assume "valid" is set. */
|
|
||||||
cp = str1;
|
|
||||||
rs = routerstatus_parse_entry_from_string(area, &cp, tokens, NULL, NULL,
|
rs = routerstatus_parse_entry_from_string(area, &cp, tokens, NULL, NULL,
|
||||||
24, FLAV_MICRODESC);
|
24, FLAV_MICRODESC);
|
||||||
tt_assert(rs);
|
tt_assert(rs);
|
||||||
|
Loading…
Reference in New Issue
Block a user