summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-01-10 15:44:32 -0500
committerNick Mathewson <nickm@torproject.org>2015-01-10 15:44:32 -0500
commitddfdeb5659be17b3e7a4c34b749207bdeae5124a (patch)
treec9f3649051d1b8d03571497d74b3887d28f9fe50
parentc83d83814660b643b705ed7de4aa1fc35e2d20ad (diff)
downloadtor-ddfdeb5659be17b3e7a4c34b749207bdeae5124a.tar.gz
tor-ddfdeb5659be17b3e7a4c34b749207bdeae5124a.zip
More documentation for proposal 227 work
-rw-r--r--doc/tor.1.txt6
-rw-r--r--src/common/container.c5
-rw-r--r--src/or/dirvote.c13
3 files changed, 20 insertions, 4 deletions
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 9e86a67359..9b491f7635 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -1881,6 +1881,12 @@ on the public Tor network.
multiple times: the values from multiple lines are spliced together. When
this is set then **VersioningAuthoritativeDirectory** should be set too.
+[[RecommendedPackageVersions]] **RecommendedPackageVersions** __PACKAGENAME__ __VERSION__ __URL__ __DIGESTTYPE__**=**__DIGEST__ ::
+ Adds "package" line to the directory authority's vote. This information
+ is used to vote on the correct URL and digest for the released versions
+ of different Tor-related packages, so that the consensus can certify
+ them. This line may appear any number of times.
+
[[RecommendedClientVersions]] **RecommendedClientVersions** __STRING__::
STRING is a comma-separated list of Tor versions currently believed to be
safe for clients to use. This information is included in version 2
diff --git a/src/common/container.c b/src/common/container.c
index 68e3711c90..864fd8a552 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -735,7 +735,10 @@ smartlist_get_most_frequent_string(smartlist_t *sl)
return smartlist_get_most_frequent(sl, compare_string_ptrs_);
}
-/** Return the most frequent string in the sorted list <b>sl</b> */
+/** Return the most frequent string in the sorted list <b>sl</b>.
+ * If <b>count_out</b> is provided, set <b>count_out</b> to the
+ * number of times that string appears.
+ */
char *
smartlist_get_most_frequent_string_(smartlist_t *sl, int *count_out)
{
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index c09c4faf7d..7739c52d15 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -1886,13 +1886,18 @@ networkstatus_compute_consensus(smartlist_t *votes,
return result;
}
-/** DOCDOC */
+/** Given a list of networkstatus_t for each vote, return a newly allocated
+ * string containing the "package" lines for the vote. */
STATIC char *
compute_consensus_package_lines(smartlist_t *votes)
{
const int n_votes = smartlist_len(votes);
+
+ /* This will be a map from "packagename version" strings to arrays
+ * of const char *, with the i'th member of the array corresponding to the
+ * package line from the i'th vote.
+ */
strmap_t *package_status = strmap_new();
- smartlist_t *result_list = smartlist_new();
SMARTLIST_FOREACH_BEGIN(votes, networkstatus_t *, v) {
if (! v->package_lines)
@@ -1901,6 +1906,7 @@ compute_consensus_package_lines(smartlist_t *votes)
if (! validate_recommended_package_line(line))
continue;
+ /* Skip 'cp' to the second space in the line. */
const char *cp = strchr(line, ' ');
if (!cp) continue;
++cp;
@@ -1919,7 +1925,8 @@ compute_consensus_package_lines(smartlist_t *votes)
} SMARTLIST_FOREACH_END(line);
} SMARTLIST_FOREACH_END(v);
- smartlist_t *entries = smartlist_new();
+ smartlist_t *entries = smartlist_new(); /* temporary */
+ smartlist_t *result_list = smartlist_new(); /* output */
STRMAP_FOREACH(package_status, key, const char **, values) {
int i, count=-1;
for (i = 0; i < n_votes; ++i) {