diff options
author | Roger Dingledine <arma@torproject.org> | 2006-03-21 23:06:47 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-03-21 23:06:47 +0000 |
commit | f11509e494b3e0b36b02d0f5d7359a12dcb5df97 (patch) | |
tree | 5b6e82b757b1a9dbfc7220954f8489b490320982 /src/or/config.c | |
parent | 8a8a84dd52b32561e2aae185be0d957c0df5285f (diff) | |
download | tor-f11509e494b3e0b36b02d0f5d7359a12dcb5df97.tar tor-f11509e494b3e0b36b02d0f5d7359a12dcb5df97.tar.gz |
when upgrading to newer versions, throw away entry guards
picked by the old wrong algorithms.
svn:r6215
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/or/config.c b/src/or/config.c index 5325876ea..b7aacec2d 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -4018,14 +4018,25 @@ static int or_state_validate(or_state_t *old_state, or_state_t *state, int from_setconf) { const char *err; - tor_version_t v; + if (entry_guards_parse_state(state, 0, &err)<0) { log_warn(LD_GENERAL, "Unable to parse entry nodes: %s", err); return -1; } - if (state->TorVersion && tor_version_parse(state->TorVersion, &v)) { - log_warn(LD_GENERAL, "Can't parse Tor version '%s' from your state file. " - "Proceeding anyway.", state->TorVersion); + 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.1.16-rc-cvs")) { + 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); + } + } } return 0; } @@ -4040,7 +4051,7 @@ or_state_set(or_state_t *new_state) config_free(&state_format, global_state); global_state = new_state; if (entry_guards_parse_state(global_state, 1, &err)<0) - log_warn(LD_GENERAL,"Unparseable helper nodes state: %s",err); + log_warn(LD_GENERAL,"Unparseable guard nodes state: %s",err); if (rep_hist_load_state(global_state, &err)<0) log_warn(LD_GENERAL,"Unparseable bandwidth history state: %s",err); } |