diff options
author | David Goulet <dgoulet@torproject.org> | 2022-10-12 09:25:01 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2022-10-12 09:25:19 -0400 |
commit | c8d8fa0d3639058544ffe153c1b83e0ed80bf43a (patch) | |
tree | 9d119551a7f30a0f315ac669b34b4d9f1e392978 /src/core | |
parent | d543db5ac00548496b0d4e65052fb68958100cbf (diff) | |
download | tor-c8d8fa0d3639058544ffe153c1b83e0ed80bf43a.tar.gz tor-c8d8fa0d3639058544ffe153c1b83e0ed80bf43a.zip |
relay: Add number of rejected connections to MetricsPort
Related to #40194
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/mainloop/connection.c | 3 | ||||
-rw-r--r-- | src/core/or/connection_edge.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index c6af478c44..8bb3534b28 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -2013,6 +2013,7 @@ connection_handle_listener_read(connection_t *conn, int new_type) log_notice(LD_APP, "Denying socks connection from untrusted address %s.", fmt_and_decorate_addr(&addr)); + rep_hist_note_conn_rejected(new_type); tor_close_socket(news); return 0; } @@ -2022,6 +2023,7 @@ connection_handle_listener_read(connection_t *conn, int new_type) if (dir_policy_permits_address(&addr) == 0) { log_notice(LD_DIRSERV,"Denying dir connection from address %s.", fmt_and_decorate_addr(&addr)); + rep_hist_note_conn_rejected(new_type); tor_close_socket(news); return 0; } @@ -2030,6 +2032,7 @@ connection_handle_listener_read(connection_t *conn, int new_type) /* Assess with the connection DoS mitigation subsystem if this address * can open a new connection. */ if (dos_conn_addr_get_defense_type(&addr) == DOS_CONN_DEFENSE_CLOSE) { + rep_hist_note_conn_rejected(new_type); tor_close_socket(news); return 0; } diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c index ea4bf00735..7ba7ecc4c5 100644 --- a/src/core/or/connection_edge.c +++ b/src/core/or/connection_edge.c @@ -4206,6 +4206,7 @@ connection_exit_connect(edge_connection_t *edge_conn) log_info(LD_EXIT,"%s failed exit policy%s. Closing.", connection_describe(conn), why_failed_exit_policy); + rep_hist_note_conn_rejected(conn->type); connection_edge_end(edge_conn, END_STREAM_REASON_EXITPOLICY); circuit_detach_stream(circuit_get_by_edge_conn(edge_conn), edge_conn); connection_free(conn); @@ -4233,6 +4234,7 @@ connection_exit_connect(edge_connection_t *edge_conn) nodelist_reentry_contains(&conn->addr, conn->port)) { log_info(LD_EXIT, "%s tried to connect back to a known relay address. " "Closing.", connection_describe(conn)); + rep_hist_note_conn_rejected(conn->type); connection_edge_end(edge_conn, END_STREAM_REASON_CONNECTREFUSED); circuit_detach_stream(circuit_get_by_edge_conn(edge_conn), edge_conn); connection_free(conn); |