aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-12-08 10:01:23 -0500
committerAlexander Færøy <ahf@torproject.org>2020-12-16 20:37:57 +0000
commitee6ad0e592c9b6239066697ae8aff83136edc2ed (patch)
tree0f5bdf6971eefbb498f66b47676132046601d675
parentc618c4f27986825df2026fb22b8ee222edd1afa1 (diff)
downloadtor-ee6ad0e592c9b6239066697ae8aff83136edc2ed.tar.gz
tor-ee6ad0e592c9b6239066697ae8aff83136edc2ed.zip
config: Catch missing Bridge for ClientTransportPlugin
When making sure we have a Bridge line with a ClientTransportPlugin, we now check in the managed proxy list and so we can catch any missing ClientTransportPlugin for a Bridge line. Fixes #40106 Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r--changes/ticket401065
-rw-r--r--src/app/config/config.c3
-rw-r--r--src/feature/client/transports.c22
-rw-r--r--src/feature/client/transports.h1
4 files changed, 30 insertions, 1 deletions
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 79b67e7a90..d8bc5f6025 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,