diff --git a/changes/ticket40106 b/changes/ticket40106 new file mode 100644 index 0000000000..d007cf535e --- /dev/null +++ b/changes/ticket40106 @@ -0,0 +1,5 @@ + 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. diff --git a/src/app/config/config.c b/src/app/config/config.c index 100c08286a..bf2f49ead4 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -2198,7 +2198,8 @@ options_act,(const or_options_t *old_options)) * 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)) { + 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; diff --git a/src/feature/client/transports.c b/src/feature/client/transports.c index d1c807189a..4b05d55494 100644 --- a/src/feature/client/transports.c +++ b/src/feature/client/transports.c @@ -368,6 +368,28 @@ static int unconfigured_proxies_n = 0; /** Boolean: True iff we might need to restart some proxies. */ static int check_if_restarts_needed = 0; +/** Return true iff we have a managed_proxy_t in the global list is for the + * given transport name. */ +bool +managed_proxy_has_transport(const char *transport_name) +{ + tor_assert(transport_name); + + if (!managed_proxy_list) { + return false; + } + + SMARTLIST_FOREACH_BEGIN(managed_proxy_list, const managed_proxy_t *, mp) { + SMARTLIST_FOREACH_BEGIN(mp->transports_to_launch, const char *, name) { + if (!strcasecmp(name, transport_name)) { + return true; + } + } SMARTLIST_FOREACH_END(name); + } SMARTLIST_FOREACH_END(mp); + + return false; +} + /** Return true if there are still unconfigured managed proxies, or proxies * that need restarting. */ int diff --git a/src/feature/client/transports.h b/src/feature/client/transports.h index 3aff1cb248..47b118e77b 100644 --- a/src/feature/client/transports.h +++ b/src/feature/client/transports.h @@ -41,6 +41,7 @@ void transport_free_(transport_t *transport); #define transport_free(tr) FREE_AND_NULL(transport_t, transport_free_, (tr)) MOCK_DECL(transport_t*, transport_get_by_name, (const char *name)); +bool managed_proxy_has_transport(const char *transport_name); MOCK_DECL(void, pt_kickstart_proxy, (const smartlist_t *transport_list, char **proxy_argv,