From: Wouter Wijngaards Date: Tue, 30 Oct 2007 21:40:16 +0000 (+0000) Subject: ttl not greedy. X-Git-Tag: release-0.6~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63dc8ffde269161cb785697579b6b56727279f6d;p=thirdparty%2Funbound.git ttl not greedy. git-svn-id: file:///svn/unbound/trunk@720 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index f2d7dbe29..39277b291 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,7 @@ smaller than uncompressed names. A packet from comrite.com was seen to be compressed to a larger size. Added it as unit test. - quieter logging at low verbosity level for common tcp messages. + - no greedy TTL update. 23 October 2007: Wouter - fixup (grand-)parent problem for dnssec-lameness detection. diff --git a/doc/TODO b/doc/TODO index 7f6fcf8b7..58d75cafe 100644 --- a/doc/TODO +++ b/doc/TODO @@ -52,3 +52,6 @@ o make timeout backoffs randomized (a couple percent random) to spread traffic. o inspect date on executable, then warn user in log if its more than 1 year. o proactively prime root, stubs and trust anchors, feature. early failure, faster on first query, but more traffic. +o look into whether in incoming message should have RRsets replaced with + rrsets from the cache, if the one from the cache is more trusted, or has + lower TTL. diff --git a/services/cache/rrset.c b/services/cache/rrset.c index 523d12bc0..f0cb341d4 100644 --- a/services/cache/rrset.c +++ b/services/cache/rrset.c @@ -134,21 +134,6 @@ need_to_update_rrset(void* nd, void* cd, uint32_t timenow, int equal) /* o same trust, but different in data - insert it */ if( newd->trust == cached->trust && !equal ) return 1; - /* o see if TTL is better than TTL in cache. */ - /* if so, see if rrset+rdata is the same */ - /* if so, update TTL in cache, even if trust is worse. */ - if( newd->ttl > cached->ttl && equal ) { - /* if the cached rrset is bogus, and this one equal, - * do not update the TTL - let it expire. */ - if(cached->security == sec_status_bogus) - return 0; - /* since all else is the same, use the best trust value */ - if(newd->trust < cached->trust) { - newd->trust = cached->trust; - newd->security = cached->security; - } - return 1; - } return 0; } diff --git a/testcode/fake_event.c b/testcode/fake_event.c index 971a02727..ee6d0b86a 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -396,7 +396,8 @@ fake_pending_callback(struct replay_runtime* runtime, repinfo.c = &c; repinfo.addrlen = p->addrlen; memcpy(&repinfo.addr, &p->addr, p->addrlen); - pending_list_delete(runtime, p); + if(!p->serviced) + pending_list_delete(runtime, p); if((*cb)(&c, cb_arg, error, &repinfo)) { fatal_exit("unexpected: pending callback returned 1"); } diff --git a/testdata/rrset_rettl.rpl b/testdata/rrset_rettl.rpl index ea9ef0e65..b7e05eb85 100644 --- a/testdata/rrset_rettl.rpl +++ b/testdata/rrset_rettl.rpl @@ -3,7 +3,7 @@ forward-zone: name: "." forward-addr: 216.0.0.1 CONFIG_END -SCENARIO_BEGIN RRset TTL is updated from message. +SCENARIO_BEGIN RRset TTL is not greedily updated from message. STEP 1 QUERY ENTRY_BEGIN @@ -90,7 +90,6 @@ ENTRY_BEGIN ns.example.com. IN A 10.20.30.50 ENTRY_END - ; original www.example.com query STEP 10 QUERY ENTRY_BEGIN @@ -98,9 +97,10 @@ ENTRY_BEGIN SECTION QUESTION www.example.com. IN A ENTRY_END + ; immediate answer without an OUT_QUERY happening (checked on exit) ; also, the answer does not have AA set -; NS rrset has been updated. +; NS rrset has not been updated. No greedy TTL has happened. STEP 11 CHECK_ANSWER ENTRY_BEGIN MATCH all ttl @@ -110,7 +110,7 @@ ENTRY_BEGIN SECTION ANSWER www.example.com. IN A 10.20.30.40 SECTION AUTHORITY - example.com. 200 IN NS ns.example.com. + example.com. 100 IN NS ns.example.com. SECTION ADDITIONAL ns.example.com. IN A 10.20.30.50 ENTRY_END