[tor-commits] [tor/master] Merge remote-tracking branch 'public/split_entry_conn'

nickm at torproject.org nickm at torproject.org
Wed Sep 7 18:12:54 UTC 2011


commit 0cb01f5c971e497706b209c3fe75aedd089e3c8a
Merge: 8aad677 569fe93
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Sep 7 14:13:57 2011 -0400

    Merge remote-tracking branch 'public/split_entry_conn'
    
    Conflicts:
    	src/or/connection.c
    	src/or/connection_edge.c
    	src/or/connection_edge.h
    	src/or/dnsserv.c
    
    Some of these were a little tricky, since they touched code that
    changed because of the prop171 fixes.

 src/or/circuitbuild.c    |   15 +-
 src/or/circuituse.c      |   99 ++++++-----
 src/or/circuituse.h      |    6 +-
 src/or/connection.c      |  106 +++++++-----
 src/or/connection.h      |    1 +
 src/or/connection_edge.c |  413 ++++++++++++++++++++++++----------------------
 src/or/connection_edge.h |   29 ++--
 src/or/control.c         |   64 ++++----
 src/or/control.h         |    2 +-
 src/or/directory.c       |    9 +-
 src/or/dnsserv.c         |   60 ++++---
 src/or/dnsserv.h         |    4 +-
 src/or/hibernate.c       |    2 +-
 src/or/main.c            |    8 +-
 src/or/or.h              |  104 ++++++++----
 src/or/relay.c           |  102 +++++++-----
 src/or/rendclient.c      |   34 ++--
 17 files changed, 585 insertions(+), 473 deletions(-)

diff --cc src/or/connection.c
index 1b227d7,012a3fb..97989c0
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@@ -1211,10 -1268,9 +1231,10 @@@ connection_init_accepted_conn(connectio
        control_event_or_conn_status(TO_OR_CONN(conn), OR_CONN_EVENT_NEW, 0);
        return connection_tls_start_handshake(TO_OR_CONN(conn), 1);
      case CONN_TYPE_AP:
-       TO_EDGE_CONN(conn)->isolation_flags = listener->isolation_flags;
-       TO_EDGE_CONN(conn)->session_group = listener->session_group;
-       TO_EDGE_CONN(conn)->nym_epoch = get_signewnym_epoch();
-       TO_EDGE_CONN(conn)->socks_request->listener_type = listener->_base.type;
+       TO_ENTRY_CONN(conn)->isolation_flags = listener->isolation_flags;
+       TO_ENTRY_CONN(conn)->session_group = listener->session_group;
+       TO_ENTRY_CONN(conn)->nym_epoch = get_signewnym_epoch();
++      TO_ENTRY_CONN(conn)->socks_request->listener_type = listener->_base.type;
        switch (TO_CONN(listener)->type) {
          case CONN_TYPE_AP_LISTENER:
            conn->state = AP_CONN_STATE_SOCKS_WAIT;
diff --cc src/or/connection_edge.c
index 7028764,df4acc4..0d2c10f
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@@ -2441,12 -2455,11 +2454,11 @@@ connection_ap_handshake_send_begin(entr
         ap_conn->sending_optimistic_data) &&
        connection_ap_supports_optimistic_data(ap_conn)) {
      log_info(LD_APP, "Sending up to %ld + %ld bytes of queued-up data",
-              (long)connection_get_inbuf_len(TO_CONN(ap_conn)),
-              ap_conn->sending_optimistic_data ?
-                  (long)generic_buffer_len(ap_conn->sending_optimistic_data) :
-                  0);
-     if (connection_edge_package_raw_inbuf(ap_conn, 1, NULL) < 0) {
-       connection_mark_for_close(TO_CONN(ap_conn));
 -             connection_get_inbuf_len(base_conn),
++             (long)connection_get_inbuf_len(base_conn),
+ 	     ap_conn->sending_optimistic_data ?
 -		generic_buffer_len(ap_conn->sending_optimistic_data) : 0);
++               (long)generic_buffer_len(ap_conn->sending_optimistic_data) : 0);
+     if (connection_edge_package_raw_inbuf(edge_conn, 1, NULL) < 0) {
+       connection_mark_for_close(base_conn);
      }
    }
  
@@@ -3380,9 -3425,9 +3395,9 @@@ connection_edge_compatible_with_circuit
        tor_strdup(conn->socks_request->address);
    }
  
 -  /* If isolation_values_set, then the circuit is not compatible with
 -   * any new ISO_STREAM stream. */
 -  if (iso & ISO_STREAM)
 +  if ((iso & ISO_STREAM) &&
 +      (circ->associated_isolated_stream_global_id !=
-        TO_CONN(conn)->global_identifier))
++       ENTRY_TO_CONN(conn)->global_identifier))
      return 0;
  
    if ((iso & ISO_DESTPORT) && conn->socks_request->port != circ->dest_port)
@@@ -3435,21 -3477,17 +3450,21 @@@ connection_edge_update_circuit_isolatio
    if (!circ->isolation_values_set) {
      if (dry_run)
        return -1;
 +    circ->associated_isolated_stream_global_id =
-       TO_CONN(conn)->global_identifier;
++      ENTRY_TO_CONN(conn)->global_identifier;
      circ->dest_port = conn->socks_request->port;
      circ->dest_address = tor_strdup(conn->original_dest_address);
 -    circ->client_proto_type = ENTRY_TO_CONN(conn)->type;
 +    circ->client_proto_type = conn->socks_request->listener_type;
      circ->client_proto_socksver = conn->socks_request->socks_version;
-     tor_addr_copy(&circ->client_addr, &TO_CONN(conn)->addr);
+     tor_addr_copy(&circ->client_addr, &ENTRY_TO_CONN(conn)->addr);
      circ->session_group = conn->session_group;
      circ->nym_epoch = conn->nym_epoch;
 -    circ->socks_username = conn->socks_request->username ?
 -      tor_strdup(conn->socks_request->username) : NULL;
 -    circ->socks_password = conn->socks_request->password ?
 -      tor_strdup(conn->socks_request->password) : NULL;
 +    circ->socks_username = sr->username ?
 +      tor_memdup(sr->username, sr->usernamelen) : NULL;
 +    circ->socks_password = sr->password ?
 +      tor_memdup(sr->password, sr->passwordlen) : NULL;
 +    circ->socks_username_len = sr->usernamelen;
 +    circ->socks_password_len = sr->passwordlen;
  
      circ->isolation_values_set = 1;
      return 0;
@@@ -3459,15 -3497,13 +3474,15 @@@
        mixed |= ISO_DESTPORT;
      if (strcasecmp(conn->original_dest_address, circ->dest_address))
        mixed |= ISO_DESTADDR;
 -    if (strcmp_opt(conn->socks_request->username, circ->socks_username) ||
 -        strcmp_opt(conn->socks_request->password, circ->socks_password))
 +    if (!memeq_opt(sr->username, sr->usernamelen,
 +                   circ->socks_username, circ->socks_username_len) ||
 +        !memeq_opt(sr->password, sr->passwordlen,
 +                   circ->socks_password, circ->socks_password_len))
        mixed |= ISO_SOCKSAUTH;
 -    if ((ENTRY_TO_CONN(conn)->type != circ->client_proto_type ||
 +    if ((conn->socks_request->listener_type != circ->client_proto_type ||
           conn->socks_request->socks_version != circ->client_proto_socksver))
        mixed |= ISO_CLIENTPROTO;
-     if (!tor_addr_eq(&TO_CONN(conn)->addr, &circ->client_addr))
+     if (!tor_addr_eq(&ENTRY_TO_CONN(conn)->addr, &circ->client_addr))
        mixed |= ISO_CLIENTADDR;
      if (conn->session_group != circ->session_group)
        mixed |= ISO_SESSIONGRP;
diff --cc src/or/connection_edge.h
index 36aead1,cf60cf4..75a54e8
--- a/src/or/connection_edge.h
+++ b/src/or/connection_edge.h
@@@ -105,9 -105,11 +105,10 @@@ hostname_type_t parse_extended_hostname
  int get_pf_socket(void);
  #endif
  
- int connection_edge_compatible_with_circuit(const edge_connection_t *conn,
 -int connection_edge_streams_are_compatible(const entry_connection_t *a,
 -                                           const entry_connection_t *b);
++
+ int connection_edge_compatible_with_circuit(const entry_connection_t *conn,
                                              const origin_circuit_t *circ);
- int connection_edge_update_circuit_isolation(const edge_connection_t *conn,
+ int connection_edge_update_circuit_isolation(const entry_connection_t *conn,
                                               origin_circuit_t *circ,
                                               int dry_run);
  void circuit_clear_isolation(origin_circuit_t *circ);
diff --cc src/or/dnsserv.c
index 19d0427,a54530c..7f51939
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@@ -124,23 -126,22 +126,23 @@@ evdns_server_callback(struct evdns_serv
    TO_CONN(conn)->address = tor_dup_addr(&tor_addr);
  
    if (q->type == EVDNS_TYPE_A)
-     conn->socks_request->command = SOCKS_COMMAND_RESOLVE;
+     entry_conn->socks_request->command = SOCKS_COMMAND_RESOLVE;
    else
-     conn->socks_request->command = SOCKS_COMMAND_RESOLVE_PTR;
+     entry_conn->socks_request->command = SOCKS_COMMAND_RESOLVE_PTR;
  
-   strlcpy(conn->socks_request->address, q->name,
-           sizeof(conn->socks_request->address));
+   strlcpy(entry_conn->socks_request->address, q->name,
+           sizeof(entry_conn->socks_request->address));
  
-   conn->socks_request->listener_type = listener->_base.type;
-   conn->dns_server_request = req;
-   conn->isolation_flags = listener->isolation_flags;
-   conn->session_group = listener->session_group;
-   conn->nym_epoch = get_signewnym_epoch();
++  entry_conn->socks_request->listener_type = listener->_base.type;
+   entry_conn->dns_server_request = req;
+   entry_conn->isolation_flags = listener->isolation_flags;
+   entry_conn->session_group = listener->session_group;
+   entry_conn->nym_epoch = get_signewnym_epoch();
  
-   if (connection_add(TO_CONN(conn)) < 0) {
+   if (connection_add(ENTRY_TO_CONN(entry_conn)) < 0) {
      log_warn(LD_APP, "Couldn't register dummy connection for DNS request");
      evdns_server_request_respond(req, DNS_ERR_SERVERFAILED);
-     connection_free(TO_CONN(conn));
+     connection_free(ENTRY_TO_CONN(entry_conn));
      return;
    }
  
@@@ -183,14 -186,13 +187,14 @@@ dnsserv_launch_request(const char *name
  
    conn->is_dns_request = 1;
  
-   strlcpy(conn->socks_request->address, name,
-           sizeof(conn->socks_request->address));
+   strlcpy(entry_conn->socks_request->address, name,
+           sizeof(entry_conn->socks_request->address));
  
-   conn->socks_request->listener_type = CONN_TYPE_CONTROL_LISTENER;
-   conn->original_dest_address = tor_strdup(name);
-   conn->session_group = SESSION_GROUP_CONTROL_RESOLVE;
-   conn->nym_epoch = get_signewnym_epoch();
-   conn->isolation_flags = ISO_DEFAULT;
++  entry_conn->socks_request->listener_type = CONN_TYPE_CONTROL_LISTENER;
+   entry_conn->original_dest_address = tor_strdup(name);
+   entry_conn->session_group = SESSION_GROUP_CONTROL_RESOLVE;
+   entry_conn->nym_epoch = get_signewnym_epoch();
+   entry_conn->isolation_flags = ISO_DEFAULT;
  
    if (connection_add(TO_CONN(conn))<0) {
      log_warn(LD_APP, "Couldn't register dummy connection for RESOLVE request");



More information about the tor-commits mailing list