]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add dns_multicast_local to control mDNS operation
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 1 Aug 2013 20:45:56 +0000 (08:45 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 1 Aug 2013 20:45:56 +0000 (08:45 +1200)
Enable admin control over whether mDNS operates or not. Set the default
to OFF due to .arpa reverse-DNS requests causing a rise in traffic from
this feature even on networks without mDNS responders setup.

Also, polish cachemgr idns report to show for queued queries which
resolver type and query the entry is involving. mDNS can cause a queue
to exist as some lookups timeout on the mDNS resolvers.

doc/release-notes/release-3.4.sgml
src/SquidConfig.h
src/cf.data.pre
src/dns_internal.cc

index 6580bd201f51cd9a3ec40fae6fd1a2afbd1b56ea..5f44dedfb47dbcd499d1e5934835561ac858e47f 100644 (file)
@@ -180,11 +180,13 @@ Most user-facing changes are reflected in squid.conf (see below).
 <p>The internal DNS component fof Squid now supports multicast DNS (mDNS) resolution in
     accordance with RFC 6762.
 
-<p>There is no additional or special configuration required. The multicast DNS group IP
-   addresses for IPv4 and IPv6 resolving are added to the set of available DNS resolvers
-   and used automatically for domain names ending in <em>.local</em> before attempting a
-   secondary resolution on the configured resolvers. Domains without <em>.local</em> are
-   resolved using only the configured DNS resolvers.
+<p>The <em>dns_multicast_local</em> directive must be set to <em>on</em> to enable this
+   feature. 
+
+<p>The multicast DNS group IP addresses for IPv4 and IPv6 resolving are added to the set
+   of available DNS resolvers and used automatically for domain names ending in <em>.local</em>
+   and reverse-DNS lookups before attempting a secondary resolution on the configured
+   resolvers. Domains without <em>.local</em> are resolved using only the configured resolvers.
 
 <p>Statistics for multicast DNS resolution can be found on the <em>idns</em> cache manager
    report.
@@ -218,6 +220,9 @@ This section gives a thorough account of those changes in three categories:
        <p>Whether Squid supports directive parameters with spaces, quotes, and other
           special characters. Surround such parameters with "double quotes".
 
+       <tag>dns_multicast_local</tag>
+       <p>Use multicast DNS for <em>.local</em> domains and reverse-DNS resolution.
+
        <tag>note</tag>
        <p>Use ACLs to annotate a transaction with customized annotations
           which can be logged in access.log
index 3e71d0815eec9902f061f8e6e8419a23bc2bce50..0efcf0c7beab364232f93bf115dbf015330d9f95 100644 (file)
@@ -355,6 +355,7 @@ public:
         int memory_cache_disk;
         int hostStrictVerify;
         int client_dst_passthru;
+        int dns_mdns;
     } onoff;
 
     int pipeline_max_prefetch;
index 9160ba3201fef9ffe223947895912d994117f0cc..753f7625143df58e6e093c748f3f50ddb747ace1 100644 (file)
@@ -8332,6 +8332,19 @@ DOC_START
        Squid to handle single-component names, enable this option.
 DOC_END
 
+NAME: dns_multicast_local
+COMMENT: on|off
+TYPE: onoff
+DEFAULT: off
+DEFAULT_DOC: Search for .local and .arpa names is disabled.
+LOC: Config.onoff.dns_mdns
+DOC_START
+       When set to on, Squid sends multicast DNS lookups on the local
+       network for domains ending in .local and .arpa.
+       This enables local servers and devices to be contacted in an
+       ad-hoc or zero-configuration network environment.
+DOC_END
+
 NAME: dns_nameservers
 TYPE: wordlist
 DEFAULT: none
index 6a4e5b0b9959cdc70ae570952339ee9fae8215ae..47810177bf2a104d3a8315d73b253577b3ffcc5a 100644 (file)
@@ -268,6 +268,9 @@ static void idnsSendSlaveAAAAQuery(idns_query *q);
 static void
 idnsCheckMDNS(idns_query *q)
 {
+    if (!Config.onoff.dns_mdns || q->permit_mdns)
+        return;
+
     size_t slen = strlen(q->name);
     if (slen > 6 && memcmp(q->name +(slen-6),".local", 6) == 0) {
         q->permit_mdns = true;
@@ -279,6 +282,10 @@ idnsAddMDNSNameservers()
 {
     nns_mdns_count=0;
 
+    // mDNS is disabled
+    if (!Config.onoff.dns_mdns)
+        return;
+
     // mDNS resolver addresses are explicit multicast group IPs
     if (Ip::EnableIpv6) {
         idnsAddNameserver("FF02::FB");
@@ -717,21 +724,23 @@ idnsStats(StoreEntry * sentry)
     storeAppendPrintf(sentry, "Internal DNS Statistics:\n");
     storeAppendPrintf(sentry, "\nThe Queue:\n");
     storeAppendPrintf(sentry, "                       DELAY SINCE\n");
-    storeAppendPrintf(sentry, "  ID   SIZE SENDS FIRST SEND LAST SEND\n");
-    storeAppendPrintf(sentry, "------ ---- ----- ---------- ---------\n");
+    storeAppendPrintf(sentry, "  ID   SIZE SENDS FIRST SEND LAST SEND M FQDN\n");
+    storeAppendPrintf(sentry, "------ ---- ----- ---------- --------- - ----\n");
 
     for (n = lru_list.head; n; n = n->next) {
         q = (idns_query *)n->data;
-        storeAppendPrintf(sentry, "%#06x %4d %5d %10.3f %9.3f\n",
+        storeAppendPrintf(sentry, "%#06x %4d %5d %10.3f %9.3f %c %s\n",
                           (int) q->query_id, (int) q->sz, q->nsends,
                           tvSubDsec(q->start_t, current_time),
-                          tvSubDsec(q->sent_t, current_time));
+                          tvSubDsec(q->sent_t, current_time),
+                          (q->permit_mdns? 'M':' '),
+                          q->name);
     }
 
     if (Config.dns.packet_max > 0)
-        storeAppendPrintf(sentry, "DNS jumbo-grams: %zd Bytes\n", Config.dns.packet_max);
+        storeAppendPrintf(sentry, "\nDNS jumbo-grams: %zd Bytes\n", Config.dns.packet_max);
     else
-        storeAppendPrintf(sentry, "DNS jumbo-grams: not working\n");
+        storeAppendPrintf(sentry, "\nDNS jumbo-grams: not working\n");
 
     storeAppendPrintf(sentry, "\nNameservers:\n");
     storeAppendPrintf(sentry, "IP ADDRESS                                     # QUERIES # REPLIES Type\n");
@@ -1816,7 +1825,7 @@ idnsPTRLookup(const Ip::Address &addr, IDNSCB * callback, void *data)
     debugs(78, 3, "idnsPTRLookup: buf is " << q->sz << " bytes for " << ip <<
            ", id = 0x" << std::hex << q->query_id);
 
-    q->permit_mdns = true;
+    q->permit_mdns = Config.onoff.dns_mdns;
     idnsStartQuery(q, callback, data);
 }