aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-06-24 10:42:00 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-06-24 13:51:37 -0400
commit29a35d262c4b60535050748df78325c78060c535 (patch)
treee8c4d10a8e9757f5a74427de874bd99205f0e7c0
parent59f5c3d26337ba82be2a7cb2af02ba77e02c1b87 (diff)
downloadtor-29a35d262c4b60535050748df78325c78060c535.tar.gz
tor-29a35d262c4b60535050748df78325c78060c535.zip
addr: Rename resolved_addr_is_local()
Better function name. Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r--src/app/config/resolve_addr.c2
-rw-r--r--src/app/config/resolve_addr.h2
-rw-r--r--src/core/or/channeltls.c6
-rw-r--r--src/feature/dircache/dircache.c2
-rw-r--r--src/test/test_channeltls.c18
5 files changed, 15 insertions, 15 deletions
diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c
index cd19402f94..15a94cb82e 100644
--- a/src/app/config/resolve_addr.c
+++ b/src/app/config/resolve_addr.c
@@ -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];
diff --git a/src/app/config/resolve_addr.h b/src/app/config/resolve_addr.h
index ff732561c6..54f55ba36c 100644
--- a/src/app/config/resolve_addr.h
+++ b/src/app/config/resolve_addr.h
@@ -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
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index 3e7f25ae48..f9937ce880 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -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",
diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c
index 44dc462051..691c100974 100644
--- a/src/feature/dircache/dircache.c
+++ b/src/feature/dircache/dircache.c
@@ -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. */
diff --git a/src/test/test_channeltls.c b/src/test/test_channeltls.c
index 8018000331..f682c57acf 100644
--- a/src/test/test_channeltls.c
+++ b/src/test/test_channeltls.c
@@ -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;
}