]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- EDNS timeout code will not fire if EDNS status already known.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 21 May 2010 11:00:35 +0000 (11:00 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 21 May 2010 11:00:35 +0000 (11:00 +0000)
       - EDNS failure not stored if EDNS status known to work.

git-svn-id: file:///svn/unbound/trunk@2115 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/cache/infra.c
services/cache/infra.h
services/outside_network.c
testcode/unitmain.c

index 012ece3ba81707f5738fd7e6e70f033d2f6b3254..3df67f323824811c0102cf7333ff79e931b4cdd6 100644 (file)
@@ -1,3 +1,7 @@
+21 May 2010: Wouter
+       - EDNS timeout code will not fire if EDNS status already known.
+       - EDNS failure not stored if EDNS status known to work.
+
 19 May 2010: Wouter
        - Fix resolution for domains like safesvc.com.cn.  If the iterator
          can not recurse further and it finds the delegation in a state
index 6066f98bb4beba72b943ebfec2c0f805d28b6eb8..219a67a6bd51750b80b6478f3f196130a0b586e8 100644 (file)
@@ -514,8 +514,11 @@ infra_edns_update(struct infra_cache* infra,
        } 
        /* have an entry, update the rtt, and the ttl */
        data = (struct infra_host_data*)e->data;
-       data->edns_version = edns_version;
-       data->edns_lame_known = 1;
+       /* do not update if noEDNS and stored is yesEDNS */
+       if(!(edns_version == -1 && data->edns_version != -1)) {
+               data->edns_version = edns_version;
+               data->edns_lame_known = 1;
+       }
 
        if(needtoinsert)
                slabhash_insert(infra->hosts, e->hash, e, e->data, NULL);
index e6fc3cda20e7c192eeda43f365363205160e7538..80321b0e11e693d034167969d099c6b43baa2b81 100644 (file)
@@ -251,6 +251,7 @@ void infra_update_tcp_works(struct infra_cache* infra,
  * @param addr: host address.
  * @param addrlen: length of addr.
  * @param edns_version: the version that it publishes.
+ *     If it is known to support EDNS then no-EDNS is not stored over it.
  * @param timenow: what time it is now.
  * @return: 0 on error.
  */
index aeb44971aeb44ba5c407dc05678a50b41495e2f3..91614024d2417cb95e1655aabcee2bc3966cc539 100644 (file)
@@ -1244,8 +1244,7 @@ serviced_udp_send(struct serviced_query* sq, ldns_buffer* buff)
                &edns_lame_known, &rtt))
                return 0;
        if(sq->status == serviced_initial) {
-               if((vs != -1 || edns_lame_known == 0) && 
-                       rtt > 5000 && rtt < 10001) {
+               if(edns_lame_known == 0 && rtt > 5000 && rtt < 10001) {
                        /* perform EDNS lame probe - check if server is
                         * EDNS lame (EDNS queries to it are dropped) */
                        verbose(VERB_ALGO, "serviced query: send probe to see "
@@ -1494,11 +1493,9 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
        if(error == NETEVENT_TIMEOUT) {
                int rto = 0;
                if(sq->status == serviced_query_PROBE_EDNS) {
-                       /* non-EDNS probe failed; not an EDNS lame server */
-                       if(!infra_edns_update(outnet->infra, &sq->addr, 
-                               sq->addrlen, 0, (uint32_t)now.tv_sec)) {
-                               log_err("Out of memory caching edns works");
-                       }
+                       /* non-EDNS probe failed; we do not know its status,
+                        * keep trying with EDNS, timeout may not be caused
+                        * by EDNS. */
                        sq->status = serviced_query_UDP_EDNS;
                }
                sq->retry++;
index 9105afb881f0569205a8b7ee0a1b28bfaa08d49e..d4750df654ec77249f802341f8ae3c24c37b7bb1 100644 (file)
@@ -407,7 +407,7 @@ infra_test()
        unit_assert( infra_edns_update(slab, &one, onelen, -1, now) );
        unit_assert( infra_host(slab, &one, onelen, 
                        now, &vs, &edns_lame, &to) );
-       unit_assert( vs == -1 && to == init*2  && edns_lame == 1);
+       unit_assert( vs == 0 && to == init*2  && edns_lame == 0);
 
        now += cfg->host_ttl + 10;
        unit_assert( infra_host(slab, &one, onelen,