[Dnsmasq-discuss] Cache is flushed repeated when 2 cname point to the same domain
simon at thekelleys.org.uk
Tue Jan 10 17:46:09 GMT 2017
-----BEGIN PGP SIGNED MESSAGE-----
On 09/01/17 01:43, 石磊 wrote:
> We are running into an issue that the cache is flushed repeated
> when 2 cnames are point to the same domain. For example, Domain-A
> is cnamed to Domain-True Domain-B is cnamed to Domain-True, and
> then Domain-True is a A record. In this configuration, if we dig in
> the sequence: Domain-A=> Domain-B=> Domain-A=> Domain-B, we saw the
> 3rd step and 4th step are forwarded.
> After read the code, we found in the function “cache_scan_free”,
> it will check the A record, and remove it if found. My question is
> it seems not necessary to do this check to do this check? Since
> only when the cache missing or expire or cache full will trigger a
> forward, correct me if I am worng or miss anything.
This is an unfortunate side-effect of the way that the cache is
implemented. CNAMEs are stored as a pointer to a second cached entry
representing another CNAME or a A (or AAAA) record, and not as CNAMES
to a name. THis has advantages (cache entries always contain exactly
one variable length name, and the targets of CNAMES are found "for
free". But it does have the disadvantage that the cache can't
represent the condition you have, two different CNAMES to the same
target. The results of queries are never incorrect, but caching
behavior may not be optimal.
A work around, I think, would be to make Domain-A a CNAME to Domain-B
and Domains-B a CNAME to Domain-true.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Dnsmasq-discuss