diff options
author | Nick Mathewson <nickm@torproject.org> | 2021-01-21 13:19:49 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2021-01-21 13:19:49 -0500 |
commit | 2243fc3ad1bb33ca5f4a37952bb474d8314d5325 (patch) | |
tree | 92a41ba6c4b83e0256c079ba3b043eba02fe1c85 /src/feature/client | |
parent | 8a2786072008f18ccd5bace4f014057d06345af0 (diff) | |
parent | 71fd30b75ad028dfce69563792547f06fdf9d3c2 (diff) | |
download | tor-2243fc3ad1bb33ca5f4a37952bb474d8314d5325.tar.gz tor-2243fc3ad1bb33ca5f4a37952bb474d8314d5325.zip |
Merge branch 'maint-0.4.5'
Diffstat (limited to 'src/feature/client')
-rw-r--r-- | src/feature/client/bridges.c | 20 | ||||
-rw-r--r-- | src/feature/client/bridges.h | 1 | ||||
-rw-r--r-- | src/feature/client/entrynodes.c | 3 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/feature/client/bridges.c b/src/feature/client/bridges.c index 8e2bb01661..96c3497c6f 100644 --- a/src/feature/client/bridges.c +++ b/src/feature/client/bridges.c @@ -175,6 +175,17 @@ bridget_get_transport_name(const bridge_info_t *bridge) return bridge->transport_name; } +/** + * Return true if @a bridge has a transport name for which we don't actually + * know a transport. + */ +bool +bridge_has_invalid_transport(const bridge_info_t *bridge) +{ + const char *tname = bridget_get_transport_name(bridge); + return tname && transport_get_by_name(tname) == NULL; +} + /** If we have a bridge configured whose digest matches <b>digest</b>, or a * bridge with no known digest whose address matches any of the * tor_addr_port_t's in <b>orports</b>, return that bridge. Else return @@ -656,6 +667,15 @@ launch_direct_bridge_descriptor_fetch(bridge_info_t *bridge) DIR_PURPOSE_FETCH_SERVERDESC)) return; /* it's already on the way */ + if (bridge_has_invalid_transport(bridge)) { + download_status_mark_impossible(&bridge->fetch_status); + log_warn(LD_CONFIG, "Can't use bridge at %s: there is no configured " + "transport called \"%s\".", + safe_str_client(fmt_and_decorate_addr(&bridge->addr)), + bridget_get_transport_name(bridge)); + return; /* Can't use this bridge; it has not */ + } + if (routerset_contains_bridge(options->ExcludeNodes, bridge)) { download_status_mark_impossible(&bridge->fetch_status); log_warn(LD_APP, "Not using bridge at %s: it is in ExcludeNodes.", diff --git a/src/feature/client/bridges.h b/src/feature/client/bridges.h index 1b090e8649..f5ecc1b76d 100644 --- a/src/feature/client/bridges.h +++ b/src/feature/client/bridges.h @@ -24,6 +24,7 @@ const smartlist_t *bridge_list_get(void); const uint8_t *bridge_get_rsa_id_digest(const bridge_info_t *bridge); const tor_addr_port_t * bridge_get_addr_port(const bridge_info_t *bridge); const char *bridget_get_transport_name(const bridge_info_t *bridge); +bool bridge_has_invalid_transport(const bridge_info_t *bridge); bridge_info_t *get_configured_bridge_by_addr_port_digest( const tor_addr_t *addr, uint16_t port, diff --git a/src/feature/client/entrynodes.c b/src/feature/client/entrynodes.c index 409bed1a40..078024a9be 100644 --- a/src/feature/client/entrynodes.c +++ b/src/feature/client/entrynodes.c @@ -804,6 +804,9 @@ get_sampled_guard_for_bridge(guard_selection_t *gs, entry_guard_t *guard; if (BUG(!addrport)) return NULL; // LCOV_EXCL_LINE + if (bridge_has_invalid_transport(bridge)) { + return NULL; + } guard = get_sampled_guard_by_bridge_addr(gs, addrport); if (! guard || (id && tor_memneq(id, guard->identity, DIGEST_LEN))) return NULL; |