summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-11-10 12:07:57 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-05 19:39:46 -0500
commit743d0b9d91c0c26045aa9a725865870f0c052794 (patch)
tree70988e5bea61695a53546e55eb73085e734b4726 /src/or/control.c
parente7d606900e635719ed0cb5b76343a69ef4a1e43b (diff)
downloadtor-743d0b9d91c0c26045aa9a725865870f0c052794.tar.gz
tor-743d0b9d91c0c26045aa9a725865870f0c052794.zip
hs-v3: Implement HS_DESC REQUESTED event
This changes the control_event_hs_descriptor_requested() call to add the hsdir index optional value. v2 passes NULL all the time. This commit creates hs_control.{c|h} that contains wrappers for the HS subsystem to interact with the control port subsystem. The descriptor REQUESTED event is implemented following proposal 284 extension for v3. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c
index e7ec238170..cd1be5bf4d 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -7175,23 +7175,33 @@ rend_hsaddress_str_or_unknown(const char *onion_address)
* <b>rend_query</b> is used to fetch requested onion address and auth type.
* <b>hs_dir</b> is the description of contacting hs directory.
* <b>desc_id_base32</b> is the ID of requested hs descriptor.
+ * <b>hsdir_index</b> is the HSDir fetch index value for v3, an hex string.
*/
void
control_event_hs_descriptor_requested(const char *onion_address,
rend_auth_type_t auth_type,
const char *id_digest,
- const char *desc_id)
+ const char *desc_id,
+ const char *hsdir_index)
{
+ char *hsdir_index_field = NULL;
+
if (BUG(!id_digest || !desc_id)) {
return;
}
+ if (hsdir_index) {
+ tor_asprintf(&hsdir_index_field, " HSDIR_INDEX=%s", hsdir_index);
+ }
+
send_control_event(EVENT_HS_DESC,
- "650 HS_DESC REQUESTED %s %s %s %s\r\n",
+ "650 HS_DESC REQUESTED %s %s %s %s%s\r\n",
rend_hsaddress_str_or_unknown(onion_address),
rend_auth_type_to_string(auth_type),
node_describe_longname_by_id(id_digest),
- desc_id);
+ desc_id,
+ hsdir_index_field ? hsdir_index_field : "");
+ tor_free(hsdir_index_field);
}
/** For an HS descriptor query <b>rend_data</b>, using the