diff options
author | Daniel Cagara <Daniel.Cagara@uni-dusseldorf.de> | 2011-04-05 14:50:32 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-04-05 16:24:01 -0400 |
commit | e61f3293e479bb6cadb87026937402a3c440f513 (patch) | |
tree | fc8882c3381705116eb4652ead35d1a2bae5e4d0 /src/or | |
parent | 3a9d0b4b9c0460c73c67fa5e6a64711a95df1b91 (diff) | |
download | tor-e61f3293e479bb6cadb87026937402a3c440f513.tar.gz tor-e61f3293e479bb6cadb87026937402a3c440f513.zip |
Patch from cagara: Add a CountPrivateBandwidth flag
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/config.c | 8 | ||||
-rw-r--r-- | src/or/connection.c | 5 | ||||
-rw-r--r-- | src/or/or.h | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c index d853d7b7d0..9d782b9f8e 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -211,6 +211,7 @@ static config_var_t _option_vars[] = { V(CookieAuthentication, BOOL, "0"), V(CookieAuthFileGroupReadable, BOOL, "0"), V(CookieAuthFile, STRING, NULL), + V(CountPrivateBandwidth, BOOL, "0"), V(DataDirectory, FILENAME, NULL), OBSOLETE("DebugLogFile"), V(DirAllowPrivateAddresses, BOOL, NULL), @@ -418,6 +419,7 @@ static config_var_t testing_tor_network_defaults[] = { V(AuthDirMaxServersPerAuthAddr,UINT, "0"), V(ClientDNSRejectInternalAddresses, BOOL,"0"), V(ClientRejectInternalAddresses, BOOL, "0"), + V(CountPrivateBandwidth, BOOL, "1"), V(ExitPolicyRejectPrivate, BOOL, "0"), V(V3AuthVotingInterval, INTERVAL, "5 minutes"), V(V3AuthVoteDelay, INTERVAL, "20 seconds"), @@ -429,6 +431,7 @@ static config_var_t testing_tor_network_defaults[] = { V(TestingEstimatedDescriptorPropagationTime, INTERVAL, "0 minutes"), V(MinUptimeHidServDirectoryV2, INTERVAL, "0 minutes"), V(_UsingTestNetworkDefaults, BOOL, "1"), + { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL } }; #undef VAR @@ -2955,6 +2958,11 @@ options_validate(or_options_t *old_options, or_options_t *options, tor_assert(msg); *msg = NULL; + // Cagara: Tell us if we use the private network fix! + if(options->CountPrivateBandwidth == 1) { + log_notice(LD_CONFIG, "Private bandwidth will be treated as normal traffic."); + } + if (options->ORPort < 0 || options->ORPort > 65535) REJECT("ORPort option out of bounds."); diff --git a/src/or/connection.c b/src/or/connection.c index d5577765e7..953f402317 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1953,9 +1953,10 @@ retry_all_listeners(smartlist_t *replaced_conns, static int connection_is_rate_limited(connection_t *conn) { + or_options_t *options = get_options(); if (conn->linked || /* internal connection */ - tor_addr_family(&conn->addr) == AF_UNSPEC || /* no address */ - tor_addr_is_internal(&conn->addr, 0)) /* internal address */ + (options->CountPrivateBandwidth==1 && ( tor_addr_family(&conn->addr) == AF_UNSPEC || /* no address */ + tor_addr_is_internal(&conn->addr, 0)))) /* internal address */ return 0; else return 1; diff --git a/src/or/or.h b/src/or/or.h index 6d06b85e98..fb68d4482b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2868,6 +2868,7 @@ typedef struct { /** Boolean: if set, we start even if our resolv.conf file is missing * or broken. */ int ServerDNSAllowBrokenConfig; + int CountPrivateBandwidth; // Cagara: Flag to allow private addresses counting to bucket size smartlist_t *ServerDNSTestAddresses; /**< A list of addresses that definitely * should be resolvable. Used for |