aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-03-11 11:11:38 -0500
committerNick Mathewson <nickm@torproject.org>2016-03-11 11:11:38 -0500
commitfe0d346a6df3d20f81a90c4cfe4de89046907961 (patch)
tree8ebff960fa5b9b9e7354a76b3b02ecbe462fdd24 /src/or/circuitbuild.c
parent656e23171d64885c1bea95403768386ee369e949 (diff)
parent7275dd4fd17a2b5e7465cf6f96d6db834a15c869 (diff)
downloadtor-fe0d346a6df3d20f81a90c4cfe4de89046907961.tar.gz
tor-fe0d346a6df3d20f81a90c4cfe4de89046907961.zip
Merge remote-tracking branch 'teor/bug8976_01_028'
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index baa7bad2e6..a15f4c28b5 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2419,3 +2419,18 @@ build_state_get_exit_nickname(cpath_build_state_t *state)
return state->chosen_exit->nickname;
}
+/** Return true iff the given address can be used to extend to. */
+int extend_info_addr_is_allowed(const tor_addr_t *addr)
+{
+ tor_assert(addr);
+
+ /* Check if we have a private address and if we can extend to it. */
+ if ((tor_addr_is_internal(addr, 0) || tor_addr_is_multicast(addr)) &&
+ !get_options()->ExtendAllowPrivateAddresses) {
+ goto disallow;
+ }
+ /* Allowed! */
+ return 1;
+ disallow:
+ return 0;
+}