]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3912. [bug] Address some unrecoverable lookup failures. [RT #36330]
authorMark Andrews <marka@isc.org>
Wed, 6 Aug 2014 04:18:04 +0000 (14:18 +1000)
committerMark Andrews <marka@isc.org>
Wed, 6 Aug 2014 04:18:47 +0000 (14:18 +1000)
(cherry picked from commit c5734964e6400f9e6d8c3f057fcccab596929dea)

CHANGES
lib/dns/adb.c
lib/dns/include/dns/adb.h
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index 457a29c4c7dc9137f63948b7b0501cd067b6e211..17c02389667b4ece732550cbb8325f667b322a7a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3912.  [bug]           Address some unrecoverable lookup failures. [RT #36330]
+
 3910.  [bug]           Fix races to free event during shutdown. [RT#36720]
 
 3909.  [bug]           When computing the number of elements required for a
index b9895c2c9f603b7fa45b0fb6936a674b7d274b39..89fc70f493afbdb87d6f94b006f21cd26c779ee7 100644 (file)
@@ -4297,6 +4297,11 @@ dns_adb_getudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr) {
 
 unsigned int
 dns_adb_probesize(dns_adb_t *adb, dns_adbaddrinfo_t *addr) {
+       return dns_adb_probesize2(adb, addr, 0);
+}
+
+unsigned int
+dns_adb_probesize2(dns_adb_t *adb, dns_adbaddrinfo_t *addr, int lookups) {
        int bucket;
        unsigned int size;
 
@@ -4305,14 +4310,21 @@ dns_adb_probesize(dns_adb_t *adb, dns_adbaddrinfo_t *addr) {
 
        bucket = addr->entry->lock_bucket;
        LOCK(&adb->entrylocks[bucket]);
-       if (addr->entry->to1232 > EDNSTOS)
+       if (addr->entry->to1232 > EDNSTOS || lookups >= 2)
                size = 512;
-       else if (addr->entry->to1432 > EDNSTOS)
+       else if (addr->entry->to1432 > EDNSTOS || lookups >= 1)
                size = 1232;
        else if (addr->entry->to4096 > EDNSTOS)
                size = 1432;
        else
                size = 4096;
+       /*
+        * Don't shrink probe size below what we have seen due to multiple
+        * lookups.
+        */
+       if (lookups > 0 &&
+           size < addr->entry->udpsize && addr->entry->udpsize < 4096)
+               size = addr->entry->udpsize;
        UNLOCK(&adb->entrylocks[bucket]);
 
        return (size);
index 0383f35f04495223e6b0f251ad4e590748baf8f7..c45008ae7efd20b8e24850994ccb062706488ff4 100644 (file)
@@ -605,8 +605,11 @@ dns_adb_getudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr);
 
 unsigned int
 dns_adb_probesize(dns_adb_t *adb, dns_adbaddrinfo_t *addr);
+unsigned int
+dns_adb_probesize2(dns_adb_t *adb, dns_adbaddrinfo_t *addr, int lookups);
 /*%
  * Return suggested EDNS UDP size based on observed responses / failures.
+ * 'lookups' is the number of times the current lookup has been attempted.
  *
  * Requires:
  *
index 411cac12c42e3d4fa431a5568f242573b2782b79..cbbe6c469fbe61cbd94314703ce7fbef73ed97a4 100644 (file)
@@ -2025,8 +2025,9 @@ resquery_send(resquery_t *query) {
 
                        if ((flags & FCTX_ADDRINFO_EDNSOK) != 0 &&
                            (query->options & DNS_FETCHOPT_EDNS512) == 0) {
-                               udpsize = dns_adb_probesize(fctx->adb,
-                                                           query->addrinfo);
+                               udpsize = dns_adb_probesize2(fctx->adb,
+                                                            query->addrinfo,
+                                                            fctx->timeouts);
                                if (udpsize > res->udpsize)
                                        udpsize = res->udpsize;
                        }
@@ -7412,10 +7413,6 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
                if ((options & DNS_FETCHOPT_TCP) != 0) {
                        broken_server = DNS_R_TRUNCATEDTCP;
                        keep_trying = ISC_TRUE;
-               } else if ((query->options & DNS_FETCHOPT_NOEDNS0) == 0 &&
-                          (query->options & DNS_FETCHOPT_EDNS512) == 0 &&
-                          !triededns(fctx, &query->addrinfo->sockaddr)) {
-                       resend = ISC_TRUE;
                } else {
                        options |= DNS_FETCHOPT_TCP;
                        resend = ISC_TRUE;