summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2020-05-17 16:30:29 -0700
committerGeorge Kadianakis <desnacked@riseup.net>2020-05-27 15:16:39 +0300
commitfd5ea48c27a9ded863c8770cdb73d6e4c548795e (patch)
treeea550c96fa1bf8a32147321736bd5e217670a806
parentdb4815dd8e7477803bc29c89284a7641b20ab5ba (diff)
downloadtor-fd5ea48c27a9ded863c8770cdb73d6e4c548795e.tar.gz
tor-fd5ea48c27a9ded863c8770cdb73d6e4c548795e.zip
Add HS v3 status to the SIGUSR1 dumpstats()
-rw-r--r--src/app/main/main.c1
-rw-r--r--src/feature/hs/hs_service.c44
-rw-r--r--src/feature/hs/hs_service.h2
3 files changed, 47 insertions, 0 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c
index 689bc526ab..c1c5c5ea88 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -414,6 +414,7 @@ dumpstats(int severity)
rep_hist_dump_stats(now,severity);
rend_service_dump_stats(severity);
+ hs_service_dump_stats(severity);
}
#ifdef _WIN32
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index 5b8f661832..ab53d0082c 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -4103,6 +4103,50 @@ hs_service_load_all_keys(void)
return -1;
}
+/** Log the status of introduction points for all version 3 onion services
+ * at log severity <b>severity</b>.
+ */
+void
+hs_service_dump_stats(int severity)
+{
+ origin_circuit_t *circ;
+
+ FOR_EACH_SERVICE_BEGIN(hs) {
+
+ tor_log(severity, LD_GENERAL, "Service configured in %s:",
+ service_escaped_dir(hs));
+ FOR_EACH_DESCRIPTOR_BEGIN(hs, desc) {
+
+ DIGEST256MAP_FOREACH(desc->intro_points.map, key,
+ hs_service_intro_point_t *, ip) {
+ const node_t *intro_node;
+ const char *nickname;
+
+ intro_node = get_node_from_intro_point(ip);
+ if (!intro_node) {
+ tor_log(severity, LD_GENERAL, " Couldn't find intro point, "
+ "skipping");
+ continue;
+ }
+ nickname = node_get_nickname(intro_node);
+ if (!nickname) {
+ continue;
+ }
+
+ circ = hs_circ_service_get_intro_circ(ip);
+ if (!circ) {
+ tor_log(severity, LD_GENERAL, " Intro point at %s: no circuit",
+ nickname);
+ continue;
+ }
+ tor_log(severity, LD_GENERAL, " Intro point %s: circuit is %s",
+ nickname, circuit_state_to_string(circ->base_.state));
+ } DIGEST256MAP_FOREACH_END;
+
+ } FOR_EACH_DESCRIPTOR_END;
+ } FOR_EACH_SERVICE_END;
+}
+
/** Put all service object in the given service list. After this, the caller
* looses ownership of every elements in the list and responsible to free the
* list pointer. */
diff --git a/src/feature/hs/hs_service.h b/src/feature/hs/hs_service.h
index 0f6a2c2358..b5bff5bee5 100644
--- a/src/feature/hs/hs_service.h
+++ b/src/feature/hs/hs_service.h
@@ -373,6 +373,8 @@ void hs_service_upload_desc_to_dir(const char *encoded_desc,
hs_circuit_id_protocol_t
hs_service_exports_circuit_id(const ed25519_public_key_t *pk);
+void hs_service_dump_stats(int severity);
+
#ifdef HS_SERVICE_PRIVATE
#ifdef TOR_UNIT_TESTS