[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Fix bug9309, and n_noncanonical count/continue code
commit 5d4b5018be5d85162d96cc3781acbf892f33bc21
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Jul 23 11:52:10 2013 +0200
Fix bug9309, and n_noncanonical count/continue code
When we moved channel_matches_target_addr_for_extend() into a separate
function, its sense was inverted from what one might expect, and we
didn't have a ! in one place where we should have.
Found by skruffy.
---
changes/bug9309 | 6 ++++++
src/or/channel.c | 4 ++--
src/or/channeltls.c | 5 ++---
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/changes/bug9309 b/changes/bug9309
new file mode 100644
index 0000000..38c462b
--- /dev/null
+++ b/changes/bug9309
@@ -0,0 +1,6 @@
+ o Minor bugfixes:
+ - When evaluating whether to use a connection that we haven't
+ decided is canonical using a recent link protocol version,
+ decide that it's canonical only if it used address _does_
+ match the desired address. Fixes bug 9309; bugfix on
+ 0.2.4.4-alpha. Reported by skruffy.
diff --git a/src/or/channel.c b/src/or/channel.c
index 98c23d9..05f269b 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -3090,7 +3090,7 @@ channel_get_for_extend(const char *digest,
if (chan->state != CHANNEL_STATE_OPEN) {
/* If the address matches, don't launch a new connection for this
* circuit. */
- if (!channel_matches_target_addr_for_extend(chan, target_addr))
+ if (channel_matches_target_addr_for_extend(chan, target_addr))
++n_inprogress_goodaddr;
continue;
}
@@ -4106,7 +4106,7 @@ channel_matches_extend_info(channel_t *chan, extend_info_t *extend_info)
}
/**
- * Check if a channel matches a given target address
+ * Check if a channel matches a given target address; return true iff we do.
*
* This function calls into the lower layer and asks if this channel thinks
* it matches a given target address for circuit extension purposes.
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index 60693da..d758d22 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -546,7 +546,7 @@ channel_tls_matches_extend_info_method(channel_t *chan,
}
/**
- * Check if we match a target address
+ * Check if we match a target address; return true iff we do.
*
* This implements the matches_target method for channel_tls t_; the upper
* layer wants to know if this channel matches a target address when extending
@@ -563,8 +563,7 @@ channel_tls_matches_target_method(channel_t *chan,
tor_assert(target);
tor_assert(tlschan->conn);
- return tor_addr_compare(&(tlschan->conn->real_addr),
- target, CMP_EXACT);
+ return tor_addr_eq(&(tlschan->conn->real_addr), target);
}
/**
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits