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

2016-07-28 Thread Simon Kelley
-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  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-

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] list dns cache and expiration

2016-07-28 Thread Albert ARIBAUD
Hi,

Le Thu, 28 Jul 2016 06:46:51 +0800
"水静流深" <1248283...@qq.com> a écrit:

> Dnsmasq have been installed on my os.
>  cache-size=1024 was written in /etc/dnsmasq.conf.
>  1.how to list all the dns cache on my dnsmasq?

See the dnsmasq manpage for the log-queries option (note that if you
intend on processing the cache dump, you may want to configure your
system so that the log from dnsmasq is directed to a specific file
where no other process logs anything, or even avoid the system log
altogether and instead feed the dnsmasq output directly to some
process).

>  2.how to keep the dns cache expiration till  3600 seconds on dnsmasq?

The dnsmasq manpage lists all TTL-related options. Watch out, dnsmasq
does not give you full control on the TTL, though.

Amicalement,
-- 
Albert.

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss