* squid-2.3.STABLE1.idns_config.patch * Sun Jan 16 16:18:09 CET 2000 Modified Files in squid/src dns_internal.c Reload DNS server specifications on reconfigure * squid-2.3.DEVEL3.idns_config.patch * Mon Jan 10 11:51:12 CET 2000 Modified Files in squid/src cf.data.pre dns_internal.c structs.h Configuration of timeout values for the internal DNS client implementation, and support for dns_nameservers. Index: squid/src/cf.data.pre diff -u squid/src/cf.data.pre:1.1.1.41.2.11 squid/src/cf.data.pre:1.1.1.41.2.13 --- squid/src/cf.data.pre:1.1.1.41.2.11 Wed Dec 22 00:12:59 1999 +++ squid/src/cf.data.pre Mon Jan 10 11:51:10 2000 @@ -904,6 +907,27 @@ 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: squid/src/dns_internal.c diff -u squid/src/dns_internal.c:1.1.1.3 squid/src/dns_internal.c:1.1.1.3.8.2 --- squid/src/dns_internal.c:1.1.1.3 Sat Oct 30 13:25:01 1999 +++ squid/src/dns_internal.c Sun Jan 16 16:18:09 2000 @@ -44,8 +44,6 @@ #define DOMAIN_PORT 53 #endif -#define IDNS_MAX_TRIES 20 - typedef struct _idns_query idns_query; typedef struct _ns ns; @@ -127,18 +125,17 @@ debug(78, 1) ("%s: %s\n", _PATH_RESOLV_CONF, xstrerror()); return; } - idnsFreeNameservers(); while (fgets(buf, 512, fp)) { t = strtok(buf, w_space); if (t == NULL) - continue;; - if (strcasecmp(t, "nameserver")) - continue; - t = strtok(NULL, w_space); - if (t == NULL) continue;; - debug(78, 1) ("idnsParseResolvConf: nameserver %s\n", t); - idnsAddNameserver(t); + if (strcasecmp(t, "nameserver") == 0) { + t = strtok(NULL, w_space); + if (t == NULL) + continue;; + debug(78, 1) ("idnsParseResolvConf: nameserver %s\n", t); + idnsAddNameserver(t); + } } fclose(fp); } @@ -185,21 +182,24 @@ 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); if (!event_queued) { @@ -334,13 +334,13 @@ 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); @@ -353,6 +353,10 @@ memFree(q, MEM_IDNS_QUERY); } } + if (lru_list.tail) { + eventAdd("idnsCheckQueue", idnsCheckQueue, NULL, 1.0, 1); + event_queued = 1; + } } /* ====================================================================== */ @@ -372,8 +376,17 @@ fatal("Could not create a DNS socket"); debug(78, 1) ("DNS Socket created on FD %d\n", DnsSocket); } - if (nns == 0) + if (nns != 0) + idnsFreeNameservers() + if (Config.dns_nameservers) { + wordlist *w; + debug(78, 1) ("idnsInit: adding configured nameservers\n"); + for(w=Config.dns_nameservers;w;w=w->next) { + idnsAddNameserver(w->key); + } + } else { idnsParseResolvConf(); + } if (!init) { memDataInit(MEM_IDNS_QUERY, "idns_query", sizeof(idns_query), 0); cachemgrRegister("idns", Index: squid/src/structs.h diff -u squid/src/structs.h:1.1.1.45.4.8 squid/src/structs.h:1.1.1.45.4.9 --- squid/src/structs.h:1.1.1.45.4.8 Sun Jan 16 03:51:16 2000 +++ squid/src/structs.h Sun Jan 16 04:10:27 2000 @@ -260,6 +260,10 @@ #if USE_IDENT time_t ident; #endif +#if !USE_DNSSERVERS + time_t idns_retransmit; + time_t idns_query; +#endif } Timeout; size_t maxRequestHeaderSize; size_t maxRequestBodySize;