addr: Rename resolved_addr_is_local()

Better function name.

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2020-06-24 10:42:00 -04:00
parent 59f5c3d263
commit 29a35d262c
5 changed files with 15 additions and 15 deletions

View File

@ -572,7 +572,7 @@ find_my_address(const or_options_t *options, int family, int warn_severity,
* on a private network.
*/
MOCK_IMPL(bool,
resolved_addr_is_local, (const tor_addr_t *addr))
is_local_to_resolve_addr, (const tor_addr_t *addr))
{
const int family = tor_addr_family(addr);
const tor_addr_t *last_resolved_addr = &last_resolved_addrs[family];

View File

@ -18,7 +18,7 @@ bool find_my_address(const or_options_t *options, int family,
void resolved_addr_get_last(int family, tor_addr_t *addr_out);
void resolved_addr_reset_last(int family);
MOCK_DECL(bool, resolved_addr_is_local, (const tor_addr_t *addr));
MOCK_DECL(bool, is_local_to_resolve_addr, (const tor_addr_t *addr));
#ifdef RESOLVE_ADDR_PRIVATE

View File

@ -203,7 +203,7 @@ channel_tls_connect(const tor_addr_t *addr, uint16_t port,
tlschan,
(chan->global_identifier));
if (resolved_addr_is_local(addr)) {
if (is_local_to_resolve_addr(addr)) {
log_debug(LD_CHANNEL,
"Marking new outgoing channel %"PRIu64 " at %p as local",
(chan->global_identifier), chan);
@ -340,7 +340,7 @@ channel_tls_handle_incoming(or_connection_t *orconn)
tlschan->conn = orconn;
orconn->chan = tlschan;
if (resolved_addr_is_local(&(TO_CONN(orconn)->addr))) {
if (is_local_to_resolve_addr(&(TO_CONN(orconn)->addr))) {
log_debug(LD_CHANNEL,
"Marking new incoming channel %"PRIu64 " at %p as local",
(chan->global_identifier), chan);
@ -1353,7 +1353,7 @@ channel_tls_update_marks(or_connection_t *conn)
chan = TLS_CHAN_TO_BASE(conn->chan);
if (resolved_addr_is_local(&(TO_CONN(conn)->addr))) {
if (is_local_to_resolve_addr(&(TO_CONN(conn)->addr))) {
if (!channel_is_local(chan)) {
log_debug(LD_CHANNEL,
"Marking channel %"PRIu64 " at %p as local",

View File

@ -142,7 +142,7 @@ write_http_response_header_impl(dir_connection_t *conn, ssize_t length,
if (type) {
buf_add_printf(buf, "Content-Type: %s\r\n", type);
}
if (!resolved_addr_is_local(&conn->base_.addr)) {
if (!is_local_to_resolve_addr(&conn->base_.addr)) {
/* Don't report the source address for a nearby/private connection.
* Otherwise we tend to mis-report in cases where incoming ports are
* being forwarded to a Tor server running behind the firewall. */

View File

@ -68,8 +68,8 @@ test_channeltls_create(void *arg)
/* For this test we always want the address to be treated as non-local */
tlschan_local = false;
/* Install resolved_addr_is_local() mock */
MOCK(resolved_addr_is_local, tlschan_resolved_addr_is_local_mock);
/* Install is_local_to_resolve_addr() mock */
MOCK(is_local_to_resolve_addr, tlschan_resolved_addr_is_local_mock);
/* Install mock for connection_or_connect() */
MOCK(connection_or_connect, tlschan_connection_or_connect_mock);
@ -92,7 +92,7 @@ test_channeltls_create(void *arg)
}
UNMOCK(connection_or_connect);
UNMOCK(resolved_addr_is_local);
UNMOCK(is_local_to_resolve_addr);
return;
}
@ -117,8 +117,8 @@ test_channeltls_num_bytes_queued(void *arg)
/* For this test we always want the address to be treated as non-local */
tlschan_local = false;
/* Install resolved_addr_is_local() mock */
MOCK(resolved_addr_is_local, tlschan_resolved_addr_is_local_mock);
/* Install is_local_to_resolve_addr() mock */
MOCK(is_local_to_resolve_addr, tlschan_resolved_addr_is_local_mock);
/* Install mock for connection_or_connect() */
MOCK(connection_or_connect, tlschan_connection_or_connect_mock);
@ -178,7 +178,7 @@ test_channeltls_num_bytes_queued(void *arg)
}
UNMOCK(connection_or_connect);
UNMOCK(resolved_addr_is_local);
UNMOCK(is_local_to_resolve_addr);
return;
}
@ -202,8 +202,8 @@ test_channeltls_overhead_estimate(void *arg)
/* For this test we always want the address to be treated as non-local */
tlschan_local = false;
/* Install resolved_addr_is_local() mock */
MOCK(resolved_addr_is_local, tlschan_resolved_addr_is_local_mock);
/* Install is_local_to_resolve_addr() mock */
MOCK(is_local_to_resolve_addr, tlschan_resolved_addr_is_local_mock);
/* Install mock for connection_or_connect() */
MOCK(connection_or_connect, tlschan_connection_or_connect_mock);
@ -252,7 +252,7 @@ test_channeltls_overhead_estimate(void *arg)
}
UNMOCK(connection_or_connect);
UNMOCK(resolved_addr_is_local);
UNMOCK(is_local_to_resolve_addr);
return;
}