summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-01-27 16:40:32 -0500
committerNick Mathewson <nickm@torproject.org>2015-01-27 16:40:32 -0500
commit9c4328c0384dc5fd84555daddbd54da2d375c4d0 (patch)
treee831c545f5c1ee27717799d580138377b954971f /src
parent1e61b45251bd2895e0448fcf283e4f7e05355f28 (diff)
downloadtor-9c4328c0384dc5fd84555daddbd54da2d375c4d0.tar.gz
tor-9c4328c0384dc5fd84555daddbd54da2d375c4d0.zip
New GETINFO consensus/packages to expose package information from consensus
Diffstat (limited to 'src')
-rw-r--r--src/or/control.c2
-rw-r--r--src/or/networkstatus.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 9ff71c9541..8e2b4625ae 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2165,6 +2165,8 @@ static const getinfo_item_t getinfo_items[] = {
"Brief summary of router status by nickname (v2 directory format)."),
PREFIX("ns/purpose/", networkstatus,
"Brief summary of router status by purpose (v2 directory format)."),
+ PREFIX("consensus/", networkstatus,
+ "Information abour and from the ns consensus."),
ITEM("network-status", dir,
"Brief summary of router status (v1 directory format)"),
ITEM("circuit-status", events, "List of current circuits originating here."),
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 19c0b21c21..0024b1ffc0 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1913,6 +1913,11 @@ getinfo_helper_networkstatus(control_connection_t *conn,
} else if (!strcmpstart(question, "ns/purpose/")) {
*answer = networkstatus_getinfo_by_purpose(question+11, time(NULL));
return *answer ? 0 : -1;
+ } else if (!strcmpstart(question, "consensus/packages")) {
+ const networkstatus_t *ns = networkstatus_get_latest_consensus();
+ if (ns->package_lines)
+ *answer = smartlist_join_strings(ns->package_lines, "\n", 1, NULL);
+ return *answer ? 0 : -1;
} else {
return 0;
}