Merge branch 'maint-0.3.5' into maint-0.4.3

This commit is contained in:
Nick Mathewson
2020-10-07 08:26:04 -04:00
4 changed files with 20 additions and 1 deletions
+6 -1
View File
@@ -383,8 +383,12 @@ or_connection_new(int type, int socket_family)
connection_or_set_canonical(or_conn, 0);
if (type == CONN_TYPE_EXT_OR)
if (type == CONN_TYPE_EXT_OR) {
/* If we aren't told an address for this connection, we should
* presume it isn't local, and should be rate-limited. */
TO_CONN(or_conn)->always_rate_limit_as_remote = 1;
connection_or_set_ext_or_identifier(or_conn);
}
return or_conn;
}
@@ -3152,6 +3156,7 @@ connection_is_rate_limited(const connection_t *conn)
if (conn->linked)
return 0; /* Internal connection */
else if (! options->CountPrivateBandwidth &&
! conn->always_rate_limit_as_remote &&
(tor_addr_family(&conn->addr) == AF_UNSPEC || /* no address */
tor_addr_family(&conn->addr) == AF_UNIX || /* no address */
tor_addr_is_internal(&conn->addr, 0)))