aboutsummaryrefslogtreecommitdiff
path: root/src/feature/control
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2018-11-23 22:50:55 +0100
committerNick Mathewson <nickm@torproject.org>2018-12-17 16:39:28 -0500
commite3ceaebba25127a1d4a3da16e9128ab52491c080 (patch)
tree4031572e1fe7ff60b4845641a4a3cdc385cbcaed /src/feature/control
parentbfb94dd2ca8e04fb1fe8aba9ad48effbb8b70662 (diff)
downloadtor-e3ceaebba25127a1d4a3da16e9128ab52491c080.tar.gz
tor-e3ceaebba25127a1d4a3da16e9128ab52491c080.zip
Add support for logging messages from pluggable transports.
This patch adds support for the "LOG" protocol message from a pluggable transport. This allows pluggable transport developers to relay log messages from their binary to Tor, which will both emit them as log messages from the Tor process itself, but also pass them on via the control port. See: https://bugs.torproject.org/28180 See: https://bugs.torproject.org/28181 See: https://bugs.torproject.org/28182
Diffstat (limited to 'src/feature/control')
-rw-r--r--src/feature/control/control.c11
-rw-r--r--src/feature/control/control.h5
2 files changed, 15 insertions, 1 deletions
diff --git a/src/feature/control/control.c b/src/feature/control/control.c
index 94679dfd22..b6505a85d6 100644
--- a/src/feature/control/control.c
+++ b/src/feature/control/control.c
@@ -7395,6 +7395,17 @@ control_event_transport_launched(const char *mode, const char *transport_name,
mode, transport_name, fmt_addr(addr), port);
}
+/** A pluggable transport called <b>transport_name</b> has emitted a log
+ * message found in <b>message</b>. */
+void
+control_event_transport_log(const char *transport_name, const char *message)
+{
+ send_control_event(EVENT_TRANSPORT_LOG,
+ "650 TRANSPORT_LOG %s %s\r\n",
+ transport_name,
+ message);
+}
+
/** Convert rendezvous auth type to string for HS_DESC control events
*/
const char *
diff --git a/src/feature/control/control.h b/src/feature/control/control.h
index cd5402d455..eb2b5676ea 100644
--- a/src/feature/control/control.h
+++ b/src/feature/control/control.h
@@ -205,6 +205,8 @@ void control_event_clients_seen(const char *controller_str);
void control_event_transport_launched(const char *mode,
const char *transport_name,
tor_addr_t *addr, uint16_t port);
+void control_event_transport_log(const char *transport_name,
+ const char *message);
const char *rend_auth_type_to_string(rend_auth_type_t auth_type);
MOCK_DECL(const char *, node_describe_longname_by_id,(const char *id_digest));
void control_event_hs_descriptor_requested(const char *onion_address,
@@ -293,7 +295,8 @@ void control_free_all(void);
#define EVENT_HS_DESC 0x0021
#define EVENT_HS_DESC_CONTENT 0x0022
#define EVENT_NETWORK_LIVENESS 0x0023
-#define EVENT_MAX_ 0x0023
+#define EVENT_TRANSPORT_LOG 0x0024
+#define EVENT_MAX_ 0x0024
/* sizeof(control_connection_t.event_mask) in bits, currently a uint64_t */
#define EVENT_CAPACITY_ 0x0040