Loading changes/bug11069 0 → 100644 +4 −0 Original line number Diff line number Diff line o Minor bugfixes (clients): - Fix tor so that it raises a control port warning when we fail to connect to all of our bridges. Fixes bug 11069; bugfix on tor-0.2.1.2-alpha. src/or/connection.c +25 −0 Original line number Diff line number Diff line Loading @@ -4164,6 +4164,31 @@ connection_dir_get_by_purpose_and_resource(int purpose, return NULL; } /** Return 1 if there are any active OR connections apart from * <b>this_conn</b>. * * We use this to guess if we should tell the controller that we * didn't manage to connect to any of our bridges. */ int any_other_active_or_conns(const or_connection_t *this_conn) { smartlist_t *conns = get_connection_array(); SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) { if (conn == TO_CONN(this_conn)) { /* don't consider this conn */ continue; } if (conn->type == CONN_TYPE_OR && !conn->marked_for_close) { log_debug(LD_DIR, "%s: Found an OR connection: %s", __func__, conn->address); return 1; } } SMARTLIST_FOREACH_END(conn); return 0; } /** Return 1 if <b>conn</b> is a listener conn, else return 0. */ int connection_is_listener(connection_t *conn) Loading src/or/connection.h +2 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,8 @@ connection_t *connection_get_by_type_state_rendquery(int type, int state, dir_connection_t *connection_dir_get_by_purpose_and_resource( int state, const char *resource); int any_other_active_or_conns(const or_connection_t *this_conn); #define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR) int connection_is_listener(connection_t *conn); int connection_state_is_open(connection_t *conn); Loading src/or/connection_or.c +5 −3 Original line number Diff line number Diff line Loading @@ -714,7 +714,8 @@ connection_or_about_to_close(or_connection_t *or_conn) reason); if (!authdir_mode_tests_reachability(options)) control_event_bootstrap_problem( orconn_end_reason_to_control_string(reason), reason); orconn_end_reason_to_control_string(reason), reason, or_conn); } } } else if (conn->hold_open_until_flushed) { Loading Loading @@ -1077,7 +1078,7 @@ connection_or_connect_failed(or_connection_t *conn, { control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED, reason); if (!authdir_mode_tests_reachability(get_options())) control_event_bootstrap_problem(msg, reason); control_event_bootstrap_problem(msg, reason, conn); } /** <b>conn</b> got an error in connection_handle_read_impl() or Loading Loading @@ -1708,7 +1709,8 @@ connection_or_client_learned_peer_id(or_connection_t *conn, if (!authdir_mode_tests_reachability(options)) control_event_bootstrap_problem( "Unexpected identity in router certificate", END_OR_CONN_REASON_OR_IDENTITY); END_OR_CONN_REASON_OR_IDENTITY, conn); return -1; } if (authdir_mode_tests_reachability(options)) { Loading src/or/control.c +8 −5 Original line number Diff line number Diff line Loading @@ -4873,10 +4873,12 @@ control_event_bootstrap(bootstrap_status_t status, int progress) /** Called when Tor has failed to make bootstrapping progress in a way * that indicates a problem. <b>warn</b> gives a hint as to why, and * <b>reason</b> provides an "or_conn_end_reason" tag. * <b>reason</b> provides an "or_conn_end_reason" tag. <b>or_conn</b> * is the connection that caused this problem. */ MOCK_IMPL(void, control_event_bootstrap_problem, (const char *warn, int reason)) control_event_bootstrap_problem, (const char *warn, int reason, const or_connection_t *or_conn)) { int status = bootstrap_percent; const char *tag, *summary; Loading @@ -4898,9 +4900,10 @@ control_event_bootstrap_problem, (const char *warn, int reason)) if (reason == END_OR_CONN_REASON_NO_ROUTE) recommendation = "warn"; if (get_options()->UseBridges && !any_bridge_descriptors_known() && !any_pending_bridge_descriptor_fetches()) /* If we are using bridges and all our OR connections are now closed, it means that we totally failed to connect to our bridges. Throw a warning. */ if (get_options()->UseBridges && !any_other_active_or_conns(or_conn)) recommendation = "warn"; if (we_are_hibernating()) Loading Loading
changes/bug11069 0 → 100644 +4 −0 Original line number Diff line number Diff line o Minor bugfixes (clients): - Fix tor so that it raises a control port warning when we fail to connect to all of our bridges. Fixes bug 11069; bugfix on tor-0.2.1.2-alpha.
src/or/connection.c +25 −0 Original line number Diff line number Diff line Loading @@ -4164,6 +4164,31 @@ connection_dir_get_by_purpose_and_resource(int purpose, return NULL; } /** Return 1 if there are any active OR connections apart from * <b>this_conn</b>. * * We use this to guess if we should tell the controller that we * didn't manage to connect to any of our bridges. */ int any_other_active_or_conns(const or_connection_t *this_conn) { smartlist_t *conns = get_connection_array(); SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) { if (conn == TO_CONN(this_conn)) { /* don't consider this conn */ continue; } if (conn->type == CONN_TYPE_OR && !conn->marked_for_close) { log_debug(LD_DIR, "%s: Found an OR connection: %s", __func__, conn->address); return 1; } } SMARTLIST_FOREACH_END(conn); return 0; } /** Return 1 if <b>conn</b> is a listener conn, else return 0. */ int connection_is_listener(connection_t *conn) Loading
src/or/connection.h +2 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,8 @@ connection_t *connection_get_by_type_state_rendquery(int type, int state, dir_connection_t *connection_dir_get_by_purpose_and_resource( int state, const char *resource); int any_other_active_or_conns(const or_connection_t *this_conn); #define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR) int connection_is_listener(connection_t *conn); int connection_state_is_open(connection_t *conn); Loading
src/or/connection_or.c +5 −3 Original line number Diff line number Diff line Loading @@ -714,7 +714,8 @@ connection_or_about_to_close(or_connection_t *or_conn) reason); if (!authdir_mode_tests_reachability(options)) control_event_bootstrap_problem( orconn_end_reason_to_control_string(reason), reason); orconn_end_reason_to_control_string(reason), reason, or_conn); } } } else if (conn->hold_open_until_flushed) { Loading Loading @@ -1077,7 +1078,7 @@ connection_or_connect_failed(or_connection_t *conn, { control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED, reason); if (!authdir_mode_tests_reachability(get_options())) control_event_bootstrap_problem(msg, reason); control_event_bootstrap_problem(msg, reason, conn); } /** <b>conn</b> got an error in connection_handle_read_impl() or Loading Loading @@ -1708,7 +1709,8 @@ connection_or_client_learned_peer_id(or_connection_t *conn, if (!authdir_mode_tests_reachability(options)) control_event_bootstrap_problem( "Unexpected identity in router certificate", END_OR_CONN_REASON_OR_IDENTITY); END_OR_CONN_REASON_OR_IDENTITY, conn); return -1; } if (authdir_mode_tests_reachability(options)) { Loading
src/or/control.c +8 −5 Original line number Diff line number Diff line Loading @@ -4873,10 +4873,12 @@ control_event_bootstrap(bootstrap_status_t status, int progress) /** Called when Tor has failed to make bootstrapping progress in a way * that indicates a problem. <b>warn</b> gives a hint as to why, and * <b>reason</b> provides an "or_conn_end_reason" tag. * <b>reason</b> provides an "or_conn_end_reason" tag. <b>or_conn</b> * is the connection that caused this problem. */ MOCK_IMPL(void, control_event_bootstrap_problem, (const char *warn, int reason)) control_event_bootstrap_problem, (const char *warn, int reason, const or_connection_t *or_conn)) { int status = bootstrap_percent; const char *tag, *summary; Loading @@ -4898,9 +4900,10 @@ control_event_bootstrap_problem, (const char *warn, int reason)) if (reason == END_OR_CONN_REASON_NO_ROUTE) recommendation = "warn"; if (get_options()->UseBridges && !any_bridge_descriptors_known() && !any_pending_bridge_descriptor_fetches()) /* If we are using bridges and all our OR connections are now closed, it means that we totally failed to connect to our bridges. Throw a warning. */ if (get_options()->UseBridges && !any_other_active_or_conns(or_conn)) recommendation = "warn"; if (we_are_hibernating()) Loading