diff --git a/ChangeLog b/ChangeLog index 159a8a5092..74265159a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ Changes in version 0.1.2.4-alpha - 2006-11-?? o Minor features - Add breakdown of public key operations to dumped statistics. + o Major bugfixes + - Handle TransPort connections even when the server sends data before + the client sends data. Previously, the connection would just hang + until the client sent data. (Patch from tup based on patch from + Zajcev Evgeny.) + o Minor bugfixes - Don't log spurious warnings when we see a circuit close reason we don't recognize; it's probably just from a newer version of Tor. diff --git a/src/or/connection.c b/src/or/connection.c index b7a3889cdf..ce7046675e 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -96,7 +96,6 @@ conn_state_to_string(int type, int state) break; case CONN_TYPE_AP: switch (state) { - case AP_CONN_STATE_ORIGDST_WAIT: case AP_CONN_STATE_SOCKS_WAIT: return "waiting for dest info"; case AP_CONN_STATE_RENDDESC_WAIT: return "waiting for rendezvous desc"; case AP_CONN_STATE_CONTROLLER_WAIT: return "waiting for controller"; @@ -808,6 +807,8 @@ connection_handle_listener_read(connection_t *conn, int new_type) /** Initialize states for newly accepted connection conn. * If conn is an OR, start the tls handshake. + * If conn is a transparent AP, get its original destination + * and place it in circuit_wait. */ static int connection_init_accepted_conn(connection_t *conn, uint8_t listener_type) @@ -824,8 +825,8 @@ connection_init_accepted_conn(connection_t *conn, uint8_t listener_type) conn->state = AP_CONN_STATE_SOCKS_WAIT; break; case CONN_TYPE_AP_TRANS_LISTENER: - conn->state = AP_CONN_STATE_ORIGDST_WAIT; - break; + conn->state = AP_CONN_STATE_CIRCUIT_WAIT; + return connection_ap_process_transparent(TO_EDGE_CONN(conn)); } break; case CONN_TYPE_DIR: diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index b7429788a4..cd04549a9b 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -28,7 +28,6 @@ const char connection_edge_c_id[] = static smartlist_t *redirect_exit_list = NULL; static int connection_ap_handshake_process_socks(edge_connection_t *conn); -static int connection_ap_process_transparent(edge_connection_t *conn); static int connection_exit_connect_dir(edge_connection_t *exit_conn); /** An AP stream has failed/finished. If it hasn't already sent back @@ -110,12 +109,6 @@ connection_edge_process_inbuf(edge_connection_t *conn, int package_partial) return -1; } return 0; - case AP_CONN_STATE_ORIGDST_WAIT: - if (connection_ap_process_transparent(conn) < 0) { - /* already marked */ - return -1; - } - return 0; case AP_CONN_STATE_OPEN: case EXIT_CONN_STATE_OPEN: if (connection_edge_package_raw_inbuf(conn, package_partial) < 0) { @@ -254,7 +247,6 @@ connection_edge_finished_flushing(edge_connection_t *conn) connection_edge_consider_sending_sendme(conn); return 0; case AP_CONN_STATE_SOCKS_WAIT: - case AP_CONN_STATE_ORIGDST_WAIT: case AP_CONN_STATE_RENDDESC_WAIT: case AP_CONN_STATE_CIRCUIT_WAIT: case AP_CONN_STATE_CONNECT_WAIT: @@ -1452,14 +1444,14 @@ connection_ap_handshake_process_socks(edge_connection_t *conn) return connection_ap_handshake_rewrite_and_attach(conn, NULL); } -/** connection_edge_process_inbuf() found a conn in state - * origdst_wait. Get the original destination and - * send it to connection_ap_handshake_rewrite_and_attach(). +/** connection_init_accepted_conn() found a new trans AP conn. + * Get the original destination and send it to + * connection_ap_handshake_rewrite_and_attach(). * * Return -1 if an unexpected error with conn (and it should be marked * for close), else return 0. */ -static int +int connection_ap_process_transparent(edge_connection_t *conn) { socks_request_t *socks; @@ -1467,7 +1459,6 @@ connection_ap_process_transparent(edge_connection_t *conn) tor_assert(conn); tor_assert(conn->_base.type == CONN_TYPE_AP); - tor_assert(conn->_base.state == AP_CONN_STATE_ORIGDST_WAIT); tor_assert(conn->socks_request); socks = conn->socks_request; diff --git a/src/or/control.c b/src/or/control.c index baaaa29899..736cc3ee32 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1583,8 +1583,7 @@ handle_getinfo_helper(control_connection_t *control_conn, origin_circuit_t *origin_circ = NULL; if (conns[i]->type != CONN_TYPE_AP || conns[i]->marked_for_close || - conns[i]->state == AP_CONN_STATE_SOCKS_WAIT || - conns[i]->state == AP_CONN_STATE_ORIGDST_WAIT) + conns[i]->state == AP_CONN_STATE_SOCKS_WAIT) continue; conn = TO_EDGE_CONN(conns[i]); switch (conn->_base.state) diff --git a/src/or/or.h b/src/or/or.h index f2663695e5..68b36d45dd 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -294,10 +294,7 @@ typedef enum { #define AP_CONN_STATE_RESOLVE_WAIT 10 /** State for a SOCKS connection: ready to send and receive. */ #define AP_CONN_STATE_OPEN 11 -/** State for a transparent proxy connection: waiting for original - * destination. */ -#define AP_CONN_STATE_ORIGDST_WAIT 12 -#define _AP_CONN_STATE_MAX 12 +#define _AP_CONN_STATE_MAX 11 #define _DIR_CONN_STATE_MIN 1 /** State for connection to directory server: waiting for connect(). */ @@ -1993,6 +1990,7 @@ void circuit_discard_optional_exit_enclaves(extend_info_t *info); int connection_ap_detach_retriable(edge_connection_t *conn, origin_circuit_t *circ, int reason); +int connection_ap_process_transparent(edge_connection_t *conn); void addressmap_init(void); void addressmap_clean(time_t now);