aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2018-04-17 08:38:34 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-17 10:44:43 -0400
commit93ff1870ba153332ab695e53d906da6a14a8097c (patch)
treec3755b27a3617e9c977ee036c64430e1d77f9ace /src/or/relay.c
parent9ef4c05df8323850b5894782f435da15810d6189 (diff)
downloadtor-93ff1870ba153332ab695e53d906da6a14a8097c.tar.gz
tor-93ff1870ba153332ab695e53d906da6a14a8097c.zip
heartbeat: Log the number of circuits killed because too many cells
We recently merged a circuit cell queue size safeguard. This commit adds the number of killed circuits that have reached the limit to the DoS heartbeat. It now looks like this: [notice] DoS mitigation since startup: 0 circuits killed with too many cells. 0 circuits rejected, 0 marked addresses. 0 connections closed. 0 single hop clients refused. Second thing that this patch does. It makes tor always print the DoS mitigation heartbeat line (for a relay) even though no DoS mitigation have been enabled. The reason is because we now kill circuits that have too many cells regardless on if it is enabled or not but also it will give the operator a chance to learn what is enabled with the heartbeat instead of suddenly appearing when it is enabled by let say the consensus. Fixes #25824 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 5a3c43e058..b3571d6cdf 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -115,6 +115,9 @@ uint64_t stats_n_relay_cells_relayed = 0;
* hop?
*/
uint64_t stats_n_relay_cells_delivered = 0;
+/** Stats: how many circuits have we closed due to the cell queue limit being
+ * reached (see append_cell_to_circuit_queue()) */
+uint64_t stats_n_circ_max_cell_reached = 0;
/** Used to tell which stream to read from first on a circuit. */
static tor_weak_rng_t stream_choice_rng = TOR_WEAK_RNG_INIT;
@@ -3041,6 +3044,7 @@ append_cell_to_circuit_queue(circuit_t *circ, channel_t *chan,
(exitward) ? "Outbound" : "Inbound", queue->n,
max_circuit_cell_queue_size);
circuit_mark_for_close(circ, END_CIRC_REASON_RESOURCELIMIT);
+ stats_n_circ_max_cell_reached++;
return;
}