I'm writing a DNS resolver and am building a spreadsheet of when a DNS record should be cached, and not be cached... but it's harder than it first looks (to me at least).

Is there consolidated test cases for DNS caching that I can refer to? All the RFCs seem to have many revisions, and the requirements on caching are inconsistent at best. This is further complicated by the re-definitions of the SOA record.

An improperly cached DNS record can mean that I'm poisoning the cache with invalid records.

The most relevant example I can think of is where a fake referral is generated for an NS, A, or MX.

  1. When should validation of that referral be done?
  2. How is that referral validated?
  3. Should I traverse from the root servers again?

1 Answer 1


See http://en.wikipedia.org/wiki/DNS_cache_poisoning and the many entries linked from there.

A short answer would be that you should only cache the answer when it comes from a server that you would normally trust for the the relevant domain.

  • 1
    Aye, there is the rub. I'm having trouble defining what 'normal' is. What are the conditions in which a record should be cached? Dec 2, 2010 at 4:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.