Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug21065 035 #2053

Open
wants to merge 2 commits into
base: maint-0.3.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changes/bug20165
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
o Minor bugfixes (self-testing):
- Relays now only mark their OR ports as reachable when they get
a circuit on an incoming connection _to the right address_. Previously,
any incoming connection would make the port count as reachable.
Fixes bug 20165; bugfix on 0.1.0.1-rc.
12 changes: 10 additions & 2 deletions src/core/or/channeltls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1761,18 +1761,26 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
* This is actually never going to happen, since my_addr_len is at most 255,
* and CELL_PAYLOAD_LEN - 6 is 503. So we know that cp is < end. */

/* We should find out if we're canonical to our peer, so we know if we
* were extended (or if we extended ourselves) using the right address.
*
* Clients have no IDs and are never canonical. Bridges can be canonical on
* incomin connections, but never on outgoing connections. */
const bool may_be_canonical_to_peer = me &&
(!get_options()->BridgeRelay || !started_here);

if (my_addr_type == RESOLVED_TYPE_IPV4 && my_addr_len == 4) {
tor_addr_from_ipv4n(&my_apparent_addr, get_uint32(my_addr_ptr));

if (!get_options()->BridgeRelay && me &&
if (may_be_canonical_to_peer &&
get_uint32(my_addr_ptr) == htonl(me->addr)) {
TLS_CHAN_TO_BASE(chan)->is_canonical_to_peer = 1;
}

} else if (my_addr_type == RESOLVED_TYPE_IPV6 && my_addr_len == 16) {
tor_addr_from_ipv6_bytes(&my_apparent_addr, (const char *) my_addr_ptr);

if (!get_options()->BridgeRelay && me &&
if (may_be_canonical_to_peer &&
!tor_addr_is_null(&me->ipv6_addr) &&
tor_addr_eq(&my_apparent_addr, &me->ipv6_addr)) {
TLS_CHAN_TO_BASE(chan)->is_canonical_to_peer = 1;
Expand Down
3 changes: 2 additions & 1 deletion src/core/or/circuitbuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,8 @@ onionskin_answer(or_circuit_t *circ,
* TestingTorNetwork sets ExtendAllowPrivateAddresses. */
if ((!channel_is_local(circ->p_chan)
|| get_options()->ExtendAllowPrivateAddresses)
&& !channel_is_outgoing(circ->p_chan)) {
&& !channel_is_outgoing(circ->p_chan)
&& circ->p_chan->is_canonical_to_peer) {
/* record that we could process create cells from a non-local conn
* that we didn't initiate; presumably this means that create cells
* can reach us too. */
Expand Down