Merge remote-tracking branch 'teor/first-hop-no-private'

This commit is contained in:
Nick Mathewson
2015-12-09 10:47:59 -05:00
3 changed files with 21 additions and 3 deletions
+8
View File
@@ -498,6 +498,14 @@ circuit_handle_first_hop(origin_circuit_t *circ)
tor_assert(firsthop);
tor_assert(firsthop->extend_info);
/* XX/teor - does tor ever need build a circuit directly to itself? */
if (tor_addr_is_internal(&firsthop->extend_info->addr, 0) &&
!get_options()->ExtendAllowPrivateAddresses) {
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"Client asked me to connect directly to a private address");
return -END_CIRC_REASON_TORPROTOCOL;
}
/* now see if we're already connected to the first OR in 'route' */
log_debug(LD_CIRC,"Looking for firsthop '%s'",
fmt_addrport(&firsthop->extend_info->addr,