diff options
author | Roger Dingledine <arma@torproject.org> | 2007-08-24 08:01:47 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-08-24 08:01:47 +0000 |
commit | 9bacf68851b3803a84e76d532aeb3f72d35273fd (patch) | |
tree | 2b80b7588c56583a88a745eec2110aff8036e887 /src/or/config.c | |
parent | fe962c58d3e157bf716302d41158a4ff6dffc42f (diff) | |
download | tor-9bacf68851b3803a84e76d532aeb3f72d35273fd.tar tor-9bacf68851b3803a84e76d532aeb3f72d35273fd.tar.gz |
cleanups on r11258
svn:r11263
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/or/config.c b/src/or/config.c index 5fad240ef..39f4698d0 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -299,10 +299,12 @@ static config_var_t _state_vars[] = { VAR("AccountingExpectedUsage", MEMUNIT, AccountingExpectedUsage, NULL), VAR("AccountingIntervalStart", ISOTIME, AccountingIntervalStart, NULL), VAR("AccountingSecondsActive", INTERVAL, AccountingSecondsActive, NULL), + VAR("EntryGuard", LINELIST_S, EntryGuards, NULL), VAR("EntryGuardDownSince", LINELIST_S, EntryGuards, NULL), VAR("EntryGuardUnlistedSince", LINELIST_S, EntryGuards, NULL), VAR("EntryGuards", LINELIST_V, EntryGuards, NULL), + VAR("GuardVersion", UINT, GuardVersion, "0"), VAR("BWHistoryReadEnds", ISOTIME, BWHistoryReadEnds, NULL), VAR("BWHistoryReadInterval", UINT, BWHistoryReadInterval, "900"), @@ -529,6 +531,8 @@ static config_var_description_t state_description[] = { "The last entry guard has been unreachable since this time." }, { "EntryGuardUnlistedSince", "The last entry guard has been unusable since this time." }, + { "GuardVersion", "Which algorithm did we use to pick these guards?" }, + { "LastRotatedOnionKey", "The last time at which we changed the medium-term private key used for " "building circuits." }, @@ -4332,6 +4336,12 @@ get_or_state_fname(void) return fname; } +/** What's the newest known version for our guard-picking algorithm? + * If the version in the state file is older than this (or if there is + * no version listed in the state file), we want to ignore the guards + * in the state file and pick new ones. */ +#define RECOMMENDED_GUARD_VERSION 1 + /** Return 0 if every setting in <b>state</b> is reasonable, and a * permissible transition from <b>old_state</b>. Else warn and return -1. * Should have no side effects, except for normalizing the contents of @@ -4346,27 +4356,17 @@ or_state_validate(or_state_t *old_state, or_state_t *state, * signature. */ (void) from_setconf; (void) old_state; - if (entry_guards_parse_state(state, 0, msg)<0) { + + if (state->GuardVersion < RECOMMENDED_GUARD_VERSION) { + config_free_lines(state->EntryGuards); + state->EntryGuards = NULL; + log_notice(LD_CONFIG, "Detected state file from old version '%s'. " + "Choosing new entry guards for you.", + state->TorVersion ? state->TorVersion : "unknown"); + state->GuardVersion = RECOMMENDED_GUARD_VERSION; + } else if (entry_guards_parse_state(state, 0, msg)<0) { return -1; } - if (state->TorVersion) { - tor_version_t v; - if (tor_version_parse(state->TorVersion, &v)) { - log_warn(LD_GENERAL, "Can't parse Tor version '%s' from your state " - "file. Proceeding anyway.", state->TorVersion); - } else { /* take action based on v */ - if ((tor_version_as_new_as(state->TorVersion, "0.1.1.10-alpha") && - !tor_version_as_new_as(state->TorVersion, "0.1.2.17-dev")) - || (tor_version_as_new_as(state->TorVersion, "0.2.0.0-alpha") && - !tor_version_as_new_as(state->TorVersion, "0.2.0.6-alpha-dev"))) { - log_notice(LD_CONFIG, "Detected state file from buggy version '%s'. " - "Enabling workaround to choose working entry guards.", - state->TorVersion); - config_free_lines(state->EntryGuards); - state->EntryGuards = NULL; - } - } - } return 0; } |