According to RFC 1035, resource records with TTL=0 must not be cached. They may only be used for the current transaction.
However, in my setup AdGuard Home appears to cache upstream responses with TTL=0 and then rewrites the returned TTL to cache_ttl_min. This seems incorrect for two reasons:
- TTL=0 responses should not be cached.
- Rewriting TTL=0 to
cache_ttl_min changes the caching semantics defined by RFC 1035.
Expected behavior:
- A response with TTL=0 should not be inserted into cache.
cache_ttl_min should not be applied to TTL=0 responses, unless this behavior is explicitly documented as an intentional standards deviation.
Actual behavior:
- Repeated queries appear to be served from cache.
- The returned TTL is rewritten to the configured
cache_ttl_min instead of remaining non-cacheable.
Notes:
- RFC 1035 says TTL=0 records "should not be cached".
- Current dnsproxy cache logic also appears to treat computed TTL=0 as non-cacheable.
|
l.Debug("ttl calculated to be 0; not caching") |
- If this behavior is intentional, the documentation for
cache_ttl_min should explicitly mention that TTL=0 is overridden and cached despite RFC semantics.
Reproduction:
- Configure an upstream that returns TTL=0 for a test record.
- Set
cache_ttl_min to a positive value.
- Query the same record multiple times through AdGuard Home.
- Observe whether the second and later responses are served from cache and have TTL rewritten to
cache_ttl_min.
According to RFC 1035, resource records with TTL=0 must not be cached. They may only be used for the current transaction.
However, in my setup AdGuard Home appears to cache upstream responses with TTL=0 and then rewrites the returned TTL to
cache_ttl_min. This seems incorrect for two reasons:cache_ttl_minchanges the caching semantics defined by RFC 1035.Expected behavior:
cache_ttl_minshould not be applied to TTL=0 responses, unless this behavior is explicitly documented as an intentional standards deviation.Actual behavior:
cache_ttl_mininstead of remaining non-cacheable.Notes:
dnsproxy/proxy/cache.go
Line 406 in 88e87e0
cache_ttl_minshould explicitly mention that TTL=0 is overridden and cached despite RFC semantics.Reproduction:
cache_ttl_minto a positive value.cache_ttl_min.