[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] if we fetch the dir from a mirror that has a wildly skewed



Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or

Modified Files:
	directory.c routerlist.c routerparse.c 
Log Message:
if we fetch the dir from a mirror that has a wildly skewed
clock, then don't bother checking recommended-versions: it will
just make us sad.

as a side effect, people running obsolete versions and whose
clocks are wildly skewed will not be auto-shut-down. but they
will still get warns about their clock skew.


Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- directory.c	29 Jan 2005 11:23:34 -0000	1.205
+++ directory.c	29 Jan 2005 11:48:37 -0000	1.206
@@ -592,6 +592,7 @@
   int delta;
   int compression;
   int plausible;
+  int skewed=0;
 
   switch (fetch_from_buf_http(conn->inbuf,
                               &headers, MAX_HEADERS_SIZE,
@@ -621,6 +622,7 @@
              conn->address,
              abs(delta)/60, delta>0 ? "ahead" : "behind",
              abs(delta)/60, delta>0 ? "behind" : "ahead");
+      skewed = 1; /* don't check the recommended-versions line */
     } else {
       log_fn(LOG_INFO, "Time on received directory is within tolerance; we are %d seconds skewed.  (That's okay.)", delta);
     }
@@ -692,9 +694,8 @@
       tor_free(body); tor_free(headers);
       return -1;
     }
-    /* xxx maybe we can tell router_... here that it was skewed so don't believe it all. */
-    if (router_load_routerlist_from_directory(body, NULL, 1, 0) < 0) {
-      log_fn(LOG_WARN,"I failed to parse the directory I fetched from %s:%d. Ignoring.", conn->address, conn->port);
+    if (router_load_routerlist_from_directory(body, NULL, skewed, 0) < 0) {
+      log_fn(LOG_NOTICE,"I failed to parse the directory I fetched from %s:%d. Ignoring.", conn->address, conn->port);
     } else {
       log_fn(LOG_INFO,"updated routers.");
     }

Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- routerlist.c	20 Jan 2005 20:42:45 -0000	1.208
+++ routerlist.c	29 Jan 2005 11:48:37 -0000	1.209
@@ -843,7 +843,11 @@
  * signed directory <b>s</b>.  If pkey is provided, check the signature against
  * pkey; else check against the pkey of the signing directory server.
  *
- * DOCDOC dir_is_recent/cached
+ * If <b>dir_is_recent</b> is non-zero, then examine the
+ * Recommended-versions line and take appropriate action.
+ *
+ * If <b>dir_is_cached</b> is non-zero, then we're reading it
+ * from the cache so don't bother to re-write it to the cache.
  */
 int router_load_routerlist_from_directory(const char *s,
                                           crypto_pk_env_t *pkey,

Index: routerparse.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerparse.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- routerparse.c	6 Jan 2005 20:11:52 -0000	1.98
+++ routerparse.c	29 Jan 2005 11:48:37 -0000	1.99
@@ -289,10 +289,17 @@
 }
 
 /** Parse a directory from <b>str</b> and, when done, store the
- * resulting routerlist in *<b>dest</b>, freeing the old value if necessary.
+ * resulting routerlist in *<b>dest</b>, freeing the old value if
+ * necessary.
+ *
  * If <b>pkey</b> is provided, we check the directory signature with pkey.
  *
- * DOCDOC check_version, write_to_cache.
+ * If <b>check_version</b> is non-zero, then examine the
+ * Recommended-versions * line in the directory, and warn or quit
+ * as needed.
+ *
+ * If <b>write_to_cache</b> is non-zero, then store this directory in
+ * memory and/or disk as well.
  */
 int /* Should be static; exposed for unit tests */
 router_parse_routerlist_from_directory(const char *str,