Ticket #23577: 009-bugfix-r1.patch

File 009-bugfix-r1.patch, 4.8 KB (added by neel, 3 years ago)

Revision patch 1

  • src/or/hs_circuit.c

    From 0f0d5262171e772ad9f463e801a0d22ac9e78821 Mon Sep 17 00:00:00 2001
    From: Neel Chauhan <neel@neelc.org>
    Date: Tue, 14 Nov 2017 13:38:59 -0500
    Subject: [PATCH 1/3] Add smartlist_add() in IPv6 section of
     get_lspecs_from_node()
    
    ---
     src/or/hs_circuit.c | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
    index 26fe22eb7..9e7709504 100644
    a b get_lspecs_from_node(const node_t *node, smartlist_t *lspecs) 
    617617    link_specifier_set_un_ipv6_port(ls, ap.port);
    618618    /* Sixteen bytes IPv6 and two bytes port. */
    619619    link_specifier_set_ls_len(ls, addr_len + sizeof(ap.port));
     620    smartlist_add(lspecs, ls);
    620621  }
    621622}
    622623
  • src/or/hs_circuit.c

    -- 
    2.15.0
    
    
    From 8348b445bbae09fd107b4bb20fea3d54e3439697 Mon Sep 17 00:00:00 2001
    From: Neel Chauhan <neel@neelc.org>
    Date: Tue, 14 Nov 2017 16:18:16 -0500
    Subject: [PATCH 2/3] Make intro1_data a pointer
    
    ---
     src/or/hs_circuit.c | 18 ++++++++++--------
     1 file changed, 10 insertions(+), 8 deletions(-)
    
    diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
    index 9e7709504..9e99cf8dd 100644
    a b hs_circ_send_introduce1(origin_circuit_t *intro_circ, 
    10941094  int ret = -1;
    10951095  ssize_t payload_len;
    10961096  uint8_t payload[RELAY_PAYLOAD_SIZE] = {0};
    1097   hs_cell_introduce1_data_t intro1_data;
     1097  hs_cell_introduce1_data_t *intro1_data =
     1098    tor_malloc_zero(sizeof(hs_cell_introduce1_data_t));
    10981099
    10991100  tor_assert(intro_circ);
    11001101  tor_assert(rend_circ);
    hs_circ_send_introduce1(origin_circuit_t *intro_circ, 
    11041105  /* This takes various objects in order to populate the introduce1 data
    11051106   * object which is used to build the content of the cell. */
    11061107  const node_t *exit_node = build_state_get_exit_node(rend_circ->build_state);
    1107   setup_introduce1_data(ip, exit_node, subcredential, &intro1_data);
     1108  setup_introduce1_data(ip, exit_node, subcredential, intro1_data);
    11081109  /* If we didn't get any link specifiers, it's because our node was
    11091110   * bad. */
    1110   if (BUG(!intro1_data.link_specifiers) ||
    1111       !smartlist_len(intro1_data.link_specifiers)) {
     1111  if (BUG(!intro1_data->link_specifiers) ||
     1112      !smartlist_len(intro1_data->link_specifiers)) {
    11121113    log_warn(LD_REND, "Unable to get link specifiers for INTRODUCE1 cell on "
    11131114             "circuit %u.", TO_CIRCUIT(intro_circ)->n_circ_id);
    11141115    goto done;
    hs_circ_send_introduce1(origin_circuit_t *intro_circ, 
    11171118  /* Final step before we encode a cell, we setup the circuit identifier which
    11181119   * will generate both the rendezvous cookie and client keypair for this
    11191120   * connection. Those are put in the ident. */
    1120   intro1_data.rendezvous_cookie = rend_circ->hs_ident->rendezvous_cookie;
    1121   intro1_data.client_kp = &rend_circ->hs_ident->rendezvous_client_kp;
     1121  intro1_data->rendezvous_cookie = rend_circ->hs_ident->rendezvous_cookie;
     1122  intro1_data->client_kp = &rend_circ->hs_ident->rendezvous_client_kp;
    11221123
    11231124  memcpy(intro_circ->hs_ident->rendezvous_cookie,
    11241125         rend_circ->hs_ident->rendezvous_cookie,
    hs_circ_send_introduce1(origin_circuit_t *intro_circ, 
    11261127
    11271128  /* From the introduce1 data object, this will encode the INTRODUCE1 cell
    11281129   * into payload which is then ready to be sent as is. */
    1129   payload_len = hs_cell_build_introduce1(&intro1_data, payload);
     1130  payload_len = hs_cell_build_introduce1(intro1_data, payload);
    11301131  if (BUG(payload_len < 0)) {
    11311132    goto done;
    11321133  }
    hs_circ_send_introduce1(origin_circuit_t *intro_circ, 
    11461147  goto done;
    11471148
    11481149 done:
    1149   hs_cell_introduce1_data_clear(&intro1_data);
     1150  hs_cell_introduce1_data_clear(intro1_data);
     1151  tor_free(intro1_data);
    11501152  memwipe(payload, 0, sizeof(payload));
    11511153  return ret;
    11521154}
  • src/or/hs_circuit.c

    -- 
    2.15.0
    
    
    From dae2dab17a2fc5036b7c05b71a2a9bb9e512b120 Mon Sep 17 00:00:00 2001
    From: Neel Chauhan <neel@neelc.org>
    Date: Tue, 14 Nov 2017 16:40:16 -0500
    Subject: [PATCH 3/3] Add error message for setup_introduce1_data() in
     hs_circ_send_introduce1()
    
    ---
     src/or/hs_circuit.c | 5 +++++
     1 file changed, 5 insertions(+)
    
    diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
    index 9e99cf8dd..8fcbc9338 100644
    a b hs_circ_send_introduce1(origin_circuit_t *intro_circ, 
    11051105  /* This takes various objects in order to populate the introduce1 data
    11061106   * object which is used to build the content of the cell. */
    11071107  const node_t *exit_node = build_state_get_exit_node(rend_circ->build_state);
     1108  if (exit_node == NULL) {
     1109    log_info(LD_REND, "Unable to get rendezvous point for circuit %u. "
     1110             "Failing.", TO_CIRCUIT(intro_circ)->n_circ_id);
     1111    goto done;
     1112  }
    11081113  setup_introduce1_data(ip, exit_node, subcredential, intro1_data);
    11091114  /* If we didn't get any link specifiers, it's because our node was
    11101115   * bad. */