diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-10-07 08:26:04 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-10-07 08:26:04 -0400 |
commit | 701a1936fae48c6887cadd90dbe50ae84a00a29f (patch) | |
tree | e27f1784f683a1c2969272f452cb095613e032f7 /src/core/mainloop | |
parent | a49373844cd3c7047759244a6a5c103304d88a7b (diff) | |
parent | ad7ffa5240c4b3a9b675a12f0705d9cbe0bc8beb (diff) | |
download | tor-701a1936fae48c6887cadd90dbe50ae84a00a29f.tar.gz tor-701a1936fae48c6887cadd90dbe50ae84a00a29f.zip |
Merge branch 'maint-0.3.5' into maint-0.4.3
Diffstat (limited to 'src/core/mainloop')
-rw-r--r-- | src/core/mainloop/connection.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index 268c7a70be..fd8c7e37ab 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -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))) |