summaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-03-19 12:29:29 -0400
committerNick Mathewson <nickm@torproject.org>2013-03-19 12:29:29 -0400
commit4eaca17f2f755cb1aca9a20216002a4ad652d7ef (patch)
tree8bcc8ed0ac0bafae0e925c011fdd0df28291d9f4 /src/or/circuituse.c
parent597cd893c557f8e05be98b6cade1b312fc6f0f8d (diff)
parent73a35dc3c0b4ab6cf79d88fc513c5c2762eff28a (diff)
downloadtor-4eaca17f2f755cb1aca9a20216002a4ad652d7ef.tar.gz
tor-4eaca17f2f755cb1aca9a20216002a4ad652d7ef.zip
Merge branch 'bug7582_v2' into maint-0.2.4
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 4d1065bbd8..d48449fa81 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -109,6 +109,8 @@ circuit_is_acceptable(const origin_circuit_t *origin_circ,
return 0;
if (purpose == CIRCUIT_PURPOSE_C_GENERAL) {
+ tor_addr_t addr;
+ const int family = tor_addr_parse(&addr, conn->socks_request->address);
if (!exitnode && !build_state->onehop_tunnel) {
log_debug(LD_CIRC,"Not considering circuit with unknown router.");
return 0; /* this circuit is screwed and doesn't know it yet,
@@ -129,9 +131,7 @@ circuit_is_acceptable(const origin_circuit_t *origin_circ,
return 0; /* this is a circuit to somewhere else */
if (tor_digest_is_zero(digest)) {
/* we don't know the digest; have to compare addr:port */
- tor_addr_t addr;
- int r = tor_addr_parse(&addr, conn->socks_request->address);
- if (r < 0 ||
+ if (family < 0 ||
!tor_addr_eq(&build_state->chosen_exit->addr, &addr) ||
build_state->chosen_exit->port != conn->socks_request->port)
return 0;
@@ -143,6 +143,13 @@ circuit_is_acceptable(const origin_circuit_t *origin_circ,
return 0;
}
}
+ if (origin_circ->prepend_policy && family != -1) {
+ int r = compare_tor_addr_to_addr_policy(&addr,
+ conn->socks_request->port,
+ origin_circ->prepend_policy);
+ if (r == ADDR_POLICY_REJECTED)
+ return 0;
+ }
if (exitnode && !connection_ap_can_use_exit(conn, exitnode)) {
/* can't exit from this router */
return 0;