]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Initialise DNS TTL for A and AAAA records.
authorPhilipp Winter <phw@nymity.ch>
Wed, 27 Jul 2016 16:01:03 +0000 (12:01 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 18 Jan 2017 13:57:09 +0000 (08:57 -0500)
So far, the TTLs for both A and AAAA records were not initialised,
resulting in exit relays sending back the value 60 to Tor clients.  This
also impacts exit relays' DNS cache -- the expiry time for all domains
is set to 60.

This fixes <https://bugs.torproject.org/19025>.

src/or/dns.c

index 41a6dfd0a48373155aa625c7502b191c2c082529..e007a402f4edc832f6738d54943a81dc643a27ae 100644 (file)
@@ -326,7 +326,7 @@ cached_resolve_add_answer(cached_resolve_t *resolve,
       resolve->result_ipv4.err_ipv4 = dns_result;
       resolve->res_status_ipv4 = RES_STATUS_DONE_ERR;
     }
-
+    resolve->ttl_ipv4 = ttl;
   } else if (query_type == DNS_IPv6_AAAA) {
     if (resolve->res_status_ipv6 != RES_STATUS_INFLIGHT)
       return;
@@ -341,6 +341,7 @@ cached_resolve_add_answer(cached_resolve_t *resolve,
       resolve->result_ipv6.err_ipv6 = dns_result;
       resolve->res_status_ipv6 = RES_STATUS_DONE_ERR;
     }
+    resolve->ttl_ipv6 = ttl;
   }
 }