[Dnsmasq-discuss] TTL override for clients?

Fredrik Ringertz Fredrik_Ringertz at livewire-connections.com
Thu May 6 09:15:18 BST 2010


Hi Simon,

Yes you are right, I did not think of that :)

Thank you very much for your help on this!


Best Regards

Fredrik

-----Original Message-----
From: Simon Kelley [mailto:simon at thekelleys.org.uk] 
Sent: 05 May 2010 21:50
To: Fredrik Ringertz
Cc: dnsmasq-discuss at lists.thekelleys.org.uk
Subject: Re: [Dnsmasq-discuss] TTL override for clients?

Fredrik Ringertz wrote:
> Hi Simon,
> 
> Thanks again for all your help! I believe my patch seems to be
> working fine now after some more testing.
> 
> I have attached it here in case anyone else would be interested in
> it. It will add a new configurable option (can be set in both command
> line or dnsmasq.conf) called "max-ttl". The TTL (in seconds)
> specified after it will be a maximum ttl which will be handed out to
> a client.
> 
> For example, if max-ttl is set to 150 and a client looks up
> google.com which has a TTL of 300, then dnsmasq will add google.com
> to its cache with a TTL of 300 still, however it will tell its
> clients that the TTL is 150. If the returned TTL for google.com
> happened to be 60, then 60 would be given to the clients since it is
> lower then the configured max-ttl value.
> 
> This is handy if for example like me you want your clients to have a
> low ttl to avoid longer caching, but you don't want to override the
> actual TTL value (to avoid flooding the upstream DNS servers).
> 
> 
> Any feedback on the patch is highly appreciated as I am going to
> apply it in a working environment soon and my C++ knowledge is basic
> at best :)
> 
> I haven't been able to add the max-ttl option to the French and
> Spanish man page but otherwise I think it is all in there :)
> 
> 

That looks great. The only problem I can see is that you don't take into
account that --max-ttl may not be supplied, in which can daemon->max_ttl
will be zero and nothing should be done.


For your deployment it's fine. I've folded the patch into

http://www.thekelleys.org.uk/dnsmasq/test-releases/dnsmasq-2.53test20.tar.gz

and fixed the no --max-ttl issue there.

Cheers,


Simon.






More information about the Dnsmasq-discuss mailing list