[Dnsmasq-discuss] Cache is flushed repeated when 2 cname point to the same domain

Simon Kelley simon at thekelleys.org.uk
Tue Jan 10 17:46:09 GMT 2017


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



On 09/01/17 01:43, 石磊 wrote:
> Hi,
> 
> 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.

Cheers,

Simon.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIbBAEBCAAGBQJYdR3hAAoJEBXN2mrhkTWiTwIP92zRgtaPdy0vR/NawQWdTy8M
XFK0a6nSL26htBuAG0Ctrt5SXR6RCglyzegpQ8VMqon/ORzHu/Z2MbyugwA1qK/Z
et5NQv2RttMGbGteQw3EApJw3BrUBfgd9WMvFCcT1xicvCeQi9ZmspeVrhlcMe4h
Mg+0FBRJE7zzb2V6jSq8T0YdVyOZqD/43YmqvUp9UFz6Mj1LxDyZqLYnlnDD1KEa
Y7zQNlMGy59/e/NHmj2+h2EC5YQfMgcqAv0HsjN5BAmvNv/jkThbBQFWKTirjpcn
60K4FALVjbNKii4J+jGglE7T2s+mWyLB8NBLrgBLBlOwcuT+CX2SUa1qexEb5Qd+
ZMqS2t2GyMK3zU0wa4/f9OxjvUqmiy1M0CtLhatJJCOWCBpLajG1vbYuRCN0CNjJ
L0mT5/kw32+HBpMvrOfB5e4FEyVjzi3MF4bsnIFIX4M72IOkfwlRApK+rNGeT/U4
yYfTmqltZCtNBTL+VH+b0EWuGraF9BBn+NUn/pnI5u7XfweSKYewWTg27L8a//6+
2yvG1DeqO0bcZjNOPv6CHz1v5PwGYxAgJ4k7EhN5MobWKmk0DZlf4hinusnB8rkD
0JXoTe6F/zrw6CJ0rSvcVhw8bkD1pKSnZ2lcXPezUT0gFdl25VW8DUOQxHU+xpAn
tYWak83d6jSEZd2XEFQ=
=QDiF
-----END PGP SIGNATURE-----



More information about the Dnsmasq-discuss mailing list