aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/dns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-02-18 12:00:24 -0500
committerNick Mathewson <nickm@torproject.org>2020-02-18 12:00:24 -0500
commitdcbc45e6b2f80e8bd3664972d6317331d6b3bc85 (patch)
treee2276809612617eaaf92fad248ec0b62540e07d9 /src/feature/relay/dns.c
parent17724a7cdeb9b98539831f1164a82784f1fb050f (diff)
downloadtor-dcbc45e6b2f80e8bd3664972d6317331d6b3bc85.tar.gz
tor-dcbc45e6b2f80e8bd3664972d6317331d6b3bc85.zip
Replace identifiers related to clipping DNS ttls.
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ MIN_DNS_TTL_AT_EXIT MIN_DNS_TTL \ MAX_DNS_TTL_AT_EXIT MAX_DNS_TTL \ dns_clip_ttl clip_dns_ttl
Diffstat (limited to 'src/feature/relay/dns.c')
-rw-r--r--src/feature/relay/dns.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c
index da0cbb1df4..08fe4d39cf 100644
--- a/src/feature/relay/dns.c
+++ b/src/feature/relay/dns.c
@@ -272,16 +272,16 @@ has_dns_init_failed(void)
* OP that asked us to resolve it, and how long to cache that record
* ourselves. */
uint32_t
-dns_clip_ttl(uint32_t ttl)
+clip_dns_ttl(uint32_t ttl)
{
/* This logic is a defense against "DefectTor" DNS-based traffic
* confirmation attacks, as in https://nymity.ch/tor-dns/tor-dns.pdf .
* We only give two values: a "low" value and a "high" value.
*/
- if (ttl < MIN_DNS_TTL_AT_EXIT)
- return MIN_DNS_TTL_AT_EXIT;
+ if (ttl < MIN_DNS_TTL)
+ return MIN_DNS_TTL;
else
- return MAX_DNS_TTL_AT_EXIT;
+ return MAX_DNS_TTL;
}
/** Helper: free storage held by an entry in the DNS cache. */
@@ -521,7 +521,7 @@ send_resolved_cell,(edge_connection_t *conn, uint8_t answer_type,
uint32_t ttl;
buf[0] = answer_type;
- ttl = dns_clip_ttl(conn->address_ttl);
+ ttl = clip_dns_ttl(conn->address_ttl);
switch (answer_type)
{
@@ -593,7 +593,7 @@ send_resolved_hostname_cell,(edge_connection_t *conn,
size_t namelen = strlen(hostname);
tor_assert(namelen < 256);
- ttl = dns_clip_ttl(conn->address_ttl);
+ ttl = clip_dns_ttl(conn->address_ttl);
buf[0] = RESOLVED_TYPE_HOSTNAME;
buf[1] = (uint8_t)namelen;
@@ -1338,7 +1338,7 @@ make_pending_resolve_cached(cached_resolve_t *resolve)
resolve->ttl_hostname < ttl)
ttl = resolve->ttl_hostname;
- set_expiry(new_resolve, time(NULL) + dns_clip_ttl(ttl));
+ set_expiry(new_resolve, time(NULL) + clip_dns_ttl(ttl));
}
assert_cache_ok();
@@ -2188,7 +2188,7 @@ dns_cache_handle_oom(time_t now, size_t min_remove_bytes)
total_bytes_removed += bytes_removed;
/* Increase time_inc by a reasonable fraction. */
- time_inc += (MAX_DNS_TTL_AT_EXIT / 4);
+ time_inc += (MAX_DNS_TTL / 4);
} while (total_bytes_removed < min_remove_bytes);
return total_bytes_removed;