Repository navigation
Conversation
Frando
force-pushed
the
fix/cache-fqdn-key
branch
from
November 23, 2026 13:11
f87027f to
2f21d81
Compare
The cache key dropped a trailing dot, so `foo` and `foo.` shared one entry. The search list expands only the relative `foo`, so the two names can resolve to different nodes. An answer from a search domain, which the local network can control, could then answer the absolute name, and the reverse. The key now keeps the trailing dot. The hosts file still drops it. Its key moves to Hosts::key, and the cache and the hosts file share the lowercase helper.
A positive answer was cached under the search name that produced it, such as foo.corp.example, while lookups probe the cache with the caller's foo. A relative name answered through a search domain never hit the cache. Negative answers and serve-stale already used the caller's name. Positive answers now do too.
Frando
force-pushed
the
fix/cache-fqdn-key
branch
from
November 23, 2026 14:12
2f21d81 to
2f3d4bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
n0-dns-resolver keys the cache inconsistently around search domains:
fooandfoo.share one entry. The cache key drops the trailing dot. But the search list expands only the relativefoo, so the two names can resolve to different nodes:foo.caches its answer underfoo. A later lookup of the relativefoogets that answer and never tries the search domains.foocaches a negative answer underfoo. The first negative in search order can come from a search domain such asfoo.corp.example, a zone the local network can control through DHCP. A later lookup offoo.gets that answer instead of its own.foothat comes fromfoo.corp.exampleis stored underfoo.corp.example, but lookups check the cache withfoo. So a relative name answered through a search domain never hits the cache. Negative answers and serve-stale already use the caller's name.This PR keys every cache entry on the name the caller asked for, lowercased, with the trailing dot kept.
fooandfoo.get separate entries, and a relative name answered through a search domain hits the cache on the next lookup. The two names stay apart even when no search domains are set. They resolve the same then, but a single rule is simpler than one that depends on the search config.The hosts file still treats
fooandfoo.as one name. Its key moves toHosts::key, and the cache and the hosts file now share thelowercasehelper.Three new end-to-end tests: two cover the shared entry in each direction, and one checks that a relative name hits the cache on its second lookup. Each fails without its fix.
Breaking changes
None in the API.
fooandfoo.no longer share a cache entry, so a lookup of one does not fill the cache for the other.