aboutsummaryrefslogtreecommitdiff
path: root/src/core/mainloop
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2020-08-03 16:48:52 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2020-08-03 16:48:52 +0300
commit18d2c7c5d7eb0441d891fb7642fbbabde6c53cf2 (patch)
tree22d88e323dc8ae5d29456f5d2a244c306a6500ac /src/core/mainloop
parent4c22050de14244418b1b3dbce124544e7fb40e4a (diff)
parentceb6585a4bc2beadde2fb194395711e72ee8559d (diff)
downloadtor-18d2c7c5d7eb0441d891fb7642fbbabde6c53cf2.tar.gz
tor-18d2c7c5d7eb0441d891fb7642fbbabde6c53cf2.zip
Merge remote-tracking branch 'tor-gitlab/mr/79' into maint-0.4.4
Diffstat (limited to 'src/core/mainloop')
-rw-r--r--src/core/mainloop/connection.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 792cdbf686..36adc43d1e 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -384,8 +384,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;
}
@@ -3146,6 +3150,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)))