aboutsummaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-10-31 13:57:14 -0400
committerDavid Goulet <dgoulet@torproject.org>2019-10-31 13:57:14 -0400
commite85f86bb7b676435b2eb11006f111f6e45b8d252 (patch)
tree9978af1c5da8eee404ad70e206c9bb908e8f6d5a /src/feature
parentff8823d03cef50cb3a78f13a35558288e54c2173 (diff)
downloadtor-e85f86bb7b676435b2eb11006f111f6e45b8d252.tar.gz
tor-e85f86bb7b676435b2eb11006f111f6e45b8d252.zip
dos: Add HS DoS INTRO2 rejected stats in heartbeat
The DoS heartbeat now contains the number of rejected INTRODUCE2 cell that the relay has seen. Closes #31371 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/hs/hs_dos.c7
-rw-r--r--src/feature/hs/hs_dos.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/feature/hs/hs_dos.c b/src/feature/hs/hs_dos.c
index 81041475e8..d36ee97e6b 100644
--- a/src/feature/hs/hs_dos.c
+++ b/src/feature/hs/hs_dos.c
@@ -206,6 +206,13 @@ hs_dos_can_send_intro2(or_circuit_t *s_intro_circ)
return true;
}
+/* Return rolling count of rejected INTRO2. */
+uint64_t
+hs_dos_get_intro2_rejected_count(void)
+{
+ return intro2_rejected_count;
+}
+
/* Initialize the onion service Denial of Service subsystem. */
void
hs_dos_init(void)
diff --git a/src/feature/hs/hs_dos.h b/src/feature/hs/hs_dos.h
index ccf4e27179..b9e39aca4e 100644
--- a/src/feature/hs/hs_dos.h
+++ b/src/feature/hs/hs_dos.h
@@ -24,6 +24,9 @@ void hs_dos_consensus_has_changed(const networkstatus_t *ns);
bool hs_dos_can_send_intro2(or_circuit_t *s_intro_circ);
void hs_dos_setup_default_intro2_defenses(or_circuit_t *circ);
+/* Statistics. */
+uint64_t hs_dos_get_intro2_rejected_count(void);
+
#ifdef HS_DOS_PRIVATE
#ifdef TOR_UNIT_TESTS