diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-09-21 01:03:29 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-09-21 01:03:29 -0400 |
commit | ef5925237d4712c40fb6d69b8de882ab39e6798f (patch) | |
tree | db3ef32cb703879117bea8e354a7c59d99c21b69 /src/or/config.c | |
parent | 5a55662a6b38dd5c70a514bd8cb7e4b2e0df7e97 (diff) | |
download | tor-ef5925237d4712c40fb6d69b8de882ab39e6798f.tar.gz tor-ef5925237d4712c40fb6d69b8de882ab39e6798f.zip |
First cut of code to enable RefuseUnknownExits
The RefuseUnknownExits config option is now a tristate, with "1"
meaning "enable it no matter what the consensus says", "0" meaning
"disable it no matter what the consensus says", and "auto" meaning "do
what the consensus says". If the consensus is silent, we enable
RefuseUnknownExits.
This patch also changes the dirserv logic so that refuseunknownexits
won't make us cache unless we're an exit.
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c index 6b3bcf6da8..30a4d0f297 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -327,7 +327,7 @@ static config_var_t _option_vars[] = { V(RecommendedClientVersions, LINELIST, NULL), V(RecommendedServerVersions, LINELIST, NULL), OBSOLETE("RedirectExit"), - V(RefuseUnknownExits, BOOL, "0"), + V(RefuseUnknownExits, STRING, "auto"), V(RejectPlaintextPorts, CSV, ""), V(RelayBandwidthBurst, MEMUNIT, "0"), V(RelayBandwidthRate, MEMUNIT, "0"), @@ -1228,6 +1228,19 @@ options_act(or_options_t *old_options) if (accounting_is_enabled(options)) configure_accounting(time(NULL)); + /* parse RefuseUnknownExits tristate */ + if (!strcmp(options->RefuseUnknownExits, "0")) + options->RefuseUnknownExits_ = 0; + else if (!strcmp(options->RefuseUnknownExits, "1")) + options->RefuseUnknownExits_ = 1; + else if (!strcmp(options->RefuseUnknownExits, "auto")) + options->RefuseUnknownExits_ = -1; + else { + /* Should have caught this in options_validate */ + return -1; + } + + /* Change the cell EWMA settings */ cell_ewma_set_scale_factor(options, networkstatus_get_latest_consensus()); @@ -2994,6 +3007,12 @@ options_validate(or_options_t *old_options, or_options_t *options, REJECT("Failed to resolve/guess local address. See logs for details."); } + if (strcmp(options->RefuseUnknownExits, "0") && + strcmp(options->RefuseUnknownExits, "1") && + strcmp(options->RefuseUnknownExits, "auto")) { + REJECT("RefuseUnknownExits must be 0, 1, or auto"); + } + #ifndef MS_WINDOWS if (options->RunAsDaemon && torrc_fname && path_is_relative(torrc_fname)) REJECT("Can't use a relative path to torrc when RunAsDaemon is set."); |