]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
hno/squid-2.3.STABLE1.idns_config-2.patch [with adaptions to current release]
authorhno <>
Wed, 3 May 2000 02:39:27 +0000 (02:39 +0000)
committerhno <>
Wed, 3 May 2000 02:39:27 +0000 (02:39 +0000)
Squid-2.3.DEVEL3: Configurable DNS retransmission interval

Added squid.conf parameters for DNS retransmissions.

ChangeLog
src/cf.data.pre
src/dns_internal.cc
src/structs.h

index 1006587e0c6e60ad3d4e30a3b2f9de54c7f874de..c81db9072486f7040634a131da1cd1612292bea2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,7 @@ Changes to Squid-2.4.DEVEL3 ():
        - httpd_accel_single_host squid.conf directive
        - "round-robin" cache_peer counters are reset every 5 minutes to
          compensate previously dead peers
+       - DNS retransmit parameters
 
 Changes to Squid-2.4.DEVEL2 ():
 
index f6e3bcbc1e9375b4d375ee88c3dc648edb5bcba1..66b1d805fd5eba551c2cc1e8d38d17819bfdc725 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.174 2000/05/02 20:28:30 hno Exp $
+# $Id: cf.data.pre,v 1.175 2000/05/02 20:39:27 hno Exp $
 #
 #
 # SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -921,6 +921,27 @@ DOC_START
 dns_children 5
 DOC_END
 
+NAME: dns_retransmit_interval
+TYPE: time_t
+DEFAULT: 5 seconds
+LOC: Config.Timeout.idns_retransmit
+IFDEF: !USE_DNSSERVERS
+DOC_START
+       Initial retransmit interval for DNS queries. The interval is
+       doubled each time all configured DNS servers have been tried.
+
+DOC_END
+
+NAME: dns_timeout
+TYPE: time_t
+DEFAULT: 5 minutes
+LOC: Config.Timeout.idns_query
+IFDEF: !USE_DNSSERVERS
+DOC_START
+       DNS Query timeout. If no response is received to a DNS query
+       within this time then all DNS servers for the queried domain
+       is assumed to be unavailable.
+DOC_END
 
 NAME: dns_defnames
 COMMENT: on|off
index 8b8ae9243ad995e1ec7f064e807aadb8d90b08ea..3ec8b9bba5935398481d07d9e2e960cae49e3c2a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns_internal.cc,v 1.18 2000/03/06 16:23:31 wessels Exp $
+ * $Id: dns_internal.cc,v 1.19 2000/05/02 20:39:28 hno Exp $
  *
  * DEBUG: section 78    DNS lookups; interacts with lib/rfc1035.c
  * AUTHOR: Duane Wessels
@@ -44,8 +44,6 @@
 #define DOMAIN_PORT 53
 #endif
 
-#define IDNS_MAX_TRIES 20
-
 typedef struct _idns_query idns_query;
 typedef struct _ns ns;
 
@@ -141,15 +139,13 @@ idnsParseResolvConf(void)
     }
     while (fgets(buf, 512, fp)) {
        t = strtok(buf, w_space);
-       if (NULL == t)
-           continue;
-       if (strcasecmp(t, "nameserver"))
-           continue;
-       t = strtok(NULL, w_space);
-       if (t == NULL)
-           continue;;
-       debug(78, 1) ("Adding nameserver %s from %s\n", t, _PATH_RESOLV_CONF);
-       idnsAddNameserver(t);
+       if (strcasecmp(t, "nameserver") == 0) {
+           t = strtok(NULL, w_space);
+           if (t == NULL)
+               continue;;
+           debug(78, 1) ("Adding nameserver %s from %s\n", t, _PATH_RESOLV_CONF);
+           idnsAddNameserver(t);
+       }
     }
     fclose(fp);
 }
@@ -207,21 +203,24 @@ idnsSendQuery(idns_query * q)
     assert(nns > 0);
     assert(q->lru.next == NULL);
     assert(q->lru.prev == NULL);
+try_again:
     ns = q->nsends % nns;
     x = comm_udp_sendto(DnsSocket,
        &nameservers[ns].S,
        sizeof(nameservers[ns].S),
        q->buf,
        q->sz);
+    q->nsends++;
+    q->sent_t = current_time;
     if (x < 0) {
        debug(50, 1) ("idnsSendQuery: FD %d: sendto: %s\n",
            DnsSocket, xstrerror());
+       if (q->nsends % nns != 0)
+           goto try_again;
     } else {
        fd_bytes(DnsSocket, x, FD_WRITE);
        commSetSelect(DnsSocket, COMM_SELECT_READ, idnsRead, NULL, 0);
     }
-    q->nsends++;
-    q->sent_t = current_time;
     nameservers[ns].nqueries++;
     dlinkAdd(q, &q->lru, &lru_list);
     idnsTickleQueue();
@@ -353,13 +352,13 @@ idnsCheckQueue(void *unused)
     event_queued = 0;
     for (n = lru_list.tail; n; n = p) {
        q = n->data;
-       if (tvSubDsec(q->sent_t, current_time) < 5.0)
+       if (tvSubDsec(q->sent_t, current_time) < Config.Timeout.idns_retransmit * ( 1 << q->nsends % nns))
            break;
        debug(78, 3) ("idnsCheckQueue: ID %#04x timeout\n",
            q->id);
        p = n->prev;
        dlinkDelete(&q->lru, &lru_list);
-       if (q->nsends < IDNS_MAX_TRIES) {
+       if (tvSubDsec(q->start_t, current_time) < Config.Timeout.idns_query) {
            idnsSendQuery(q);
        } else {
            int v = cbdataValid(q->callback_data);
index 7e4d5bf54904ea1c71a19636c30b285aa5370ccb..217133ae2ebe33628c3a28ec5855577cfee5681c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.323 2000/05/02 20:31:45 hno Exp $
+ * $Id: structs.h,v 1.324 2000/05/02 20:39:28 hno Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -265,6 +265,10 @@ struct _SquidConfig {
        int mcast_icp_query;    /* msec */
 #if USE_IDENT
        time_t ident;
+#endif
+#if !USE_DNSSERVERS
+       time_t idns_retransmit;
+       time_t idns_query;
 #endif
     } Timeout;
     size_t maxRequestHeaderSize;