commit e61f3293e479bb6cadb87026937402a3c440f513
Author: Daniel Cagara <Daniel.Cagara(a)uni-dusseldorf.de>
Date: Tue Apr 5 14:50:32 2011 -0400
Patch from cagara: Add a CountPrivateBandwidth flag
---
src/or/config.c | 8 ++++++++
src/or/connection.c | 5 +++--
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 d853d7b..9d782b9 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 d557776..953f402 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 6d06b85..fb68d44 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