summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@torproject.org>2012-08-14 14:03:58 +0200
committerNick Mathewson <nickm@torproject.org>2012-09-04 11:52:22 -0400
commit156ffef2494136d2fa0b1456a1c21cc29cbc3ff0 (patch)
treeff097e88842d0d6acc6532025fcd183b79ed402b /src/or/dirserv.c
parent485b4b7eee3bebf3f783d5d0d5d3c9cd8133f7f7 (diff)
downloadtor-156ffef2494136d2fa0b1456a1c21cc29cbc3ff0.tar.gz
tor-156ffef2494136d2fa0b1456a1c21cc29cbc3ff0.zip
Have directory authorities vote on IPv6 OR ports according to the spec
Define new new consensus method 14 adding "a" lines to vote and consensus documents. From proposal 186: As with other data in the vote derived from the descriptor, the consensus will include whichever set of "a" lines are given by the most authorities who voted for the descriptor digest that will be used for the router. This patch implements this.
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index f4ba02b4ad..5814171c5b 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -2053,7 +2053,7 @@ version_from_platform(const char *platform)
* non-NULL, add a "v" line for the platform. Return 0 on success, -1 on
* failure.
*
- * The format argument has three possible values:
+ * The format argument has one of the following values:
* NS_V2 - Output an entry suitable for a V2 NS opinion document
* NS_V3_CONSENSUS - Output the first portion of a V3 NS consensus entry
* NS_V3_CONSENSUS_MICRODESC - Output the first portion of a V3 microdesc
@@ -2092,17 +2092,18 @@ routerstatus_format_entry(char *buf, size_t buf_len,
log_warn(LD_BUG, "Not enough space in buffer.");
return -1;
}
+ cp = buf + strlen(buf);
/* TODO: Maybe we want to pass in what we need to build the rest of
* this here, instead of in the caller. Then we could use the
* networkstatus_type_t values, with an additional control port value
* added -MP */
- if (format == NS_V3_CONSENSUS || format == NS_V3_CONSENSUS_MICRODESC)
- return 0;
- cp = buf + strlen(buf);
+ /* V3 microdesc consensuses don't have "a" lines. */
+ if (format == NS_V3_CONSENSUS_MICRODESC)
+ return 0;
- /* Possible "a" line, not included in consensus for now. */
+ /* Possible "a" line. At most one for now. */
if (!tor_addr_is_null(&rs->ipv6_addr)) {
const char *addr_str = fmt_and_decorate_addr(&rs->ipv6_addr);
r = tor_snprintf(cp, buf_len - (cp-buf),
@@ -2116,6 +2117,9 @@ routerstatus_format_entry(char *buf, size_t buf_len,
cp += strlen(cp);
}
+ if (format == NS_V3_CONSENSUS)
+ return 0;
+
/* NOTE: Whenever this list expands, be sure to increase MAX_FLAG_LINE_LEN*/
r = tor_snprintf(cp, buf_len - (cp-buf),
"s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",