Merge remote-tracking branch 'tor-gitlab/mr/306'

This commit is contained in:
George Kadianakis 2021-02-24 12:35:55 +02:00
commit 830b0f8c62
5 changed files with 17 additions and 4 deletions

5
changes/ticket40255 Normal file
View File

@ -0,0 +1,5 @@
o Major features (directory authority, sybil):
- When voting for a relay with a Sybil-like appearance, add the Sybil
flag when clearing out the other flags. This lets a relay operator
know why their relay hasn't been voted on. Closes ticket 40255.
Patch by Neel Chauhan.

View File

@ -4542,13 +4542,16 @@ routers_make_ed_keys_unique(smartlist_t *routers)
} SMARTLIST_FOREACH_END(ri);
}
/** Routerstatus <b>rs</b> is part of a group of routers that are on
* too narrow an IP-space. Clear out its flags since we don't want it be used
/** Routerstatus <b>rs</b> is part of a group of routers that are on too
* narrow an IP-space. Clear out its flags since we don't want it be used
* because of its Sybil-like appearance.
*
* Leave its BadExit flag alone though, since if we think it's a bad exit,
* we want to vote that way in case all the other authorities are voting
* Running and Exit.
*
* Also set the Sybil flag in order to let a relay operator know that's
* why their relay hasn't been voted on.
*/
static void
clear_status_flags_on_sybil(routerstatus_t *rs)
@ -4556,6 +4559,7 @@ clear_status_flags_on_sybil(routerstatus_t *rs)
rs->is_authority = rs->is_exit = rs->is_stable = rs->is_fast =
rs->is_flagged_running = rs->is_named = rs->is_valid =
rs->is_hs_dir = rs->is_v2_dir = rs->is_possible_guard = 0;
rs->is_sybil = 1;
/* FFFF we might want some mechanism to check later on if we
* missed zeroing any flags: it's easy to add a new flag but
* forget to add it to this clause. */
@ -4570,6 +4574,7 @@ const char DIRVOTE_UNIVERSAL_FLAGS[] =
"HSDir "
"Stable "
"StaleDesc "
"Sybil "
"V2Dir "
"Valid";
/** Space-separated list of all flags that we may or may not vote on,
@ -4749,7 +4754,6 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
dirserv_read_measured_bandwidths(options->V3BandwidthsFile,
routerstatuses, bw_file_headers,
bw_file_digest256);
} else {
/*
* No bandwidths file; clear the measured bandwidth cache in case we had

View File

@ -446,6 +446,8 @@ routerstatus_parse_entry_from_string(memarea_t *area,
rs->is_v2_dir = 1;
} else if (!strcmp(tok->args[i], "StaleDesc")) {
rs->is_staledesc = 1;
} else if (!strcmp(tok->args[i], "Sybil")) {
rs->is_sybil = 1;
}
}
/* These are implied true by having been included in a consensus made

View File

@ -87,7 +87,7 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
goto done;
smartlist_add_asprintf(chunks,
"s%s%s%s%s%s%s%s%s%s%s%s\n",
"s%s%s%s%s%s%s%s%s%s%s%s%s\n",
/* These must stay in alphabetical order. */
rs->is_authority?" Authority":"",
rs->is_bad_exit?" BadExit":"",
@ -98,6 +98,7 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
rs->is_flagged_running?" Running":"",
rs->is_stable?" Stable":"",
rs->is_staledesc?" StaleDesc":"",
rs->is_sybil?" Sybil":"",
rs->is_v2_dir?" V2Dir":"",
rs->is_valid?" Valid":"");

View File

@ -58,6 +58,7 @@ struct routerstatus_t {
*/
unsigned int is_staledesc:1; /** True iff the authorities think this router
* should upload a new descriptor soon. */
unsigned int is_sybil:1; /** True iff this router is a sybil. */
unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */