summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-09-30 03:11:13 +0000
committerNick Mathewson <nickm@torproject.org>2006-09-30 03:11:13 +0000
commit723ff1c93df01e7dab8442991bd554c3837296f4 (patch)
treeb2f6843ef0d9106b7fe5af2c7f663ebdc20a9e87 /src/or
parent2cb956d1f58199296962cbe8645100225517b315 (diff)
downloadtor-723ff1c93df01e7dab8442991bd554c3837296f4.tar.gz
tor-723ff1c93df01e7dab8442991bd554c3837296f4.zip
r8800@totoro: nickm | 2006-09-29 23:10:49 -0400
Resolve bug 336: When displaying circuit paths with non-named routers, use their digests, not their nicknames. svn:r8548
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitbuild.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index d9d16d6188..23bcf4e4ad 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -116,20 +116,29 @@ circuit_list_path(origin_circuit_t *circ, int verbose)
circ->build_state->desired_path_len,
circ->_base.state == CIRCUIT_STATE_OPEN ? "" : ", exit ",
circ->_base.state == CIRCUIT_STATE_OPEN ? "" :
- (nickname?nickname:"*unnamed*"));
+ (nickname?nickname:"*unnamed*"));
smartlist_add(elements, tor_strdup(buf));
}
hop = circ->cpath;
do {
- const char *elt;
+ routerinfo_t *ri;
+ char *elt;
if (!hop)
break;
if (!verbose && hop->state != CPATH_STATE_OPEN)
break;
if (!hop->extend_info)
break;
- elt = hop->extend_info->nickname;
+ if ((ri = router_get_by_digest(hop->extend_info->identity_digest)) &&
+ ri->is_named) {
+ elt = tor_strdup(hop->extend_info->nickname);
+ } else {
+ elt = tor_malloc(HEX_DIGEST_LEN+2);
+ elt[0] = '$';
+ base16_encode(elt+1, HEX_DIGEST_LEN+1,
+ hop->extend_info->identity_digest, DIGEST_LEN);
+ }
tor_assert(elt);
if (verbose) {
size_t len = strlen(elt)+2+strlen(states[hop->state])+1;
@@ -137,8 +146,9 @@ circuit_list_path(origin_circuit_t *circ, int verbose)
tor_assert(hop->state <= 2);
tor_snprintf(v,len,"%s(%s)",elt,states[hop->state]);
smartlist_add(elements, v);
+ tor_free(elt);
} else {
- smartlist_add(elements, tor_strdup(elt));
+ smartlist_add(elements, elt);
}
hop = hop->next;
} while (hop != circ->cpath);