commit 29a35d262c4b60535050748df78325c78060c535 Author: David Goulet dgoulet@torproject.org Date: Wed Jun 24 10:42:00 2020 -0400
addr: Rename resolved_addr_is_local()
Better function name.
Signed-off-by: David Goulet dgoulet@torproject.org --- src/app/config/resolve_addr.c | 2 +- src/app/config/resolve_addr.h | 2 +- src/core/or/channeltls.c | 6 +++--- src/feature/dircache/dircache.c | 2 +- src/test/test_channeltls.c | 18 +++++++++--------- 5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c index cd19402f9..15a94cb82 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 ff732561c..54f55ba36 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 3e7f25ae4..f9937ce88 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 44dc46205..691c10097 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 801800033..f682c57ac 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; }
tor-commits@lists.torproject.org