aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2013-02-09 22:07:22 -0500
committerRoger Dingledine <arma@torproject.org>2013-02-09 22:07:22 -0500
commit74e6a47a808803c985f55b626dff294dbe425043 (patch)
tree9ba39d530438b96f69a04a698ece46b22939862e /src/or/router.c
parent002c860caee374688f9478dfd6a6e2ebddad791f (diff)
downloadtor-74e6a47a808803c985f55b626dff294dbe425043.tar
tor-74e6a47a808803c985f55b626dff294dbe425043.tar.gz
stop setting, or using, router->address
resolves ticket 5528.
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/router.c b/src/or/router.c
index c7932d194..f8678ac57 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1759,7 +1759,6 @@ router_rebuild_descriptor(int force)
ri = tor_malloc_zero(sizeof(routerinfo_t));
ri->cache_info.routerlist_index = -1;
- ri->address = tor_dup_ip(addr);
ri->nickname = tor_strdup(options->Nickname);
ri->addr = addr;
ri->or_port = router_get_advertised_or_port(options);
@@ -2218,6 +2217,7 @@ int
router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
crypto_pk_t *ident_key)
{
+ char *address;
char *onion_pkey; /* Onion key, PEM-encoded. */
char *identity_pkey; /* Identity key, PEM-encoded. */
char digest[DIGEST_LEN];
@@ -2292,6 +2292,8 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
}
}
+ address = tor_dup_ip(router->addr);
+
/* Generate the easy portion of the router descriptor. */
result = tor_snprintf(s, maxlen,
"router %s %s %d 0 %d\n"
@@ -2307,7 +2309,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
"signing-key\n%s"
"%s%s%s%s",
router->nickname,
- router->address,
+ address,
router->or_port,
decide_to_advertise_dirport(options, router->dir_port),
extra_or_address ? extra_or_address : "",
@@ -2328,6 +2330,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
options->HidServDirectoryV2 ? "hidden-service-dir\n" : "",
options->AllowSingleHopExits ? "allow-single-hop-exits\n" : "");
+ tor_free(address);
tor_free(family_line);
tor_free(onion_pkey);
tor_free(identity_pkey);