mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
metrics: Add connection socket family to metrics
Adds either ipv4 or ipv6 to the "tor_relay_connections_total" stats. Closes #40710 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
@@ -660,7 +660,7 @@ listener_connection_new(int type, int socket_family)
|
||||
connection_init(time(NULL), TO_CONN(listener_conn), type, socket_family);
|
||||
/* Listener connections aren't accounted for with note_connection() so do
|
||||
* this explicitly so to count them. */
|
||||
rep_hist_note_conn_opened(false, type);
|
||||
rep_hist_note_conn_opened(false, type, socket_family);
|
||||
return listener_conn;
|
||||
}
|
||||
|
||||
@@ -1165,7 +1165,8 @@ connection_mark_for_close_internal_, (connection_t *conn,
|
||||
conn->timestamp_last_write_allowed = time(NULL);
|
||||
|
||||
/* Note the connection close. */
|
||||
rep_hist_note_conn_closed(conn->from_listener, conn->type);
|
||||
rep_hist_note_conn_closed(conn->from_listener, conn->type,
|
||||
conn->socket_family);
|
||||
}
|
||||
|
||||
/** Find each connection that has hold_open_until_flushed set to
|
||||
@@ -2013,7 +2014,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);
|
||||
rep_hist_note_conn_rejected(new_type, conn->socket_family);
|
||||
tor_close_socket(news);
|
||||
return 0;
|
||||
}
|
||||
@@ -2023,7 +2024,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);
|
||||
rep_hist_note_conn_rejected(new_type, conn->socket_family);
|
||||
tor_close_socket(news);
|
||||
return 0;
|
||||
}
|
||||
@@ -2032,7 +2033,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);
|
||||
rep_hist_note_conn_rejected(new_type, conn->socket_family);
|
||||
tor_close_socket(news);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user