Sam Trenholme's webpage
Support this website

Deadwood bug fixed

 

January 4 2012

I have fixed a bug in Deadwood: Srinivas Hebbar reported that Deadwood changed the TTL of cached records to always have a TTL of at least 30 seconds. This resulted 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://www.maradns.org/deadwood/snap/
To post a comment about an entry, send me an email and I may or may not post your comment (with or without editing)