mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-20 21:16:22 +02:00
Only launch transport proxies that provide useful transports.
This commit is contained in:
parent
7ef2939e5a
commit
6f33dffec1
3
changes/bug5018
Normal file
3
changes/bug5018
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Minor features:
|
||||||
|
- Don't launch pluggable transport proxies that contribute
|
||||||
|
transports we don't need. Resolves ticket 5018.
|
@ -4243,6 +4243,7 @@ parse_client_transport_line(const char *line, int validate_only)
|
|||||||
char **proxy_argv=NULL;
|
char **proxy_argv=NULL;
|
||||||
char **tmp=NULL;
|
char **tmp=NULL;
|
||||||
int proxy_argc, i;
|
int proxy_argc, i;
|
||||||
|
int is_useless_proxy=1;
|
||||||
|
|
||||||
int line_length;
|
int line_length;
|
||||||
|
|
||||||
@ -4264,11 +4265,16 @@ parse_client_transport_line(const char *line, int validate_only)
|
|||||||
smartlist_split_string(transport_list, transports, ",",
|
smartlist_split_string(transport_list, transports, ",",
|
||||||
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
||||||
SMARTLIST_FOREACH_BEGIN(transport_list, const char *, transport_name) {
|
SMARTLIST_FOREACH_BEGIN(transport_list, const char *, transport_name) {
|
||||||
|
/* validate transport names */
|
||||||
if (!string_is_C_identifier(transport_name)) {
|
if (!string_is_C_identifier(transport_name)) {
|
||||||
log_warn(LD_CONFIG, "Transport name is not a C identifier (%s).",
|
log_warn(LD_CONFIG, "Transport name is not a C identifier (%s).",
|
||||||
transport_name);
|
transport_name);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* see if we actually need the transports provided by this proxy */
|
||||||
|
if (!validate_only && transport_is_needed(transport_name))
|
||||||
|
is_useless_proxy = 0;
|
||||||
} SMARTLIST_FOREACH_END(transport_name);
|
} SMARTLIST_FOREACH_END(transport_name);
|
||||||
|
|
||||||
/* field2 is either a SOCKS version or "exec" */
|
/* field2 is either a SOCKS version or "exec" */
|
||||||
@ -4287,9 +4293,15 @@ parse_client_transport_line(const char *line, int validate_only)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_managed) { /* managed */
|
if (is_managed) { /* managed */
|
||||||
if (!validate_only) { /* if we are not just validating, use the
|
if (!validate_only && is_useless_proxy) {
|
||||||
rest of the line as the argv of the proxy
|
log_warn(LD_GENERAL, "Pluggable transport proxy (%s) does not provide "
|
||||||
to be launched */
|
"any needed transports and will not be launched.", line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we are not just validating, use the rest of the line as the
|
||||||
|
argv of the proxy to be launched. Also, make sure that we are
|
||||||
|
only launching proxies that contribute useful transports. */
|
||||||
|
if (!validate_only && !is_useless_proxy) {
|
||||||
proxy_argc = line_length-2;
|
proxy_argc = line_length-2;
|
||||||
tor_assert(proxy_argc > 0);
|
tor_assert(proxy_argc > 0);
|
||||||
proxy_argv = tor_malloc_zero(sizeof(char*)*(proxy_argc+1));
|
proxy_argv = tor_malloc_zero(sizeof(char*)*(proxy_argc+1));
|
||||||
|
@ -1761,6 +1761,29 @@ bridge_resolve_conflicts(const tor_addr_t *addr, uint16_t port,
|
|||||||
} SMARTLIST_FOREACH_END(bridge);
|
} SMARTLIST_FOREACH_END(bridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return True if we have a bridge that uses a transport with name
|
||||||
|
* <b>transport_name</b>. */
|
||||||
|
int
|
||||||
|
transport_is_needed(const char *transport_name)
|
||||||
|
{
|
||||||
|
int retval;
|
||||||
|
smartlist_t *needed_transports = NULL;
|
||||||
|
|
||||||
|
if (!bridge_list)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
needed_transports = smartlist_new();
|
||||||
|
|
||||||
|
SMARTLIST_FOREACH_BEGIN(bridge_list, const bridge_info_t *, bridge) {
|
||||||
|
if (bridge->transport_name)
|
||||||
|
smartlist_add(needed_transports, bridge->transport_name);
|
||||||
|
} SMARTLIST_FOREACH_END(bridge);
|
||||||
|
|
||||||
|
retval = smartlist_string_isin(needed_transports, transport_name);
|
||||||
|
smartlist_free(needed_transports);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
/** Remember a new bridge at <b>addr</b>:<b>port</b>. If <b>digest</b>
|
/** Remember a new bridge at <b>addr</b>:<b>port</b>. If <b>digest</b>
|
||||||
* is set, it tells us the identity key too. If we already had the
|
* is set, it tells us the identity key too. If we already had the
|
||||||
* bridge in our list, unmark it, and don't actually add anything new.
|
* bridge in our list, unmark it, and don't actually add anything new.
|
||||||
|
@ -118,6 +118,7 @@ struct transport_t;
|
|||||||
int find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port,
|
int find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port,
|
||||||
const struct transport_t **transport);
|
const struct transport_t **transport);
|
||||||
|
|
||||||
|
int transport_is_needed(const char *transport_name);
|
||||||
int validate_pluggable_transports_config(void);
|
int validate_pluggable_transports_config(void);
|
||||||
|
|
||||||
double pathbias_get_close_success_count(entry_guard_t *guard);
|
double pathbias_get_close_success_count(entry_guard_t *guard);
|
||||||
|
Loading…
Reference in New Issue
Block a user