aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuitlist.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2024-01-30 10:13:09 -0500
committerDavid Goulet <dgoulet@torproject.org>2024-01-30 10:13:09 -0500
commit5a5ca444c80ee5ef17a5f0b0d94720e82f51209c (patch)
tree2396d70c3034909832f05ef5c6231055b0c6b88b /src/core/or/circuitlist.c
parent9536c0b0f2e1fb65685471b1728e35ffb61c18f5 (diff)
downloadtor-5a5ca444c80ee5ef17a5f0b0d94720e82f51209c.tar.gz
tor-5a5ca444c80ee5ef17a5f0b0d94720e82f51209c.zip
metrics: Add new relay metrics to MetricsPort
This commit adds the total number of DROP cell seen, the total number of DESTROY cell received and the total number of protocol violation that lead to a circuit close. Closes #40816 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core/or/circuitlist.c')
-rw-r--r--src/core/or/circuitlist.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index 643d97b064..8f8ed915fb 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -160,6 +160,10 @@ double cc_stats_circ_close_ss_cwnd_ma = 0;
uint64_t cc_stats_circs_closed = 0;
+/** Total number of circuit protocol violation. This is incremented when the
+ * END_CIRC_REASON_TORPROTOCOL is used to close a circuit. */
+uint64_t circ_n_proto_violation = 0;
+
/********* END VARIABLES ************/
/* Implement circuit handle helpers. */
@@ -2197,6 +2201,10 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, int line,
tor_assert(line);
tor_assert(file);
+ if (reason == END_CIRC_REASON_TORPROTOCOL) {
+ circ_n_proto_violation++;
+ }
+
/* Check whether the circuitpadding subsystem wants to block this close */
if (circpad_marked_circuit_for_padding(circ, reason)) {
return;