diff options
author | Roger Dingledine <arma@torproject.org> | 2005-01-12 04:58:23 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-01-12 04:58:23 +0000 |
commit | 84c81e07838f5966f7a949df9b8f7d5bbb72d62e (patch) | |
tree | 9c3f159d592f1a9615fb2608cd23e6921dd54d4f /src/or/config.c | |
parent | 51f47d746e602b4043b054acb733e9e389361c30 (diff) | |
download | tor-84c81e07838f5966f7a949df9b8f7d5bbb72d62e.tar.gz tor-84c81e07838f5966f7a949df9b8f7d5bbb72d62e.zip |
Annotate circuits w/ whether they aim to contain high uptime nodes and/or
high capacity nodes. When building circuits, choose appropriate nodes.
New config option LongLivedPorts to indicate application streams
that will want high uptime circuits.
When attaching a stream to a circuit, pay attention to its requirements.
This means that every single node in an intro rend circuit, not just
the last one, will have a minimum uptime.
Boost the min uptime from an hour to 24 hours.
svn:r3339
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/or/config.c b/src/or/config.c index 4a0e8f4fbf..f1fab0e324 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -53,6 +53,7 @@ static config_abbrev_t config_abbrevs[] = { PLURAL(EntryNode), PLURAL(ExcludeNode), PLURAL(FirewallPort), + PLURAL(LongLivedPort), PLURAL(HiddenServiceNode), PLURAL(HiddenServiceExcludeNode), PLURAL(RendNode), @@ -149,6 +150,7 @@ static config_var_t config_vars[] = { VAR("ORBindAddress", LINELIST, ORBindAddress, NULL), VAR("OutboundBindAddress", STRING, OutboundBindAddress, NULL), VAR("PidFile", STRING, PidFile, NULL), + VAR("LongLivedPorts", CSV, LongLivedPorts, "22,6667"), VAR("PathlenCoinWeight", DOUBLE, PathlenCoinWeight, "0.3"), VAR("RedirectExit", LINELIST, RedirectExit, NULL), OBSOLETE("RouterFile"), @@ -1137,13 +1139,32 @@ config_dump_options(or_options_t *options, int minimal) return result; } +static int +validate_ports_csv(smartlist_t *sl, char *name) { + int i; + int result = 0; + tor_assert(name); + + if(!sl) + return 0; + + SMARTLIST_FOREACH(sl, const char *, cp, + { + i = atoi(cp); + if (i < 1 || i > 65535) { + log(LOG_WARN, "Port '%s' out of range in %s", cp, name); + result=-1; + } + }); + return result; +} + /** Return 0 if every setting in <b>options</b> is reasonable. Else * warn and return -1. Should have no side effects, except for * normalizing the contents of <b>options</b>. */ static int options_validate(or_options_t *options) { - int i; int result = 0; struct config_line_t *cl; addr_policy_t *addr_policy=NULL; @@ -1261,16 +1282,14 @@ options_validate(or_options_t *options) options->_AccountingMaxKB = 0; } - if (options->FirewallPorts) { - SMARTLIST_FOREACH(options->FirewallPorts, const char *, cp, - { - i = atoi(cp); - if (i < 1 || i > 65535) { - log(LOG_WARN, "Port '%s' out of range in FirewallPorts", cp); - result=-1; - } - }); - } + if (validate_ports_csv(options->FirewallPorts, + "FirewallPorts") < 0) + result = -1; + + if (validate_ports_csv(options->LongLivedPorts, + "LongLivedPorts") < 0) + result = -1; + options->_AllowUnverified = 0; if (options->AllowUnverifiedNodes) { SMARTLIST_FOREACH(options->AllowUnverifiedNodes, const char *, cp, { @@ -1287,7 +1306,7 @@ options_validate(or_options_t *options) else { log(LOG_WARN, "Unrecognized value '%s' in AllowUnverifiedNodes", cp); - result=-1; + result = -1; } }); } |