aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/connection_edge.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-07-14 14:08:55 -0400
committerNick Mathewson <nickm@torproject.org>2020-07-16 09:02:10 -0400
commitdb21e91f4bda5860dea2d817c1f707f57119abee (patch)
tree87c80d62b2579d3eea5c41143cac8de61ad39e7d /src/core/or/connection_edge.c
parent0ccdf05dc54bf956348b0647414732b6a497d17a (diff)
downloadtor-db21e91f4bda5860dea2d817c1f707f57119abee.tar.gz
tor-db21e91f4bda5860dea2d817c1f707f57119abee.zip
Remove "ADDR_ONLY" mode from channel_get_*_remote_descr.
This mode was only used in one place, and it caused a dangerous mingling of functionality. The method is supposed to _describe_ the peer's address, not give its actual address. We already had a function to get the actual address.
Diffstat (limited to 'src/core/or/connection_edge.c')
-rw-r--r--src/core/or/connection_edge.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index cd4ec8be7b..2798d1bf37 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -3996,10 +3996,13 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
* caller might want to know whether the remote IP address has changed,
* and we might already have corrected base_.addr[ess] for the relay's
* canonical IP address. */
- if (or_circ && or_circ->p_chan)
- address = tor_strdup(channel_get_actual_remote_address(or_circ->p_chan));
- else
+ tor_addr_t chan_addr;
+ if (or_circ && or_circ->p_chan &&
+ channel_get_addr_if_possible(or_circ->p_chan, &chan_addr)) {
+ address = tor_addr_to_str_dup(&chan_addr);
+ } else {
address = tor_strdup("127.0.0.1");
+ }
port = 1; /* XXXX This value is never actually used anywhere, and there
* isn't "really" a connection here. But we
* need to set it to something nonzero. */