]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge remote-tracking branch 'public/wide_circ_ids'
authorNick Mathewson <nickm@torproject.org>
Fri, 15 Feb 2013 21:23:43 +0000 (16:23 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 15 Feb 2013 21:23:43 +0000 (16:23 -0500)
Conflicts:
src/or/channel.h
src/or/connection_or.c
src/or/cpuworker.c

15 files changed:
1  2 
src/or/buffers.c
src/or/channel.c
src/or/channel.h
src/or/channeltls.c
src/or/circuitbuild.c
src/or/circuitlist.c
src/or/command.c
src/or/connection.c
src/or/connection_or.c
src/or/connection_or.h
src/or/cpuworker.c
src/or/or.h
src/or/relay.c
src/or/relay.h
src/or/router.c

Simple merge
Simple merge
index ec79888063698ff5aa925e2534348e8978080087,a21271ca1e44cd464065d6f9ab016210e4934c38..0933ec8d3907f703d8579caf971c14d0628d0d36
@@@ -142,7 -142,9 +142,9 @@@ struct channel_s 
     * When we send CREATE cells along this connection, which half of the
     * space should we use?
     */
 -  circ_id_type_t circ_id_type:2;
 +  ENUM_BF(circ_id_type_t) circ_id_type:2;
+   /** DOCDOC*/
+   unsigned wide_circ_ids:1;
    /*
     * Which circ_id do we try to use next on this connection?  This is
     * always in the range 0..1<<15-1.
Simple merge
Simple merge
Simple merge
index 09313b48a2c5f4c95ab0135a38634fb032b571d2,4007cd60013b0214bca2a9a318e8f21daa4547a8..dfe4f659162fd22f9c169ddbc5f26efe003bfe52
@@@ -221,17 -218,12 +221,20 @@@ command_process_create_cell(cell_t *cel
      return;
    }
  
 +  if (cell->circ_id == 0) {
 +    log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
 +           "Received a create cell (type %d) from %s with zero circID; "
 +           " ignoring.", (int)cell->command,
 +           channel_get_actual_remote_descr(chan));
 +    return;
 +  }
 +
    /* If the high bit of the circuit ID is not as expected, close the
     * circ. */
-   id_is_high = cell->circ_id & (1<<15);
+   if (chan->wide_circ_ids)
+     id_is_high = cell->circ_id & (1u<<31);
+   else
+     id_is_high = cell->circ_id & (1u<<15);
    if ((id_is_high &&
         chan->circ_id_type == CIRC_ID_TYPE_HIGHER) ||
        (!id_is_high &&
Simple merge
index 5ec32d63240dee634f6e1867c8c5f40ad67fb107,4da43670ce88808f0c597705c5f52bf335768c69..c4415c5f888a200636ceb6d26176dc8e0af0d662
@@@ -1764,9 -1785,9 +1791,9 @@@ or_handshake_state_record_cell(or_conne
    d = *dptr;
    /* Re-packing like this is a little inefficient, but we don't have to do
       this very often at all. */
-   cell_pack(&packed, cell);
-   crypto_digest_add_bytes(d, packed.body, sizeof(packed.body));
+   cell_pack(&packed, cell, conn->wide_circ_ids);
+   crypto_digest_add_bytes(d, packed.body, cell_network_size);
 -  memset(&packed, 0, sizeof(packed));
 +  memwipe(&packed, 0, sizeof(packed));
  }
  
  /** Remember that a variable-length <b>cell</b> has been transmitted (if
@@@ -1797,11 -1820,11 +1826,11 @@@ or_handshake_state_record_var_cell(or_c
  
    d = *dptr;
  
-   var_cell_pack_header(cell, buf);
-   crypto_digest_add_bytes(d, buf, sizeof(buf));
+   n = var_cell_pack_header(cell, buf, conn->wide_circ_ids);
+   crypto_digest_add_bytes(d, buf, n);
    crypto_digest_add_bytes(d, (const char *)cell->payload, cell->payload_len);
  
 -  memset(buf, 0, sizeof(buf));
 +  memwipe(buf, 0, sizeof(buf));
  }
  
  /** Set <b>conn</b>'s state to OR_CONN_STATE_OPEN, and tell other subsystems
Simple merge
index 444f17cd411b8e40e57c0833da0d2954ba2cb186,a25a8a780aeb2d54eb4d2efcc2eb76675ebda294..af5f91a623c55c198d9875ab21203c8019ac0d39
  #define MIN_CPUWORKERS 1
  
  /** The tag specifies which circuit this onionskin was from. */
- #define TAG_LEN 10
+ #define TAG_LEN 12
 -/** How many bytes are sent from the cpuworker back to tor? */
 -#define LEN_ONION_RESPONSE \
 -  (1+TAG_LEN+ONIONSKIN_REPLY_LEN+CPATH_KEY_MATERIAL_LEN)
  
  /** How many cpuworkers we have running right now. */
  static int num_cpuworkers=0;
@@@ -78,69 -81,12 +78,69 @@@ tag_pack(uint8_t *tag, uint64_t chan_id
  /** Unpack <b>tag</b> into addr, port, and circ_id.
   */
  static void
 -tag_unpack(const char *tag, uint64_t *chan_id, circid_t *circ_id)
 +tag_unpack(const uint8_t *tag, uint64_t *chan_id, circid_t *circ_id)
  {
    *chan_id = get_uint64(tag);
-   *circ_id = get_uint16(tag+8);
+   *circ_id = get_uint32(tag+8);
  }
  
 +/** Magic numbers to make sure our cpuworker_requests don't grow any
 + * mis-framing bugs. */
 +#define CPUWORKER_REQUEST_MAGIC 0xda4afeed
 +#define CPUWORKER_REPLY_MAGIC 0x5eedf00d
 +
 +/** A request sent to a cpuworker. */
 +typedef struct cpuworker_request_t {
 +  /** Magic number; must be CPUWORKER_REQUEST_MAGIC. */
 +  uint32_t magic;
 +  /** Opaque tag to identify the job */
 +  uint8_t tag[TAG_LEN];
 +  /** Task code. Must be one of CPUWORKER_TASK_* */
 +  uint8_t task;
 +
 +  /** Flag: Are we timing this request? */
 +  unsigned timed : 1;
 +  /** If we're timing this request, when was it sent to the cpuworker? */
 +  struct timeval started_at;
 +
 +  /** A create cell for the cpuworker to process. */
 +  create_cell_t create_cell;
 +
 +  /* Turn the above into a tagged union if needed. */
 +} cpuworker_request_t;
 +
 +/** A reply sent by a cpuworker. */
 +typedef struct cpuworker_reply_t {
 +  /** Magic number; must be CPUWORKER_REPLY_MAGIC. */
 +  uint32_t magic;
 +  /** Opaque tag to identify the job; matches the request's tag.*/
 +  uint8_t tag[TAG_LEN];
 +  /** True iff we got a successful request. */
 +  uint8_t success;
 +
 +  /** Are we timing this request? */
 +  unsigned int timed : 1;
 +  /** What handshake type was the request? (Used for timing) */
 +  uint16_t handshake_type;
 +  /** When did we send the request to the cpuworker? */
 +  struct timeval started_at;
 +  /** Once the cpuworker received the request, how many microseconds did it
 +   * take? (This shouldn't overflow; 4 billion micoseconds is over an hour,
 +   * and we'll never have an onion handshake that takes so long.) */
 +  uint32_t n_usec;
 +
 +  /** Output of processing a create cell
 +   *
 +   * @{
 +   */
 +  /** The created cell to send back. */
 +  created_cell_t created_cell;
 +  /** The keys to use on this circuit. */
 +  uint8_t keys[CPATH_KEY_MATERIAL_LEN];
 +  /** Input to use for authenticating introduce1 cells. */
 +  uint8_t rend_auth_material[DIGEST_LEN];
 +} cpuworker_reply_t;
 +
  /** Called when the onion key has changed and we need to spawn new
   * cpuworkers.  Close all currently idle cpuworkers, and mark the last
   * rotation time as now.
diff --cc src/or/or.h
Simple merge
diff --cc src/or/relay.c
Simple merge
diff --cc src/or/relay.h
Simple merge
diff --cc src/or/router.c
Simple merge