[or-cvs] r11272: revert the recommended-guard-version thing. it did not do wh (tor/trunk/src/or)
arma at seul.org
arma at seul.org
Sat Aug 25 20:34:14 UTC 2007
Author: arma
Date: 2007-08-25 16:34:13 -0400 (Sat, 25 Aug 2007)
New Revision: 11272
Modified:
tor/trunk/src/or/config.c
tor/trunk/src/or/or.h
Log:
revert the recommended-guard-version thing. it did not do what we
want, which is to expire old guards *every* time somebody moves
from an old version to the new one.
also, refine which version numbers count as 'new enough'.
Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c 2007-08-24 14:41:19 UTC (rev 11271)
+++ tor/trunk/src/or/config.c 2007-08-25 20:34:13 UTC (rev 11272)
@@ -304,7 +304,6 @@
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"),
@@ -531,7 +530,6 @@
"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 "
@@ -4336,12 +4334,6 @@
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
@@ -4357,15 +4349,26 @@
(void) from_setconf;
(void) old_state;
- if (state->EntryGuards && 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) {
+ if (entry_guards_parse_state(state, 0, msg)<0)
return -1;
+
+ if (state->EntryGuards && 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.16-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"))) {
+ log_notice(LD_CONFIG, "Detected state file from old version '%s'. "
+ "Choosing new entry guards for you.",
+ state->TorVersion);
+ config_free_lines(state->EntryGuards);
+ state->EntryGuards = NULL;
+ }
+ }
}
return 0;
}
@@ -4524,7 +4527,6 @@
len = strlen(get_version())+8;
global_state->TorVersion = tor_malloc(len);
tor_snprintf(global_state->TorVersion, len, "Tor %s", get_version());
- global_state->GuardVersion = RECOMMENDED_GUARD_VERSION;
state = config_dump(&state_format, global_state, 1, 0);
len = strlen(state)+256;
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-08-24 14:41:19 UTC (rev 11271)
+++ tor/trunk/src/or/or.h 2007-08-25 20:34:13 UTC (rev 11272)
@@ -2123,11 +2123,6 @@
/** A list of Entry Guard-related configuration lines. */
config_line_t *EntryGuards;
- /** What algorithm did we use to select these guards? 0 if we didn't
- * know about the GuardVersion concept when we picked them. We use
- * this to expire and re-pick our guards if Tor knows about a newer
- * version than the state file lists. */
- int GuardVersion;
/** These fields hold information on the history of bandwidth usage for
* servers. The "Ends" fields hold the time when we last updated the
More information about the tor-commits
mailing list