From: hno <> Date: Wed, 3 May 2000 02:39:27 +0000 (+0000) Subject: hno/squid-2.3.STABLE1.idns_config-2.patch [with adaptions to current release] X-Git-Tag: SQUID_3_0_PRE1~2006 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fe0e1d0543d436c946c127b4663c0875e47657b;p=thirdparty%2Fsquid.git hno/squid-2.3.STABLE1.idns_config-2.patch [with adaptions to current release] Squid-2.3.DEVEL3: Configurable DNS retransmission interval Added squid.conf parameters for DNS retransmissions. --- diff --git a/ChangeLog b/ChangeLog index 1006587e0c..c81db90724 100644 --- 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 (): diff --git a/src/cf.data.pre b/src/cf.data.pre index f6e3bcbc1e..66b1d805fd 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 8b8ae9243a..3ec8b9bba5 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -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); diff --git a/src/structs.h b/src/structs.h index 7e4d5bf549..217133ae2e 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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;