summaryrefslogtreecommitdiff
path: root/src/feature/relay
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@mullvad.net>2022-10-12 20:29:11 +0200
committerDavid Goulet <dgoulet@torproject.org>2022-11-01 09:29:19 -0400
commit0fe2096144104e63d403896844af121c9622a7a8 (patch)
treee7dfb5e73e9d877c855d3160947b6c03de849a64 /src/feature/relay
parent619dd35321c13684d5496b660a3404d2d3fe2827 (diff)
downloadtor-0fe2096144104e63d403896844af121c9622a7a8.tar.gz
tor-0fe2096144104e63d403896844af121c9622a7a8.zip
Clip DNS TTL values once in event callback
This change ensures that other parts of the code base always operate on the same clipped TTL values, notably without being aware of clipping.
Diffstat (limited to 'src/feature/relay')
-rw-r--r--src/feature/relay/dns.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c
index 4ae4a8e4b9..06087e6b47 100644
--- a/src/feature/relay/dns.c
+++ b/src/feature/relay/dns.c
@@ -512,7 +512,7 @@ send_resolved_cell,(edge_connection_t *conn, uint8_t answer_type,
uint32_t ttl;
buf[0] = answer_type;
- ttl = clip_dns_ttl(conn->address_ttl);
+ ttl = conn->address_ttl;
switch (answer_type)
{
@@ -584,7 +584,7 @@ send_resolved_hostname_cell,(edge_connection_t *conn,
size_t namelen = strlen(hostname);
tor_assert(namelen < 256);
- ttl = clip_dns_ttl(conn->address_ttl);
+ ttl = conn->address_ttl;
buf[0] = RESOLVED_TYPE_HOSTNAME;
buf[1] = (uint8_t)namelen;
@@ -1310,7 +1310,7 @@ make_pending_resolve_cached(cached_resolve_t *resolve)
resolve->ttl_hostname < ttl)
ttl = resolve->ttl_hostname;
- set_expiry(new_resolve, time(NULL) + clip_dns_ttl(ttl));
+ set_expiry(new_resolve, time(NULL) + ttl);
}
assert_cache_ok();
@@ -1725,7 +1725,7 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
}
if (result != DNS_ERR_SHUTDOWN)
dns_found_answer(string_address, orig_query_type,
- result, &addr, hostname, ttl);
+ result, &addr, hostname, clip_dns_ttl(ttl));
/* The result can be changed within this function thus why we note the result
* at the end. */