Ticket #18462: patch.diff

File patch.diff, 9.4 KB (added by icanhasaccount, 4 years ago)

Rename tor_dup_addr to tor_addr_to_str_dup

  • src/common/address.c

    diff --git a/src/common/address.c b/src/common/address.c
    index 8f1ce9d..face749 100644
    a b tor_addr_hash(const tor_addr_t *addr) 
    11721172
    11731173/** Return a newly allocated string with a representation of <b>addr</b>. */
    11741174char *
    1175 tor_dup_addr(const tor_addr_t *addr)
     1175tor_addr_to_str_dup(const tor_addr_t *addr)
    11761176{
    11771177  char buf[TOR_ADDR_BUF_LEN];
    11781178  if (tor_addr_to_str(buf, addr, sizeof(buf), 0)) {
    MOCK_IMPL(smartlist_t *,get_interface_address6_list,(int severity, 
    17901790    if (get_interface_address6_via_udp_socket_hack(severity,AF_INET,
    17911791                                                   &addr) == 0) {
    17921792      if (include_internal || !tor_addr_is_internal(&addr, 0)) {
    1793         smartlist_add(addrs, tor_dup_addr(&addr));
     1793        smartlist_add(addrs, tor_addr_to_str_dup(&addr));
    17941794      }
    17951795    }
    17961796  }
    MOCK_IMPL(smartlist_t *,get_interface_address6_list,(int severity, 
    17991799    if (get_interface_address6_via_udp_socket_hack(severity,AF_INET6,
    18001800                                                   &addr) == 0) {
    18011801      if (include_internal || !tor_addr_is_internal(&addr, 0)) {
    1802         smartlist_add(addrs, tor_dup_addr(&addr));
     1802        smartlist_add(addrs, tor_addr_to_str_dup(&addr));
    18031803      }
    18041804    }
    18051805  }
  • src/common/address.h

    diff --git a/src/common/address.h b/src/common/address.h
    index 53712bd..3de67e1 100644
    a b tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u) 
    179179#define TOR_ADDR_BUF_LEN 48
    180180
    181181int tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr_out);
    182 char *tor_dup_addr(const tor_addr_t *addr) ATTR_MALLOC;
     182char *tor_addr_to_str_dup(const tor_addr_t *addr) ATTR_MALLOC;
    183183
    184184/** Wrapper function of fmt_addr_impl(). It does not decorate IPv6
    185185 *  addresses. */
  • src/or/channel.c

    diff --git a/src/or/channel.c b/src/or/channel.c
    index 851d837..96aeaae 100644
    a b channel_dump_statistics, (channel_t *chan, int severity)) 
    34803480  have_remote_addr = channel_get_addr_if_possible(chan, &remote_addr);
    34813481  if (have_remote_addr) {
    34823482    char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
    3483     remote_addr_str = tor_dup_addr(&remote_addr);
     3483    remote_addr_str = tor_addr_to_str_dup(&remote_addr);
    34843484    tor_log(severity, LD_GENERAL,
    34853485        " * Channel " U64_FORMAT " says its remote address"
    34863486        " is %s, and gives a canonical description of \"%s\" and an "
  • src/or/channeltls.c

    diff --git a/src/or/channeltls.c b/src/or/channeltls.c
    index 30165bf..92d73a8 100644
    a b channel_tls_get_remote_descr_method(channel_t *chan, int flags) 
    554554        break;
    555555      case GRD_FLAG_ORIGINAL:
    556556        /* Actual address with port */
    557         addr_str = tor_dup_addr(&(tlschan->conn->real_addr));
     557        addr_str = tor_addr_to_str_dup(&(tlschan->conn->real_addr));
    558558        tor_snprintf(buf, MAX_DESCR_LEN + 1,
    559559                     "%s:%u", addr_str, conn->port);
    560560        tor_free(addr_str);
    channel_tls_get_remote_descr_method(channel_t *chan, int flags) 
    567567        break;
    568568      case GRD_FLAG_ORIGINAL|GRD_FLAG_ADDR_ONLY:
    569569        /* Actual address, no port */
    570         addr_str = tor_dup_addr(&(tlschan->conn->real_addr));
     570        addr_str = tor_addr_to_str_dup(&(tlschan->conn->real_addr));
    571571        strlcpy(buf, addr_str, sizeof(buf));
    572572        tor_free(addr_str);
    573573        answer = buf;
  • src/or/connection.c

    diff --git a/src/or/connection.c b/src/or/connection.c
    index 2e1c508..177f0e9 100644
    a b connection_handle_listener_read(connection_t *conn, int new_type) 
    15511551    /* remember the remote address */
    15521552    tor_addr_copy(&newconn->addr, &addr);
    15531553    newconn->port = port;
    1554     newconn->address = tor_dup_addr(&addr);
     1554    newconn->address = tor_addr_to_str_dup(&addr);
    15551555
    15561556    if (new_type == CONN_TYPE_AP && conn->socket_family != AF_UNIX) {
    15571557      log_info(LD_NET, "New SOCKS connection opened from %s.",
    retry_listener_ports(smartlist_t *old_conns, 
    25202520                                           real_port,
    25212521                                           listensockaddr,
    25222522                                           sizeof(struct sockaddr_storage));
    2523       address = tor_dup_addr(&port->addr);
     2523      address = tor_addr_to_str_dup(&port->addr);
    25242524    }
    25252525
    25262526    if (listensockaddr) {
  • src/or/connection_edge.c

    diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
    index f680e1d..f037071 100644
    a b connection_ap_handshake_send_resolve(entry_connection_t *ap_conn) 
    24332433
    24342434  if (!base_conn->address) {
    24352435    /* This might be unnecessary. XXXX */
    2436     base_conn->address = tor_dup_addr(&base_conn->addr);
     2436    base_conn->address = tor_addr_to_str_dup(&base_conn->addr);
    24372437  }
    24382438  base_conn->state = AP_CONN_STATE_RESOLVE_WAIT;
    24392439  log_info(LD_APP,"Address sent for resolve, ap socket "TOR_SOCKET_T_FORMAT
  • src/or/connection_or.c

    diff --git a/src/or/connection_or.c b/src/or/connection_or.c
    index f39d5b2..c7b47d6 100644
    a b connection_or_init_conn_from_address(or_connection_t *conn, 
    912912    }
    913913    conn->nickname = tor_strdup(node_get_nickname(r));
    914914    tor_free(conn->base_.address);
    915     conn->base_.address = tor_dup_addr(&node_ap.addr);
     915    conn->base_.address = tor_addr_to_str_dup(&node_ap.addr);
    916916  } else {
    917917    conn->nickname = tor_malloc(HEX_DIGEST_LEN+2);
    918918    conn->nickname[0] = '$';
    connection_or_init_conn_from_address(or_connection_t *conn, 
    920920                  conn->identity_digest, DIGEST_LEN);
    921921
    922922    tor_free(conn->base_.address);
    923     conn->base_.address = tor_dup_addr(addr);
     923    conn->base_.address = tor_addr_to_str_dup(addr);
    924924  }
    925925
    926926  /*
  • src/or/directory.c

    diff --git a/src/or/directory.c b/src/or/directory.c
    index e4feda4..22fa3f2 100644
    a b directory_initiate_command_rend(const tor_addr_port_t *or_addr_port, 
    11221122  /* set up conn so it's got all the data we need to remember */
    11231123  tor_addr_copy(&conn->base_.addr, &addr);
    11241124  conn->base_.port = port;
    1125   conn->base_.address = tor_dup_addr(&addr);
     1125  conn->base_.address = tor_addr_to_str_dup(&addr);
    11261126  memcpy(conn->identity_digest, digest, DIGEST_LEN);
    11271127
    11281128  conn->base_.purpose = dir_purpose;
  • src/or/dnsserv.c

    diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
    index 8ddb414..3b48d80 100644
    a b evdns_server_callback(struct evdns_server_request *req, void *data_) 
    132132
    133133  tor_addr_copy(&TO_CONN(conn)->addr, &tor_addr);
    134134  TO_CONN(conn)->port = port;
    135   TO_CONN(conn)->address = tor_dup_addr(&tor_addr);
     135  TO_CONN(conn)->address = tor_addr_to_str_dup(&tor_addr);
    136136
    137137  if (q->type == EVDNS_TYPE_A || q->type == EVDNS_TYPE_AAAA ||
    138138      q->type == EVDNS_QTYPE_ALL) {
    dnsserv_launch_request(const char *name, int reverse, 
    207207  tor_addr_copy(&TO_CONN(conn)->addr, &control_conn->base_.addr);
    208208#ifdef AF_UNIX
    209209  /*
    210    * The control connection can be AF_UNIX and if so tor_dup_addr will
     210   * The control connection can be AF_UNIX and if so tor_addr_to_str_dup will
    211211   * unhelpfully say "<unknown address type>"; say "(Tor_internal)"
    212212   * instead.
    213213   */
    dnsserv_launch_request(const char *name, int reverse, 
    216216    TO_CONN(conn)->address = tor_strdup("(Tor_internal)");
    217217  } else {
    218218    TO_CONN(conn)->port = control_conn->base_.port;
    219     TO_CONN(conn)->address = tor_dup_addr(&control_conn->base_.addr);
     219    TO_CONN(conn)->address = tor_addr_to_str_dup(&control_conn->base_.addr);
    220220  }
    221221#else
    222222  TO_CONN(conn)->port = control_conn->base_.port;
    223   TO_CONN(conn)->address = tor_dup_addr(&control_conn->base_.addr);
     223  TO_CONN(conn)->address = tor_addr_to_str_dup(&control_conn->base_.addr);
    224224#endif
    225225
    226226  if (reverse)
  • src/or/ext_orport.c

    diff --git a/src/or/ext_orport.c b/src/or/ext_orport.c
    index 584abf6..e5290b6 100644
    a b connection_ext_or_handle_cmd_useraddr(connection_t *conn, 
    461461    return -1;
    462462
    463463  { /* do some logging */
    464     char *old_address = tor_dup_addr(&conn->addr);
    465     char *new_address = tor_dup_addr(&addr);
     464    char *old_address = tor_addr_to_str_dup(&conn->addr);
     465    char *new_address = tor_addr_to_str_dup(&addr);
    466466
    467467    log_debug(LD_NET, "Received USERADDR."
    468468             "We rewrite our address from '%s:%u' to '%s:%u'.",
    connection_ext_or_handle_cmd_useraddr(connection_t *conn, 
    478478  if (conn->address) {
    479479    tor_free(conn->address);
    480480  }
    481   conn->address = tor_dup_addr(&addr);
     481  conn->address = tor_addr_to_str_dup(&addr);
    482482
    483483  return 0;
    484484}
  • src/or/rendcommon.c

    diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
    index 7f7d04b..9cac7bb 100644
    a b rend_encode_v2_intro_points(char **encoded, rend_service_descriptor_t *desc) 
    209209      goto done;
    210210    }
    211211    /* Assemble everything for this introduction point. */
    212     address = tor_dup_addr(&info->addr);
     212    address = tor_addr_to_str_dup(&info->addr);
    213213    res = tor_snprintf(unenc + unenc_written, unenc_len - unenc_written,
    214214                         "introduction-point %s\n"
    215215                         "ip-address %s\n"
  • src/or/routerlist.c

    diff --git a/src/or/routerlist.c b/src/or/routerlist.c
    index de42286..d148482 100644
    a b dir_server_new(int is_authority, 
    42744274    return NULL;
    42754275
    42764276  if (!hostname)
    4277     hostname_ = tor_dup_addr(addr);
     4277    hostname_ = tor_addr_to_str_dup(addr);
    42784278  else
    42794279    hostname_ = tor_strdup(hostname);
    42804280