aboutsummaryrefslogtreecommitdiff
path: root/src/or/channel.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/channel.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/channel.c')
-rw-r--r--src/or/channel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/channel.c b/src/or/channel.c
index f547aea1b3..fdd3f81e81 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -2583,6 +2583,7 @@ channel_do_open_actions(channel_t *chan)
if (!router_get_by_id_digest(chan->identity_digest)) {
if (channel_get_addr_if_possible(chan, &remote_addr)) {
char *transport_name = NULL;
+ channel_tls_t *tlschan = BASE_CHAN_TO_TLS(chan);
if (chan->get_transport_name(chan, &transport_name) < 0)
transport_name = NULL;
@@ -2590,6 +2591,10 @@ channel_do_open_actions(channel_t *chan)
&remote_addr, transport_name,
now);
tor_free(transport_name);
+ /* Notify the DoS subsystem of a new client. */
+ if (tlschan && tlschan->conn) {
+ dos_new_client_conn(tlschan->conn);
+ }
}
/* Otherwise the underlying transport can't tell us this, so skip it */
}