diff options
author | George Kadianakis <desnacked@gmail.com> | 2011-09-11 23:51:29 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@gmail.com> | 2011-09-11 23:51:29 +0200 |
commit | d0416ce3ec67ca87448153c8b2416dd7901013c6 (patch) | |
tree | dbc89ce65edb91bc96d4614a45d53a4a43bd01ea /src | |
parent | e8715b30411062d09832e912d87d526dc203e4f0 (diff) | |
download | tor-d0416ce3ec67ca87448153c8b2416dd7901013c6.tar.gz tor-d0416ce3ec67ca87448153c8b2416dd7901013c6.zip |
Don't warn of stray Bridges if managed proxies are still unconfigured.
With managed proxies you would always get the error message:
"You have a Bridge line using the X pluggable transport, but there
doesn't seem to be a corresponding ClientTransportPlugin line."
because the check happened directly after parse_client_transport_line()
when managed proxies were not fully configured and their transports
were not registered.
The fix is to move the validation to run_scheduled_events() and make
sure that all managed proxies are configured first.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/circuitbuild.c | 13 | ||||
-rw-r--r-- | src/or/circuitbuild.h | 2 | ||||
-rw-r--r-- | src/or/config.c | 5 | ||||
-rw-r--r-- | src/or/main.c | 9 |
4 files changed, 20 insertions, 9 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index b4c234301e..ed813046a9 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -4769,11 +4769,14 @@ transport_add_from_config(const tor_addr_t *addr, uint16_t port, } } -/** Warns the user of possible pluggable transport misconfiguration. */ -void +/** Warn the user of possible pluggable transport misconfiguration. + * Return 0 if the validation happened, -1 if we should postpone the + * validation. */ +int validate_pluggable_transports_config(void) { - if (bridge_list) { + /* Don't validate if managed proxies are not yet fully configured. */ + if (bridge_list && !pt_proxies_configuration_pending()) { SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, b) { /* Skip bridges without transports. */ if (!b->transport_name) @@ -4787,6 +4790,10 @@ validate_pluggable_transports_config(void) "corresponding ClientTransportPlugin line.", b->transport_name); } SMARTLIST_FOREACH_END(b); + + return 0; + } else { + return -1; } } diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h index 10e72879e6..dca541d6ff 100644 --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@ -157,7 +157,7 @@ int find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port, const transport_t **transport); transport_t *transport_get_by_name(const char *name); -void validate_pluggable_transports_config(void); +int validate_pluggable_transports_config(void); #endif diff --git a/src/or/config.c b/src/or/config.c index f2cb6cde5c..8bd47b5008 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1271,11 +1271,6 @@ options_act(or_options_t *old_options) sweep_transport_list(); sweep_proxy_list(); - /* If we have pluggable transport related options enabled, see if we - should warn the user about potential configuration problems. */ - if (options->Bridges || options->ClientTransportPlugin) - validate_pluggable_transports_config(); - /* Bail out at this point if we're not going to be a client or server: * we want to not fork, and to log stuff to stderr. */ if (!running_tor) diff --git a/src/or/main.c b/src/or/main.c index 5294e4ad0d..6297f0f3e2 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1068,6 +1068,7 @@ run_scheduled_events(time_t now) static int should_init_bridge_stats = 1; static time_t time_to_retry_dns_init = 0; static time_t time_to_next_heartbeat = 0; + static int has_validated_pt = 0; or_options_t *options = get_options(); int is_server = server_mode(options); int i; @@ -1472,6 +1473,14 @@ run_scheduled_events(time_t now) if (pt_proxies_configuration_pending()) pt_configure_remaining_proxies(); + /** 11c. validate pluggable transports configuration if we need to */ + if (!has_validated_pt && + (options->Bridges || options->ClientTransportPlugin)) { + if (validate_pluggable_transports_config() == 0) { + has_validated_pt = 1; + } + } + /** 12. write the heartbeat message */ if (options->HeartbeatPeriod && time_to_next_heartbeat < now) { |