aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2018-01-25 16:05:59 -0500
committerDavid Goulet <dgoulet@torproject.org>2018-01-30 09:18:15 -0500
commitc05272783d0164363023ddd4b3ee93c2e12c8911 (patch)
tree3640c136f039852247d4cb8ec6967939512b4680 /src/or/connection.c
parent51fda85c23e5ff2cabbc66ea19b006c4cb04b1e2 (diff)
downloadtor-c05272783d0164363023ddd4b3ee93c2e12c8911.tar.gz
tor-c05272783d0164363023ddd4b3ee93c2e12c8911.zip
dos: Track new and closed OR client connections
Implement a basic connection tracking that counts the number of concurrent connections when they open and close. This commit also adds the circuit creation mitigation data structure that will be needed at later commit to keep track of the circuit rate. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 8b00d637f6..15f489c6b4 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -78,6 +78,7 @@
#include "dirserv.h"
#include "dns.h"
#include "dnsserv.h"
+#include "dos.h"
#include "entrynodes.h"
#include "ext_orport.h"
#include "geoip.h"
@@ -687,6 +688,13 @@ connection_free,(connection_t *conn))
"connection_free");
}
#endif
+
+ /* Notify the circuit creation DoS mitigation subsystem that an OR client
+ * connection has been closed. And only do that if we track it. */
+ if (conn->type == CONN_TYPE_OR) {
+ dos_close_client_conn(TO_OR_CONN(conn));
+ }
+
connection_unregister_events(conn);
connection_free_(conn);
}