Patch from cagara: Add a CountPrivateBandwidth flag

This commit is contained in:
Daniel Cagara 2011-04-05 14:50:32 -04:00 committed by Nick Mathewson
parent 3a9d0b4b9c
commit e61f3293e4
3 changed files with 12 additions and 2 deletions

View File

@ -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.");

View File

@ -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;

View File

@ -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