]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
bridge: Don't initiate connection without a transport
authorDavid Goulet <dgoulet@torproject.org>
Wed, 20 Jan 2021 15:31:30 +0000 (10:31 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Wed, 20 Jan 2021 20:55:50 +0000 (15:55 -0500)
Don't pick the bridge as the guard or launch descriptor fetch if no transport
is found.

Fixes #40106

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/feature/client/bridges.c
src/feature/client/entrynodes.c

index 8e2bb016616bdb1bf68dacee1747cf0b0e4710b7..11b2ffd62dbf8b50e58bb360cb9ebdcf1b8d4edb 100644 (file)
@@ -656,6 +656,15 @@ launch_direct_bridge_descriptor_fetch(bridge_info_t *bridge)
       DIR_PURPOSE_FETCH_SERVERDESC))
     return; /* it's already on the way */
 
+  if (transport_get_by_name(bridget_get_transport_name(bridge)) == NULL) {
+    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.",
index 82866ea668bf8ad302a868e06bba3b2652a88eb9..2676df6aaeb4e5920a9ed35c2fe75a95bf8b7c93 100644 (file)
@@ -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 (!transport_get_by_name(bridget_get_transport_name(bridge))) {
+    return NULL;
+  }
   guard = get_sampled_guard_by_bridge_addr(gs, addrport);
   if (! guard || (id && tor_memneq(id, guard->identity, DIGEST_LEN)))
     return NULL;