summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsis Lovecruft <isis@torproject.org>2018-05-07 23:59:06 +0000
committerNick Mathewson <nickm@torproject.org>2018-05-22 12:13:41 -0400
commitb681438daf06d8d5b1c67d8c78f1b041f9b1f5b8 (patch)
tree094e2e02c6f291acea1e28d74d8ff509705246b4
parenteb966928428a80c105d33bd60bcae5503a1adeb7 (diff)
downloadtor-b681438daf06d8d5b1c67d8c78f1b041f9b1f5b8.tar.gz
tor-b681438daf06d8d5b1c67d8c78f1b041f9b1f5b8.zip
vote: TROVE-2018-005 Make DirAuths omit misbehaving routers from their vote.
-rw-r--r--src/or/dirserv.c6
-rw-r--r--src/or/protover.c12
-rw-r--r--src/or/protover.h1
3 files changed, 19 insertions, 0 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 95bef9889d..68df1c4676 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -2943,6 +2943,12 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
microdescriptors = smartlist_new();
SMARTLIST_FOREACH_BEGIN(routers, routerinfo_t *, ri) {
+ /* If it has a protover list and contains a protocol name greater than
+ * MAX_PROTOCOL_NAME_LENGTH, skip it. */
+ if (ri->protocol_list &&
+ protover_contains_long_protocol_names(ri->protocol_list)) {
+ continue;
+ }
if (ri->cache_info.published_on >= cutoff) {
routerstatus_t *rs;
vote_routerstatus_t *vrs;
diff --git a/src/or/protover.c b/src/or/protover.c
index 24b3813614..94e6b11c46 100644
--- a/src/or/protover.c
+++ b/src/or/protover.c
@@ -274,6 +274,18 @@ parse_protocol_list(const char *s)
}
/**
+ * Return true if the unparsed protover in <b>s</b> would contain a protocol
+ * name longer than MAX_PROTOCOL_NAME_LENGTH, and false otherwise.
+ */
+bool
+protover_contains_long_protocol_names(const char *s)
+{
+ if (!parse_protocol_list(s))
+ return true;
+ return false;
+}
+
+/**
* Given a protocol type and version number, return true iff we know
* how to speak that protocol.
*/
diff --git a/src/or/protover.h b/src/or/protover.h
index 657977279e..8b2db85d77 100644
--- a/src/or/protover.h
+++ b/src/or/protover.h
@@ -38,6 +38,7 @@ typedef enum protocol_type_t {
PRT_CONS,
} protocol_type_t;
+bool protover_contains_long_protocol_names(const char *s);
int protover_all_supported(const char *s, char **missing);
int protover_is_supported_here(protocol_type_t pr, uint32_t ver);
const char *protover_get_supported_protocols(void);