aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dircache
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-06-23 10:43:39 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-06-24 13:51:37 -0400
commit2f3b4e38888116f434297fb45ac093acd2d01e55 (patch)
tree87c882dc262e5056f66383f6892e72d3c2168b5f /src/feature/dircache
parent7795dd7ef6fa01202b91d20a0ac82eda1456cef8 (diff)
downloadtor-2f3b4e38888116f434297fb45ac093acd2d01e55.tar.gz
tor-2f3b4e38888116f434297fb45ac093acd2d01e55.zip
addr: Refactor is_local_addr() to support IPv6
Series of changes: 1. Rename function to reflect the namespace of the file. 2. Use the new last resolved cache instead of the unused last_resolved_addr_v4 (which is also removed in this commit). 3. Make the entire code base use the new resolved_addr_is_local() function. You will notice that this function uses /24 to differentiate subnets where the rest of tor uses /16 (including documentation of EnforceDistinctSubnets). Ticket #40009 has been opened for that. But that the moment, the function keeps looking at /24. Part of #33233 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/dircache')
-rw-r--r--src/feature/dircache/dircache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c
index ca127720f2..44dc462051 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 (!is_local_addr(&conn->base_.addr)) {
+ if (!resolved_addr_is_local(&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. */