aboutsummaryrefslogtreecommitdiff
path: root/src/core/or
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2020-08-25 20:37:04 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2020-08-25 20:37:04 +0300
commitd4f3cfe99a4c3ef3495a8f8848981f9b30cc8a34 (patch)
treef38c8af8720c9be4790466ed030e1ba8bb8867bb /src/core/or
parentcc4e42ee3257d5157172cedb73ed86ba88ca271d (diff)
parent75772ea096e030ecc79f67b1444cac42aaed7449 (diff)
downloadtor-d4f3cfe99a4c3ef3495a8f8848981f9b30cc8a34.tar.gz
tor-d4f3cfe99a4c3ef3495a8f8848981f9b30cc8a34.zip
Merge branch 'mr/113'
Diffstat (limited to 'src/core/or')
-rw-r--r--src/core/or/channel.c2
-rw-r--r--src/core/or/channel.h3
-rw-r--r--src/core/or/channeltls.c7
3 files changed, 12 insertions, 0 deletions
diff --git a/src/core/or/channel.c b/src/core/or/channel.c
index 91f083ec00..d082174dc8 100644
--- a/src/core/or/channel.c
+++ b/src/core/or/channel.c
@@ -871,6 +871,8 @@ channel_init(channel_t *chan)
/* Channel is not in the scheduler heap. */
chan->sched_heap_idx = -1;
+
+ tor_addr_make_unspec(&chan->addr_according_to_peer);
}
/**
diff --git a/src/core/or/channel.h b/src/core/or/channel.h
index 10b80aa7d5..606b0730b8 100644
--- a/src/core/or/channel.h
+++ b/src/core/or/channel.h
@@ -236,6 +236,9 @@ struct channel_t {
/** The handle to this channel (to free on canceled timers) */
struct channel_handle_t *timer_handle;
+ /** If not UNSPEC, the address that the peer says we have. */
+ tor_addr_t addr_according_to_peer;
+
/**
* These two fields specify the minimum and maximum negotiated timeout
* values for inactivity (send or receive) before we decide to pad a
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index 51b772728e..a0debf8d22 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -1856,6 +1856,13 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
}
}
+ if (me) {
+ /* We have a descriptor, so we are a relay: record the address that the
+ * other side said we had. */
+ tor_addr_copy(&TLS_CHAN_TO_BASE(chan)->addr_according_to_peer,
+ &my_apparent_addr);
+ }
+
n_other_addrs = netinfo_cell_get_n_my_addrs(netinfo_cell);
for (uint8_t i = 0; i < n_other_addrs; i++) {
/* Consider all the other addresses; if any matches, this connection is