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
This commit is contained in:
parent
d07122ba47
commit
07c7f9e9e7
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue