Merge remote-tracking branch 'tor-gitlab/mr/268' into maint-0.4.5

This commit is contained in:
Nick Mathewson 2021-01-21 13:10:16 -05:00
commit 9390e2bf83
4 changed files with 17 additions and 21 deletions

View File

@ -1,5 +1,6 @@
o Minor bugfixes (config, bridge):
- Really fix the case where torrc has a missing ClientTransportPlugin but
configured with a Bridge line and UseBridges. Previously, we failed to
also look at the managed proxy list and thus it would fail for the
"exec" case. Fixes bug 40106; bugfix on 0.4.5.1-alpha.
- Don't initiate a connection to a bridge without a corresponding
transport. Fixes bug 40106; bugfix on 0.4.5.1-alpha.
- This also reverts an earlier fix we did for this that would validate
configuration to avoid such situation but turns out it wouldn't work for
a DisableNetwork thus the new approach.

View File

@ -2189,23 +2189,6 @@ options_act,(const or_options_t *old_options))
}
}
/* Validate that we actually have a configured transport for a Bridge line
* that has one. This is done here because we require the bridge and
* transport to be added to the global list before doing the validation.
*
* In an ideal world, pt_parse_transport_line() would actually return a
* transport_t object so we could inspect it and thus do this step at
* validation time. */
SMARTLIST_FOREACH_BEGIN(bridge_list_get(), const bridge_info_t *, bi) {
const char *bi_transport_name = bridget_get_transport_name(bi);
if (bi_transport_name && (!transport_get_by_name(bi_transport_name) &&
!managed_proxy_has_transport(bi_transport_name))) {
log_warn(LD_CONFIG, "Bridge line with transport %s is missing a "
"ClientTransportPlugin line", bi_transport_name);
return -1;
}
} SMARTLIST_FOREACH_END(bi);
if (options_act_server_transport(old_options) < 0)
return -1;

View 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.",

View 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;