diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/or/routerlist.c | 3 | ||||
-rw-r--r-- | src/or/routerparse.c | 17 |
2 files changed, 16 insertions, 4 deletions
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, |