[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r8945: Patch from tup based on patch from Zajcev Evgeny: Make Trans (in tor/trunk: . src/or)



Author: nickm
Date: 2006-11-13 19:06:02 -0500 (Mon, 13 Nov 2006)
New Revision: 8945

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/control.c
   tor/trunk/src/or/or.h
Log:
 r9307@totoro:  nickm | 2006-11-13 18:25:56 -0500
 Patch from tup based on patch from Zajcev Evgeny: Make TransPort work even when the server wants to talk before the client.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r9307] on 96637b51-b116-0410-a10e-9941ebb49b64

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-11-13 07:17:31 UTC (rev 8944)
+++ tor/trunk/ChangeLog	2006-11-14 00:06:02 UTC (rev 8945)
@@ -2,6 +2,12 @@
   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.

Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2006-11-13 07:17:31 UTC (rev 8944)
+++ tor/trunk/src/or/connection.c	2006-11-14 00:06:02 UTC (rev 8945)
@@ -96,7 +96,6 @@
       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 @@
 
 /** Initialize states for newly accepted connection <b>conn</b>.
  * 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 @@
           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:

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2006-11-13 07:17:31 UTC (rev 8944)
+++ tor/trunk/src/or/connection_edge.c	2006-11-14 00:06:02 UTC (rev 8945)
@@ -28,7 +28,6 @@
 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 @@
         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_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 @@
   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 @@
 
   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;
 

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2006-11-13 07:17:31 UTC (rev 8944)
+++ tor/trunk/src/or/control.c	2006-11-14 00:06:02 UTC (rev 8945)
@@ -1583,8 +1583,7 @@
       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)

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-11-13 07:17:31 UTC (rev 8944)
+++ tor/trunk/src/or/or.h	2006-11-14 00:06:02 UTC (rev 8945)
@@ -294,10 +294,7 @@
 #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 @@
 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);