[Dnsmasq-discuss] why not cache data obtained via TCP?

Simon Kelley simon at thekelleys.org.uk
Thu Jul 28 21:53:41 BST 2016


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



On 27/07/16 09:02, Albert ARIBAUD wrote:
> Hi Ming,
> 
> Le Wed, 27 Jul 2016 10:06:47 +0800 XMing <mgabcde at gmail.com> a
> écrit:
> 
>> is there any regulation or spec about that?
> 
> There is neither, and DNS records obtained through TCP /are/
> cached.
> 
> Or, more to the point, answers are cached (or not, depending on
> the cache-related settings in dnsmasq) regardless of whether they
> were obtained through UDP or TCP.
> 
> What made you believe that answers obtained through TCP would not
> be cached?
> 
> Amicalement,
> 

Actually, they're not cached.

TCP connections are handled by forking a new process for each TCP
connection. The records which arrive to that new process are not
inserted into the cache (actually, they may be inserted into the cache
of the child process, bu that's a copy which evaporates when the TCP
connection dies, they don't make it to the real cache in the
long-lived dnsmasq process.

The reason for this is ease of implementation; it's the simplest and
smallest way to handle TCP connections. It's not the most efficient,
and it means that records which come via TCP are not cached. Since TCP
connections are pretty rare, that's a trade-off worth making, I think.


Tl;DR data obatined via TCP is not cached. There's no mandate to do
that in the DNS spec, it just makes the implementation easy.

Cheers,

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

iQIcBAEBCAAGBQJXmnDVAAoJEBXN2mrhkTWiKmwP/Azgm8BeA0fB5u3xD/3MixCv
NCCMP7ECeevuhF3HSwlD8YP+bP7eqJdrrNr67BOvPXhxfOGMOnFeqynVe0gDKIwa
AZPWNx9QaazXb4Aj3xGBfhzC0TC8T0sIO05KXOPNaJTmG/FG6Jy8+E5S+WrXibrd
Vq/dTDfEqSWyVubjvMkjYlEs1IqrJNt6QEXLNOmeGylaU16iS36TsxrAqGwpt/vq
ucAECG2ZmwqIycoGQEqs+wa4pvrDW3HUOTmWv8mSh3RMyYsmQIeGAa69OqboUjnm
bB0x0I+0VJlK7BFYqorrFsv0hbvOoBOsm5ZxhzhfFgbJ8RhW22yz5mW+2HDRRk7o
5IfUH9HCQMW10tjSGcjJR6cg0Jbci3E7+lBbsLBz+NYyf7NcXM989sCO44RdvaS3
AEmZE1zTaPhIRr8lIuRzHzzXEoIgCQzwnaCtU/mljodv4jIg3Utd36xYgUs4Ie5x
Sd4jrhXqgUVRWnvzkFChvhaTWvnW4ecK1NHKqeL/pVY2q31ZNbsZy6wwtwi7yqll
lLsnRUBPAJZ9ZA8q/SxG2oLnByYDmuqRSvZjyftSLtCKVObI4Dvkg+cSc7qr3p3H
RhsIUpGNca4sC+nhID4LzClWo4jgjvkXH17UDcHwQfWu6TTfKwd6Km+tLvK0lG8d
6k/ZUFcPVKSJMt0PHryG
=VLDO
-----END PGP SIGNATURE-----



More information about the Dnsmasq-discuss mailing list