diff options
author | teor (Tim Wilson-Brown) <teor2345@gmail.com> | 2016-03-23 13:37:35 +1100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-03-24 10:13:58 -0400 |
commit | f2153f9716876b87bfcc53ff13b86b878edaae86 (patch) | |
tree | f4ea20d094c9fbf4cb1d2ba594d52248cfc94f24 /src/or/entrynodes.c | |
parent | 45681f695c6096e280bc7ec3bf0a67c27708dbbc (diff) | |
download | tor-f2153f9716876b87bfcc53ff13b86b878edaae86.tar.gz tor-f2153f9716876b87bfcc53ff13b86b878edaae86.zip |
Always allow OR connections to bridges on private addresses
Regardless of the setting of ExtendAllowPrivateAddresses.
This fixes a bug with pluggable transports that ignore the
(potentially private) address in their bridge line.
Fixes bug 18517; bugfix on 23b088907f in tor-0.2.8.1-alpha.
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r-- | src/or/entrynodes.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 3287fcd584..8dbfeaecea 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -1795,7 +1795,7 @@ get_configured_bridge_by_orports_digest(const char *digest, } /** If we have a bridge configured whose digest matches <b>digest</b>, or a - * bridge with no known digest whose address matches <b>addr</b>:<b>/port</b>, + * bridge with no known digest whose address matches <b>addr</b>:<b>port</b>, * return that bridge. Else return NULL. If <b>digest</b> is NULL, check for * address/port matches only. */ static bridge_info_t * @@ -1818,6 +1818,28 @@ get_configured_bridge_by_addr_port_digest(const tor_addr_t *addr, return NULL; } +/** If we have a bridge configured whose digest matches <b>digest</b>, or a + * bridge with no known digest whose address matches <b>addr</b>:<b>port</b>, + * return 1. Else return 0. If <b>digest</b> is NULL, check for + * address/port matches only. */ +int addr_is_a_configured_bridge(const tor_addr_t *addr, + uint16_t port, + const char *digest) +{ + tor_assert(addr); + return get_configured_bridge_by_addr_port_digest(addr, port, digest) ? 1 : 0; +} + +/** If we have a bridge configured whose digest matches + * <b>ei->identity_digest</b>, or a bridge with no known digest whose address + * matches <b>ei->addr</b>:<b>ei->port</b>, return 1. Else return 0. + * If <b>ei->onion_key</b> is NULL, check for address/port matches only. */ +int extend_info_is_a_configured_bridge(const extend_info_t *ei) +{ + const char *digest = ei->onion_key ? ei->identity_digest : NULL; + return addr_is_a_configured_bridge(&ei->addr, ei->port, digest); +} + /** Wrapper around get_configured_bridge_by_addr_port_digest() to look * it up via router descriptor <b>ri</b>. */ static bridge_info_t * |