mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Validate address more carefully when checking self-reachability
Previously, we would treat *any* incoming circuit on a non-local
channel as meaning that our ORPort was reachable. With this patch,
we make sure that the address that the peer _says_ we have is the
same as the one we're trying to advertise right now.
Closes 20165. Bugfix on 4f5192b280 in 0.1.0.1-rc, when
reachability self-tests were first introduced.
This commit is contained in:
committed by
George Kadianakis
parent
afd88ee87f
commit
75772ea096
@@ -872,6 +872,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1868,6 +1868,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
|
||||
|
||||
Reference in New Issue
Block a user