diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2022-02-28 09:33:25 +0100 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2022-02-28 19:04:48 +0100 |
commit | 3e296068bab730329d4dd8708b1cf9a530b13722 (patch) | |
tree | 2abd30be5d5a46c0c4e5b9afa42f21e66b0b4db7 /lib/cache | |
parent | Merge !1264: Fix defects detected by Coverity Scan (diff) | |
download | knot-resolver-3e296068bab730329d4dd8708b1cf9a530b13722.tar.xz knot-resolver-3e296068bab730329d4dd8708b1cf9a530b13722.zip |
cache nit: reduce cache.max_ttl limit a bit
The new limit is over 68 years, so still completely meaningless.
Diffstat (limited to 'lib/cache')
-rw-r--r-- | lib/cache/api.h | 2 | ||||
-rw-r--r-- | lib/cache/entry_pkt.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/cache/api.h b/lib/cache/api.h index 3b2e5c50..56ae837d 100644 --- a/lib/cache/api.h +++ b/lib/cache/api.h @@ -37,6 +37,8 @@ struct kr_cache uv_timer_t *health_timer; /**< Timer used for kr_cache_check_health() */ }; +// https://datatracker.ietf.org/doc/html/rfc2181#section-8 +#define TTL_MAX_MAX ((1u << 31) - 1) /** * Open/create cache with provided storage options. diff --git a/lib/cache/entry_pkt.c b/lib/cache/entry_pkt.c index 4a139dc2..fa59380d 100644 --- a/lib/cache/entry_pkt.c +++ b/lib/cache/entry_pkt.c @@ -18,7 +18,7 @@ KR_EXPORT uint32_t packet_ttl(const knot_pkt_t *pkt, bool is_negative) { bool has_ttl = false; - uint32_t ttl = UINT32_MAX; + uint32_t ttl = TTL_MAX_MAX; /* Find minimum entry TTL in the packet or SOA minimum TTL. */ for (knot_section_t i = KNOT_ANSWER; i <= KNOT_ADDITIONAL; ++i) { const knot_pktsection_t *sec = knot_pkt_section(pkt, i); |