]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
New GETINFO consensus/packages to expose package information from consensus
authorNick Mathewson <nickm@torproject.org>
Tue, 27 Jan 2015 21:40:32 +0000 (16:40 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 27 Jan 2015 21:40:32 +0000 (16:40 -0500)
src/or/control.c
src/or/networkstatus.c

index 9ff71c9541b065e55ab6e28e256647286178bf8f..8e2b4625ae358cb3d8f19f52dc98e2551bac348e 100644 (file)
@@ -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."),
index 19c0b21c219d7d09cfe54fb98b2772f1a26160c3..0024b1ffc0553c355024f94899c5fb44eb53aa0f 100644 (file)
@@ -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;
   }