2 Commits

Author SHA1 Message Date
Baltasar Blanco
234f5fd378 plugin/cache: stop setting AA on answers served from cache (#8419)
* plugin/cache: stop setting AA on answers served from cache

toMsg hardcoded m1.Authoritative = true, so a reply rebuilt from a cache entry claimed authority the answer that populated it never had.

The hardcoding was a workaround for legacy stub resolvers that dropped non-authoritative answers, but it only ever ran on the cache hit path: the same query still returned AA=0 on every miss and after every TTL expiry, so those clients were never actually protected.

Signed-off-by: baltasarblanco <baltablanco9008@gmail.com>

* plugin/cache: pin the AA=1 side of the cache round trip

Signed-off-by: baltasarblanco <baltablanco9008@gmail.com>

* plugin/cache: assert AA=0 on verified stale refresh and prove the cache hit

Signed-off-by: baltasarblanco <baltablanco9008@gmail.com>

* plugin/cache: count backend calls in TestCachePreservesAA

Signed-off-by: baltasarblanco <baltablanco9008@gmail.com>

---------

Signed-off-by: baltasarblanco <baltablanco9008@gmail.com>
2026-08-23 17:54:41 -07:00
houyuwushang
c0adbae99b plugin/cache: preserve monotonic time for TTL expiry (#8346)
Keep cache timestamps and TTL calculations on the time values returned by the cache clock. Converting them with UTC strips Go's monotonic clock reading and can extend cached entries when the wall clock moves backward.

Add a regression test that verifies new cache items retain the original monotonic timestamp.

Fixes #5478.

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-07-29 18:12:56 -07:00