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

[or-cvs] r12867: When we were reading router descriptors from cache, we were (in tor/trunk: . src/or)



Author: arma
Date: 2007-12-18 22:11:02 -0500 (Tue, 18 Dec 2007)
New Revision: 12867

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/routerlist.c
   tor/trunk/src/or/routerparse.c
Log:
When we were reading router descriptors from cache, we were ignoring
the annotations -- including reading in bridge-purpose descriptors
as general-purpose descriptors.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-12-19 00:04:50 UTC (rev 12866)
+++ tor/trunk/ChangeLog	2007-12-19 03:11:02 UTC (rev 12867)
@@ -23,6 +23,9 @@
     - Relays were publishing their server descriptor to v1 and v2
       directory authorities, but they didn't try publishing to v3-only
       authorities. Fix this; and also stop publishing to v1 authorities.
+    - When we were reading router descriptors from cache, we were ignoring
+      the annotations -- including reading in bridge-purpose descriptors
+      as general-purpose descriptors.
 
   o Major features:
     - Bridges now behave like clients with respect to time intervals for

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-12-19 00:04:50 UTC (rev 12866)
+++ tor/trunk/src/or/routerlist.c	2007-12-19 03:11:02 UTC (rev 12867)
@@ -2506,7 +2506,8 @@
 #endif
 }
 
-/** DOCDOC */
+/** DOCDOC -NM */
+/* XXX020 why are we dropping all router annotations here? -RD */
 static routerinfo_t *
 routerlist_reparse_old(routerlist_t *rl, signed_descriptor_t *sd)
 {

Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c	2007-12-19 00:04:50 UTC (rev 12866)
+++ tor/trunk/src/or/routerparse.c	2007-12-19 03:11:02 UTC (rev 12867)
@@ -978,6 +978,8 @@
                                               allow_annotations,
                                               prepend_annotations);
       if (router) {
+        log_debug(LD_DIR, "Read router '%s', purpose '%s'",
+                  router->nickname, router_purpose_to_string(router->purpose));
         signed_desc = &router->cache_info;
         elt = router;
       }
@@ -1063,7 +1065,7 @@
   if (prepend_annotations) {
     if (tokenize_string(prepend_annotations,NULL,tokens,
                         routerdesc_token_table,TS_NOCHECK)) {
-      log_warn(LD_DIR, "Error tokenizing router descriptor.");
+      log_warn(LD_DIR, "Error tokenizing router descriptor (annotations).");
       goto err;
     }
   }
@@ -1079,6 +1081,14 @@
     s = cp+1;
   }
 
+  if (allow_annotations && start_of_annotations != s) {
+    if (tokenize_string(start_of_annotations,s,tokens,
+                        routerdesc_token_table,TS_NOCHECK)) {
+      log_warn(LD_DIR, "Error tokenizing router descriptor (annotations).");
+      goto err;
+    }
+  }
+
   if (router_get_router_hash(s, digest) < 0) {
     log_warn(LD_DIR, "Couldn't compute router hash.");
     return NULL;
@@ -1130,7 +1140,7 @@
   }
   router->address = tor_strdup(tok->args[1]);
   if (!tor_inet_aton(router->address, &in)) {
-    log_warn(LD_DIR,"Router address is not an IP.");
+    log_warn(LD_DIR,"Router address is not an IP address.");
     goto err;
   }
   router->addr = ntohl(in.s_addr);
@@ -2798,7 +2808,8 @@
 
 /** Read all tokens from a string between <b>start</b> and <b>end</b>, and add
  * them to <b>out</b>.  Parse according to the token rules in <b>table</b>.
- * Caller must free tokens in <b>out</b>.
+ * Caller must free tokens in <b>out</b>.  If <b>end</b> is NULL, use the
+ * entire string.
  */
 static int
 tokenize_string(const char *start, const char *end, smartlist_t *out,