summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-12-19 03:11:02 +0000
committerRoger Dingledine <arma@torproject.org>2007-12-19 03:11:02 +0000
commit07c7f9e9e70125aca74e22b5c0bd9546d1b6314a (patch)
tree5a67ef6fb4ccceebd44c8680e412860e842e2eeb
parentd07122ba4741897967d110b10ed8ca0441cc6397 (diff)
downloadtor-07c7f9e9e70125aca74e22b5c0bd9546d1b6314a.tar.gz
tor-07c7f9e9e70125aca74e22b5c0bd9546d1b6314a.zip
When we were reading router descriptors from cache, we were ignoring
the annotations -- including reading in bridge-purpose descriptors as general-purpose descriptors. svn:r12867
-rw-r--r--ChangeLog3
-rw-r--r--src/or/routerlist.c3
-rw-r--r--src/or/routerparse.c17
3 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 361c0aaecd..4c50b4bca0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,9 @@ Changes in version 0.2.0.13-alpha - 2007-12-??
- 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
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index a9a43c9ba3..156285a47f 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2506,7 +2506,8 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
#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)
{
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 696271bc54..afdd9dc158 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -978,6 +978,8 @@ router_parse_list_from_string(const char **s, const char *eos,
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 @@ router_parse_entry_from_string(const char *s, const char *end,
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 @@ router_parse_entry_from_string(const char *s, const char *end,
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_parse_entry_from_string(const char *s, const char *end,
}
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 @@ get_next_token(const char **s, const char *eos, token_rule_t *table)
/** 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,