Index: mDNSResponder/Makefile
===================================================================
--- mDNSResponder/Makefile	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/Makefile	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -17,5 +17,5 @@
 include $(MAKEFILEPATH)/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-765.20.4"
+MVERS = "mDNSResponder-765.30.11"
 
 DDNSWRITECONFIG = "$(DSTROOT)/Library/Application Support/Bonjour/ddnswriteconfig"
Index: mDNSResponder/mDNSCore/dnsproxy.c
===================================================================
--- mDNSResponder/mDNSCore/dnsproxy.c	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSCore/dnsproxy.c	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -196,4 +196,6 @@
     CacheRecord *cname = mDNSNULL;
     mDNSu8 *limit;
+    domainname tempQName;
+    mDNSu32 tempQNameHash;
 
     *error = mStatus_NoError;
@@ -223,18 +225,15 @@
     LogInfo("AddResourceRecords: Limit is %d", limit - m->omsg.data);
 
-    if (!SameDomainName(&pc->qname, &pc->q.qname))
-    {
-        AssignDomainName(&pc->q.qname, &pc->qname);
-        pc->q.qnamehash = DomainNameHashValue(&pc->q.qname);
-    }
+    AssignDomainName(&tempQName, &pc->qname);
+    tempQNameHash = DomainNameHashValue(&tempQName);
 
 again:
     nsec = soa = cname = mDNSNULL;
-    slot = HashSlot(&pc->q.qname);
-        
-    cg = CacheGroupForName(m, slot, pc->q.qnamehash, &pc->q.qname);
+    slot = HashSlot(&tempQName);
+
+    cg = CacheGroupForName(m, slot, tempQNameHash, &tempQName);
     if (!cg)
     {
-        LogInfo("AddResourceRecords: CacheGroup not found");
+        LogInfo("AddResourceRecords: CacheGroup not found for %##s", tempQName.c);
         *error = mStatus_NoSuchRecord;
         return mDNSNULL;
@@ -345,6 +344,6 @@
     if (cname)
     {
-        AssignDomainName(&pc->q.qname, &cname->resrec.rdata->u.name);
-        pc->q.qnamehash = DomainNameHashValue(&pc->q.qname);
+        AssignDomainName(&tempQName, &cname->resrec.rdata->u.name);
+        tempQNameHash = DomainNameHashValue(&tempQName);
         goto again;
     }
Index: mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
===================================================================
--- mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -3377,5 +3377,5 @@
 extern void mDNSPlatformGetDNSRoutePolicy(mDNS *const m, DNSQuestion *q, mDNSBool *isBlocked);
 #endif
-extern void mDNSPlatformSetSocktOpt(void *sock, mDNSTransport_Type transType, mDNSAddr_Type addrType, DNSQuestion *q);
+extern void mDNSPlatformSetSocktOpt(void *sock, mDNSTransport_Type transType, mDNSAddr_Type addrType, const DNSQuestion *q);
 extern mDNSs32 mDNSPlatformGetPID(void);
 extern mDNSBool mDNSValidKeepAliveRecord(AuthRecord *rr);
Index: mDNSResponder/mDNSCore/uDNS.c
===================================================================
--- mDNSResponder/mDNSCore/uDNS.c	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSCore/uDNS.c	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -4738,5 +4738,8 @@
                         q->LocalSocket = mDNSPlatformUDPSocket(m, zeroIPPort);
                         if (q->LocalSocket)
-                            mDNSPlatformSetSocktOpt(q->LocalSocket, mDNSTransport_UDP, q->qDNSServer->addr.type, q);
+                        {
+                            mDNSPlatformSetSocktOpt(q->LocalSocket, mDNSTransport_UDP, mDNSAddrType_IPv4, q);
+                            mDNSPlatformSetSocktOpt(q->LocalSocket, mDNSTransport_UDP, mDNSAddrType_IPv6, q);
+                        }
                     }
                     if (!q->LocalSocket) err = mStatus_NoMemoryErr; // If failed to make socket (should be very rare), we'll try again next time
Index: mDNSResponder/mDNSMacOSX/Metrics.m
===================================================================
--- mDNSResponder/mDNSMacOSX/Metrics.m	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSMacOSX/Metrics.m	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -100,7 +100,5 @@
     { "icloud.com.",    (domainname *)"\x6" "icloud"    "\x3" "com", 2 },
     { "mzstatic.com.",  (domainname *)"\x8" "mzstatic"  "\x3" "com", 2 },
-    { "me.com.",        (domainname *)"\x2" "me"        "\x3" "com", 2 },
     { "google.com.",    (domainname *)"\x6" "google"    "\x3" "com", 2 },
-    { "youtube.com.",   (domainname *)"\x7" "youtube"   "\x3" "com", 2 },
     { "facebook.com.",  (domainname *)"\x8" "facebook"  "\x3" "com", 2 },
     { "baidu.com.",     (domainname *)"\x5" "baidu"     "\x3" "com", 2 },
@@ -109,5 +107,5 @@
 };
 
-check_compile_time(countof(kQueryStatsDomains) == 11);
+check_compile_time(countof(kQueryStatsDomains) == 9);
 
 // DNSHist contains the per domain per network type histogram data that goes in a DNSDomainStats protobuf message. See
@@ -169,5 +167,4 @@
 typedef struct
 {
-    DNSHist *       histAny;    // Histogram data for queries of any resource record type.
     DNSHist *       histA;      // Histogram data for queries for A resource records.
     DNSHist *       histAAAA;   // Histogram data for queries for AAAA resource records.
@@ -314,5 +311,5 @@
 mDNSlocal void      DNSDomainStatsFree(DNSDomainStats *inStats);
 mDNSlocal void      DNSDomainStatsFreeList(DNSDomainStats *inList);
-mDNSlocal mStatus   DNSDomainStatsUpdate(DNSDomainStats *inStats, uint16_t inType, const ResourceRecord *inRR, mDNSu32 inQuerySendCount, mDNSu32 inLatencyMs, mDNSBool inForCell);
+mDNSlocal mStatus   DNSDomainStatsUpdate(DNSDomainStats *inStats, int inType, const ResourceRecord *inRR, mDNSu32 inQuerySendCount, mDNSu32 inLatencyMs, mDNSBool inForCell);
 
 mDNSlocal mStatus   ResolveStatsDomainCreate(const Domain *inDomain, ResolveStatsDomain **outDomain);
@@ -363,15 +360,7 @@
 mStatus MetricsInit(void)
 {
-    mStatus     err;
-
 #if (METRICS_VALIDATE_DNS_STATS_DOMAINS)
     ValidateDNSStatsDomains();
 #endif
-
-    err = CreateDomainStatsList(&gDomainStatsList);
-    require_noerr_quiet(err, exit);
-
-    err = CreateResolveStatsList(&gResolveStatsList);
-    require_noerr_quiet(err, exit);
 
     @autoreleasepool
@@ -396,5 +385,5 @@
                 }
                 forIdentifier: (UInt32)AWDMetricId_MDNSResponder_ResolveStats];
-            
+
             [gAWDServerConnection
                 registerQueriableMetricCallback: ^(UInt32 inMetricID)
@@ -409,6 +398,12 @@
         }
     }
-exit:
-    return (err);
+
+    if( gAWDServerConnection )
+    {
+        CreateDomainStatsList(&gDomainStatsList);
+        CreateResolveStatsList(&gResolveStatsList);
+    }
+
+    return (mStatus_NoError);
 }
 
@@ -425,4 +420,7 @@
     int                     skipCount;
     int                     skipCountLast = -1;
+
+    require_quiet(gAWDServerConnection, exit);
+    require_quiet((inType == kDNSType_A) || (inType == kDNSType_AAAA), exit);
 
     queryLabelCount = CountLabels(inQueryName);
@@ -456,4 +454,6 @@
     }
 
+exit:
+    return;
 }
 
@@ -474,4 +474,5 @@
     Response                    response;
 
+    require_quiet(gAWDServerConnection, exit);
     require_quiet((inRR->rrtype == kDNSType_A) || (inRR->rrtype == kDNSType_AAAA), exit);
     require_quiet(inRR->rDNSServer, exit);
@@ -537,4 +538,5 @@
     int                                 addrObjCount     = 0;
 
+    LogMsgNoIdent("gAWDServerConnection %p", gAWDServerConnection);
     LogMsgNoIdent("---- DNS query stats by domain -----");
 
@@ -658,5 +660,4 @@
     if (inStats->nonCellular)
     {
-        ForgetMem(&inStats->nonCellular->histAny);
         ForgetMem(&inStats->nonCellular->histA);
         ForgetMem(&inStats->nonCellular->histAAAA);
@@ -666,5 +667,4 @@
     if (inStats->cellular)
     {
-        ForgetMem(&inStats->cellular->histAny);
         ForgetMem(&inStats->cellular->histA);
         ForgetMem(&inStats->cellular->histAAAA);
@@ -694,49 +694,29 @@
 //===========================================================================================================================
 
-mDNSlocal mStatus DNSDomainStatsUpdate(DNSDomainStats *inStats, uint16_t inType, const ResourceRecord *inRR, mDNSu32 inQuerySendCount, mDNSu32 inLatencyMs, mDNSBool inForCell)
+mDNSlocal mStatus DNSDomainStatsUpdate(DNSDomainStats *inStats, int inType, const ResourceRecord *inRR, mDNSu32 inQuerySendCount, mDNSu32 inLatencyMs, mDNSBool inForCell)
 {
     mStatus             err;
-    DNSHistSet **       p;
     DNSHistSet *        set;
-    DNSHist *           histAny;
+    DNSHistSet **       pSet;
     DNSHist *           hist;
+    DNSHist **          pHist;
     int                 i;
 
     require_action_quiet(inRR || (inQuerySendCount > 0), exit, err = mStatus_NoError);
-
-    p = inForCell ? &inStats->cellular : &inStats->nonCellular;
-    if ((set = *p) == NULL)
+    require_action_quiet((inType == kDNSType_A) || (inType == kDNSType_AAAA), exit, err = mStatus_NoError);
+
+    pSet = inForCell ? &inStats->cellular : &inStats->nonCellular;
+    if ((set = *pSet) == NULL)
     {
         set = (DNSHistSet *)calloc(1, sizeof(*set));
         require_action_quiet(set, exit, err = mStatus_NoMemoryErr);
-        *p = set;
-    }
-    if ((histAny = set->histAny) == NULL)
-    {
-        histAny = (DNSHist *)calloc(1, sizeof(*histAny));
-        require_action_quiet(histAny, exit, err = mStatus_NoMemoryErr);
-        set->histAny = histAny;
-    }
-    if (inType == kDNSType_A)
-    {
-        if ((hist = set->histA) == NULL)
-        {
-            hist = (DNSHist *)calloc(1, sizeof(*hist));
-            require_action_quiet(hist, exit, err = mStatus_NoMemoryErr);
-            set->histA = hist;
-        }
-    }
-    else if (inType == kDNSType_AAAA)
-    {
-        if ((hist = set->histAAAA) == NULL)
-        {
-            hist = (DNSHist *)calloc(1, sizeof(*hist));
-            require_action_quiet(hist, exit, err = mStatus_NoMemoryErr);
-            set->histAAAA = hist;
-        }
-    }
-    else
-    {
-        hist = NULL;
+        *pSet = set;
+    }
+    pHist = (inType == kDNSType_A) ? &set->histA : &set->histAAAA;
+    if ((hist = *pHist) == NULL)
+    {
+        hist = (DNSHist *)calloc(1, sizeof(*hist));
+        require_action_quiet(hist, exit, err = mStatus_NoMemoryErr);
+        *pHist = hist;
     }
 
@@ -749,22 +729,12 @@
         i = Min(inQuerySendCount, kQueryStatsMaxQuerySendCount);
 
-        sendCountBins = isNegative ? histAny->negAnsweredQuerySendCountBins : histAny->answeredQuerySendCountBins;
+        sendCountBins = isNegative ? hist->negAnsweredQuerySendCountBins : hist->answeredQuerySendCountBins;
         increment_saturate(sendCountBins[i], UINT16_MAX);
-        if (hist)
-        {
-            sendCountBins = isNegative ? hist->negAnsweredQuerySendCountBins : hist->answeredQuerySendCountBins;
-            increment_saturate(sendCountBins[i], UINT16_MAX);
-        }
 
         if (inQuerySendCount > 0)
         {
             for (i = 0; (i < (int)countof(kResponseLatencyMsLimits)) && (inLatencyMs >= kResponseLatencyMsLimits[i]); ++i) {}
-            latencyBins = isNegative ? histAny->negResponseLatencyBins : histAny->responseLatencyBins;
+            latencyBins = isNegative ? hist->negResponseLatencyBins : hist->responseLatencyBins;
             increment_saturate(latencyBins[i], UINT16_MAX);
-            if (hist)
-            {
-                latencyBins = isNegative ? hist->negResponseLatencyBins : hist->responseLatencyBins;
-                increment_saturate(latencyBins[i], UINT16_MAX);
-            }
         }
     }
@@ -772,10 +742,8 @@
     {
         i = Min(inQuerySendCount, kQueryStatsMaxQuerySendCount);
-        increment_saturate(histAny->unansweredQuerySendCountBins[i], UINT16_MAX);
-        if (hist) increment_saturate(hist->unansweredQuerySendCountBins[i], UINT16_MAX);
+        increment_saturate(hist->unansweredQuerySendCountBins[i], UINT16_MAX);
 
         for (i = 0; (i < (int)countof(kResponseLatencyMsLimits)) && (inLatencyMs >= kResponseLatencyMsLimits[i]); ++i) {}
-        increment_saturate(histAny->unansweredQueryDurationBins[i], UINT16_MAX);
-        if (hist) increment_saturate(hist->unansweredQueryDurationBins[i], UINT16_MAX);
+        increment_saturate(hist->unansweredQueryDurationBins[i], UINT16_MAX);
     }
     err = mStatus_NoError;
@@ -1506,5 +1474,5 @@
 mDNSlocal mStatus SubmitAWDMetric(UInt32 inMetricID)
 {
-    mStatus     err = mStatus_NoError;
+    mStatus     err;
 
     switch (inMetricID)
@@ -1519,9 +1487,10 @@
 
         case AWDMetricId_MDNSResponder_ServicesStats:
-            [AWDMetricManagerSoft postMetricWithId:AWDMetricId_MDNSResponder_ServicesStats integerValue:max_num_regservices];
+            [AWDMetricManagerSoft postMetricWithId:AWDMetricId_MDNSResponder_ServicesStats unsignedIntegerValue:max_num_regservices];
             KQueueLock(&mDNSStorage);
             // reset the no of max services since we want to collect the max no of services registered per AWD submission period
             max_num_regservices = curr_num_regservices;
             KQueueUnlock(&mDNSStorage, "SubmitAWDSimpleMetricServiceStats");
+            err = mStatus_NoError;
             break;
             
@@ -1531,6 +1500,5 @@
     }
 
-    if (err)
-        LogMsg("SubmitAWDMetric for metric ID 0x%08X failed with error %d", inMetricID, err);
+    if (err) LogMsg("SubmitAWDMetric for metric ID 0x%08X failed with error %d", inMetricID, err);
     return (err);
 }
@@ -1553,7 +1521,6 @@
     require_noerr_quiet(err, exit);
 
+    KQueueLock(&mDNSStorage);
     domainStatsList = gDomainStatsList;
-
-    KQueueLock(&mDNSStorage);
     gDomainStatsList = newDomainStatsList;
     KQueueUnlock(&mDNSStorage, "SubmitAWDMetricQueryStats");
@@ -1612,8 +1579,7 @@
     require_noerr_quiet(err, exit);
 
+    KQueueLock(&mDNSStorage);
     domainList = gResolveStatsList;
     serverList = gResolveStatsServerList;
-
-    KQueueLock(&mDNSStorage);
     gResolveStatsList           = newResolveStatsList;
     gResolveStatsServerList     = NULL;
@@ -1763,7 +1729,7 @@
     AWDDNSDomainStats *     awdStats;
 
-    if (inSet->histAny)
-    {
-        err = CreateAWDDNSDomainStats(inSet->histAny, inDomain, inForCell, AWDDNSDomainStats_RecordType_Any, &awdStats);
+    if (inSet->histA)
+    {
+        err = CreateAWDDNSDomainStats(inSet->histA, inDomain, inForCell, AWDDNSDomainStats_RecordType_A, &awdStats);
         require_noerr_quiet(err, exit);
 
@@ -1771,7 +1737,7 @@
         [awdStats release];
     }
-    if (inSet->histA)
-    {
-        err = CreateAWDDNSDomainStats(inSet->histA, inDomain, inForCell, AWDDNSDomainStats_RecordType_A, &awdStats);
+    if (inSet->histAAAA)
+    {
+        err = CreateAWDDNSDomainStats(inSet->histAAAA, inDomain, inForCell, AWDDNSDomainStats_RecordType_AAAA, &awdStats);
         require_noerr_quiet(err, exit);
 
@@ -1779,12 +1745,4 @@
         [awdStats release];
     }
-    if (inSet->histAAAA)
-    {
-        err = CreateAWDDNSDomainStats(inSet->histAAAA, inDomain, inForCell, AWDDNSDomainStats_RecordType_AAAA, &awdStats);
-        require_noerr_quiet(err, exit);
-
-        [inMetric addStats:awdStats];
-        [awdStats release];
-    }
     err = mStatus_NoError;
 
@@ -1799,5 +1757,4 @@
 mDNSlocal void LogDNSHistSet(const DNSHistSet *inSet, const char *inDomain, mDNSBool inForCell)
 {
-    if (inSet->histAny)     LogDNSHist(inSet->histAny,  inDomain, inForCell, "Any");
     if (inSet->histA)       LogDNSHist(inSet->histA,    inDomain, inForCell, "A");
     if (inSet->histAAAA)    LogDNSHist(inSet->histAAAA, inDomain, inForCell, "AAAA");
Index: mDNSResponder/mDNSMacOSX/mDNSMacOSX.c
===================================================================
--- mDNSResponder/mDNSMacOSX/mDNSMacOSX.c	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSMacOSX/mDNSMacOSX.c	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -1836,5 +1836,5 @@
 }
 
-mDNSexport void mDNSPlatformSetSocktOpt(void *sockCxt, mDNSTransport_Type transType, mDNSAddr_Type addrType, DNSQuestion *q)
+mDNSexport void mDNSPlatformSetSocktOpt(void *sockCxt, mDNSTransport_Type transType, mDNSAddr_Type addrType, const DNSQuestion *q)
 {
     int sockfd;
@@ -6967,5 +6967,17 @@
         {
             LogInfo("mDNSPlatformSetDNSConfig: config->n_resolver = %d, generation %llu, last %llu", config->n_resolver, config->generation, m->p->LastConfigGeneration);
-            if (m->p->LastConfigGeneration == config->generation)
+
+            // For every network change, the search domainÂ list is updated.
+            // This update is done without regard for generation numberÂ because it is
+            // not an expensive update and it keeps the search domain list in sync (even when
+            // a network change occurs, while currently processing a network
+            // change).
+            //
+            // For every DNS configuration change, theÂ DNSÂ server list isÂ updated.
+            // This update is NOT done every network change because it may involve
+            // updating cache entries which worst-case is expensive. Setting the generation
+            // per DNS server list change keeps the list in sync with configd.
+
+            if (setservers &&  m->p->LastConfigGeneration == config->generation)
             {
                 LogInfo("mDNSPlatformSetDNSConfig: generation number %llu same, not processing", config->generation);
@@ -6993,19 +7005,11 @@
             ConfigResolvers(m, config, kScopeServiceID, setsearch, setservers, &sdc, resolverGroupID);
 
-            // Acking provides a hint that we processed this current configuration and
-            // we will use that from now on, assuming we don't get another one immediately
-            // after we return from here.
+            // Acking provides a hint to other processes that the current DNS configuration has completed
+            // its update.  When configd receives the ack, it publishes a notification.
+            // Applications monitoring the notification then know when to re-issue their DNS queries
+            // after a network change occurs.
             if (ackConfig)
             {
                 // Note: We have to set the generation number here when we are acking.
-                // For every DNS configuration change, we do the following:
-                //
-                // 1) Copy dns configuration, handle search domains change
-                // 2) Copy dns configuration, handle dns server change
-                //
-                // If we update the generation number at step (1), we won't process the
-                // DNS servers the second time because generation number would be the same.
-                // As we ack only when we process dns servers, we set the generation number
-                // during acking.
                 m->p->LastConfigGeneration = config->generation;
                 LogInfo("mDNSPlatformSetDNSConfig: Acking configuration setservers %d, setsearch %d", setservers, setsearch);
Index: mDNSResponder/mDNSPosix/Responder.c
===================================================================
--- mDNSResponder/mDNSPosix/Responder.c	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSPosix/Responder.c	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -504,4 +504,5 @@
     mStatus status = mStatus_NoError;
     FILE *      fp = fopen(filePath, "r");
+    int rv;
 
     if (fp == NULL) {
@@ -604,5 +605,6 @@
     }
 
-    assert(0 == fclose(fp));
+    rv = fclose(fp);
+    assert(rv == 0);
 
     return status;
Index: mDNSResponder/mDNSPosix/mDNSPosix.c
===================================================================
--- mDNSResponder/mDNSPosix/mDNSPosix.c	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSPosix/mDNSPosix.c	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -585,9 +585,18 @@
 mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf)
 {
+    int rv;
     assert(intf != NULL);
     if (intf->intfName != NULL) free((void *)intf->intfName);
-    if (intf->multicastSocket4 != -1) assert(close(intf->multicastSocket4) == 0);
+    if (intf->multicastSocket4 != -1)
+    {
+        rv = close(intf->multicastSocket4);
+        assert(rv == 0);
+    }
 #if HAVE_IPV6
-    if (intf->multicastSocket6 != -1) assert(close(intf->multicastSocket6) == 0);
+    if (intf->multicastSocket6 != -1)
+    {
+        rv = close(intf->multicastSocket6);
+        assert(rv == 0);
+    }
 #endif
 
@@ -852,5 +861,11 @@
 
     // Clean up
-    if (err != 0 && *sktPtr != -1) { assert(close(*sktPtr) == 0); *sktPtr = -1; }
+    if (err != 0 && *sktPtr != -1)
+    {
+        int rv;
+        rv = close(*sktPtr);
+        assert(rv == 0);
+        *sktPtr = -1;
+    }
     assert((err == 0) == (*sktPtr != -1));
     return err;
@@ -1354,9 +1369,18 @@
 mDNSexport void mDNSPlatformClose(mDNS *const m)
 {
+    int rv;
     assert(m != NULL);
     ClearInterfaceList(m);
-    if (m->p->unicastSocket4 != -1) assert(close(m->p->unicastSocket4) == 0);
+    if (m->p->unicastSocket4 != -1)
+    {
+        rv = close(m->p->unicastSocket4);
+        assert(rv == 0);
+    }
 #if HAVE_IPV6
-    if (m->p->unicastSocket6 != -1) assert(close(m->p->unicastSocket6) == 0);
+    if (m->p->unicastSocket6 != -1)
+    {
+        rv = close(m->p->unicastSocket6);
+        assert(rv == 0);
+    }
 #endif
 }
@@ -1663,5 +1687,5 @@
 }
 
-mDNSexport void mDNSPlatformSetSocktOpt(void *sock, mDNSTransport_Type transType, mDNSAddr_Type addrType, DNSQuestion *q)
+mDNSexport void mDNSPlatformSetSocktOpt(void *sock, mDNSTransport_Type transType, mDNSAddr_Type addrType, const DNSQuestion *q)
 {
     (void) sock;
Index: mDNSResponder/mDNSPosix/mDNSUNP.c
===================================================================
--- mDNSResponder/mDNSPosix/mDNSUNP.c	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSPosix/mDNSUNP.c	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -200,5 +200,7 @@
 done:
     if (sockfd != -1) {
-        assert(close(sockfd) == 0);
+        int rv;
+        rv = close(sockfd);
+        assert(rv == 0);
     }
     if (fp != NULL) {
Index: mDNSResponder/mDNSShared/dns_sd.h
===================================================================
--- mDNSResponder/mDNSShared/dns_sd.h	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSShared/dns_sd.h	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -67,5 +67,5 @@
 
 #ifndef _DNS_SD_H
-#define _DNS_SD_H 7652004
+#define _DNS_SD_H 7653011
 
 #ifdef  __cplusplus
Index: mDNSResponder/mDNSWindows/mDNSWin32.c
===================================================================
--- mDNSResponder/mDNSWindows/mDNSWin32.c	(revision fc605b34255e1bacf6126fcd87e56fcd8b69ceba)
+++ mDNSResponder/mDNSWindows/mDNSWin32.c	(revision 7d33d36d73d2e902b107fb597e84e44ab11274a9)
@@ -2153,5 +2153,5 @@
 }
 
-mDNSexport void mDNSPlatformSetSocktOpt(void *sock, mDNSTransport_Type transType, mDNSAddr_Type addrType, DNSQuestion *q)
+mDNSexport void mDNSPlatformSetSocktOpt(void *sock, mDNSTransport_Type transType, mDNSAddr_Type addrType, const DNSQuestion *q)
     {
     (void) sock;
