diff options
author | David Fifield <david@bamsoftware.com> | 2012-10-06 21:03:24 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-10-10 22:25:29 -0400 |
commit | 5cbf0f2106e85fe69b6ce0d185d62755c2997220 (patch) | |
tree | f1371f5e2824c0d3ac07ff2e0ddd23f1a8f6dfaf /src | |
parent | 41328c700992433fe3900fcbb78d62340ba197f2 (diff) | |
download | tor-5cbf0f2106e85fe69b6ce0d185d62755c2997220.tar tor-5cbf0f2106e85fe69b6ce0d185d62755c2997220.tar.gz |
Use fmt_and_decorate_addr in TransportProxy statefile entry.
state_transport_line_is_valid calls tor_addr_port_lookup, which expects
brackets around an IPv6 address. Without this, cached transport
addresses can't be parsed later:
[warn] state: Could not parse addrport.
[warn] state: State file seems to be broken.
See #7011.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/statefile.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/statefile.c b/src/or/statefile.c index 499572a07..dd9d10230 100644 --- a/src/or/statefile.c +++ b/src/or/statefile.c @@ -553,7 +553,8 @@ save_transport_to_state(const char *transport, if (transport_line) { /* if transport already exists in state... */ const char *prev_bindaddr = /* get its addrport... */ get_transport_bindaddr(transport_line->value, transport); - tor_asprintf(&transport_addrport, "%s:%d", fmt_addr(addr), (int)port); + tor_asprintf(&transport_addrport, "%s:%d", fmt_and_decorate_addr(addr), + (int)port); /* if transport in state has the same address as this one, life is good */ if (!strcmp(prev_bindaddr, transport_addrport)) { @@ -566,7 +567,7 @@ save_transport_to_state(const char *transport, "address:port"); tor_free(transport_line->value); /* free the old line */ tor_asprintf(&transport_line->value, "%s %s:%d", transport, - fmt_addr(addr), + fmt_and_decorate_addr(addr), (int) port); /* replace old addrport line with new line */ } } else { /* never seen this one before; save it in state for next time */ @@ -585,7 +586,7 @@ save_transport_to_state(const char *transport, *next = line = tor_malloc_zero(sizeof(config_line_t)); line->key = tor_strdup("TransportProxy"); tor_asprintf(&line->value, "%s %s:%d", transport, - fmt_addr(addr), (int) port); + fmt_and_decorate_addr(addr), (int) port); next = &(line->next); } |