mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
stop passing "address" around the directory_initiate_command* funcs
since it was always just the string version of "addr" anyway
This commit is contained in:
parent
99185397de
commit
ccaefd65a4
@ -86,8 +86,7 @@ static void dir_microdesc_download_failed(smartlist_t *failed,
|
||||
static void note_client_request(int purpose, int compressed, size_t bytes);
|
||||
static int client_likes_consensus(networkstatus_t *v, const char *want_url);
|
||||
|
||||
static void directory_initiate_command_rend(const char *address,
|
||||
const tor_addr_t *addr,
|
||||
static void directory_initiate_command_rend(const tor_addr_t *addr,
|
||||
uint16_t or_port,
|
||||
uint16_t dir_port,
|
||||
const char *digest,
|
||||
@ -483,7 +482,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
|
||||
tor_addr_t addr;
|
||||
routerinfo_t *ri = node->ri;
|
||||
node_get_addr(node, &addr);
|
||||
directory_initiate_command(ri->address, &addr,
|
||||
directory_initiate_command(&addr,
|
||||
ri->or_port, 0/*no dirport*/,
|
||||
ri->cache_info.identity_digest,
|
||||
dir_purpose,
|
||||
@ -616,9 +615,6 @@ directory_initiate_command_routerstatus_rend(const routerstatus_t *status,
|
||||
{
|
||||
const or_options_t *options = get_options();
|
||||
const node_t *node;
|
||||
char address_buf[INET_NTOA_BUF_LEN+1];
|
||||
struct in_addr in;
|
||||
const char *address;
|
||||
tor_addr_t addr;
|
||||
const int anonymized_connection = dirind_is_anon(indirection);
|
||||
node = node_get_by_id(status->identity_digest);
|
||||
@ -628,13 +624,6 @@ directory_initiate_command_routerstatus_rend(const routerstatus_t *status,
|
||||
"don't have its router descriptor.",
|
||||
routerstatus_describe(status));
|
||||
return;
|
||||
} else if (node) {
|
||||
node_get_address_string(node, address_buf, sizeof(address_buf));
|
||||
address = address_buf;
|
||||
} else {
|
||||
in.s_addr = htonl(status->addr);
|
||||
tor_inet_ntoa(&in, address_buf, sizeof(address_buf));
|
||||
address = address_buf;
|
||||
}
|
||||
tor_addr_from_ipv4h(&addr, status->addr);
|
||||
|
||||
@ -648,7 +637,7 @@ directory_initiate_command_routerstatus_rend(const routerstatus_t *status,
|
||||
return;
|
||||
}
|
||||
|
||||
directory_initiate_command_rend(address, &addr,
|
||||
directory_initiate_command_rend(&addr,
|
||||
status->or_port, status->dir_port,
|
||||
status->identity_digest,
|
||||
dir_purpose, router_purpose,
|
||||
@ -907,7 +896,7 @@ directory_command_should_use_begindir(const or_options_t *options,
|
||||
* <b>supports_begindir</b>, and whose identity key digest is
|
||||
* <b>digest</b>. */
|
||||
void
|
||||
directory_initiate_command(const char *address, const tor_addr_t *_addr,
|
||||
directory_initiate_command(const tor_addr_t *_addr,
|
||||
uint16_t or_port, uint16_t dir_port,
|
||||
const char *digest,
|
||||
uint8_t dir_purpose, uint8_t router_purpose,
|
||||
@ -915,7 +904,7 @@ directory_initiate_command(const char *address, const tor_addr_t *_addr,
|
||||
const char *payload, size_t payload_len,
|
||||
time_t if_modified_since)
|
||||
{
|
||||
directory_initiate_command_rend(address, _addr, or_port, dir_port,
|
||||
directory_initiate_command_rend(_addr, or_port, dir_port,
|
||||
digest, dir_purpose,
|
||||
router_purpose, indirection,
|
||||
resource, payload, payload_len,
|
||||
@ -939,7 +928,7 @@ is_sensitive_dir_purpose(uint8_t dir_purpose)
|
||||
/** Same as directory_initiate_command(), but accepts rendezvous data to
|
||||
* fetch a hidden service descriptor. */
|
||||
static void
|
||||
directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
|
||||
directory_initiate_command_rend(const tor_addr_t *_addr,
|
||||
uint16_t or_port, uint16_t dir_port,
|
||||
const char *digest,
|
||||
uint8_t dir_purpose, uint8_t router_purpose,
|
||||
@ -957,7 +946,6 @@ directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
|
||||
const int anonymized_connection = dirind_is_anon(indirection);
|
||||
tor_addr_t addr;
|
||||
|
||||
tor_assert(address);
|
||||
tor_assert(_addr);
|
||||
tor_assert(or_port || dir_port);
|
||||
tor_assert(digest);
|
||||
@ -990,7 +978,7 @@ directory_initiate_command_rend(const char *address, const tor_addr_t *_addr,
|
||||
/* set up conn so it's got all the data we need to remember */
|
||||
tor_addr_copy(&conn->base_.addr, &addr);
|
||||
conn->base_.port = use_begindir ? or_port : dir_port;
|
||||
conn->base_.address = tor_strdup(address);
|
||||
conn->base_.address = tor_dup_addr(&addr);
|
||||
memcpy(conn->identity_digest, digest, DIGEST_LEN);
|
||||
|
||||
conn->base_.purpose = dir_purpose;
|
||||
|
@ -63,7 +63,7 @@ int connection_dir_process_inbuf(dir_connection_t *conn);
|
||||
int connection_dir_finished_flushing(dir_connection_t *conn);
|
||||
int connection_dir_finished_connecting(dir_connection_t *conn);
|
||||
void connection_dir_about_to_close(dir_connection_t *dir_conn);
|
||||
void directory_initiate_command(const char *address, const tor_addr_t *addr,
|
||||
void directory_initiate_command(const tor_addr_t *addr,
|
||||
uint16_t or_port, uint16_t dir_port,
|
||||
const char *digest,
|
||||
uint8_t dir_purpose, uint8_t router_purpose,
|
||||
|
@ -1739,7 +1739,6 @@ find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port,
|
||||
static void
|
||||
launch_direct_bridge_descriptor_fetch(bridge_info_t *bridge)
|
||||
{
|
||||
char *address;
|
||||
const or_options_t *options = get_options();
|
||||
|
||||
if (connection_get_by_type_addr_port_purpose(
|
||||
@ -1754,15 +1753,12 @@ launch_direct_bridge_descriptor_fetch(bridge_info_t *bridge)
|
||||
return;
|
||||
}
|
||||
|
||||
address = tor_dup_addr(&bridge->addr);
|
||||
|
||||
directory_initiate_command(address, &bridge->addr,
|
||||
directory_initiate_command(&bridge->addr,
|
||||
bridge->port, 0/*no dirport*/,
|
||||
bridge->identity,
|
||||
DIR_PURPOSE_FETCH_SERVERDESC,
|
||||
ROUTER_PURPOSE_BRIDGE,
|
||||
DIRIND_ONEHOP, "authority.z", NULL, 0, 0);
|
||||
tor_free(address);
|
||||
}
|
||||
|
||||
/** Fetching the bridge descriptor from the bridge authority returned a
|
||||
|
@ -1143,7 +1143,7 @@ consider_testing_reachability(int test_or, int test_dir)
|
||||
CONN_TYPE_DIR, &addr, me->dir_port,
|
||||
DIR_PURPOSE_FETCH_SERVERDESC)) {
|
||||
/* ask myself, via tor, for my server descriptor. */
|
||||
directory_initiate_command(me->address, &addr,
|
||||
directory_initiate_command(&addr,
|
||||
me->or_port, me->dir_port,
|
||||
me->cache_info.identity_digest,
|
||||
DIR_PURPOSE_FETCH_SERVERDESC,
|
||||
|
Loading…
Reference in New Issue
Block a user