summaryrefslogtreecommitdiff
path: root/src/feature/relay/circuitbuild_relay.h
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-03-18 18:07:14 +1000
committerteor <teor@torproject.org>2020-04-09 10:59:51 +1000
commitc9b674d5110278f98c48f7e36653141bd39416dd (patch)
tree44ce9f59f8816077399854f66409dcb93df8e540 /src/feature/relay/circuitbuild_relay.h
parentf863954f1e4d52fa6b73521e878a7140fe06c257 (diff)
downloadtor-c9b674d5110278f98c48f7e36653141bd39416dd.tar.gz
tor-c9b674d5110278f98c48f7e36653141bd39416dd.zip
relay: Protocol warn when a client gets an extend
circuit_extend() may be called when a client receives an extend cell, even if the relay module is disabled. Log a protocol warning when the relay module is disabled. Part of 33633.
Diffstat (limited to 'src/feature/relay/circuitbuild_relay.h')
-rw-r--r--src/feature/relay/circuitbuild_relay.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/feature/relay/circuitbuild_relay.h b/src/feature/relay/circuitbuild_relay.h
index decc28d3a8..890b40dc20 100644
--- a/src/feature/relay/circuitbuild_relay.h
+++ b/src/feature/relay/circuitbuild_relay.h
@@ -13,6 +13,9 @@
#define TOR_FEATURE_RELAY_CIRCUITBUILD_RELAY_H
#include "lib/cc/torint.h"
+#include "lib/log/log.h"
+
+#include "app/config/config.h"
struct cell_t;
struct created_cell_t;
@@ -20,6 +23,14 @@ struct created_cell_t;
struct circuit_t;
struct or_circuit_t;
+/* Log a protocol warning about getting an extend cell on a client. */
+static inline void
+circuitbuild_warn_client_extend(void)
+{
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "Got an extend cell, but running as a client. Closing.");
+}
+
#ifdef HAVE_MODULE_RELAY
int circuit_extend(struct cell_t *cell, struct circuit_t *circ);
@@ -36,7 +47,7 @@ circuit_extend(struct cell_t *cell, struct circuit_t *circ)
{
(void)cell;
(void)circ;
- tor_assert_nonfatal_unreached();
+ circuitbuild_warn_client_extend();
return -1;
}