commit e006aa5dfa3110648daa92bde27e8abc87db3c57 Merge: 6083276 6053e11 Author: Nick Mathewson nickm@torproject.org Date: Mon Jul 11 15:57:12 2011 -0400
Merge remote-tracking branch 'public/bug2841'
Conflicts: src/or/config.c
src/or/circuitbuild.c | 200 ++++++++++++++++++++++++++++++++++++++++++----- src/or/circuitbuild.h | 22 +++++- src/or/config.c | 150 ++++++++++++++++++++++++++++++++---- src/or/connection.c | 101 ++++++++++++++++++++++++ src/or/connection.h | 3 + src/or/connection_or.c | 46 +++++------ src/or/main.c | 7 ++ src/or/or.h | 33 ++++++-- 8 files changed, 493 insertions(+), 69 deletions(-)
diff --cc src/or/circuitbuild.h index caa8a67,74715b7..bb5c2eb --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@@ -70,9 -82,10 +82,10 @@@ int node_is_a_configured_bridge(const n void learned_router_identity(const tor_addr_t *addr, uint16_t port, const char *digest); void bridge_add_from_config(const tor_addr_t *addr, uint16_t port, - const char *digest); + const char *digest, + const char *transport_name); void retry_bridge_descriptor_fetch_directly(const char *digest); -void fetch_bridge_descriptors(or_options_t *options, time_t now); +void fetch_bridge_descriptors(const or_options_t *options, time_t now); void learned_bridge_descriptor(routerinfo_t *ri, int from_cache); int any_bridge_descriptors_known(void); int any_pending_bridge_descriptor_fetches(void); diff --cc src/or/config.c index 4aabe6b,0082ff9..4a9d2c9 --- a/src/or/config.c +++ b/src/or/config.c @@@ -546,33 -547,31 +547,34 @@@ static char *get_windows_conf_root(void #endif static void config_line_append(config_line_t **lst, const char *key, const char *val); -static void option_clear(config_format_t *fmt, or_options_t *options, - config_var_t *var); -static void option_reset(config_format_t *fmt, or_options_t *options, - config_var_t *var, int use_defaults); -static void config_free(config_format_t *fmt, void *options); +static void option_clear(const config_format_t *fmt, or_options_t *options, + const config_var_t *var); +static void option_reset(const config_format_t *fmt, or_options_t *options, + const config_var_t *var, int use_defaults); +static void config_free(const config_format_t *fmt, void *options); static int config_lines_eq(config_line_t *a, config_line_t *b); -static int option_is_same(config_format_t *fmt, - or_options_t *o1, or_options_t *o2, +static int option_is_same(const config_format_t *fmt, + const or_options_t *o1, const or_options_t *o2, const char *name); -static or_options_t *options_dup(config_format_t *fmt, or_options_t *old); -static int options_validate(or_options_t *old_options, or_options_t *options, +static or_options_t *options_dup(const config_format_t *fmt, + const or_options_t *old); +static int options_validate(or_options_t *old_options, + or_options_t *options, int from_setconf, char **msg); -static int options_act_reversible(or_options_t *old_options, char **msg); -static int options_act(or_options_t *old_options); -static int options_transition_allowed(or_options_t *old, or_options_t *new, +static int options_act_reversible(const or_options_t *old_options, char **msg); +static int options_act(const or_options_t *old_options); +static int options_transition_allowed(const or_options_t *old, + const or_options_t *new, char **msg); -static int options_transition_affects_workers(or_options_t *old_options, - or_options_t *new_options); -static int options_transition_affects_descriptor(or_options_t *old_options, - or_options_t *new_options); +static int options_transition_affects_workers( + const or_options_t *old_options, const or_options_t *new_options); +static int options_transition_affects_descriptor( + const or_options_t *old_options, const or_options_t *new_options); static int check_nickname_list(const char *lst, const char *name, char **msg); -static void config_register_addressmaps(or_options_t *options); +static void config_register_addressmaps(const or_options_t *options);
static int parse_bridge_line(const char *line, int validate_only); + static int parse_client_transport_line(const char *line, int validate_only); static int parse_dir_server_line(const char *line, dirinfo_type_t required_type, int validate_only); @@@ -3676,15 -3683,17 +3698,19 @@@ options_validate(or_options_t *old_opti if (validate_dir_authorities(options, old_options) < 0) REJECT("Directory authority line did not parse. See logs for details.");
+ if (options->UseBridges && !options->Bridges) + REJECT("If you set UseBridges, you must specify at least one bridge."); if (options->UseBridges && !options->TunnelDirConns) - REJECT("TunnelDirConns set to 0 only works with UseBridges set to 0"); + REJECT("If you set UseBridges, you must set TunnelDirConns."); - if (options->Bridges) { - for (cl = options->Bridges; cl; cl = cl->next) { - if (parse_bridge_line(cl->value, 1)<0) - REJECT("Bridge line did not parse. See logs for details."); - } + + for (cl = options->ClientTransportPlugin; cl; cl = cl->next) { + if (parse_client_transport_line(cl->value, 1)<0) + REJECT("Transport line did not parse. See logs for details."); + } + + for (cl = options->Bridges; cl; cl = cl->next) { + if (parse_bridge_line(cl->value, 1)<0) + REJECT("Bridge line did not parse. See logs for details."); }
if (options->ConstrainedSockets) { diff --cc src/or/connection_or.c index 679500d,a02ec1e..5092f63 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@@ -828,11 -818,15 +819,15 @@@ connection_or_connect(const tor_addr_t const char *id_digest) { or_connection_t *conn; - or_options_t *options = get_options(); + const or_options_t *options = get_options(); int socket_error = 0; - int using_proxy = 0; tor_addr_t addr;
+ int r; + tor_addr_t proxy_addr; + uint16_t proxy_port; + int proxy_type; + tor_assert(_addr); tor_assert(id_digest); tor_addr_copy(&addr, _addr); diff --cc src/or/or.h index ff82446,d1817d4..2f960ca --- a/src/or/or.h +++ b/src/or/or.h @@@ -2651,9 -2662,23 +2667,12 @@@ typedef struct * when doing so. */ char *BridgePassword;
- /** Whether we should start all circuits with a bridge. This is an - * "autobool": 1 means strictly yes, 0 means strictly no, and -1 means that - * we do iff any bridges are configured, we are not running a server and - * have not specified a list of entry nodes. Don't use this value directly; - * use <b>UseBridges</b> instead. */ - int UseBridges_; - /** Effective value of UseBridges. Will be set equally for UseBridges set to - * 1 or 0, but for 'auto' it will be set to 1 iff any bridges are - * configured, we are not running a server and have not specified a list of - * entry nodes. */ - int UseBridges; - + int UseBridges; /**< Boolean: should we start all circuits with a bridge? */ config_line_t *Bridges; /**< List of bootstrap bridge addresses. */
+ config_line_t *ClientTransportPlugin; /**< List of client + transport plugins. */ + int BridgeRelay; /**< Boolean: are we acting as a bridge relay? We make * this explicit so we can change how we behave in the * future. */
tor-commits@lists.torproject.org