diff options
author | George Kadianakis <desnacked@gmail.com> | 2011-07-13 19:06:07 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@gmail.com> | 2011-07-13 19:06:07 +0200 |
commit | 5492de76dde34cb56c5658b6311772281c08c200 (patch) | |
tree | d79fa81821228e50b67353d8381882213b8468a4 /src/or/connection.c | |
parent | 9ba2d0e439e53f8307c808fe26e37b53892a604c (diff) | |
download | tor-5492de76dde34cb56c5658b6311772281c08c200.tar.gz tor-5492de76dde34cb56c5658b6311772281c08c200.zip |
Put some last missing pieces together.
* Add some utility transport functions in circuitbuild.[ch] so that we
can use them from pt.c.
* Make the accounting system consider traffic coming from proxies.
* Make sure that we only fetch bridge descriptors when all the
transports are configured.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 00f25e6b52..5e8f95f522 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -2068,15 +2068,20 @@ retry_all_listeners(smartlist_t *replaced_conns, return retval; } -/** Return 1 if we should apply rate limiting to <b>conn</b>, - * and 0 otherwise. Right now this just checks if it's an internal - * IP address or an internal connection. */ +/** Return 1 if we should apply rate limiting to <b>conn</b>, and 0 + * otherwise. + * Right now this just checks if it's an internal IP address or an + * internal connection. We also check if the connection uses pluggable + * transports, since we should then limit it even if it comes from an + * internal IP address. */ static int connection_is_rate_limited(connection_t *conn) { or_options_t *options = get_options(); if (conn->linked) return 0; /* Internal connection */ + else if (connection_uses_transport(conn)) /* pluggable transport proxy */ + return 1; else if (! options->CountPrivateBandwidth && (tor_addr_family(&conn->addr) == AF_UNSPEC || /* no address */ tor_addr_is_internal(&conn->addr, 0))) @@ -4147,6 +4152,19 @@ get_proxy_addrport(tor_addr_t *addr, uint16_t *port, int *proxy_type, return 0; } +/** Returns true if connection <b>conn</b> is using a pluggable + * transports proxy server. */ +int +connection_uses_transport(connection_t *conn) +{ + const transport_t *transport=NULL; + if (find_transport_by_bridge_addrport(&conn->addr, + conn->port,&transport) == 0) + return 1; + else + return 0; +} + /** Returns the global proxy type used by tor. */ static int get_proxy_type(void) |