summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2021-02-12 15:43:48 -0800
committerNeel Chauhan <neel@neelc.org>2021-02-19 10:44:11 -0800
commit88559aca2d9487a9b101bb563b1ddf857a013962 (patch)
tree4ae714bff1fb59a48652048d5c916339543fbcb2 /src/feature
parentb64fe4bf55e57c19bb0ade5fc08d6500ac561019 (diff)
downloadtor-88559aca2d9487a9b101bb563b1ddf857a013962.tar.gz
tor-88559aca2d9487a9b101bb563b1ddf857a013962.zip
Make dirauths vote the Sybil flag when other flags are zeroed out
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/dirauth/dirvote.c10
-rw-r--r--src/feature/dirparse/ns_parse.c2
-rw-r--r--src/feature/nodelist/fmt_routerstatus.c3
-rw-r--r--src/feature/nodelist/routerstatus_st.h1
4 files changed, 12 insertions, 4 deletions
diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c
index 0f62a8bbf5..430589b2ae 100644
--- a/src/feature/dirauth/dirvote.c
+++ b/src/feature/dirauth/dirvote.c
@@ -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
diff --git a/src/feature/dirparse/ns_parse.c b/src/feature/dirparse/ns_parse.c
index 138d248b08..8c5f449b89 100644
--- a/src/feature/dirparse/ns_parse.c
+++ b/src/feature/dirparse/ns_parse.c
@@ -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
diff --git a/src/feature/nodelist/fmt_routerstatus.c b/src/feature/nodelist/fmt_routerstatus.c
index 252b2e61fe..5c1e9309b9 100644
--- a/src/feature/nodelist/fmt_routerstatus.c
+++ b/src/feature/nodelist/fmt_routerstatus.c
@@ -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":"");
diff --git a/src/feature/nodelist/routerstatus_st.h b/src/feature/nodelist/routerstatus_st.h
index 254ba73f7f..ef8687db76 100644
--- a/src/feature/nodelist/routerstatus_st.h
+++ b/src/feature/nodelist/routerstatus_st.h
@@ -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 */