[MaraDNS list] I have fixed Srinivas Hebbar's TTL expire issue

Sam Trenholme <[email protected]> Wed, 4 Jan 2012 09:42:19 -0800
Newsgroups gmane.network.dns.maradns.general
Message-ID <CAJxgfkSTpMjUtWm7wDbuqbMKOx51dG1+h1zUdZcpU8PzqF+4Og@mail.gmail.com>
Srinivas Hebbar reported that Deadwood changes the TTL of cached
records to always have a TTL of at least 30 seconds.  This results in
Deadwood not removing a record from the cache if it's retrieved every
30 seconds or more.

The reason why Deadwood did this is because:

* The code for adding records to Deadwood's LRU hash requires a record
to have a TTL of at least 30 seconds

* Deadwood's code that ages TTLs and rotates records fetches a record
from the LRU hash, then immediately puts the same record back in the
LRU hash.

To fix this issue, I modified the code that adds a record to the LRU
hash.  I have added special code, so that if the TTL has a value of
-2, this means do the following:

* Look to see if the record is already in the LRU hash.

* If it is, do not alter the TTL when updating the record.

* If it is not, give the new record a new TTL of 30 seconds.

Using a SQA test I created for this issue yesterday, I have verified
that my patch resolves Srinivas' issue.

The patch is here:

http://maradns.org/deadwood/patches/deadwood-3.1.03-ttl_expire.patch

And the snapshot with this patch as well as the new SQA test is here:

http://maradns.org/deadwood/snap/

- Sam