summaryrefslogtreecommitdiffstats
path: root/mDNSResponder
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-19 08:52:21 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-20 11:23:32 +0200
commitf761b290f135957f47e1c9af71b4a81c76c32b48 (patch)
tree2b7d273db4ff2388867efec5ad432fa49cd4047e /mDNSResponder
parentmDNSResponder: Update to v576.30.4 (diff)
downloadrtems-libbsd-f761b290f135957f47e1c9af71b4a81c76c32b48.tar.bz2
mDNSResponder: Update to v625.41.2
The sources can be obtained via: https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-625.41.2.tar.gz Update #3522.
Diffstat (limited to 'mDNSResponder')
-rw-r--r--mDNSResponder/.DS_Storebin8196 -> 6148 bytes
-rw-r--r--mDNSResponder/Clients/ClientCommon.c6
-rw-r--r--mDNSResponder/Clients/dns-sd.c52
-rw-r--r--mDNSResponder/Clients/dnsctl.c86
-rw-r--r--mDNSResponder/Makefile2
-rw-r--r--mDNSResponder/mDNSCore/CryptoAlg.c2
-rw-r--r--mDNSResponder/mDNSCore/CryptoAlg.h3
-rw-r--r--mDNSResponder/mDNSCore/DNSCommon.c119
-rw-r--r--mDNSResponder/mDNSCore/DNSCommon.h14
-rw-r--r--mDNSResponder/mDNSCore/DNSDigest.c3
-rw-r--r--mDNSResponder/mDNSCore/anonymous.c39
-rw-r--r--mDNSResponder/mDNSCore/anonymous.h2
-rw-r--r--mDNSResponder/mDNSCore/dnsproxy.c35
-rw-r--r--mDNSResponder/mDNSCore/dnsproxy.h3
-rw-r--r--mDNSResponder/mDNSCore/dnssec.c21
-rw-r--r--mDNSResponder/mDNSCore/dnssec.h3
-rwxr-xr-xmDNSResponder/mDNSCore/mDNS.c935
-rwxr-xr-xmDNSResponder/mDNSCore/mDNSDebug.h10
-rwxr-xr-xmDNSResponder/mDNSCore/mDNSEmbeddedAPI.h95
-rw-r--r--mDNSResponder/mDNSCore/nsec.c14
-rw-r--r--mDNSResponder/mDNSCore/nsec.h3
-rw-r--r--mDNSResponder/mDNSCore/nsec3.c28
-rw-r--r--mDNSResponder/mDNSCore/nsec3.h2
-rwxr-xr-xmDNSResponder/mDNSCore/uDNS.c66
-rw-r--r--mDNSResponder/mDNSMacOS9/Mac OS Test Responder.c227
-rw-r--r--mDNSResponder/mDNSMacOS9/Mac OS Test Searcher.c243
-rw-r--r--mDNSResponder/mDNSMacOS9/README.txt48
-rw-r--r--mDNSResponder/mDNSMacOS9/Responder.c183
-rw-r--r--mDNSResponder/mDNSMacOS9/Searcher.c240
-rwxr-xr-xmDNSResponder/mDNSMacOS9/ShowInitIcon.c160
-rwxr-xr-xmDNSResponder/mDNSMacOS9/ShowInitIcon.h20
-rw-r--r--mDNSResponder/mDNSMacOS9/SubTypeTester.c217
-rw-r--r--mDNSResponder/mDNSMacOS9/mDNS.mcpbin1002330 -> 0 bytes
-rw-r--r--mDNSResponder/mDNSMacOS9/mDNSLibrary.c63
-rw-r--r--mDNSResponder/mDNSMacOS9/mDNSLibraryLoader.c68
-rw-r--r--mDNSResponder/mDNSMacOS9/mDNSLibraryResources.r197
-rw-r--r--mDNSResponder/mDNSMacOS9/mDNSMacOS9.c687
-rwxr-xr-xmDNSResponder/mDNSMacOS9/mDNSMacOS9.h58
-rw-r--r--mDNSResponder/mDNSMacOS9/mDNSPrefix.h64
-rw-r--r--mDNSResponder/mDNSMacOSX/BonjourEvents.c7
-rw-r--r--mDNSResponder/mDNSMacOSX/CUPolicy.c95
-rw-r--r--mDNSResponder/mDNSMacOSX/CryptoSupport.c106
-rw-r--r--mDNSResponder/mDNSMacOSX/CryptoSupport.h3
-rw-r--r--mDNSResponder/mDNSMacOSX/DNSProxySupport.c9
-rw-r--r--mDNSResponder/mDNSMacOSX/DNSSECSupport.c11
-rw-r--r--mDNSResponder/mDNSMacOSX/DNSSECSupport.h2
-rw-r--r--mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.c5
-rw-r--r--mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.h2
-rw-r--r--mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryDefines.h2
-rw-r--r--mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryReply.defs2
-rw-r--r--mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryRequest.defs2
-rw-r--r--mDNSResponder/mDNSMacOSX/LaunchDaemonInfo-Tiger.helper.plist18
-rw-r--r--mDNSResponder/mDNSMacOSX/LaunchDaemonInfo-Tiger.plist17
-rw-r--r--mDNSResponder/mDNSMacOSX/LegacyNATTraversal.c16
-rw-r--r--mDNSResponder/mDNSMacOSX/Metrics.h (renamed from mDNSResponder/mDNSMacOS9/CarbonResource.r)27
-rw-r--r--mDNSResponder/mDNSMacOSX/Metrics.m531
-rw-r--r--mDNSResponder/mDNSMacOSX/P2PPacketFilter.c5
-rw-r--r--mDNSResponder/mDNSMacOSX/P2PPacketFilter.h2
-rw-r--r--mDNSResponder/mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.m26
-rw-r--r--mDNSResponder/mDNSMacOSX/PreferencePane/English.lproj/InfoPlist.stringsbin484 -> 219 bytes
-rw-r--r--mDNSResponder/mDNSMacOSX/PreferencePane/PrivilegedOperations.c33
-rw-r--r--mDNSResponder/mDNSMacOSX/PreferencePane/ddnswriteconfig.m42
-rw-r--r--mDNSResponder/mDNSMacOSX/Private/dns_sd_private.h32
-rw-r--r--mDNSResponder/mDNSMacOSX/Private/dns_services.c245
-rw-r--r--mDNSResponder/mDNSMacOSX/Private/dns_services.h55
-rw-r--r--mDNSResponder/mDNSMacOSX/Private/dns_xpc.h4
-rw-r--r--mDNSResponder/mDNSMacOSX/Private/xpc_services.c36
-rw-r--r--mDNSResponder/mDNSMacOSX/SymptomReporter.c187
-rw-r--r--mDNSResponder/mDNSMacOSX/VPNService.c33
-rw-r--r--mDNSResponder/mDNSMacOSX/base.xcconfig2
-rw-r--r--mDNSResponder/mDNSMacOSX/com.apple.dnsextd.plist (renamed from mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.dnsextd.plist)0
-rw-r--r--mDNSResponder/mDNSMacOSX/com.apple.mDNSResponder.plist (renamed from mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.plist)10
-rw-r--r--mDNSResponder/mDNSMacOSX/com.apple.mDNSResponderHelper.plist (renamed from mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.helper.plist)4
-rw-r--r--mDNSResponder/mDNSMacOSX/daemon.c326
-rw-r--r--mDNSResponder/mDNSMacOSX/helper-error.h2
-rw-r--r--mDNSResponder/mDNSMacOSX/helper-main.c19
-rw-r--r--mDNSResponder/mDNSMacOSX/helper-server.h2
-rw-r--r--mDNSResponder/mDNSMacOSX/helper-stubs.c27
-rw-r--r--mDNSResponder/mDNSMacOSX/helper.c137
-rw-r--r--mDNSResponder/mDNSMacOSX/helper.h2
-rw-r--r--mDNSResponder/mDNSMacOSX/helpermsg-types.h2
-rw-r--r--mDNSResponder/mDNSMacOSX/helpermsg.defs2
-rw-r--r--mDNSResponder/mDNSMacOSX/ipsec_strerror.h6
-rw-r--r--mDNSResponder/mDNSMacOSX/libpfkey.h6
-rw-r--r--mDNSResponder/mDNSMacOSX/mDNSMacOSX.c1136
-rw-r--r--mDNSResponder/mDNSMacOSX/mDNSMacOSX.h14
-rw-r--r--mDNSResponder/mDNSMacOSX/mDNSResponder-entitlements.plist4
-rw-r--r--mDNSResponder/mDNSMacOSX/mDNSResponder.pbproj/project.pbxproj2338
-rw-r--r--mDNSResponder/mDNSMacOSX/mDNSResponder.sb15
-rw-r--r--mDNSResponder/mDNSMacOSX/mDNSResponder.xcodeproj/project.pbxproj783
-rw-r--r--mDNSResponder/mDNSMacOSX/mDNSResponderHelper.82
-rw-r--r--mDNSResponder/mDNSMacOSX/pfkey.c6
-rw-r--r--mDNSResponder/mDNSMacOSX/uDNSPathEvalulation.c155
-rwxr-xr-xmDNSResponder/mDNSPosix/._ReadMe.txtbin0 -> 171 bytes
-rw-r--r--mDNSResponder/mDNSPosix/Identify.c6
-rwxr-xr-xmDNSResponder/mDNSPosix/Makefile3
-rwxr-xr-xmDNSResponder/mDNSPosix/ReadMe.txt14
-rwxr-xr-xmDNSResponder/mDNSPosix/mDNSPosix.c36
-rwxr-xr-xmDNSResponder/mDNSPosix/mDNSUNP.c21
-rw-r--r--mDNSResponder/mDNSPosix/mdnsd.sh2
-rwxr-xr-xmDNSResponder/mDNSPosix/nss_mdns.c4
-rw-r--r--mDNSResponder/mDNSShared/CommonServices.h6
-rw-r--r--mDNSResponder/mDNSShared/DebugServices.c4
-rw-r--r--mDNSResponder/mDNSShared/GenLinkedList.c9
-rw-r--r--mDNSResponder/mDNSShared/PlatformCommon.c11
-rw-r--r--mDNSResponder/mDNSShared/dns-sd.12
-rw-r--r--mDNSResponder/mDNSShared/dns_sd.h47
-rw-r--r--mDNSResponder/mDNSShared/dnsextd.82
-rw-r--r--mDNSResponder/mDNSShared/dnsextd.c30
-rw-r--r--mDNSResponder/mDNSShared/dnsextd_lexer.l7
-rw-r--r--mDNSResponder/mDNSShared/dnsextd_parser.y33
-rw-r--r--mDNSResponder/mDNSShared/dnssd_clientlib.c4
-rw-r--r--mDNSResponder/mDNSShared/dnssd_clientstub.c70
-rw-r--r--mDNSResponder/mDNSShared/dnssd_ipc.c4
-rw-r--r--mDNSResponder/mDNSShared/dnssd_ipc.h6
-rw-r--r--mDNSResponder/mDNSShared/mDNSDebug.c9
-rw-r--r--mDNSResponder/mDNSShared/mDNSResponder.827
-rw-r--r--mDNSResponder/mDNSShared/uds_daemon.c223
-rw-r--r--mDNSResponder/mDNSShared/uds_daemon.h11
-rwxr-xr-xmDNSResponder/mDNSWindows/mDNSWin32.c54
120 files changed, 3681 insertions, 7537 deletions
diff --git a/mDNSResponder/.DS_Store b/mDNSResponder/.DS_Store
index 13e50c91..48c76542 100644
--- a/mDNSResponder/.DS_Store
+++ b/mDNSResponder/.DS_Store
Binary files differ
diff --git a/mDNSResponder/Clients/ClientCommon.c b/mDNSResponder/Clients/ClientCommon.c
index 68f354cc..cb59e7b9 100644
--- a/mDNSResponder/Clients/ClientCommon.c
+++ b/mDNSResponder/Clients/ClientCommon.c
@@ -1,8 +1,8 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2008-2011 Apple Inc. All rights reserved.
*
- * Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
+ * Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
* ("Apple") in consideration of your agreement to the following terms, and your
* use, installation, modification or redistribution of this Apple software
* constitutes acceptance of these terms. If you do not agree with these terms,
@@ -16,7 +16,7 @@
* the Apple Software in its entirety and without modifications, you must retain
* this notice and the following text and disclaimers in all such redistributions of
* the Apple Software. Neither the name, trademarks, service marks or logos of
- * Apple Computer, Inc. may be used to endorse or promote products derived from the
+ * Apple Inc. may be used to endorse or promote products derived from the
* Apple Software without specific prior written permission from Apple. Except as
* expressly stated in this notice, no other rights or licenses, express or implied,
* are granted by Apple herein, including but not limited to any patent rights that
diff --git a/mDNSResponder/Clients/dns-sd.c b/mDNSResponder/Clients/dns-sd.c
index 9acf41e5..9469d24d 100644
--- a/mDNSResponder/Clients/dns-sd.c
+++ b/mDNSResponder/Clients/dns-sd.c
@@ -1,8 +1,8 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
- * Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
+ * Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
* ("Apple") in consideration of your agreement to the following terms, and your
* use, installation, modification or redistribution of this Apple software
* constitutes acceptance of these terms. If you do not agree with these terms,
@@ -16,7 +16,7 @@
* the Apple Software in its entirety and without modifications, you must retain
* this notice and the following text and disclaimers in all such redistributions of
* the Apple Software. Neither the name, trademarks, service marks or logos of
- * Apple Computer, Inc. may be used to endorse or promote products derived from the
+ * Apple Inc. may be used to endorse or promote products derived from the
* Apple Software without specific prior written permission from Apple. Except as
* expressly stated in this notice, no other rights or licenses, express or implied,
* are granted by Apple herein, including but not limited to any patent rights that
@@ -57,14 +57,6 @@
// aren't in the system's /usr/lib/libSystem.dylib.
//#define TEST_NEW_CLIENTSTUB 1
-// When building mDNSResponder for Mac OS X 10.4 and earlier, /usr/lib/libSystem.dylib is built using its own private
-// copy of dnssd_clientstub.c, which is old and doesn't have all the entry points defined in the latest version, so
-// when we're building dns-sd.c on Mac OS X 10.4 or earlier, we automatically set TEST_NEW_CLIENTSTUB so that we'll
-// embed a copy of the latest dnssd_clientstub.c instead of trying to link to the incomplete version in libSystem.dylib
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ <= 1040
-#define TEST_NEW_CLIENTSTUB 1
-#endif
-
#include <ctype.h>
#include <stdio.h> // For stdout, stderr
#include <stdlib.h> // For exit()
@@ -185,14 +177,6 @@ static const char kFilePathSep = '/';
#include <dispatch/private.h>
#endif
-// The "+0" is to cope with the case where _DNS_SD_H is defined but empty (e.g. on Mac OS X 10.4 and earlier)
-#if _DNS_SD_H+0 >= 116
-#define HAS_NAT_PMP_API 1
-#define HAS_ADDRINFO_API 1
-#else
-#define kDNSServiceFlagsReturnIntermediates 0
-#endif
-
//*************************************************************************************************************
// Globals
@@ -421,7 +405,6 @@ done:
#endif //_DNS_SD_LIBDISPATCH
}
-#if HAS_NAT_PMP_API | HAS_ADDRINFO_API
static DNSServiceProtocol GetProtocol(const char *s)
{
if (!strcasecmp(s, "v4" )) return(kDNSServiceProtocol_IPv4);
@@ -434,7 +417,6 @@ static DNSServiceProtocol GetProtocol(const char *s)
else if (!strcasecmp(s, "tcpudp" )) return(kDNSServiceProtocol_UDP | kDNSServiceProtocol_TCP);
else return(atoi(s));
}
-#endif
//*************************************************************************************************************
@@ -494,18 +476,14 @@ static void print_usage(const char *arg0, int print_all)
fprintf(stderr, "%s -q <name> <rrtype> <rrclass> (Generic query for any record type)\n", arg0);
fprintf(stderr, "%s -D <name> <rrtype> <rrclass>(Validate query for any record type with DNSSEC)\n", arg0);
fprintf(stderr, "%s -Z <Type> <Domain> (Output results in Zone File format)\n", arg0);
-#if HAS_ADDRINFO_API
fprintf(stderr, "%s -G v4/v6/v4v6 <name> (Get address information for hostname)\n", arg0);
fprintf(stderr, "%s -g v4/v6/v4v6 <name> (Validate address info for hostname with DNSSEC)\n", arg0);
-#endif
fprintf(stderr, "%s -V (Get version of currently running daemon / system service)\n", arg0);
if (print_all) //Print all available options for dns-sd tool
{
fprintf(stderr, "%s -C <FQDN> <rrtype> <rrclass> (Query; reconfirming each result)\n", arg0);
-#if HAS_NAT_PMP_API
fprintf(stderr, "%s -X udp/tcp/udptcp <IntPort> <ExtPort> <TTL> (NAT Port Mapping)\n", arg0);
-#endif
fprintf(stderr, "%s -A (Test Adding/Updating/Deleting a record)\n", arg0);
fprintf(stderr, "%s -U (Test updating a TXT record)\n", arg0);
fprintf(stderr, "%s -N (Test adding a large NULL record)\n", arg0);
@@ -1041,15 +1019,15 @@ static void DNSSD_API qr_reply(DNSServiceRef sdref, const DNSServiceFlags flags,
case kDNSServiceType_CNAME:
case kDNSServiceType_PTR:
case kDNSServiceType_DNAME:
- p += snprintd(p, sizeof(rdb), &rd);
+ snprintd(p, sizeof(rdb), &rd);
break;
case kDNSServiceType_SOA:
p += snprintd(p, rdb + sizeof(rdb) - p, &rd); // mname
p += snprintf(p, rdb + sizeof(rdb) - p, " ");
p += snprintd(p, rdb + sizeof(rdb) - p, &rd); // rname
- p += snprintf(p, rdb + sizeof(rdb) - p, " Ser %d Ref %d Ret %d Exp %d Min %d",
- ntohl(((uint32_t*)rd)[0]), ntohl(((uint32_t*)rd)[1]), ntohl(((uint32_t*)rd)[2]), ntohl(((uint32_t*)rd)[3]), ntohl(((uint32_t*)rd)[4]));
+ snprintf(p, rdb + sizeof(rdb) - p, " Ser %d Ref %d Ret %d Exp %d Min %d",
+ ntohl(((uint32_t*)rd)[0]), ntohl(((uint32_t*)rd)[1]), ntohl(((uint32_t*)rd)[2]), ntohl(((uint32_t*)rd)[3]), ntohl(((uint32_t*)rd)[4]));
break;
case kDNSServiceType_AAAA:
@@ -1060,9 +1038,9 @@ static void DNSSD_API qr_reply(DNSServiceRef sdref, const DNSServiceFlags flags,
case kDNSServiceType_SRV:
p += snprintf(p, rdb + sizeof(rdb) - p, "%d %d %d ", // priority, weight, port
- ntohs(*(unsigned short*)rd), ntohs(*(unsigned short*)(rd+2)), ntohs(*(unsigned short*)(rd+4)));
+ ntohs(*(unsigned short*)rd), ntohs(*(unsigned short*)(rd+2)), ntohs(*(unsigned short*)(rd+4)));
rd += 6;
- p += snprintd(p, rdb + sizeof(rdb) - p, &rd); // target host
+ snprintd(p, rdb + sizeof(rdb) - p, &rd); // target host
break;
case kDNSServiceType_DS:
@@ -1124,7 +1102,6 @@ static void DNSSD_API qr_reply(DNSServiceRef sdref, const DNSServiceFlags flags,
fflush(stdout);
}
-#if HAS_NAT_PMP_API
static void DNSSD_API port_mapping_create_reply(DNSServiceRef sdref, DNSServiceFlags flags, uint32_t ifIndex, DNSServiceErrorType errorCode, uint32_t publicAddress, uint32_t protocol, uint16_t privatePort, uint16_t publicPort, uint32_t ttl, void *context)
{
(void)sdref; // Unused
@@ -1146,9 +1123,7 @@ static void DNSSD_API port_mapping_create_reply(DNSServiceRef sdref, DNSServiceF
if (!(flags & kDNSServiceFlagsMoreComing)) fflush(stdout);
}
-#endif
-#if HAS_ADDRINFO_API
static void DNSSD_API addrinfo_reply(DNSServiceRef sdref, const DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *hostname, const struct sockaddr *address, uint32_t ttl, void *context)
{
char *op = (flags & kDNSServiceFlagsAdd) ? "Add" : "Rmv";
@@ -1218,7 +1193,6 @@ static void DNSSD_API addrinfo_reply(DNSServiceRef sdref, const DNSServiceFlags
if (!(flags & kDNSServiceFlagsMoreComing))
fflush(stdout);
}
-#endif
//*************************************************************************************************************
// The main test function
@@ -1362,6 +1336,7 @@ static DNSServiceErrorType RegisterProxyAddressRecord(DNSServiceRef sdref, const
// Any DNSService* call will initialize WinSock for us, so we make sure
// DNSServiceCreateConnection() is called before getip() is.
struct sockaddr_storage hostaddr;
+ memset(&hostaddr, 0, sizeof(hostaddr));
getip(ip, &hostaddr);
flags |= kDNSServiceFlagsUnique;
if (hostaddr.ss_family == AF_INET)
@@ -1553,12 +1528,8 @@ int main(int argc, char **argv)
if (argc < 2) goto Fail; // Minimum command line is the command name and one argument
operation = getfirstoption(argc, argv, "EFBZLlRPQqCAUNTMISVHhD"
- #if HAS_NAT_PMP_API
"X"
- #endif
- #if HAS_ADDRINFO_API
"Gg"
- #endif
, &opi);
if (operation == -1) goto Fail;
@@ -1592,6 +1563,7 @@ int main(int argc, char **argv)
if (dom[0] == '.' && dom[1] == 0) dom[0] = 0; // We allow '.' on the command line as a synonym for empty string
printf("Browsing for %s%s%s\n", typ, dom[0] ? "." : "", dom);
err = DNSServiceCreateConnection(&client);
+ if (err) { fprintf(stderr, "DNSServiceCreateConnection returned %d\n", err); return(err); }
sc1 = client;
err = DNSServiceBrowse(&sc1, kDNSServiceFlagsShareConnection, opinterface, typ, dom, zonedata_browse, NULL);
break;
@@ -1694,7 +1666,6 @@ int main(int argc, char **argv)
break;
}
-#if HAS_NAT_PMP_API
case 'X': {
if (argc == opi) // If no arguments, just fetch IP address
err = DNSServiceNATPortMappingCreate(&client, 0, 0, 0, 0, 0, 0, port_mapping_create_reply, NULL);
@@ -1711,9 +1682,7 @@ int main(int argc, char **argv)
else goto Fail;
break;
}
-#endif
-#if HAS_ADDRINFO_API
case 'g':
case 'G': {
flags |= kDNSServiceFlagsReturnIntermediates;
@@ -1731,7 +1700,6 @@ int main(int argc, char **argv)
err = DNSServiceGetAddrInfo(&client, flags, opinterface, GetProtocol(argv[opi+0]), argv[opi+1], addrinfo_reply, NULL);
break;
}
-#endif
case 'S': {
Opaque16 registerPort = { { 0x23, 0x45 } }; // 9029 decimal
diff --git a/mDNSResponder/Clients/dnsctl.c b/mDNSResponder/Clients/dnsctl.c
index bb2a0716..f10f2259 100644
--- a/mDNSResponder/Clients/dnsctl.c
+++ b/mDNSResponder/Clients/dnsctl.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2012-2015 Apple Inc. All rights reserved.
*
* dnsctl.c
* Command-line tool using libdns_services.dylib
@@ -31,24 +31,24 @@ static DNSXConnRef ClientRef = NULL;
// Utility Funcs:
//*************************************************************************************************************
-static void printtimestamp(void)
+static void printtimestamp(void)
{
- struct tm tm;
- int ms;
+ struct tm tm;
+ int ms;
static char date[16];
static char new_date[16];
- struct timeval tv;
+ struct timeval tv;
gettimeofday(&tv, NULL);
localtime_r((time_t*)&tv.tv_sec, &tm);
ms = tv.tv_usec/1000;
strftime(new_date, sizeof(new_date), "%a %d %b %Y", &tm);
//display date only if it has changed
if (strncmp(date, new_date, sizeof(new_date)))
- {
+ {
printf("DATE: ---%s---\n", new_date);
- strncpy(date, new_date, sizeof(date));
- }
- printf("%2d:%02d:%02d.%03d ", tm.tm_hour, tm.tm_min, tm.tm_sec, ms);
+ strlcpy(date, new_date, sizeof(date));
+ }
+ printf("%2d:%02d:%02d.%03d ", tm.tm_hour, tm.tm_min, tm.tm_sec, ms);
}
static void print_usage(const char *arg0)
@@ -69,18 +69,18 @@ static void dnsproxy_reply(DNSXConnRef connRef, DNSXErrorType errCode)
printtimestamp();
switch (errCode)
{
- case kDNSX_NoError : printf(" SUCCESS \n"); break;
- case kDNSX_DictError : printf(" DICT ERROR \n"); break;
+ case kDNSX_NoError : printf(" SUCCESS \n");
+ break;
case kDNSX_DaemonNotRunning : printf(" NO DAEMON \n");
- DNSXRefDeAlloc(ClientRef); break;
- case kDNSX_Engaged : printf(" ENGAGED \n");
- DNSXRefDeAlloc(ClientRef); break;
+ DNSXRefDeAlloc(ClientRef); break;
+ case kDNSX_BadParam : printf(" BAD PARAMETER \n");
+ DNSXRefDeAlloc(ClientRef); break;
case kDNSX_UnknownErr :
- default : printf("UNKNOWN ERR \n");
- DNSXRefDeAlloc(ClientRef); break;
+ default : printf(" UNKNOWN ERR \n");
+ DNSXRefDeAlloc(ClientRef); break;
}
fflush(NULL);
-
+
}
//*************************************************************************************************************
@@ -88,40 +88,41 @@ static void dnsproxy_reply(DNSXConnRef connRef, DNSXErrorType errCode)
int main(int argc, char **argv)
{
DNSXErrorType err;
-
+
// Default i/p intf is lo0 and o/p intf is primary interface
IfIndex Ipintfs[MaxInputIf] = {1, 0, 0, 0, 0};
IfIndex Opintf = kDNSIfindexAny;
-
+
// Extract program name from argv[0], which by convention contains the path to this executable
- const char *a0 = strrchr(argv[0], kFilePathSep) + 1;
+ const char *a0 = strrchr(argv[0], kFilePathSep) + 1;
if (a0 == (const char *)1)
a0 = argv[0];
-
+
// Must run as root
- if (0 != geteuid())
- {
- fprintf(stderr, "%s MUST run as root!!\n", a0);
- exit(-1);
+ if (0 != geteuid())
+ {
+ fprintf(stderr, "%s MUST run as root!!\n", a0);
+ exit(-1);
}
if ((sizeof(argv) == 8))
printf("dnsctl running in 64-bit mode\n");
else if ((sizeof(argv) == 4))
printf("dnsctl running in 32-bit mode\n");
-
+
// expects atleast one argument
if (argc < 2)
goto Usage;
-
+
if ( !strcmp(argv[1], "-DP") || !strcmp(argv[1], "-dp") )
{
if (argc == 2)
{
printtimestamp();
- printf("Proceeding to Enable DNSProxy on mDNSResponder with Default Parameters\n");
+ printf("Enabling DNSProxy on mDNSResponder with Default Parameters\n");
dispatch_queue_t my_Q = dispatch_queue_create("com.apple.dnsctl.callback_queue", NULL);
err = DNSXEnableProxy(&ClientRef, kDNSProxyEnable, Ipintfs, Opintf, my_Q, dnsproxy_reply);
- }
+ if (err) fprintf(stderr, "DNSXEnableProxy returned %d\n", err);
+ }
else if (argc > 2)
{
argc--;
@@ -129,17 +130,17 @@ int main(int argc, char **argv)
if (!strcmp(argv[1], "-o"))
{
Opintf = if_nametoindex(argv[2]);
- if (!Opintf)
+ if (!Opintf)
Opintf = atoi(argv[2]);
- if (!Opintf)
- {
- fprintf(stderr, "Could not parse o/p interface [%s]: Passing default primary \n", argv[2]);
+ if (!Opintf)
+ {
+ fprintf(stderr, "Could not parse o/p interface [%s]: Passing default primary \n", argv[2]);
Opintf = kDNSIfindexAny;
}
argc -= 2;
argv += 2;
}
- if (argc > 2 && !strcmp(argv[1], "-i"))
+ if (argc > 2 && !strcmp(argv[1], "-i"))
{
int i;
argc--;
@@ -148,29 +149,30 @@ int main(int argc, char **argv)
{
Ipintfs[i] = if_nametoindex(argv[1]);
if (!Ipintfs[i])
- Ipintfs[i] = atoi(argv[1]);
+ Ipintfs[i] = atoi(argv[1]);
if (!Ipintfs[i])
{
- fprintf(stderr, "Could not parse i/p interface [%s]: Passing default lo0 \n", argv[2]);
+ fprintf(stderr, "Could not parse i/p interface [%s]: Passing default lo0 \n", argv[2]);
Ipintfs[i] = 1;
}
argc--;
argv++;
}
- }
+ }
printtimestamp();
- printf("Proceeding to Enable DNSProxy on mDNSResponder \n");
+ printf("Enabling DNSProxy on mDNSResponder \n");
dispatch_queue_t my_Q = dispatch_queue_create("com.apple.dnsctl.callback_queue", NULL);
- err = DNSXEnableProxy(&ClientRef, kDNSProxyEnable, Ipintfs, Opintf, my_Q, dnsproxy_reply);
+ err = DNSXEnableProxy(&ClientRef, kDNSProxyEnable, Ipintfs, Opintf, my_Q, dnsproxy_reply);
+ if (err) fprintf(stderr, "DNSXEnableProxy returned %d\n", err);
}
}
else
{
goto Usage;
}
-
- dispatch_main();
-
+
+ dispatch_main();
+
Usage:
print_usage(a0);
return 0;
diff --git a/mDNSResponder/Makefile b/mDNSResponder/Makefile
index 647dcf95..ba79b293 100644
--- a/mDNSResponder/Makefile
+++ b/mDNSResponder/Makefile
@@ -16,7 +16,7 @@
include $(MAKEFILEPATH)/pb_makefiles/platform.make
-MVERS = "mDNSResponder-576.30.4"
+MVERS = "mDNSResponder-625.41.2"
DDNSWRITECONFIG = "$(DSTROOT)/Library/Application Support/Bonjour/ddnswriteconfig"
VER =
diff --git a/mDNSResponder/mDNSCore/CryptoAlg.c b/mDNSResponder/mDNSCore/CryptoAlg.c
index 38533fc8..0008405d 100644
--- a/mDNSResponder/mDNSCore/CryptoAlg.c
+++ b/mDNSResponder/mDNSCore/CryptoAlg.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2012 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSCore/CryptoAlg.h b/mDNSResponder/mDNSCore/CryptoAlg.h
index 6cb3dc9d..c21507e4 100644
--- a/mDNSResponder/mDNSCore/CryptoAlg.h
+++ b/mDNSResponder/mDNSCore/CryptoAlg.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2012 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#ifndef __CRYPTO_ALG_H
#define __CRYPTO_ALG_H
diff --git a/mDNSResponder/mDNSCore/DNSCommon.c b/mDNSResponder/mDNSCore/DNSCommon.c
index 249e3b23..d364ee02 100644
--- a/mDNSResponder/mDNSCore/DNSCommon.c
+++ b/mDNSResponder/mDNSCore/DNSCommon.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -513,7 +513,7 @@ mDNSexport char *GetRRDisplayString_rdb(const ResourceRecord *const rr, const RD
expTimeBuf, inceptTimeBuf, swap16(rrsig->keyTag), ((domainname *)(&rrsig->signerName))->c);
len = DomainNameLength((domainname *)&rrsig->signerName);
- length += baseEncode(buffer + length, RemSpc, (const mDNSu8 *)(rd->data + len + RRSIG_FIXED_SIZE),
+ baseEncode(buffer + length, RemSpc, (const mDNSu8 *)(rd->data + len + RRSIG_FIXED_SIZE),
rr->rdlength - (len + RRSIG_FIXED_SIZE), ENC_BASE64);
}
break;
@@ -521,7 +521,7 @@ mDNSexport char *GetRRDisplayString_rdb(const ResourceRecord *const rr, const RD
rdataDNSKey *rrkey = (rdataDNSKey *)rd->data;
length += mDNS_snprintf(buffer+length, RemSpc, "\t%d %d %s %u ", swap16(rrkey->flags), rrkey->proto,
DNSSECAlgName(rrkey->alg), (unsigned int)keytag((mDNSu8 *)rrkey, rr->rdlength));
- length += baseEncode(buffer + length, RemSpc, (const mDNSu8 *)(rd->data + DNSKEY_FIXED_SIZE),
+ baseEncode(buffer + length, RemSpc, (const mDNSu8 *)(rd->data + DNSKEY_FIXED_SIZE),
rr->rdlength - DNSKEY_FIXED_SIZE, ENC_BASE64);
}
break;
@@ -1481,6 +1481,7 @@ mDNSexport void mDNS_SetupQuestion(DNSQuestion *const q, const mDNSInterfaceID I
q->qnameOrig = mDNSNULL;
q->AnonInfo = mDNSNULL;
q->pid = mDNSPlatformGetPID();
+ q->euid = 0;
q->DisallowPID = mDNSfalse;
q->ServiceID = -1;
q->QuestionCallback = callback;
@@ -2357,13 +2358,9 @@ mDNSexport mDNSu8 *putRData(const DNSMessage *const msg, mDNSu8 *ptr, const mDNS
case kDNSType_NSEC: {
// For NSEC records, rdlength represents the exact number of bytes
// of in memory storage.
- int len = rr->rdlength;
mDNSu8 *nsec = (mDNSu8 *)rdb->data;
domainname *name = (domainname *)nsec;
- int dlen;
-
- dlen = DomainNameLength(name);
- len -= dlen;
+ const int dlen = DomainNameLength(name);
nsec += dlen;
// This function is called when we are sending a NSEC record as part of mDNS,
// or to copy the data to any other buffer needed which could be a mDNS or uDNS
@@ -2376,7 +2373,6 @@ mDNSexport mDNSu8 *putRData(const DNSMessage *const msg, mDNSu8 *ptr, const mDNS
int i, j, wlen;
wlen = *(nsec + 1);
nsec += 2; // Skip the window number and len
- len -= 2;
// For our simplified use of NSEC synthetic records:
//
@@ -2406,6 +2402,7 @@ mDNSexport mDNSu8 *putRData(const DNSMessage *const msg, mDNSu8 *ptr, const mDNS
else
{
int win, wlen;
+ int len = rr->rdlength - dlen;
// Sanity check whether the bitmap is good
while (len)
@@ -2607,7 +2604,7 @@ mDNSexport mDNSu8 *putDeleteAllRRSets(DNSMessage *msg, mDNSu8 *ptr, const domain
}
// for dynamic updates
-mDNSexport mDNSu8 *putUpdateLease(DNSMessage *msg, mDNSu8 *end, mDNSu32 lease)
+mDNSexport mDNSu8 *putUpdateLease(DNSMessage *msg, mDNSu8 *ptr, mDNSu32 lease)
{
AuthRecord rr;
mDNS_SetupResourceRecord(&rr, mDNSNULL, mDNSInterface_Any, kDNSType_OPT, kStandardTTL, kDNSRecordTypeKnownUnique, AuthRecordAny, mDNSNULL, mDNSNULL);
@@ -2616,13 +2613,13 @@ mDNSexport mDNSu8 *putUpdateLease(DNSMessage *msg, mDNSu8 *end, mDNSu32 lease)
rr.resrec.rdestimate = sizeof(rdataOPT);
rr.resrec.rdata->u.opt[0].opt = kDNSOpt_Lease;
rr.resrec.rdata->u.opt[0].u.updatelease = lease;
- end = PutResourceRecordTTLJumbo(msg, end, &msg->h.numAdditionals, &rr.resrec, 0);
- if (!end) { LogMsg("ERROR: putUpdateLease - PutResourceRecordTTL"); return mDNSNULL; }
- return end;
+ ptr = PutResourceRecordTTLJumbo(msg, ptr, &msg->h.numAdditionals, &rr.resrec, 0);
+ if (!ptr) { LogMsg("ERROR: putUpdateLease - PutResourceRecordTTL"); return mDNSNULL; }
+ return ptr;
}
// for dynamic updates
-mDNSexport mDNSu8 *putUpdateLeaseWithLimit(DNSMessage *msg, mDNSu8 *end, mDNSu32 lease, mDNSu8 *limit)
+mDNSexport mDNSu8 *putUpdateLeaseWithLimit(DNSMessage *msg, mDNSu8 *ptr, mDNSu32 lease, mDNSu8 *limit)
{
AuthRecord rr;
mDNS_SetupResourceRecord(&rr, mDNSNULL, mDNSInterface_Any, kDNSType_OPT, kStandardTTL, kDNSRecordTypeKnownUnique, AuthRecordAny, mDNSNULL, mDNSNULL);
@@ -2631,9 +2628,9 @@ mDNSexport mDNSu8 *putUpdateLeaseWithLimit(DNSMessage *msg, mDNSu8 *end, mDNSu32
rr.resrec.rdestimate = sizeof(rdataOPT);
rr.resrec.rdata->u.opt[0].opt = kDNSOpt_Lease;
rr.resrec.rdata->u.opt[0].u.updatelease = lease;
- end = PutResourceRecordTTLWithLimit(msg, end, &msg->h.numAdditionals, &rr.resrec, 0, limit);
- if (!end) { LogMsg("ERROR: putUpdateLease - PutResourceRecordTTLWithLimit"); return mDNSNULL; }
- return end;
+ ptr = PutResourceRecordTTLWithLimit(msg, ptr, &msg->h.numAdditionals, &rr.resrec, 0, limit);
+ if (!ptr) { LogMsg("ERROR: putUpdateLeaseWithLimit - PutResourceRecordTTLWithLimit"); return mDNSNULL; }
+ return ptr;
}
mDNSexport mDNSu8 *putDNSSECOption(DNSMessage *msg, mDNSu8 *end, mDNSu8 *limit)
@@ -2650,7 +2647,7 @@ mDNSexport mDNSu8 *putDNSSECOption(DNSMessage *msg, mDNSu8 *end, mDNSu8 *limit)
// set the DO bit
ttl |= 0x8000;
end = PutResourceRecordTTLWithLimit(msg, end, &msg->h.numAdditionals, &rr.resrec, ttl, limit);
- if (!end) { LogMsg("ERROR: putUpdateLease - PutResourceRecordTTLWithLimit"); return mDNSNULL; }
+ if (!end) { LogMsg("ERROR: putDNSSECOption - PutResourceRecordTTLWithLimit"); return mDNSNULL; }
return end;
}
@@ -3441,12 +3438,7 @@ mDNSexport const mDNSu8 *GetLargeResourceRecord(mDNS *const m, const DNSMessage
mDNSu16 pktrdlength;
if (largecr == &m->rec && m->rec.r.resrec.RecordType)
- {
- LogMsg("GetLargeResourceRecord: m->rec appears to be already in use for %s", CRDisplayString(m, &m->rec.r));
-#if ForceAlerts
- *(long*)0 = 0;
-#endif
- }
+ LogFatalError("GetLargeResourceRecord: m->rec appears to be already in use for %s", CRDisplayString(m, &m->rec.r));
rr->next = mDNSNULL;
rr->resrec.name = &largecr->namestorage;
@@ -3713,7 +3705,7 @@ mDNSexport void DumpPacket(mDNS *const m, mStatus status, mDNSBool sent, char *t
}
ptr = DumpRecords(m, msg, ptr, end, msg->h.numAnswers, IsUpdate ? "Prerequisites" : "Answers");
ptr = DumpRecords(m, msg, ptr, end, msg->h.numAuthorities, IsUpdate ? "Updates" : "Authorities");
- ptr = DumpRecords(m, msg, ptr, end, msg->h.numAdditionals, "Additionals");
+ DumpRecords(m, msg, ptr, end, msg->h.numAdditionals, "Additionals");
LogMsg("--------------");
}
@@ -3725,11 +3717,8 @@ mDNSexport void DumpPacket(mDNS *const m, mStatus status, mDNSBool sent, char *t
// Stub definition of TCPSocket_struct so we can access flags field. (Rest of TCPSocket_struct is platform-dependent.)
struct TCPSocket_struct { TCPSocketFlags flags; /* ... */ };
-
-struct UDPSocket_struct
-{
- mDNSIPPort port; // MUST BE FIRST FIELD -- mDNSCoreReceive expects every UDPSocket_struct to begin with mDNSIPPort port
-};
+// Stub definition of UDPSocket_struct so we can access port field. (Rest of UDPSocket_struct is platform-dependent.)
+struct UDPSocket_struct { mDNSIPPort port; /* ... */ };
// Note: When we sign a DNS message using DNSDigest_SignMessage(), the current real-time clock value is used, which
// is why we generally defer signing until we send the message, to ensure the signature is as fresh as possible.
@@ -3844,12 +3833,7 @@ mDNSexport void mDNS_Lock_(mDNS *const m, const char * const functionname)
// If that client callback does mDNS API calls, mDNS_reentrancy and mDNS_busy will both be one
// If mDNS_busy != mDNS_reentrancy that's a bad sign
if (m->mDNS_busy != m->mDNS_reentrancy)
- {
- LogMsg("%s: mDNS_Lock: Locking failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", functionname, m->mDNS_busy, m->mDNS_reentrancy);
-#if ForceAlerts
- *(long*)0 = 0;
-#endif
- }
+ LogFatalError("%s: mDNS_Lock: Locking failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", functionname, m->mDNS_busy, m->mDNS_reentrancy);
// If this is an initial entry into the mDNSCore code, set m->timenow
// else, if this is a re-entrant entry into the mDNSCore code, m->timenow should already be set
@@ -3930,82 +3914,89 @@ mDNSlocal mDNSs32 GetNextScheduledEvent(const mDNS *const m)
return(e);
}
+#define LogTSE TSE++,LogMsg
+
mDNSexport void ShowTaskSchedulingError(mDNS *const m)
{
+ int TSE = 0;
AuthRecord *rr;
mDNS_Lock(m);
- LogMsg("Task Scheduling Error: Continuously busy for more than a second");
+ LogMsg("Task Scheduling Error: *** Continuously busy for more than a second");
// Note: To accurately diagnose *why* we're busy, the debugging code here needs to mirror the logic in GetNextScheduledEvent above
if (m->NewQuestions && (!m->NewQuestions->DelayAnswering || m->timenow - m->NewQuestions->DelayAnswering >= 0))
- LogMsg("Task Scheduling Error: NewQuestion %##s (%s)",
+ LogTSE("Task Scheduling Error: NewQuestion %##s (%s)",
m->NewQuestions->qname.c, DNSTypeName(m->NewQuestions->qtype));
if (m->NewLocalOnlyQuestions)
- LogMsg("Task Scheduling Error: NewLocalOnlyQuestions %##s (%s)",
+ LogTSE("Task Scheduling Error: NewLocalOnlyQuestions %##s (%s)",
m->NewLocalOnlyQuestions->qname.c, DNSTypeName(m->NewLocalOnlyQuestions->qtype));
if (m->NewLocalRecords)
{
rr = AnyLocalRecordReady(m);
- if (rr) LogMsg("Task Scheduling Error: NewLocalRecords %s", ARDisplayString(m, rr));
+ if (rr) LogTSE("Task Scheduling Error: NewLocalRecords %s", ARDisplayString(m, rr));
}
- if (m->NewLocalOnlyRecords) LogMsg("Task Scheduling Error: NewLocalOnlyRecords");
+ if (m->NewLocalOnlyRecords) LogTSE("Task Scheduling Error: NewLocalOnlyRecords");
- if (m->SPSProxyListChanged) LogMsg("Task Scheduling Error: SPSProxyListChanged");
- if (m->LocalRemoveEvents) LogMsg("Task Scheduling Error: LocalRemoveEvents");
+ if (m->SPSProxyListChanged) LogTSE("Task Scheduling Error: SPSProxyListChanged");
- if (m->timenow - m->NextScheduledEvent >= 0)
- LogMsg("Task Scheduling Error: m->NextScheduledEvent %d", m->timenow - m->NextScheduledEvent);
+ if (m->LocalRemoveEvents) LogTSE("Task Scheduling Error: LocalRemoveEvents");
#ifndef UNICAST_DISABLED
if (m->timenow - m->NextuDNSEvent >= 0)
- LogMsg("Task Scheduling Error: m->NextuDNSEvent %d", m->timenow - m->NextuDNSEvent);
+ LogTSE("Task Scheduling Error: m->NextuDNSEvent %d", m->timenow - m->NextuDNSEvent);
if (m->timenow - m->NextScheduledNATOp >= 0)
- LogMsg("Task Scheduling Error: m->NextScheduledNATOp %d", m->timenow - m->NextScheduledNATOp);
+ LogTSE("Task Scheduling Error: m->NextScheduledNATOp %d", m->timenow - m->NextScheduledNATOp);
if (m->NextSRVUpdate && m->timenow - m->NextSRVUpdate >= 0)
- LogMsg("Task Scheduling Error: m->NextSRVUpdate %d", m->timenow - m->NextSRVUpdate);
+ LogTSE("Task Scheduling Error: m->NextSRVUpdate %d", m->timenow - m->NextSRVUpdate);
#endif
if (m->timenow - m->NextCacheCheck >= 0)
- LogMsg("Task Scheduling Error: m->NextCacheCheck %d", m->timenow - m->NextCacheCheck);
+ LogTSE("Task Scheduling Error: m->NextCacheCheck %d", m->timenow - m->NextCacheCheck);
if (m->timenow - m->NextScheduledSPS >= 0)
- LogMsg("Task Scheduling Error: m->NextScheduledSPS %d", m->timenow - m->NextScheduledSPS);
+ LogTSE("Task Scheduling Error: m->NextScheduledSPS %d", m->timenow - m->NextScheduledSPS);
if (m->timenow - m->NextScheduledKA >= 0)
- LogMsg("Task Scheduling Error: m->NextScheduledKA %d", m->timenow - m->NextScheduledKA);
+ LogTSE("Task Scheduling Error: m->NextScheduledKA %d", m->timenow - m->NextScheduledKA);
if (!m->DelaySleep && m->SleepLimit && m->timenow - m->NextScheduledSPRetry >= 0)
- LogMsg("Task Scheduling Error: m->NextScheduledSPRetry %d", m->timenow - m->NextScheduledSPRetry);
+ LogTSE("Task Scheduling Error: m->NextScheduledSPRetry %d", m->timenow - m->NextScheduledSPRetry);
if (m->DelaySleep && m->timenow - m->DelaySleep >= 0)
- LogMsg("Task Scheduling Error: m->DelaySleep %d", m->timenow - m->DelaySleep);
+ LogTSE("Task Scheduling Error: m->DelaySleep %d", m->timenow - m->DelaySleep);
if (m->SuppressSending && m->timenow - m->SuppressSending >= 0)
- LogMsg("Task Scheduling Error: m->SuppressSending %d", m->timenow - m->SuppressSending);
+ LogTSE("Task Scheduling Error: m->SuppressSending %d", m->timenow - m->SuppressSending);
if (m->timenow - m->NextScheduledQuery >= 0)
- LogMsg("Task Scheduling Error: m->NextScheduledQuery %d", m->timenow - m->NextScheduledQuery);
+ LogTSE("Task Scheduling Error: m->NextScheduledQuery %d", m->timenow - m->NextScheduledQuery);
if (m->timenow - m->NextScheduledProbe >= 0)
- LogMsg("Task Scheduling Error: m->NextScheduledProbe %d", m->timenow - m->NextScheduledProbe);
+ LogTSE("Task Scheduling Error: m->NextScheduledProbe %d", m->timenow - m->NextScheduledProbe);
if (m->timenow - m->NextScheduledResponse >= 0)
- LogMsg("Task Scheduling Error: m->NextScheduledResponse %d", m->timenow - m->NextScheduledResponse);
+ LogTSE("Task Scheduling Error: m->NextScheduledResponse %d", m->timenow - m->NextScheduledResponse);
+ if (m->timenow - m->NextScheduledStopTime >= 0)
+ LogTSE("Task Scheduling Error: m->NextScheduledStopTime %d", m->timenow - m->NextScheduledStopTime);
+
+ if (m->timenow - m->NextScheduledEvent >= 0)
+ LogTSE("Task Scheduling Error: m->NextScheduledEvent %d", m->timenow - m->NextScheduledEvent);
+
+ if (m->NetworkChanged && m->timenow - m->NetworkChanged >= 0)
+ LogTSE("Task Scheduling Error: NetworkChanged %d", m->timenow - m->NetworkChanged);
+
+ if (!TSE) LogMsg("Task Scheduling Error: *** No likely causes identified");
+ else LogMsg("Task Scheduling Error: *** %d potential cause%s identified (significant only if the same cause consistently appears)", TSE, TSE > 1 ? "s" : "");
mDNS_Unlock(m);
}
-mDNSexport void mDNS_Unlock_(mDNS *const m, const char * const functionname)
+mDNSexport void mDNS_Unlock_(mDNS *const m, const char *const functionname)
{
// Decrement mDNS_busy
m->mDNS_busy--;
// Check for locking failures
if (m->mDNS_busy != m->mDNS_reentrancy)
- {
- LogMsg("%s: mDNS_Unlock: Locking failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", functionname, m->mDNS_busy, m->mDNS_reentrancy);
-#if ForceAlerts
- *(long*)0 = 0;
-#endif
- }
+ LogFatalError("%s: mDNS_Unlock: Locking failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", functionname, m->mDNS_busy, m->mDNS_reentrancy);
// If this is a final exit from the mDNSCore code, set m->NextScheduledEvent and clear m->timenow
if (m->mDNS_busy == 0)
diff --git a/mDNSResponder/mDNSCore/DNSCommon.h b/mDNSResponder/mDNSCore/DNSCommon.h
index b92f5a9a..e51b06dd 100644
--- a/mDNSResponder/mDNSCore/DNSCommon.h
+++ b/mDNSResponder/mDNSCore/DNSCommon.h
@@ -220,7 +220,7 @@ extern mDNSu8 *putDeletionRecord(DNSMessage *msg, mDNSu8 *ptr, ResourceRecord *r
extern mDNSu8 *putDeletionRecordWithLimit(DNSMessage *msg, mDNSu8 *ptr, ResourceRecord *rr, mDNSu8 *limit);
extern mDNSu8 *putDeleteRRSetWithLimit(DNSMessage *msg, mDNSu8 *ptr, const domainname *name, mDNSu16 rrtype, mDNSu8 *limit);
extern mDNSu8 *putDeleteAllRRSets(DNSMessage *msg, mDNSu8 *ptr, const domainname *name);
-extern mDNSu8 *putUpdateLease(DNSMessage *msg, mDNSu8 *end, mDNSu32 lease);
+extern mDNSu8 *putUpdateLease(DNSMessage *msg, mDNSu8 *ptr, mDNSu32 lease);
extern mDNSu8 *putUpdateLeaseWithLimit(DNSMessage *msg, mDNSu8 *ptr, mDNSu32 lease, mDNSu8 *limit);
extern mDNSu8 *putHINFO(const mDNS *const m, DNSMessage *const msg, mDNSu8 *ptr, DomainAuthInfo *authInfo, mDNSu8 *limit);
@@ -297,16 +297,16 @@ extern void mDNS_Unlock_(mDNS *const m, const char * const functionname);
#define mDNS_Unlock(X) mDNS_Unlock_((X), __func__)
-#define mDNS_CheckLock(X) { if ((X)->mDNS_busy != (X)->mDNS_reentrancy+1) \
- LogMsg("%s: Lock not held! mDNS_busy (%ld) mDNS_reentrancy (%ld)", __func__, (X)->mDNS_busy, (X)->mDNS_reentrancy); }
+#define mDNS_CheckLock(X) \
+ if ((X)->mDNS_busy != (X)->mDNS_reentrancy+1) LogMsg("%s: Lock not held! mDNS_busy (%ld) mDNS_reentrancy (%ld)", __func__, (X)->mDNS_busy, (X)->mDNS_reentrancy)
#define mDNS_DropLockBeforeCallback() do { m->mDNS_reentrancy++; \
- if (m->mDNS_busy != m->mDNS_reentrancy) LogMsg("%s: Locking Failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", __func__, m->mDNS_busy, m->mDNS_reentrancy); \
-} while (0)
+ if (m->mDNS_busy != m->mDNS_reentrancy) LogMsg("%s: Locking Failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", __func__, m->mDNS_busy, m->mDNS_reentrancy); \
+ } while (0)
#define mDNS_ReclaimLockAfterCallback() do { \
- if (m->mDNS_busy != m->mDNS_reentrancy) LogMsg("%s: Unlocking Failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", __func__, m->mDNS_busy, m->mDNS_reentrancy); \
- m->mDNS_reentrancy--; } while (0)
+ if (m->mDNS_busy != m->mDNS_reentrancy) LogMsg("%s: Unlocking Failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", __func__, m->mDNS_busy, m->mDNS_reentrancy); \
+ m->mDNS_reentrancy--; } while (0)
#ifdef __cplusplus
}
diff --git a/mDNSResponder/mDNSCore/DNSDigest.c b/mDNSResponder/mDNSCore/DNSDigest.c
index 33798d38..57a40120 100644
--- a/mDNSResponder/mDNSCore/DNSDigest.c
+++ b/mDNSResponder/mDNSCore/DNSDigest.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/mDNSResponder/mDNSCore/anonymous.c b/mDNSResponder/mDNSCore/anonymous.c
index 55a83175..779e4ea6 100644
--- a/mDNSResponder/mDNSCore/anonymous.c
+++ b/mDNSResponder/mDNSCore/anonymous.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2012 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2012-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,14 @@
#define ANON_NSEC3_ITERATIONS 1
+struct AnonInfoResourceRecord_struct
+{
+ ResourceRecord resrec;
+ RData rdatastorage;
+};
+
+typedef struct AnonInfoResourceRecord_struct AnonInfoResourceRecord;
+
mDNSlocal mDNSBool InitializeNSEC3Record(ResourceRecord *rr, const mDNSu8 *AnonData, int len, mDNSu32 salt)
{
const mDNSu8 *ptr;
@@ -118,9 +126,10 @@ mDNSlocal ResourceRecord *ConstructNSEC3Record(const domainname *service, const
mDNSlocal ResourceRecord *CopyNSEC3ResourceRecord(AnonymousInfo *si, const ResourceRecord *rr)
{
- int len;
+ AnonInfoResourceRecord *anonRR;
domainname *name;
- ResourceRecord *nsec3rr;
+ mDNSu32 neededLen;
+ mDNSu32 extraLen;
if (rr->rdlength < MCAST_NSEC3_RDLENGTH)
{
@@ -128,22 +137,26 @@ mDNSlocal ResourceRecord *CopyNSEC3ResourceRecord(AnonymousInfo *si, const Resou
return mDNSNULL;
}
// Allocate space for the name and the rdata along with the ResourceRecord
- len = DomainNameLength(rr->name);
- nsec3rr = mDNSPlatformMemAllocate(sizeof(ResourceRecord) + len + sizeof(RData));
- if (!nsec3rr)
+ neededLen = rr->rdlength + DomainNameLength(rr->name);
+ extraLen = (neededLen > sizeof(RDataBody)) ? (neededLen - sizeof(RDataBody)) : 0;
+ anonRR = (AnonInfoResourceRecord *)mDNSPlatformMemAllocate(sizeof(AnonInfoResourceRecord) + extraLen);
+ if (!anonRR)
return mDNSNULL;
- *nsec3rr = *rr;
- name = (domainname *)((mDNSu8 *)nsec3rr + sizeof(ResourceRecord));
- nsec3rr->name = (const domainname *)name;
+ anonRR->resrec = *rr;
+
+ anonRR->rdatastorage.MaxRDLength = rr->rdlength;
+ mDNSPlatformMemCopy(anonRR->rdatastorage.u.data, rr->rdata->u.data, rr->rdlength);
+
+ name = (domainname *)(anonRR->rdatastorage.u.data + rr->rdlength);
AssignDomainName(name, rr->name);
- nsec3rr->rdata = (RData *)((mDNSu8 *)nsec3rr->name + len);
- mDNSPlatformMemCopy(nsec3rr->rdata->u.data, rr->rdata->u.data, rr->rdlength);
+ anonRR->resrec.name = name;
+ anonRR->resrec.rdata = &anonRR->rdatastorage;
- si->nsec3RR = nsec3rr;
+ si->nsec3RR = (ResourceRecord *)anonRR;
- return nsec3rr;
+ return si->nsec3RR;
}
// When a service is started or a browse is started with the Anonymous data, we allocate a new random
diff --git a/mDNSResponder/mDNSCore/anonymous.h b/mDNSResponder/mDNSCore/anonymous.h
index 2f2b4f8c..b60812ea 100644
--- a/mDNSResponder/mDNSCore/anonymous.h
+++ b/mDNSResponder/mDNSCore/anonymous.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2012 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2012 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSCore/dnsproxy.c b/mDNSResponder/mDNSCore/dnsproxy.c
index 11bacc10..5b358864 100644
--- a/mDNSResponder/mDNSCore/dnsproxy.c
+++ b/mDNSResponder/mDNSCore/dnsproxy.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,10 +83,6 @@ mDNSlocal void FreeDNSProxyClient(DNSProxyClient *pc)
mDNSlocal mDNSBool ParseEDNS0(DNSProxyClient *pc, const mDNSu8 *ptr, int length, const mDNSu8 *limit)
{
- mDNSu16 rrtype, rrclass;
- mDNSu8 rcode, version;
- mDNSu16 flag;
-
if (ptr + length > limit)
{
LogInfo("ParseEDNS0: Not enough space in the packet");
@@ -94,18 +90,19 @@ mDNSlocal mDNSBool ParseEDNS0(DNSProxyClient *pc, const mDNSu8 *ptr, int length,
}
// Skip the root label
ptr++;
- rrtype = (mDNSu16) ((mDNSu16)ptr[0] << 8 | ptr[1]);
+ mDNSu16 rrtype = (mDNSu16) ((mDNSu16)ptr[0] << 8 | ptr[1]);
if (rrtype != kDNSType_OPT)
{
LogInfo("ParseEDNS0: Not the right type %d", rrtype);
return mDNSfalse;
}
- rrclass = (mDNSu16) ((mDNSu16)ptr[2] << 8 | ptr[3]);
- rcode = ptr[4];
- version = ptr[5];
- flag = (mDNSu16) ((mDNSu16)ptr[6] << 8 | ptr[7]);
-
+ mDNSu16 rrclass = (mDNSu16) ((mDNSu16)ptr[2] << 8 | ptr[3]);
+#if MDNS_DEBUGMSGS
+ mDNSu8 rcode = ptr[4];
+ mDNSu8 version = ptr[5];
+ mDNSu16 flag = (mDNSu16) ((mDNSu16)ptr[6] << 8 | ptr[7]);
debugf("rrtype is %s, length is %d, rcode %d, version %d, flag 0x%x", DNSTypeName(rrtype), rrclass, rcode, version, flag);
+#endif
pc->rcvBufSize = rrclass;
pc->DNSSECOK = ptr[6] & 0x80;
@@ -366,7 +363,7 @@ again:
return mDNSNULL;
}
len += (ptr - orig);
- orig = ptr;
+ // orig = ptr; Commented out to avoid ‘value never read’ error message
}
LogInfo("AddResourceRecord: Added %d bytes to the packet", len);
return ptr;
@@ -471,14 +468,16 @@ mDNSlocal void ProxyClientCallback(mDNS *const m, DNSQuestion *question, const R
}
}
}
+
+ debugf("ProxyClientCallback: InterfaceID is %p for response to client", pc->interfaceID);
if (!pc->tcp)
{
- mDNSSendDNSMessage(m, &m->omsg, ptr, mDNSInterface_Any, (UDPSocket *)pc->socket, &pc->addr, pc->port, mDNSNULL, mDNSNULL, mDNSfalse);
+ mDNSSendDNSMessage(m, &m->omsg, ptr, pc->interfaceID, (UDPSocket *)pc->socket, &pc->addr, pc->port, mDNSNULL, mDNSNULL, mDNSfalse);
}
else
{
- mDNSSendDNSMessage(m, &m->omsg, ptr, mDNSInterface_Any, mDNSNULL, &pc->addr, pc->port, (TCPSocket *)pc->socket, mDNSNULL, mDNSfalse);
+ mDNSSendDNSMessage(m, &m->omsg, ptr, pc->interfaceID, mDNSNULL, &pc->addr, pc->port, (TCPSocket *)pc->socket, mDNSNULL, mDNSfalse);
}
done:
@@ -502,8 +501,6 @@ mDNSlocal void SendError(mDNS *const m, void *socket, void *const pkt, const mDN
int pktlen = (int)(end - (mDNSu8 *)pkt);
DNSMessage *msg = (DNSMessage *)pkt;
- (void) InterfaceID;
-
// RFC 1035 requires that we copy the question back and RFC 2136 is okay with sending nothing
// in the body or send back whatever we get for updates. It is easy to return whatever we get
// in the question back to the responder. We return as much as we can fit in our standard
@@ -517,12 +514,12 @@ mDNSlocal void SendError(mDNS *const m, void *socket, void *const pkt, const mDN
mDNSPlatformMemCopy(m->omsg.data, (mDNSu8 *)&msg->h.numQuestions, pktlen);
if (!tcp)
{
- mDNSSendDNSMessage(m, &m->omsg, (mDNSu8 *)&m->omsg + pktlen, mDNSInterface_Any, socket, dstaddr, dstport, mDNSNULL, mDNSNULL,
+ mDNSSendDNSMessage(m, &m->omsg, (mDNSu8 *)&m->omsg + pktlen, InterfaceID, socket, dstaddr, dstport, mDNSNULL, mDNSNULL,
mDNSfalse);
}
else
{
- mDNSSendDNSMessage(m, &m->omsg, (mDNSu8 *)&m->omsg + pktlen, mDNSInterface_Any, mDNSNULL, dstaddr, dstport, (TCPSocket *)socket,
+ mDNSSendDNSMessage(m, &m->omsg, (mDNSu8 *)&m->omsg + pktlen, InterfaceID, mDNSNULL, dstaddr, dstport, (TCPSocket *)socket,
mDNSNULL, mDNSfalse);
}
mDNSPlatformDisposeProxyContext(context);
@@ -576,7 +573,7 @@ mDNSlocal void ProxyCallbackCommon(mDNS *const m, void *socket, void *const pkt,
const mDNSu8 *ptr;
DNSQuestion q, *qptr;
DNSProxyClient *pc;
- const mDNSu8 *optRR;
+ const mDNSu8 *optRR = mDNSNULL;
int optLen = 0;
DNSProxyClient **ppc = &DNSProxyClients;
diff --git a/mDNSResponder/mDNSCore/dnsproxy.h b/mDNSResponder/mDNSCore/dnsproxy.h
index ed46a125..8aa3d007 100644
--- a/mDNSResponder/mDNSCore/dnsproxy.h
+++ b/mDNSResponder/mDNSCore/dnsproxy.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#ifndef __DNS_PROXY_H
#define __DNS_PROXY_H
diff --git a/mDNSResponder/mDNSCore/dnssec.c b/mDNSResponder/mDNSCore/dnssec.c
index c83b8413..bf9acfe8 100644
--- a/mDNSResponder/mDNSCore/dnssec.c
+++ b/mDNSResponder/mDNSCore/dnssec.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "mDNSEmbeddedAPI.h"
#include "DNSSECSupport.h"
#include "DNSCommon.h"
@@ -309,7 +310,7 @@ mDNSlocal AuthChain *AuthChainCopy(AuthChain *ae)
rvfrom = ae->rrset;
rvto = &ac->rrset;
- while (rvfrom)
+ while (rvfrom && rvto)
{
*rvto = CopyRRVerifier(rvfrom);
rvfrom = rvfrom->next;
@@ -318,7 +319,7 @@ mDNSlocal AuthChain *AuthChainCopy(AuthChain *ae)
rvfrom = ae->rrsig;
rvto = &ac->rrsig;
- while (rvfrom)
+ while (rvfrom && rvto)
{
*rvto = CopyRRVerifier(rvfrom);
rvfrom = rvfrom->next;
@@ -327,7 +328,7 @@ mDNSlocal AuthChain *AuthChainCopy(AuthChain *ae)
rvfrom = ae->key;
rvto = &ac->key;
- while (rvfrom)
+ while (rvfrom && rvto)
{
*rvto = CopyRRVerifier(rvfrom);
rvfrom = rvfrom->next;
@@ -1065,7 +1066,6 @@ mDNSlocal mStatus CheckDSForKey(mDNS *const m, DNSSECVerifier *dv, CacheRecord *
return mStatus_NoError;
else
return mStatus_NoSuchRecord;
- return (dv->ds ? mStatus_NoError : mStatus_NoSuchRecord);
}
// It returns mDNStrue if we have all the rrsets for verification and mDNSfalse otherwise.
@@ -2335,8 +2335,6 @@ mDNSlocal void SetTTLRRSet(mDNS *const m, DNSSECVerifier *dv, DNSSECStatus statu
rdataRRSig *rrsig;
mDNSu32 slot;
CacheGroup *cg;
- int sigNameLen, len;
- mDNSu8 *ptr;
mDNSu32 rrTTL, rrsigTTL, rrsigOrigTTL, rrsigTimeTTL;
domainname *qname;
mDNSu16 qtype;
@@ -2400,17 +2398,11 @@ mDNSlocal void SetTTLRRSet(mDNS *const m, DNSSECVerifier *dv, DNSSECStatus statu
{
rrsigv = dv->ac->rrsig;
rrsig = (rdataRRSig *)rrsigv->rdata;
- sigNameLen = DomainNameLength((domainname *)&rrsig->signerName);
- // pointer to signature and the length
- ptr = (mDNSu8 *)(rrsigv->rdata + sigNameLen + RRSIG_FIXED_SIZE);
- len = rrsigv->rdlength - RRSIG_FIXED_SIZE - sigNameLen;
}
else
{
rrsigv = mDNSNULL;
rrsig = mDNSNULL;
- ptr = mDNSNULL;
- sigNameLen = len = 0;
}
rrsigRR = mDNSNULL;
@@ -3187,14 +3179,11 @@ mDNSexport void VerifySignature(mDNS *const m, DNSSECVerifier *dv, DNSQuestion *
mDNSlocal mDNSBool TrustedKeyPresent(mDNS *const m, DNSSECVerifier *dv)
{
- rdataRRSig *rrsig;
rdataDS *ds;
rdataDNSKey *key;
TrustAnchor *ta;
RRVerifier *keyv;
- rrsig = (rdataRRSig *)dv->rrsig->rdata;
-
// Walk all our trusted DS Records to see if we have a matching DNS KEY record that verifies
// the hash. If we find one, verify that this key was used to sign the KEY rrsets in
// this zone. Loop till we find one.
diff --git a/mDNSResponder/mDNSCore/dnssec.h b/mDNSResponder/mDNSCore/dnssec.h
index 1a8d9535..b770af8d 100644
--- a/mDNSResponder/mDNSCore/dnssec.h
+++ b/mDNSResponder/mDNSCore/dnssec.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#ifndef __DNSSEC_H
#define __DNSSEC_H
diff --git a/mDNSResponder/mDNSCore/mDNS.c b/mDNSResponder/mDNSCore/mDNS.c
index e0af1f1a..6b02be46 100755
--- a/mDNSResponder/mDNSCore/mDNS.c
+++ b/mDNSResponder/mDNSCore/mDNS.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,6 @@
#include "dns_sd.h" // for kDNSServiceFlags* definitions
#if APPLE_OSX_mDNSResponder
-
#include <WebFilterDNS/WebFilterDNS.h>
#if !NO_WCF
@@ -63,6 +62,10 @@ void WCFConnectionDealloc(WCFConnection* c) __attribute__((weak_import));
#define NO_WCF 1
#endif // APPLE_OSX_mDNSResponder
+#if TARGET_OS_EMBEDDED
+#include "Metrics.h"
+#endif
+
// Forward declarations
mDNSlocal void BeginSleepProcessing(mDNS *const m);
mDNSlocal void RetrySPSRegistrations(mDNS *const m);
@@ -80,6 +83,7 @@ mDNSlocal void DeadvertiseAllInterfaceRecords(mDNS *const m);
mDNSlocal void FreeNSECRecords(mDNS *const m, CacheRecord *NSECRecords);
mDNSlocal void mDNSParseNSEC3Records(mDNS *const m, const DNSMessage *const response, const mDNSu8 *end,
const mDNSInterfaceID InterfaceID, CacheRecord **NSEC3Records);
+mDNSlocal mDNSu8 *GetValueForMACAddr(mDNSu8 *ptr, mDNSu8 *limit, mDNSEthAddr *eth);
// ***************************************************************************
@@ -146,10 +150,6 @@ mDNSlocal void SetNextQueryStopTime(mDNS *const m, const DNSQuestion *const q)
{
mDNS_CheckLock(m);
-#if ForceAlerts
- if (m->mDNS_busy != m->mDNS_reentrancy+1) *(long*)0 = 0;
-#endif
-
if (m->NextScheduledStopTime - q->StopTime > 0)
m->NextScheduledStopTime = q->StopTime;
}
@@ -158,10 +158,6 @@ mDNSexport void SetNextQueryTime(mDNS *const m, const DNSQuestion *const q)
{
mDNS_CheckLock(m);
-#if ForceAlerts
- if (m->mDNS_busy != m->mDNS_reentrancy+1) *(long*)0 = 0;
-#endif
-
if (ActiveQuestion(q))
{
// Depending on whether this is a multicast or unicast question we want to set either:
@@ -352,7 +348,7 @@ mDNSlocal CacheGroup *CacheGroupForRecord(const mDNS *const m, const mDNSu32 slo
return(CacheGroupForName(m, slot, rr->namehash, rr->name));
}
-mDNSexport mDNSBool mDNS_AddressIsLocalSubnet(mDNS *const m, const mDNSInterfaceID InterfaceID, const mDNSAddr *addr, mDNSBool *myself)
+mDNSexport mDNSBool mDNS_AddressIsLocalSubnet(mDNS *const m, const mDNSInterfaceID InterfaceID, const mDNSAddr *addr)
{
NetworkInterfaceInfo *intf;
@@ -363,44 +359,19 @@ mDNSexport mDNSBool mDNS_AddressIsLocalSubnet(mDNS *const m, const mDNSInterface
for (intf = m->HostInterfaces; intf; intf = intf->next)
if (intf->ip.type == addr->type && intf->InterfaceID == InterfaceID && intf->McastTxRx)
if (((intf->ip.ip.v4.NotAnInteger ^ addr->ip.v4.NotAnInteger) & intf->mask.ip.v4.NotAnInteger) == 0)
- {
- if (myself)
- {
- if (mDNSSameIPv4Address(intf->ip.ip.v4, addr->ip.v4))
- *myself = mDNStrue;
- else
- *myself = mDNSfalse;
- if (*myself)
- debugf("mDNS_AddressIsLocalSubnet: IPv4 %#a returning true", addr);
- else
- debugf("mDNS_AddressIsLocalSubnet: IPv4 %#a returning false", addr);
- }
return(mDNStrue);
- }
}
if (addr->type == mDNSAddrType_IPv6)
{
+ if (mDNSv6AddressIsLinkLocal(&addr->ip.v6)) return(mDNStrue);
for (intf = m->HostInterfaces; intf; intf = intf->next)
if (intf->ip.type == addr->type && intf->InterfaceID == InterfaceID && intf->McastTxRx)
if ((((intf->ip.ip.v6.l[0] ^ addr->ip.v6.l[0]) & intf->mask.ip.v6.l[0]) == 0) &&
(((intf->ip.ip.v6.l[1] ^ addr->ip.v6.l[1]) & intf->mask.ip.v6.l[1]) == 0) &&
(((intf->ip.ip.v6.l[2] ^ addr->ip.v6.l[2]) & intf->mask.ip.v6.l[2]) == 0) &&
(((intf->ip.ip.v6.l[3] ^ addr->ip.v6.l[3]) & intf->mask.ip.v6.l[3]) == 0))
- {
- if (myself)
- {
- if (mDNSSameIPv6Address(intf->ip.ip.v6, addr->ip.v6))
- *myself = mDNStrue;
- else
- *myself = mDNSfalse;
- if (*myself)
- debugf("mDNS_AddressIsLocalSubnet: IPv6 %#a returning true", addr);
- else
- debugf("mDNS_AddressIsLocalSubnet: IPv6 %#a returning false", addr);
- }
return(mDNStrue);
- }
}
return(mDNSfalse);
@@ -475,11 +446,20 @@ mDNSexport void AnswerQuestionByFollowingCNAME(mDNS *const m, DNSQuestion *q, Re
const mDNSu32 c = q->CNAMEReferrals + 1; // Stash a copy of the new q->CNAMEReferrals value
UDPSocket *sock = q->LocalSocket;
mDNSOpaque16 id = q->TargetQID;
+#if TARGET_OS_EMBEDDED
+ domainname *originalQName;
+#endif
// if there is a message waiting at the socket, we want to process that instead
// of throwing it away. If we have a CNAME response that answers
// both A and AAAA question and while answering it we don't want to throw
// away the response where the actual addresses are present.
+ // This is a stupid hack and we should get rid of it.
+ // The chance of there being a second unicast UDP packet already waiting in the kernel before we’ve
+ // finished processing the previous one is virtually nil, and will only happen by luck on very rare
+ // occasions when running on a machine with a fast network connection and a slow or busy processor.
+ // The idea that we’d rely for correctness on this random chance event occurring is ridiculous.
+ // -- SC
if (mDNSPlatformPeekUDP(m, q->LocalSocket))
{
LogInfo("AnswerQuestionByFollowingCNAME: Preserving UDP socket for %##s (%s)", q->qname.c, DNSTypeName(q->qtype));
@@ -508,6 +488,31 @@ mDNSexport void AnswerQuestionByFollowingCNAME(mDNS *const m, DNSQuestion *q, Re
LogInfo("AnswerQuestionByFollowingCNAME: %p %##s (%s) following CNAME referral %d for %s",
q, q->qname.c, DNSTypeName(q->qtype), q->CNAMEReferrals, RRDisplayString(m, rr));
+#if TARGET_OS_EMBEDDED
+ if (q->metrics.originalQName)
+ {
+ originalQName = q->metrics.originalQName;
+ q->metrics.originalQName = mDNSNULL;
+ }
+ else
+ {
+ mDNSu16 qNameLen;
+
+ qNameLen = DomainNameLength(&q->qname);
+ if ((qNameLen > 0) && (qNameLen <= MAX_DOMAIN_NAME))
+ {
+ originalQName = mDNSPlatformMemAllocate(qNameLen);
+ if (originalQName)
+ {
+ mDNSPlatformMemCopy(originalQName->c, q->qname.c, qNameLen);
+ }
+ }
+ else
+ {
+ originalQName = mDNSNULL;
+ }
+ }
+#endif
mDNS_StopQuery_internal(m, q); // Stop old query
AssignDomainName(&q->qname, &rr->rdata->u.name); // Update qname
q->qnamehash = DomainNameHashValue(&q->qname); // and namehash
@@ -524,6 +529,9 @@ mDNSexport void AnswerQuestionByFollowingCNAME(mDNS *const m, DNSQuestion *q, Re
// Record how many times we've done this. We need to do this *after* mDNS_StartQuery_internal,
// because mDNS_StartQuery_internal re-initializes CNAMEReferrals to zero
q->CNAMEReferrals = c;
+#if TARGET_OS_EMBEDDED
+ q->metrics.originalQName = originalQName;
+#endif
if (sock)
{
// We have a message waiting and that should answer this question.
@@ -933,7 +941,7 @@ mDNSlocal void SetTargetToHostName(mDNS *const m, AuthRecord *const rr)
{
const domainname *const n = SetUnicastTargetToHostName(m, rr);
if (n) newname = n;
- else { target->c[0] = 0; SetNewRData(&rr->resrec, mDNSNULL, 0); return; }
+ else { if (target) target->c[0] = 0; SetNewRData(&rr->resrec, mDNSNULL, 0); return; }
}
if (target && SameDomainName(target, newname))
@@ -1133,26 +1141,61 @@ mDNSlocal AuthRecord *CheckAuthSameRecord(AuthHash *r, AuthRecord *rr)
mDNSlocal void DecrementAutoTargetServices(mDNS *const m, AuthRecord *const rr)
{
+ if (RRLocalOnly(rr))
+ {
+ // A sanity check, this should be prevented in calling code.
+ LogInfo("DecrementAutoTargetServices: called for RRLocalOnly() record: %s", ARDisplayString(m, rr));
+ return;
+ }
+
if (!AuthRecord_uDNS(rr) && rr->resrec.rrtype == kDNSType_SRV && rr->AutoTarget == Target_AutoHost)
{
- m->AutoTargetServices--;
- LogInfo("DecrementAutoTargetServices: AutoService Record %s, AutoTargetServices %d", ARDisplayString(m, rr), m->AutoTargetServices);
- if (!m->AutoTargetServices)
+ // If about to get rid of the last advertised service
+ if (m->AutoTargetServices == 1)
DeadvertiseAllInterfaceRecords(m);
+
+ m->AutoTargetServices--;
+ LogInfo("DecrementAutoTargetServices: AutoTargetServices %d Record %s", m->AutoTargetServices, ARDisplayString(m, rr));
+ }
+
+#if TARGET_OS_WATCH
+ if (!AuthRecord_uDNS(rr))
+ {
+ if (m->NumAllInterfaceRecords + m->NumAllInterfaceQuestions == 1)
+ m->NetworkChanged = m->timenow;
+ m->NumAllInterfaceRecords--;
+ LogInfo("DecrementAutoTargetServices: NumAllInterfaceRecords %d NumAllInterfaceQuestions %d %s",
+ m->NumAllInterfaceRecords, m->NumAllInterfaceQuestions, ARDisplayString(m, rr));
}
+#endif
}
mDNSlocal void IncrementAutoTargetServices(mDNS *const m, AuthRecord *const rr)
{
- if (!AuthRecord_uDNS(rr) && rr->resrec.rrtype == kDNSType_SRV && rr->AutoTarget == Target_AutoHost)
+ if (RRLocalOnly(rr))
+ {
+ // A sanity check, this should be prevented in calling code.
+ LogInfo("IncrementAutoTargetServices: called for RRLocalOnly() record: %s", ARDisplayString(m, rr));
+ return;
+ }
+
+#if TARGET_OS_WATCH
+ if (!AuthRecord_uDNS(rr))
{
- int count = m->AutoTargetServices;
+ m->NumAllInterfaceRecords++;
+ LogInfo("IncrementAutoTargetServices: NumAllInterfaceRecords %d NumAllInterfaceQuestions %d %s",
+ m->NumAllInterfaceRecords, m->NumAllInterfaceQuestions, ARDisplayString(m, rr));
+ if (m->NumAllInterfaceRecords + m->NumAllInterfaceQuestions == 1)
+ m->NetworkChanged = m->timenow;
+ }
+#endif
- // Bump up before calling AdvertiseAllInterfaceRecords. AdvertiseInterface
- // returns without doing anything if the count is zero.
+ if (!AuthRecord_uDNS(rr) && rr->resrec.rrtype == kDNSType_SRV && rr->AutoTarget == Target_AutoHost)
+ {
m->AutoTargetServices++;
- LogInfo("IncrementAutoTargetServices: AutoService Record %s, AutoTargetServices %d", ARDisplayString(m, rr), m->AutoTargetServices);
- if (!count)
+ LogInfo("IncrementAutoTargetServices: AutoTargetServices %d Record %s", m->AutoTargetServices, ARDisplayString(m, rr));
+ // If this is the first advertised service
+ if (m->AutoTargetServices == 1)
AdvertiseAllInterfaceRecords(m);
}
}
@@ -1378,6 +1421,7 @@ mDNSexport mStatus mDNS_Register_internal(mDNS *const m, AuthRecord *const rr)
// (kDNSRecordTypeDeregistering) so that we deliver RMV events to the application. But this causes more
// complications and not clear whether there are any benefits. See rdar:9304275 for details.
// Hence, just bail out.
+ // This comment is doesn’t make any sense. -- SC
if (rr->resrec.RecordType & kDNSRecordTypeUniqueMask)
{
if (CheckAuthRecordConflict(&m->rrauth, rr))
@@ -1443,11 +1487,12 @@ mDNSexport mStatus mDNS_Register_internal(mDNS *const m, AuthRecord *const rr)
{
AuthGroup *ag;
ag = InsertAuthRecord(m, &m->rrauth, rr);
- if (ag && !ag->NewLocalOnlyRecords) {
+ if (ag && !ag->NewLocalOnlyRecords)
+ {
m->NewLocalOnlyRecords = mDNStrue;
ag->NewLocalOnlyRecords = rr;
}
- // No probing for LocalOnly records, Acknowledge them right away
+ // No probing for LocalOnly records; acknowledge them right away
if (rr->resrec.RecordType == kDNSRecordTypeUnique) rr->resrec.RecordType = kDNSRecordTypeVerified;
AcknowledgeRecord(m, rr);
return(mStatus_NoError);
@@ -1459,15 +1504,15 @@ mDNSexport mStatus mDNS_Register_internal(mDNS *const m, AuthRecord *const rr)
}
}
- // If this is a keepalive record, fetch the MAC address of the remote host.
+ // If this is a non-sleep proxy keepalive record, fetch the MAC address of the remote host.
// This is used by the in-NIC proxy to send the keepalive packets.
- if (mDNS_KeepaliveRecord(&rr->resrec))
+ if (!rr->WakeUp.HMAC.l[0] && mDNS_KeepaliveRecord(&rr->resrec))
{
+ mDNSAddr raddr;
// Set the record type to known unique to prevent probing keep alive records.
// Also make sure we do not announce the keepalive records.
rr->resrec.RecordType = kDNSRecordTypeKnownUnique;
rr->AnnounceCount = 0;
- mDNSAddr raddr;
getKeepaliveRaddr(m, rr, &raddr);
// This is an asynchronous call. Once the remote MAC address is available, helper will schedule an
// asynchronous task to update the resource record
@@ -1476,8 +1521,9 @@ mDNSexport mStatus mDNS_Register_internal(mDNS *const m, AuthRecord *const rr)
if (!AuthRecord_uDNS(rr)) // This check is superfluous, given that for unicast records we (currently) bail out above
{
- // We have inserted the record in the list. See if we have to advertise the A/AAAA,HINFO,PTR records.
+ // We have inserted the record in the list. See if we have to advertise the A/AAAA, HINFO, PTR records.
IncrementAutoTargetServices(m, rr);
+
// For records that are not going to probe, acknowledge them right away
if (rr->resrec.RecordType != kDNSRecordTypeUnique && rr->resrec.RecordType != kDNSRecordTypeDeregistering)
AcknowledgeRecord(m, rr);
@@ -2361,8 +2407,8 @@ mDNSlocal void SendResponses(mDNS *const m)
LogSPS("SendResponses: Sending wakeup %2d for %.6a %s", rr->AnnounceCount-3, &rr->WakeUp.IMAC, ARDisplayString(m, rr));
SendWakeup(m, rr->resrec.InterfaceID, &rr->WakeUp.IMAC, &rr->WakeUp.password);
for (r2 = rr; r2; r2=r2->next)
- if (r2->AnnounceCount && r2->resrec.InterfaceID == rr->resrec.InterfaceID && mDNSSameEthAddress(&r2->WakeUp.IMAC, &rr->WakeUp.IMAC) &&
- !mDNSSameEthAddress(&zeroEthAddr, &r2->WakeUp.HMAC))
+ if ((r2->resrec.RecordType == kDNSRecordTypeDeregistering) && r2->AnnounceCount && (r2->resrec.InterfaceID == rr->resrec.InterfaceID) &&
+ mDNSSameEthAddress(&r2->WakeUp.IMAC, &rr->WakeUp.IMAC) && !mDNSSameEthAddress(&zeroEthAddr, &r2->WakeUp.HMAC))
{
// For now we only want to send a single Unsolicited Neighbor Advertisement restoring the address to the original
// owner, because these packets can cause some IPv6 stacks to falsely conclude that there's an address conflict.
@@ -2532,7 +2578,7 @@ mDNSlocal void SendResponses(mDNS *const m)
if ((rr->SendRNow == intf->InterfaceID) &&
((rr->resrec.InterfaceID == mDNSInterface_Any) && !mDNSPlatformValidRecordForInterface(rr, intf)))
{
- LogInfo("SendResponses: Not sending %s, on %s", ARDisplayString(m, rr), InterfaceNameForID(m, rr->SendRNow));
+ // LogInfo("SendResponses: Not sending %s, on %s", ARDisplayString(m, rr), InterfaceNameForID(m, rr->SendRNow));
rr->SendRNow = GetNextActiveInterfaceID(intf);
}
else if (rr->SendRNow == intf->InterfaceID)
@@ -2917,10 +2963,10 @@ mDNSexport mStatus mDNS_Reconfirm_internal(mDNS *const m, CacheRecord *const rr,
// BuildQuestion puts a question into a DNS Query packet and if successful, updates the value of queryptr.
// It also appends to the list of known answer records that need to be included,
// and updates the forcast for the size of the known answer section.
-mDNSlocal mDNSBool BuildQuestion(mDNS *const m, DNSMessage *query, mDNSu8 **queryptr, DNSQuestion *q,
- CacheRecord ***kalistptrptr, mDNSu32 *answerforecast)
+mDNSlocal mDNSBool BuildQuestion(mDNS *const m, const NetworkInterfaceInfo *intf, DNSMessage *query, mDNSu8 **queryptr,
+ DNSQuestion *q, CacheRecord ***kalistptrptr, mDNSu32 *answerforecast)
{
- mDNSBool ucast = (q->LargeAnswers || q->RequestUnicast) && m->CanReceiveUnicastOn5353;
+ mDNSBool ucast = (q->LargeAnswers || q->RequestUnicast) && m->CanReceiveUnicastOn5353 && intf->SupportsUnicastMDNSResponse;
mDNSu16 ucbit = (mDNSu16)(ucast ? kDNSQClass_UnicastResponse : 0);
const mDNSu8 *const limit = query->data + NormalMaxDNSMessageData;
mDNSu8 anoninfo_space = q->AnonInfo ? AnonInfoSpace(q->AnonInfo) : 0;
@@ -3060,27 +3106,27 @@ mDNSlocal const CacheRecord *FindSPSInCache1(mDNS *const m, const DNSQuestion *c
#endif // SPC_DISABLED
}
-mDNSlocal void CheckAndSwapSPS(const CacheRecord *sps1, const CacheRecord *sps2)
+mDNSlocal void CheckAndSwapSPS(const CacheRecord **sps1, const CacheRecord **sps2)
{
const CacheRecord *swap_sps;
mDNSu32 metric1, metric2;
- if (!sps1 || !sps2) return;
- metric1 = SPSMetric(sps1->resrec.rdata->u.name.c);
- metric2 = SPSMetric(sps2->resrec.rdata->u.name.c);
- if (!SPSFeatures(sps1->resrec.rdata->u.name.c) && SPSFeatures(sps2->resrec.rdata->u.name.c) && (metric2 >= metric1))
+ if (!(*sps1) || !(*sps2)) return;
+ metric1 = SPSMetric((*sps1)->resrec.rdata->u.name.c);
+ metric2 = SPSMetric((*sps2)->resrec.rdata->u.name.c);
+ if (!SPSFeatures((*sps1)->resrec.rdata->u.name.c) && SPSFeatures((*sps2)->resrec.rdata->u.name.c) && (metric2 >= metric1))
{
- swap_sps = sps1;
- sps1 = sps2;
- sps2 = swap_sps;
+ swap_sps = *sps1;
+ *sps1 = *sps2;
+ *sps2 = swap_sps;
}
}
mDNSlocal void ReorderSPSByFeature(const CacheRecord *sps[3])
{
- CheckAndSwapSPS(sps[0], sps[1]);
- CheckAndSwapSPS(sps[0], sps[2]);
- CheckAndSwapSPS(sps[1], sps[2]);
+ CheckAndSwapSPS(&sps[0], &sps[1]);
+ CheckAndSwapSPS(&sps[0], &sps[2]);
+ CheckAndSwapSPS(&sps[1], &sps[2]);
}
@@ -3124,7 +3170,7 @@ mDNSlocal mDNSBool SuppressOnThisInterface(const DupSuppressInfo ds[DupSuppressI
return(mDNSfalse);
}
-mDNSlocal int RecordDupSuppressInfo(DupSuppressInfo ds[DupSuppressInfoSize], mDNSs32 Time, mDNSInterfaceID InterfaceID, mDNSs32 Type)
+mDNSlocal void RecordDupSuppressInfo(DupSuppressInfo ds[DupSuppressInfoSize], mDNSs32 Time, mDNSInterfaceID InterfaceID, mDNSs32 Type)
{
int i, j;
@@ -3144,8 +3190,6 @@ mDNSlocal int RecordDupSuppressInfo(DupSuppressInfo ds[DupSuppressInfoSize], mDN
ds[i].Time = Time;
ds[i].InterfaceID = InterfaceID;
ds[i].Type = Type;
-
- return(i);
}
mDNSlocal void mDNSSendWakeOnResolve(mDNS *const m, DNSQuestion *q)
@@ -3163,7 +3207,6 @@ mDNSlocal void mDNSSendWakeOnResolve(mDNS *const m, DNSQuestion *q)
// Split MAC@IPAddress and pass them separately
len = d->c[0];
- i = 1;
cnt = 0;
for (i = 1; i < len; i++)
{
@@ -3558,7 +3601,7 @@ mDNSlocal void SendQueries(mDNS *const m)
}
// If we're suppressing this question, or we successfully put it, update its SendQNow state
else if ((Suppress = SuppressOnThisInterface(q->DupSuppress, intf)) ||
- BuildQuestion(m, &m->omsg, &queryptr, q, &kalistptr, &answerforecast))
+ BuildQuestion(m, intf, &m->omsg, &queryptr, q, &kalistptr, &answerforecast))
{
// We successfully added the question to the packet. Make sure that
// we also send the NSEC3 record if required. BuildQuestion accounted for
@@ -3582,7 +3625,7 @@ mDNSlocal void SendQueries(mDNS *const m)
q->WakeOnResolveCount--;
}
- // use brackground traffic class if any included question requires it
+ // use background traffic class if any included question requires it
if (q->UseBackgroundTrafficClass)
{
useBackgroundTrafficClass = mDNStrue;
@@ -3595,7 +3638,7 @@ mDNSlocal void SendQueries(mDNS *const m)
for (ar = m->ResourceRecords; ar; ar=ar->next)
if (ar->SendRNow == intf->InterfaceID)
{
- mDNSBool ucast = (ar->ProbeCount >= DefaultProbeCountForTypeUnique-1) && m->CanReceiveUnicastOn5353;
+ mDNSBool ucast = (ar->ProbeCount >= DefaultProbeCountForTypeUnique-1) && m->CanReceiveUnicastOn5353 && intf->SupportsUnicastMDNSResponse;
mDNSu16 ucbit = (mDNSu16)(ucast ? kDNSQClass_UnicastResponse : 0);
const mDNSu8 *const limit = m->omsg.data + (m->omsg.h.numQuestions ? NormalMaxDNSMessageData : AbsoluteMaxDNSMessageData);
// We forecast: compressed name (2) type (2) class (2) TTL (4) rdlength (2) rdata (n)
@@ -3893,6 +3936,31 @@ mDNSexport void AnswerCurrentQuestionWithResourceRecord(mDNS *const m, CacheReco
return;
}
+#if TARGET_OS_EMBEDDED
+ if ((AddRecord == QC_add) && Question_uDNS(q) && (!q->metrics.answered || (q->metrics.querySendCount > 0)))
+ {
+ uDNSMetrics * metrics;
+ const domainname * queryName;
+ mDNSu32 responseLatencyMs;
+ mDNSBool isForCellular;
+
+ metrics = &q->metrics;
+ queryName = metrics->originalQName ? metrics->originalQName : &q->qname;
+ if (metrics->querySendCount > 0)
+ {
+ responseLatencyMs = ((m->timenow - metrics->firstQueryTime) * 1000) / mDNSPlatformOneSecond;
+ }
+ else
+ {
+ responseLatencyMs = 0;
+ }
+ isForCellular = (q->qDNSServer && q->qDNSServer->cellIntf);
+
+ MetricsUpdateUDNSStats(queryName, mDNStrue, metrics->querySendCount, responseLatencyMs, isForCellular);
+ metrics->answered = mDNStrue;
+ metrics->querySendCount = 0;
+ }
+#endif
// Note: Use caution here. In the case of records with rr->DelayDelivery set, AnswerCurrentQuestionWithResourceRecord(... mDNStrue)
// may be called twice, once when the record is received, and again when it's time to notify local clients.
// If any counters or similar are added here, care must be taken to ensure that they are not double-incremented by this.
@@ -4884,7 +4952,7 @@ mDNSexport mDNSs32 mDNS_TimeNow(const mDNS *const m)
// had its Sleep Proxy client list change, and defer to actual BPF reconfiguration to mDNS_Execute().
// (GetNextScheduledEvent() returns "now" when m->SPSProxyListChanged is set)
#define SetSPSProxyListChanged(X) do { \
- if (m->SPSProxyListChanged && m->SPSProxyListChanged != (X)) mDNSPlatformUpdateProxyList(m, m->SPSProxyListChanged); \
+ if (m->SPSProxyListChanged && m->SPSProxyListChanged != (X)) mDNSPlatformUpdateProxyList(m, m->SPSProxyListChanged); \
m->SPSProxyListChanged = (X); } while(0)
// Called from mDNS_Execute() to expire stale proxy records
@@ -5558,26 +5626,34 @@ mDNSexport void mDNS_UpdateAllowSleep(mDNS *const m)
break;
}
- // Disallow sleep if there is no sleep proxy server
- const CacheRecord *cr = FindSPSInCache1(m, &intf->NetWakeBrowse, mDNSNULL, mDNSNULL);
- if ( cr == mDNSNULL)
- {
- allowSleep = mDNSfalse;
- mDNS_snprintf(reason, sizeof(reason), "No sleep proxy server on %s", intf->ifname);
- LogInfo("mDNS_UpdateAllowSleep: Sleep disabled because %s has no sleep proxy server", intf->ifname);
- break;
- }
- else if (m->SPSType != 0)
+ // If the interface can be an in-NIC Proxy, we should check if it can accomodate all the records
+ // that will be offloaded. If not, we should prevent sleep.
+ // This check will be possible once the lower layers provide an API to query the space available for offloads on the NIC.
+#if APPLE_OSX_mDNSResponder
+ if (!SupportsInNICProxy(intf))
+#endif
{
- mDNSu32 mymetric = LocalSPSMetric(m);
- mDNSu32 metric = SPSMetric(cr->resrec.rdata->u.name.c);
- if (metric >= mymetric)
+ // Disallow sleep if there is no sleep proxy server
+ const CacheRecord *cr = FindSPSInCache1(m, &intf->NetWakeBrowse, mDNSNULL, mDNSNULL);
+ if ( cr == mDNSNULL)
{
allowSleep = mDNSfalse;
- mDNS_snprintf(reason, sizeof(reason), "No sleep proxy server with better metric on %s", intf->ifname);
- LogInfo("mDNS_UpdateAllowSleep: Sleep disabled because %s has no sleep proxy server with a better metric", intf->ifname);
+ mDNS_snprintf(reason, sizeof(reason), "No sleep proxy server on %s", intf->ifname);
+ LogInfo("mDNS_UpdateAllowSleep: Sleep disabled because %s has no sleep proxy server", intf->ifname);
break;
}
+ else if (m->SPSType != 0)
+ {
+ mDNSu32 mymetric = LocalSPSMetric(m);
+ mDNSu32 metric = SPSMetric(cr->resrec.rdata->u.name.c);
+ if (metric >= mymetric)
+ {
+ allowSleep = mDNSfalse;
+ mDNS_snprintf(reason, sizeof(reason), "No sleep proxy server with better metric on %s", intf->ifname);
+ LogInfo("mDNS_UpdateAllowSleep: Sleep disabled because %s has no sleep proxy server with a better metric", intf->ifname);
+ break;
+ }
+ }
}
}
}
@@ -5608,7 +5684,7 @@ mDNSlocal mDNSBool mDNSUpdateOkToSend(mDNS *const m, AuthRecord *rr, NetworkInte
// updateid and we should have returned from above.
//
// Note: scopeid is the same as intf->InterfaceID. It is passed in so that we don't have to call the
- // platform function to extract the value from "intf" everytime.
+ // platform function to extract the value from "intf" every time.
if ((scopeid >= (sizeof(rr->updateIntID) * mDNSNBBY) || bit_get_opaque64(rr->updateIntID, scopeid)) &&
(!rr->resrec.InterfaceID || rr->resrec.InterfaceID == intf->InterfaceID))
@@ -5619,35 +5695,41 @@ mDNSlocal mDNSBool mDNSUpdateOkToSend(mDNS *const m, AuthRecord *rr, NetworkInte
mDNSexport void UpdateRMACCallback(mDNS *const m, void *context)
{
- IPAddressMACMapping *addrmap = (IPAddressMACMapping *)context ;
- m->CurrentRecord = m->ResourceRecords;
-
- if (!addrmap)
- {
- LogMsg("UpdateRMACCallback: Address mapping is NULL");
- return;
- }
-
- while (m->CurrentRecord)
- {
- AuthRecord *rr = m->CurrentRecord;
- // If this is a keepalive record and the remote IP address matches, update the RData
- if (mDNS_KeepaliveRecord(&rr->resrec))
- {
- mDNSAddr raddr;
- getKeepaliveRaddr(m, rr, &raddr);
- if (mDNSSameAddress(&raddr, &addrmap->ipaddr))
- {
- UpdateKeepaliveRData(m, rr, mDNSNULL, mDNStrue, (char *)(addrmap->ethaddr));
- }
- }
- m->CurrentRecord = rr->next;
- }
-
- if (addrmap)
- {
- mDNSPlatformMemFree(addrmap);
- }
+ IPAddressMACMapping *addrmap = (IPAddressMACMapping *)context ;
+ m->CurrentRecord = m->ResourceRecords;
+
+ if (!addrmap)
+ {
+ LogMsg("UpdateRMACCallback: Address mapping is NULL");
+ return;
+ }
+
+ while (m->CurrentRecord)
+ {
+ AuthRecord *rr = m->CurrentRecord;
+ // If this is a non-sleep proxy keepalive record and the remote IP address matches, update the RData
+ if (!rr->WakeUp.HMAC.l[0] && mDNS_KeepaliveRecord(&rr->resrec))
+ {
+ mDNSAddr raddr;
+ getKeepaliveRaddr(m, rr, &raddr);
+ if (mDNSSameAddress(&raddr, &addrmap->ipaddr))
+ {
+ // Update the MAC address only if it is not a zero MAC address
+ mDNSEthAddr macAddr;
+ mDNSu8 *ptr = GetValueForMACAddr((mDNSu8 *)(addrmap->ethaddr), (mDNSu8 *) (addrmap->ethaddr + sizeof(addrmap->ethaddr)), &macAddr);
+ if (ptr != mDNSNULL && !mDNSEthAddressIsZero(macAddr))
+ {
+ UpdateKeepaliveRData(m, rr, mDNSNULL, mDNStrue, (char *)(addrmap->ethaddr));
+ }
+ }
+ }
+ m->CurrentRecord = rr->next;
+ }
+
+ if (addrmap)
+ {
+ mDNSPlatformMemFree(addrmap);
+ }
}
mDNSexport mStatus UpdateKeepaliveRData(mDNS *const m, AuthRecord *rr, NetworkInterfaceInfo *const intf, mDNSBool updateMac, char *ethAddr)
@@ -6114,29 +6196,49 @@ mDNSexport mDNSBool mDNSCoreHaveAdvertisedMulticastServices(mDNS *const m)
return mDNSfalse;
}
+#define WAKE_ONLY_SERVICE 1
+#define AC_ONLY_SERVICE 2
+
#ifdef APPLE_OSX_mDNSResponder
-// This function is used only in the case of local NIC proxy. For external
-// sleep proxy server, we do this in SPSInitRecordsBeforeUpdate when we
-// walk the resource records.
-mDNSlocal void SendGoodbyesForWakeOnlyService(mDNS *const m, mDNSBool *WakeOnlyService)
+mDNSlocal void SendGoodbyesForSelectServices(mDNS *const m, mDNSBool *servicePresent, mDNSu32 serviceType)
{
AuthRecord *rr;
-
- *WakeOnlyService = mDNSfalse;
+ *servicePresent = mDNSfalse;
// Mark all the records we need to deregister and send them
for (rr = m->ResourceRecords; rr; rr=rr->next)
{
- if ((rr->AuthFlags & AuthFlagsWakeOnly) &&
- rr->resrec.RecordType == kDNSRecordTypeShared && rr->RequireGoodbye)
+ // If the service type is wake only service and the auth flags match and requires a goodbye
+ // OR if the service type is AC only and it is not a keepalive record,
+ // mark the records we need to deregister and send them
+ if ((serviceType == WAKE_ONLY_SERVICE && (rr->AuthFlags & AuthFlagsWakeOnly) &&
+ rr->resrec.RecordType == kDNSRecordTypeShared && rr->RequireGoodbye) ||
+ (serviceType == AC_ONLY_SERVICE && !mDNS_KeepaliveRecord(&rr->resrec)))
{
rr->ImmedAnswer = mDNSInterfaceMark;
- *WakeOnlyService = mDNStrue;
+ *servicePresent = mDNStrue;
}
}
}
+#endif
+
+#ifdef APPLE_OSX_mDNSResponder
+// This function is used only in the case of local NIC proxy. For external
+// sleep proxy server, we do this in SPSInitRecordsBeforeUpdate when we
+// walk the resource records.
+mDNSlocal void SendGoodbyesForWakeOnlyService(mDNS *const m, mDNSBool *WakeOnlyService)
+{
+ return SendGoodbyesForSelectServices(m, WakeOnlyService, WAKE_ONLY_SERVICE);
+}
#endif // APPLE_OSx_mDNSResponder
+#ifdef APPLE_OSX_mDNSResponder
+mDNSlocal void SendGoodbyesForACOnlyServices(mDNS *const m, mDNSBool *acOnlyService)
+{
+ return SendGoodbyesForSelectServices(m, acOnlyService, AC_ONLY_SERVICE);
+}
+#endif
+
mDNSlocal void SendSleepGoodbyes(mDNS *const m, mDNSBool AllInterfaces, mDNSBool unicast)
{
AuthRecord *rr;
@@ -6232,6 +6334,7 @@ mDNSlocal void BeginSleepProcessing(mDNS *const m)
{
mDNSBool SendGoodbyes = mDNStrue;
mDNSBool WakeOnlyService = mDNSfalse;
+ mDNSBool ACOnlyService = mDNSfalse;
mDNSBool invokeKACallback = mDNStrue;
const CacheRecord *sps[3] = { mDNSNULL };
mDNSOpaque64 updateIntID = zeroOpaque64;
@@ -6288,9 +6391,12 @@ mDNSlocal void BeginSleepProcessing(mDNS *const m)
#if APPLE_OSX_mDNSResponder
else if (SupportsInNICProxy(intf))
{
- if (ActivateLocalProxy(m, intf) == mStatus_NoError)
+ mDNSBool keepaliveOnly = mDNSfalse;
+ if (ActivateLocalProxy(m, intf, &keepaliveOnly) == mStatus_NoError)
{
SendGoodbyesForWakeOnlyService(m, &WakeOnlyService);
+ if (keepaliveOnly)
+ SendGoodbyesForACOnlyServices(m, &ACOnlyService);
SendGoodbyes = mDNSfalse;
invokeKACallback = mDNSfalse;
LogSPS("BeginSleepProcessing: %-6s using local proxy", intf->ifname);
@@ -6334,9 +6440,9 @@ mDNSlocal void BeginSleepProcessing(mDNS *const m)
{
#if ForceAlerts
if (intf->SPSAddr[i].type)
- { LogMsg("BeginSleepProcessing: %s %d intf->SPSAddr[i].type %d", intf->ifname, i, intf->SPSAddr[i].type); *(long*)0 = 0; }
+ LogFatalError("BeginSleepProcessing: %s %d intf->SPSAddr[i].type %d", intf->ifname, i, intf->SPSAddr[i].type);
if (intf->NetWakeResolve[i].ThisQInterval >= 0)
- { LogMsg("BeginSleepProcessing: %s %d intf->NetWakeResolve[i].ThisQInterval %d", intf->ifname, i, intf->NetWakeResolve[i].ThisQInterval); *(long*)0 = 0; }
+ LogFatalError("BeginSleepProcessing: %s %d intf->NetWakeResolve[i].ThisQInterval %d", intf->ifname, i, intf->NetWakeResolve[i].ThisQInterval);
#endif
intf->SPSAddr[i].type = mDNSAddrType_None;
if (intf->NetWakeResolve[i].ThisQInterval >= 0) mDNS_StopQuery(m, &intf->NetWakeResolve[i]);
@@ -6396,10 +6502,10 @@ mDNSlocal void BeginSleepProcessing(mDNS *const m)
LogSPS("BeginSleepProcessing: Not registering with Sleep Proxy Server on all interfaces");
SendSleepGoodbyes(m, mDNSfalse, mDNSfalse);
}
- else if (WakeOnlyService)
+ else if (WakeOnlyService || ACOnlyService)
{
// If we saw WakeOnly service above, send the goodbyes now.
- LogSPS("BeginSleepProcessing: Sending goodbyes for WakeOnlyServices");
+ LogSPS("BeginSleepProcessing: Sending goodbyes for %s", WakeOnlyService? "WakeOnlyService" : "AC Only Service");
SendResponses(m);
}
}
@@ -6473,11 +6579,7 @@ mDNSexport void mDNSCoreMachineSleep(mDNS *const m, mDNSBool sleep)
{
m->SleepState = SleepState_Awake;
m->SleepSeqNum++;
- // If the machine wakes and then immediately tries to sleep again (e.g. a maintenance wake)
- // then we enforce a minimum delay of 16 seconds before we begin sleep processing.
- // This is to allow time for the Ethernet link to come up, DHCP to get an address, mDNS to issue queries, etc.,
- // before we make our determination of whether there's a Sleep Proxy out there we should register with.
- m->DelaySleep = NonZeroTime(m->timenow + mDNSPlatformOneSecond * 16);
+ m->DelaySleep = 0;
}
if (m->SPSState == 3)
@@ -7103,7 +7205,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con
const mDNSAddr *srcaddr, const mDNSInterfaceID InterfaceID, mDNSBool LegacyQuery, mDNSBool QueryWasMulticast,
mDNSBool QueryWasLocalUnicast, DNSMessage *const response)
{
- mDNSBool FromLocalSubnet = srcaddr && mDNS_AddressIsLocalSubnet(m, InterfaceID, srcaddr, mDNSNULL);
+ mDNSBool FromLocalSubnet = srcaddr && mDNS_AddressIsLocalSubnet(m, InterfaceID, srcaddr);
AuthRecord *ResponseRecords = mDNSNULL;
AuthRecord **nrp = &ResponseRecords;
@@ -7653,9 +7755,9 @@ exit:
DNSQuestion *q = DupQuestions;
DupQuestions = q->NextInDQList;
q->NextInDQList = mDNSNULL;
- i = RecordDupSuppressInfo(q->DupSuppress, m->timenow, InterfaceID, srcaddr->type);
- debugf("ProcessQuery: Recorded DSI for %##s (%s) on %p/%s %d", q->qname.c, DNSTypeName(q->qtype), InterfaceID,
- srcaddr->type == mDNSAddrType_IPv4 ? "v4" : "v6", i);
+ RecordDupSuppressInfo(q->DupSuppress, m->timenow, InterfaceID, srcaddr->type);
+ debugf("ProcessQuery: Recorded DSI for %##s (%s) on %p/%s", q->qname.c, DNSTypeName(q->qtype), InterfaceID,
+ srcaddr->type == mDNSAddrType_IPv4 ? "v4" : "v6");
}
if (McastNSEC3Records)
@@ -7673,7 +7775,7 @@ mDNSlocal void mDNSCoreReceiveQuery(mDNS *const m, const DNSMessage *const msg,
{
mDNSu8 *responseend = mDNSNULL;
mDNSBool QueryWasLocalUnicast = srcaddr && dstaddr &&
- !mDNSAddrIsDNSMulticast(dstaddr) && mDNS_AddressIsLocalSubnet(m, InterfaceID, srcaddr, mDNSNULL);
+ !mDNSAddrIsDNSMulticast(dstaddr) && mDNS_AddressIsLocalSubnet(m, InterfaceID, srcaddr);
if (!InterfaceID && dstaddr && mDNSAddrIsDNSMulticast(dstaddr))
{
@@ -7791,111 +7893,6 @@ mDNSlocal DNSQuestion *ExpectingUnicastResponseForRecord(mDNS *const m,
return(mDNSNULL);
}
-// Return a pointer to the primary service name, skipping subtype name if present.
-mDNSlocal const domainname *getPrimaryServiceName(const domainname *domainName)
-{
- const domainname *primaryName = domainName;
- const domainname *subName = SkipLeadingLabels(domainName, 1);
-
- if (SameDomainLabel(subName->c, (const mDNSu8 *)mDNSSubTypeLabel))
- {
- // skip "<sub type name>._sub" portion of name
- primaryName = SkipLeadingLabels(domainName, 2);
- debugf("getPrimaryServiceName: returning %##s for _sub type", primaryName);
- }
-
- return primaryName;
-}
-
-// This function is not called if the packet is from us, which implies that we accept all multicast packets coming from us.
-mDNSlocal mDNSBool ExpectingMulticastResponseForRecord(mDNS *const m, CacheRecord *rr, const mDNSAddr *srcaddr, mDNSBool recordAccepted,
- CacheRecord **McastNSEC3Records)
-{
- DNSQuestion *q;
-
- // Accept A and AAAA if we accepted something before in the same packet as most likely related to the
- // service records that we may have accepted.
- if (recordAccepted && (rr->resrec.rrtype == kDNSType_A || rr->resrec.rrtype == kDNSType_AAAA))
- {
- LogInfo("ExpectingMulticastResponseForRecord:A:AAAA: accepting %s, from %#a due to same packet %d", CRDisplayString(m, rr), srcaddr, m->PktNum);
- return mDNStrue;
- }
- for (q = m->Questions; q; q=q->next)
- {
- if (!q->DuplicateOf && mDNSOpaque16IsZero(q->TargetQID))
- {
- mDNSBool ret;
- // 1. If a resource record answers question, cache it. This also will cache NSECs if it asserts
- // non-existence of q->qtype. If we have any matching NSEC3 Records for the question, send
- // it along with the resource record. Do it only for questions that are expecting to
- // discover only its peers (q->AnonInfo not NULL)
- if (q->AnonInfo && McastNSEC3Records && !rr->resrec.AnonInfo)
- {
- InitializeAnonInfoForCR(m, McastNSEC3Records, rr);
- }
- ret = ResourceRecordAnswersQuestion(&rr->resrec, q);
- if (ret)
- {
- // The record and the question belong to the same subset. Set the
- // anonymous data in the cache record.
- if (q->AnonInfo && rr->resrec.AnonInfo)
- {
- SetAnonData(q, &rr->resrec, mDNSfalse);
- }
- LogInfo("ExpectingMulticastResponseForRecord: Name and Type match, accepting %s, from %#a", CRDisplayString(m, rr), srcaddr);
- if (rr->resrec.rrtype == kDNSType_NSEC)
- LogInfo("ExpectingMulticastResponseForRecord: record %s, question %##s (%s)", CRDisplayString(m, rr), q->qname.c, DNSTypeName(q->qtype));
- return mDNStrue;
- }
- if (rr->resrec.rrtype == kDNSType_SRV || rr->resrec.rrtype == kDNSType_TXT)
- {
- // Point to the service type in the record name
- const domainname *name = SkipLeadingLabels(rr->resrec.name, 1);
-
- // If question is for a sub type, just compare against the primary service type
- const domainname *primaryName = getPrimaryServiceName(&q->qname);
-
- // 2. If the SRV or TXT record matches the service name, then cache it. If the TXT or SRV record is
- // before the PTR record in the packet, PTR record may not be in the cache yet and hence the logic
- // in (3) below will fail to cache it.
- if (q->qtype == kDNSType_PTR && name && SameDomainName(primaryName, name))
- {
- LogInfo("ExpectingMulticastResponseForRecord: Accepting %s due to PTR match, question %##s from %#a, pktnum %d",
- CRDisplayString(m, rr), q->qname.c, srcaddr, m->PktNum);
- return mDNStrue;
- }
-
- if (name)
- {
- const mDNSu32 slot = HashSlot(name);
- const mDNSu32 namehash = DomainNameHashValue(name);
- CacheGroup *cg = CacheGroupForName(m, slot, namehash, name);
- CacheRecord *cr;
-
- // 3. Same as in (2), but look in the cache in case we don't have the PTR question.
-
- for (cr = cg ? cg->members : mDNSNULL; cr; cr=cr->next)
- {
- if (cr->resrec.rrtype == kDNSType_PTR)
- {
- primaryName = getPrimaryServiceName(cr->resrec.name);
-
- if (SameDomainName(primaryName, name))
- {
- LogInfo("ExpectingMulticastResponseForRecord: accepting %s, from %#a, pktnum %d",
- CRDisplayString(m, rr), srcaddr, m->PktNum);
- return mDNStrue;
- }
- }
- }
- }
- }
- }
- }
- debugf("ExpectingMulticastResponseForRecord: discarding %s, from %#a, pktnum %d", CRDisplayString(m, rr), srcaddr, m->PktNum);
- return(mDNSfalse);
-}
-
// Certain data types need more space for in-memory storage than their in-packet rdlength would imply
// Currently this applies only to rdata types containing more than one domainname,
// or types where the domainname is not the last item in the structure.
@@ -8441,7 +8438,8 @@ mDNSlocal void mDNSCoreReceiveNoUnicastAnswers(mDNS *const m, const DNSMessage *
name = (const domainname *)(name->c + 1 + name->c[0]);
hash = DomainNameHashValue(name);
slot = HashSlot(name);
- cg = CacheGroupForName(m, slot, hash, name);
+ // For now, we don't need to update cg here, because we'll do it again immediately, back up at the start of this loop
+ //cg = CacheGroupForName(m, slot, hash, name);
}
}
}
@@ -8643,7 +8641,7 @@ mDNSlocal CacheRecord* mDNSCoreReceiveCacheCheck(mDNS *const m, const DNSMessage
mDNSlocal void mDNSParseNSEC3Records(mDNS *const m, const DNSMessage *const response, const mDNSu8 *end,
const mDNSInterfaceID InterfaceID, CacheRecord **NSEC3Records)
{
- const mDNSu8 *ptr = response->data;
+ const mDNSu8 *ptr;
CacheRecord *rr;
int i;
@@ -8692,24 +8690,6 @@ mDNSlocal void mDNSCoreResetRecord(mDNS *const m)
}
}
-#define DEVICE_INFO_RECORD_LABELS 4
-
-// Determine if the record is an instance of _device-info._tcp.local.
-mDNSlocal mDNSBool IsDeviceInfoRecord(const domainname *d)
-{
- const domainname *afterInstance;
-
- if (CountLabels(d) != DEVICE_INFO_RECORD_LABELS)
- return mDNSfalse;
-
- // skip the instance name
- afterInstance = SkipLeadingLabels(d, 1);
- if (SameDomainName(afterInstance, &LocalDeviceInfoName))
- return mDNStrue;
-
- return mDNSfalse;
-}
-
// Note: mDNSCoreReceiveResponse calls mDNS_Deregister_internal which can call a user callback, which may change
// the record list and/or question list.
// Any code walking either list must use the CurrentQuestion and/or CurrentRecord mechanism to protect against this.
@@ -8722,9 +8702,8 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
const mDNSInterfaceID InterfaceID)
{
int i;
- mDNSBool myself;
mDNSBool ResponseMCast = dstaddr && mDNSAddrIsDNSMulticast(dstaddr);
- mDNSBool ResponseSrcLocal = !srcaddr || mDNS_AddressIsLocalSubnet(m, InterfaceID, srcaddr, &myself);
+ mDNSBool ResponseSrcLocal = !srcaddr || mDNS_AddressIsLocalSubnet(m, InterfaceID, srcaddr);
DNSQuestion *llqMatch = mDNSNULL;
DNSQuestion *unicastQuestion = mDNSNULL;
uDNS_LLQType LLQType = uDNS_recvLLQResponse(m, response, end, srcaddr, srcport, &llqMatch);
@@ -8742,12 +8721,11 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
mDNSu8 rcode = '\0';
mDNSBool rrsigsCreated = mDNSfalse;
mDNSBool DNSSECQuestion = mDNSfalse;
- mDNSBool recordAccepted = mDNSfalse;
NetworkInterfaceInfo *llintf = FirstIPv4LLInterfaceForID(m, InterfaceID);
// All records in a DNS response packet are treated as equally valid statements of truth. If we want
// to guard against spoof responses, then the only credible protection against that is cryptographic
- // security, e.g. DNSSEC., not worring about which section in the spoof packet contained the record
+ // security, e.g. DNSSEC., not worrying about which section in the spoof packet contained the record.
int firstauthority = response->h.numAnswers;
int firstadditional = firstauthority + response->h.numAuthorities;
int totalrecords = firstadditional + response->h.numAdditionals;
@@ -8983,64 +8961,69 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
// Even though it is AcceptableResponse, we still need a DNSServer pointer for the resource records that
// we create.
- if (!mDNSOpaque16IsZero(response->h.id))
- {
- DNSQuestion *q = ExpectingUnicastResponseForRecord(m, srcaddr, ResponseSrcLocal, dstport, response->h.id, &m->rec.r, !dstaddr);
-
- // Initialize the DNS server on the resource record which will now filter what questions we answer with
- // this record.
- //
- // We could potentially lookup the DNS server based on the source address, but that may not work always
- // and that's why ExpectingUnicastResponseForRecord does not try to verify whether the response came
- // from the DNS server that queried. We follow the same logic here. If we can find a matching quetion based
- // on the "id" and "source port", then this response answers the question and assume the response
- // came from the same DNS server that we sent the query to.
-
- if (q != mDNSNULL)
- {
- AcceptableResponse = mDNStrue;
- if (!InterfaceID)
- {
- debugf("mDNSCoreReceiveResponse: InterfaceID %p %##s (%s)", q->InterfaceID, q->qname.c, DNSTypeName(q->qtype));
- m->rec.r.resrec.rDNSServer = uDNSServer = q->qDNSServer;
- }
- else
- LogInfo("mDNSCoreReceiveResponse: InterfaceID %p %##s (%s)", q->InterfaceID, q->qname.c, DNSTypeName(q->qtype));
- }
- else
- {
- // If we can't find a matching question, we need to see whether we have seen records earlier that matched
- // the question. The code below does that. So, make this record unacceptable for now
- if (!InterfaceID)
- {
- debugf("mDNSCoreReceiveResponse: Can't find question for record name %##s", m->rec.r.resrec.name->c);
- AcceptableResponse = mDNSfalse;
- }
- }
- }
- else if (ExpectingMulticastResponseForRecord(m, &m->rec.r, srcaddr, recordAccepted, &McastNSEC3Records))
- {
- recordAccepted = mDNStrue;
- AcceptableResponse = mDNStrue;
- LogInfo("mDNSCoreReceiveResponse: Accepting record in response to QU question %s, InterfaceID %p", CRDisplayString(m, &m->rec.r),
- InterfaceID);
- }
- else if (IsDeviceInfoRecord(m->rec.r.resrec.name))
- {
- recordAccepted = mDNStrue;
- AcceptableResponse = mDNStrue;
- LogInfo("mDNSCoreReceiveResponse: Accepting _device-info record %s, InterfaceID %p",
- CRDisplayString(m, &m->rec.r), InterfaceID);
- }
+ DNSQuestion *q = ExpectingUnicastResponseForRecord(m, srcaddr, ResponseSrcLocal, dstport, response->h.id, &m->rec.r, !dstaddr);
+
+ // Initialize the DNS server on the resource record which will now filter what questions we answer with
+ // this record.
+ //
+ // We could potentially lookup the DNS server based on the source address, but that may not work always
+ // and that's why ExpectingUnicastResponseForRecord does not try to verify whether the response came
+ // from the DNS server that queried. We follow the same logic here. If we can find a matching quetion based
+ // on the "id" and "source port", then this response answers the question and assume the response
+ // came from the same DNS server that we sent the query to.
+
+ if (q != mDNSNULL)
+ {
+ AcceptableResponse = mDNStrue;
+ if (!InterfaceID)
+ {
+ debugf("mDNSCoreReceiveResponse: InterfaceID %p %##s (%s)", q->InterfaceID, q->qname.c, DNSTypeName(q->qtype));
+ m->rec.r.resrec.rDNSServer = uDNSServer = q->qDNSServer;
+ }
+ else
+ LogInfo("mDNSCoreReceiveResponse: InterfaceID %p %##s (%s)", q->InterfaceID, q->qname.c, DNSTypeName(q->qtype));
+ }
+ else
+ {
+ // If we can't find a matching question, we need to see whether we have seen records earlier that matched
+ // the question. The code below does that. So, make this record unacceptable for now
+ if (!InterfaceID)
+ {
+ debugf("mDNSCoreReceiveResponse: Can't find question for record name %##s", m->rec.r.resrec.name->c);
+ AcceptableResponse = mDNSfalse;
+ }
+ }
}
}
else if (llintf && llintf->IgnoreIPv4LL && m->rec.r.resrec.rrtype == kDNSType_A)
{
- CacheRecord *const rr = &m->rec.r;
- RDataBody2 *const rdb = (RDataBody2 *)rr->smallrdatastorage.data;
+ // There are some routers (rare, thankfully) that generate bogus ARP responses for
+ // any IPv4 address they don’t recognize, including RFC 3927 IPv4 link-local addresses.
+ // To work with these broken routers, client devices need to blacklist these broken
+ // routers and ignore their bogus ARP responses. Some devices implement a technique
+ // such as the one described in US Patent 7436783, which lets clients detect and
+ // ignore these broken routers: <https://www.google.com/patents/US7436783>
+
+ // OS X and iOS do not implement this defensive mechanism, instead taking a simpler
+ // approach of just detecting these broken routers and completely disabling IPv4
+ // link-local communication on interfaces where a broken router is detected.
+ // OS X and iOS set the IFEF_ARPLL interface flag on interfaces
+ // that are deemed “safe” for IPv4 link-local communication;
+ // the flag is cleared on interfaces where a broken router is detected.
+
+ // OS X and iOS will not even try to communicate with an IPv4
+ // link-local destination on an interface without the IFEF_ARPLL flag set.
+ // This can cause some badly written applications to freeze for a long time if they
+ // attempt to connect to an IPv4 link-local destination address and then wait for
+ // that connection attempt to time out before trying other candidate addresses.
+
+ // To mask this client bug, we suppress acceptance of IPv4 link-local address
+ // records on interfaces where we know the OS will be unwilling even to attempt
+ // communication with those IPv4 link-local destination addresses.
+ // <rdar://problem/9400639> kSuppress IPv4LL answers on interfaces without IFEF_ARPLL
- // If we are supposed to ignore link-local addresses on this interface, drop
- // all "A" records that have link-local address in them.
+ const CacheRecord *const rr = &m->rec.r;
+ const RDataBody2 *const rdb = (RDataBody2 *)rr->smallrdatastorage.data;
if (mDNSv4AddressIsLinkLocal(&rdb->ipv4))
{
LogInfo("mDNSResponder: Dropping LinkLocal packet %s", CRDisplayString(m, &m->rec.r));
@@ -9099,7 +9082,7 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
if (rr->ProbeCount > DefaultProbeCountForTypeUnique)
LogInfo("mDNSCoreReceiveResponse: Already reset to Probing: %s", ARDisplayString(m, rr));
else if (rr->ProbeCount == DefaultProbeCountForTypeUnique)
- LogMsg("mDNSCoreReceiveResponse: Ignoring response received before we even began probing: %s", ARDisplayString(m, rr));
+ LogInfo("mDNSCoreReceiveResponse: Ignoring response received before we even began probing: %s", ARDisplayString(m, rr));
else
{
LogMsg("mDNSCoreReceiveResponse: Received from %#a:%d %s", srcaddr, mDNSVal16(srcport), CRDisplayString(m, &m->rec.r));
@@ -9185,27 +9168,6 @@ mDNSlocal void mDNSCoreReceiveResponse(mDNS *const m,
rr = mDNSCoreReceiveCacheCheck(m, response, LLQType, slot, cg, unicastQuestion, &cfp, &NSECCachePtr, InterfaceID);
}
- // If mDNSOppCaching is set (which affects only multicast), enable opportunistic caching in which case we cache
- // everything that was received over multicast. Otherwise, we are selective about the caching.
- //
- // Cache everything that is from ourselves (that's how we answer any questions looking for them). Otherwise call
- // ExpectingMulticastResponseForRecord which decides whether to cache this record or not.
- //
- if (!m->mDNSOppCaching && !rr && !myself && mDNSOpaque16IsZero(response->h.id))
- {
- if (!ExpectingMulticastResponseForRecord(m, &m->rec.r, srcaddr, recordAccepted, &McastNSEC3Records))
- {
- //LogMsg("mDNSCoreReceiveResponse: discarding %s", CRDisplayString(m, &m->rec.r));
- mDNSCoreResetRecord(m);
- continue;
- }
- else
- {
- recordAccepted = mDNStrue;
- }
- }
-
-
// If packet resource record not in our cache, add it now
// (unless it is just a deletion of a record we never had, in which case we don't care)
if (!rr && m->rec.r.resrec.rroriginalttl > 0)
@@ -9343,15 +9305,22 @@ exit:
// goodbye announcement with the cache flush bit set (or a case-change on record rdata,
// which we treat as a goodbye followed by an addition) and in that case it would be
// inappropriate to synchronize all the other records to a TTL of 0 (or 1).
+
// We suppress the message for the specific case of correcting from 240 to 60 for type TXT,
// because certain early Bonjour devices are known to have this specific mismatch, and
// there's no point filling syslog with messages about something we already know about.
// We also don't log this for uDNS responses, since a caching name server is obliged
// to give us an aged TTL to correct for how long it has held the record,
// so our received TTLs are expected to vary in that case
+
+ // We also suppress log message in the case of SRV records that are recieved
+ // with a TTL of 4500 that are already cached with a TTL of 120 seconds, since
+ // this behavior was observed for a number of discoveryd based AppleTV's in iOS 8
+ // GM builds.
if (r2->resrec.rroriginalttl != r1->resrec.rroriginalttl && r1->resrec.rroriginalttl > 1)
{
if (!(r2->resrec.rroriginalttl == 240 && r1->resrec.rroriginalttl == 60 && r2->resrec.rrtype == kDNSType_TXT) &&
+ !(r2->resrec.rroriginalttl == 120 && r1->resrec.rroriginalttl == 4500 && r2->resrec.rrtype == kDNSType_SRV) &&
mDNSOpaque16IsZero(response->h.id))
LogInfo("Correcting TTL from %4d to %4d for %s",
r2->resrec.rroriginalttl, r1->resrec.rroriginalttl, CRDisplayString(m, r2));
@@ -9550,6 +9519,11 @@ mDNSlocal mDNSu8 *GetValueForMACAddr(mDNSu8 *ptr, mDNSu8 *limit, mDNSEthAddr *et
}
else if (*ptr == ':')
{
+ if (colons >=5 || val > 255)
+ {
+ LogMsg("GetValueForMACAddr: Address malformed colons %d val %d", colons, val);
+ return mDNSNULL;
+ }
eth->b[colons] = val;
colons++;
val = 0;
@@ -9681,6 +9655,11 @@ mDNSlocal mDNSu8 *GetValueForIPv4Addr(mDNSu8 *ptr, mDNSu8 *limit, mDNSv4Addr *v4
val = val * 10 + *ptr - '0';
else if (*ptr == '.')
{
+ if (val > 255 || dots >= 3)
+ {
+ LogMsg("GetValueForIPv4Addr: something wrong ptr(%p) %c, limit %p, dots %d", ptr, *ptr, limit, dots);
+ return mDNSNULL;
+ }
v4->b[dots++] = val;
val = 0;
}
@@ -9723,6 +9702,37 @@ mDNSlocal mDNSu8 *GetValueForKeepalive(mDNSu8 *ptr, mDNSu8 *limit, mDNSu32 *valu
return ptr;
}
+mDNSexport mDNSBool mDNSValidKeepAliveRecord(AuthRecord *rr)
+{
+ mDNSAddr laddr, raddr;
+ mDNSEthAddr eth;
+ mDNSIPPort lport, rport;
+ mDNSu32 timeout, seq, ack;
+ mDNSu16 win;
+
+ if (!mDNS_KeepaliveRecord(&rr->resrec))
+ {
+ return mDNSfalse;
+ }
+
+ timeout = seq = ack = 0;
+ win = 0;
+ laddr = raddr = zeroAddr;
+ lport = rport = zeroIPPort;
+
+ mDNS_ExtractKeepaliveInfo(rr, &timeout, &laddr, &raddr, &eth, &seq, &ack, &lport, &rport, &win);
+
+ if (mDNSAddressIsZero(&laddr) || mDNSIPPortIsZero(lport) ||
+ mDNSAddressIsZero(&raddr) || mDNSIPPortIsZero(rport) ||
+ mDNSEthAddressIsZero(eth))
+ {
+ return mDNSfalse;
+ }
+
+ return mDNStrue;
+}
+
+
mDNSlocal void mDNS_ExtractKeepaliveInfo(AuthRecord *ar, mDNSu32 *timeout, mDNSAddr *laddr, mDNSAddr *raddr, mDNSEthAddr *eth, mDNSu32 *seq,
mDNSu32 *ack, mDNSIPPort *lport, mDNSIPPort *rport, mDNSu16 *win)
{
@@ -9899,16 +9909,18 @@ mDNSlocal void mDNS_SendKeepalives(mDNS *const m)
mDNSlocal void mDNS_SendKeepaliveACK(mDNS *const m, AuthRecord *ar)
{
- if (ar != mDNSNULL)
- {
- LogInfo("mDNS_SendKeepalivesACK: AuthRecord is NULL");
- return;
- }
- mDNSu32 timeout, seq, ack;
+ mDNSu32 timeout, seq, ack, seqInc;
mDNSu16 win;
mDNSAddr laddr, raddr;
mDNSEthAddr eth;
mDNSIPPort lport, rport;
+ mDNSu8 *ptr;
+
+ if (ar == mDNSNULL)
+ {
+ LogInfo("mDNS_SendKeepalivesACK: AuthRecord is NULL");
+ return;
+ }
timeout = seq = ack = 0;
win = 0;
@@ -9923,6 +9935,17 @@ mDNSlocal void mDNS_SendKeepaliveACK(mDNS *const m, AuthRecord *ar)
LogInfo("mDNS_SendKeepaliveACK: not a valid record %s for keepalive", ARDisplayString(m, ar));
return;
}
+
+ // To send a keepalive ACK, we need to add one to the sequence number from the keepalive
+ // record, which is the TCP connection's "next" sequence number minus one. Otherwise, the
+ // keepalive ACK also ends up being a keepalive probe. Also, seq is in network byte order, so
+ // it's converted to host byte order before incrementing it by one.
+ ptr = (mDNSu8 *)&seq;
+ seqInc = (mDNSu32)((ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3]) + 1;
+ ptr[0] = (mDNSu8)((seqInc >> 24) & 0xFF);
+ ptr[1] = (mDNSu8)((seqInc >> 16) & 0xFF);
+ ptr[2] = (mDNSu8)((seqInc >> 8) & 0xFF);
+ ptr[3] = (mDNSu8)((seqInc ) & 0xFF);
LogMsg("mDNS_SendKeepaliveACK: laddr %#a raddr %#a lport %d rport %d", &laddr, &raddr, mDNSVal16(lport), mDNSVal16(rport));
mDNSPlatformSendKeepalive(&laddr, &raddr, &lport, &rport, seq, ack, win);
}
@@ -10089,6 +10112,8 @@ mDNSlocal void mDNSCoreReceiveUpdateR(mDNS *const m, const DNSMessage *const msg
{
mDNSu32 updatelease = 60 * 60; // If SPS fails to indicate lease time, assume one hour
const mDNSu8 *ptr = LocateOptRR(msg, end, DNSOpt_LeaseData_Space);
+ mDNSAddr spsaddr;
+ char *ifname;
if (ptr)
{
ptr = GetLargeResourceRecord(m, msg, ptr, end, 0, kDNSRecordTypePacketAdd, &m->rec);
@@ -10138,8 +10163,7 @@ mDNSlocal void mDNSCoreReceiveUpdateR(mDNS *const m, const DNSMessage *const msg
}
// Update the dynamic store with the IP Address and MAC address of the sleep proxy
- char *ifname = InterfaceNameForID(m, InterfaceID);
- mDNSAddr spsaddr;
+ ifname = InterfaceNameForID(m, InterfaceID);
mDNSPlatformMemCopy(&spsaddr, srcaddr, sizeof (mDNSAddr));
mDNSPlatformStoreSPSMACAddr(&spsaddr, ifname);
}
@@ -10152,12 +10176,7 @@ mDNSexport void MakeNegativeCacheRecord(mDNS *const m, CacheRecord *const cr,
const domainname *const name, const mDNSu32 namehash, const mDNSu16 rrtype, const mDNSu16 rrclass, mDNSu32 ttl_seconds, mDNSInterfaceID InterfaceID, DNSServer *dnsserver)
{
if (cr == &m->rec.r && m->rec.r.resrec.RecordType)
- {
- LogMsg("MakeNegativeCacheRecord: m->rec appears to be already in use for %s", CRDisplayString(m, &m->rec.r));
-#if ForceAlerts
- *(long*)0 = 0;
-#endif
- }
+ LogFatalError("MakeNegativeCacheRecord: m->rec appears to be already in use for %s", CRDisplayString(m, &m->rec.r));
// Create empty resource record
cr->resrec.RecordType = kDNSRecordTypePacketNegative;
@@ -10265,7 +10284,7 @@ mDNSexport void mDNSCoreReceive(mDNS *const m, void *const pkt, const mDNSu8 *co
// Track the number of multicast packets received from a source outside our subnet.
// Check the destination address to avoid accounting for spurious packets that
// comes in with message id zero.
- if (!mDNS_AddressIsLocalSubnet(m, InterfaceID, srcaddr, mDNSNULL) &&
+ if (!mDNS_AddressIsLocalSubnet(m, InterfaceID, srcaddr) &&
mDNSAddressIsAllDNSLinkGroup(dstaddr))
{
m->RemoteSubnet++;
@@ -10472,8 +10491,8 @@ mDNSexport McastResolver *mDNS_AddMcastResolver(mDNS *const m, const domainname
{
if ((*p)->interface == interface && SameDomainName(&(*p)->domain, d))
{
- if (!((*p)->flags & DNSServer_FlagDelete)) LogMsg("Note: Mcast Resolver domain %##s (%p) registered more than once", d->c, interface);
- (*p)->flags &= ~DNSServer_FlagDelete;
+ if (!((*p)->flags & McastResolver_FlagDelete)) LogMsg("Note: Mcast Resolver domain %##s (%p) registered more than once", d->c, interface);
+ (*p)->flags &= ~McastResolver_FlagDelete;
tmp = *p;
*p = tmp->next;
tmp->next = mDNSNULL;
@@ -10491,7 +10510,7 @@ mDNSexport McastResolver *mDNS_AddMcastResolver(mDNS *const m, const domainname
else
{
(*p)->interface = interface;
- (*p)->flags = DNSServer_FlagNew;
+ (*p)->flags = McastResolver_FlagNew;
(*p)->timeout = timeout;
AssignDomainName(&(*p)->domain, d);
(*p)->next = mDNSNULL;
@@ -10696,10 +10715,11 @@ mDNSexport mDNSu32 SetValidDNSServers(mDNS *m, DNSQuestion *question)
// match the scoped entries by mistake.
//
// Note: DNS configuration change will help pick the new dns servers but currently it does not affect the timeout
-
- if (curr->scoped && curr->interface == mDNSInterface_Any)
+
+ // Skip DNSServers that are InterfaceID Scoped but have no valid interfaceid set OR DNSServers that are ServiceID Scoped but have no valid serviceid set
+ if ((curr->scoped == kScopeInterfaceID && curr->interface == mDNSInterface_Any) || (curr->scoped == kScopeServiceID && curr->serviceID <= 0))
{
- debugf("SetValidDNSServers: Scoped DNS server %#a (Domain %##s) with Interface Any", &curr->addr, curr->domain.c);
+ LogInfo("SetValidDNSServers: ScopeType[%d] Skipping DNS server %#a (Domain %##s) Interface:[%p] Serviceid:[%d]", curr->scoped, &curr->addr, curr->domain.c, curr->interface, curr->serviceID);
continue;
}
@@ -11350,6 +11370,9 @@ mDNSlocal void InitDNSConfig(mDNS *const m, DNSQuestion *const question)
question->triedAllServersOnce = 0;
question->noServerResponse = 0;
question->StopTime = 0;
+#if TARGET_OS_EMBEDDED
+ mDNSPlatformMemZero(&question->metrics, sizeof(question->metrics));
+#endif
// Need not initialize the DNS Configuration for Local Only OR P2P Questions
if (question->InterfaceID == mDNSInterface_LocalOnly || question->InterfaceID == mDNSInterface_P2P)
@@ -11397,6 +11420,7 @@ mDNSlocal mDNSBool InitCommonState(mDNS *const m, DNSQuestion *const question)
{
mDNSBool purge;
int i;
+ mDNSBool isCellBlocked = mDNSfalse;
// Note: In the case where we already have the answer to this question in our cache, that may be all the client
// wanted, and they may immediately cancel their question. In this case, sending an actual query on the wire would
@@ -11445,13 +11469,13 @@ mDNSlocal mDNSBool InitCommonState(mDNS *const m, DNSQuestion *const question)
question->FlappingInterface1 = mDNSNULL;
question->FlappingInterface2 = mDNSNULL;
- // if kDNSServiceFlagsServiceIndex flag is SET by the client, then do NOT call mDNSPlatformGetServiceID()
+ // if kDNSServiceFlagsServiceIndex flag is SET by the client, then do NOT call mDNSPlatformGetDNSRoutePolicy()
// since we would already have the question->ServiceID in that case.
if (!(question->flags & kDNSServiceFlagsServiceIndex))
- question->ServiceID = mDNSPlatformGetServiceID(m, question);
+ mDNSPlatformGetDNSRoutePolicy(m, question, &isCellBlocked);
else
- LogInfo("InitCommonState: Query for %##s (%s), PID[%d], ServiceID %d is already set by client", question->qname.c,
- DNSTypeName(question->qtype), question->pid, question->ServiceID);
+ LogInfo("InitCommonState: Query for %##s (%s), PID[%d], EUID[%d], ServiceID[%d] is already set by client", question->qname.c,
+ DNSTypeName(question->qtype), question->pid, question->euid, question->ServiceID);
InitDNSConfig(m, question);
@@ -11462,10 +11486,10 @@ mDNSlocal mDNSBool InitCommonState(mDNS *const m, DNSQuestion *const question)
// If ServiceID is 0 or the policy disallows making DNS requests,
// set DisallowPID
- question->DisallowPID = (question->ServiceID == 0 || (mDNSPlatformAllowPID(m, question) == 0));
+ question->DisallowPID = (question->ServiceID == 0 || (isCellBlocked && question->qDNSServer && question->qDNSServer->cellIntf));
if (question->DisallowPID)
LogInfo("InitCommonState: Query suppressed for %##s (%s), PID %d/ServiceID %d not allowed", question->qname.c,
- DNSTypeName(question->qtype), question->pid, question->ServiceID);
+ DNSTypeName(question->qtype), question->pid, question->ServiceID);
question->NextInDQList = mDNSNULL;
question->SendQNow = mDNSNULL;
@@ -11584,7 +11608,7 @@ mDNSlocal void InitDNSSECProxyState(mDNS *const m, DNSQuestion *const question)
{
if (question->qDNSServer->cellIntf)
{
- LogInfo("InitDNSSECProxyState: Turning off validation for %##s (%s); going over cell", question->qname.c, DNSTypeName(question->qtype));
+ debugf("InitDNSSECProxyState: Turning off validation for %##s (%s); going over cell", question->qname.c, DNSTypeName(question->qtype));
question->ValidationRequired = mDNSfalse;
}
if (DNSSECOptionalQuestion(question) && !(question->qDNSServer->req_DO))
@@ -11719,6 +11743,13 @@ mDNSexport mStatus mDNS_StartQuery_internal(mDNS *const m, DNSQuestion *const qu
}
else
{
+#if TARGET_OS_WATCH
+ m->NumAllInterfaceQuestions++;
+ LogInfo("mDNS_StartQuery_internal: NumAllInterfaceRecords %d NumAllInterfaceQuestions %d %##s (%s)",
+ m->NumAllInterfaceRecords, m->NumAllInterfaceQuestions, question->qname.c, DNSTypeName(question->qtype));
+ if (m->NumAllInterfaceRecords + m->NumAllInterfaceQuestions == 1)
+ m->NetworkChanged = m->timenow;
+#endif
if (purge)
{
LogInfo("mDNS_StartQuery_internal: Purging for %##s", question->qname.c);
@@ -11763,14 +11794,35 @@ mDNSexport mStatus mDNS_StopQuery_internal(mDNS *const m, DNSQuestion *const que
#if !ForceAlerts
if (question->ThisQInterval >= 0) // Only log error message if the query was supposed to be active
#endif
- LogMsg("mDNS_StopQuery_internal: Question %##s (%s) not found in active list",
- question->qname.c, DNSTypeName(question->qtype));
-#if ForceAlerts
- *(long*)0 = 0;
-#endif
+ LogFatalError("mDNS_StopQuery_internal: Question %##s (%s) not found in active list", question->qname.c, DNSTypeName(question->qtype));
return(mStatus_BadReferenceErr);
}
+#if TARGET_OS_WATCH
+ if (question->InterfaceID != mDNSInterface_LocalOnly && question->InterfaceID != mDNSInterface_P2P && mDNSOpaque16IsZero(question->TargetQID))
+ {
+ if (m->NumAllInterfaceRecords + m->NumAllInterfaceQuestions == 1)
+ m->NetworkChanged = m->timenow;
+ m->NumAllInterfaceQuestions--;
+ LogInfo("mDNS_StopQuery_internal: NumAllInterfaceRecords %d NumAllInterfaceQuestions %d %##s (%s)",
+ m->NumAllInterfaceRecords, m->NumAllInterfaceQuestions, question->qname.c, DNSTypeName(question->qtype));
+ }
+#endif
+
+#if TARGET_OS_EMBEDDED
+ if (Question_uDNS(question) && !question->metrics.answered)
+ {
+ uDNSMetrics * metrics;
+ const domainname * queryName;
+ mDNSBool isForCellular;
+
+ metrics = &question->metrics;
+ queryName = metrics->originalQName ? metrics->originalQName : &question->qname;
+ isForCellular = (question->qDNSServer && question->qDNSServer->cellIntf);
+
+ MetricsUpdateUDNSStats(queryName, mDNSfalse, metrics->querySendCount, 0, isForCellular);
+ }
+#endif
// Take care to cut question from list *before* calling UpdateQuestionDuplicates
UpdateQuestionDuplicates(m, question);
// But don't trash ThisQInterval until afterwards.
@@ -11893,6 +11945,13 @@ mDNSexport mStatus mDNS_StopQuery_internal(mDNS *const m, DNSQuestion *const que
FreeAnonInfo(question->AnonInfo);
question->AnonInfo = mDNSNULL;
}
+#if TARGET_OS_EMBEDDED
+ if (question->metrics.originalQName)
+ {
+ mDNSPlatformMemFree(question->metrics.originalQName);
+ question->metrics.originalQName = mDNSNULL;
+ }
+#endif
return(mStatus_NoError);
}
@@ -12345,6 +12404,7 @@ mDNSexport mStatus mDNS_GetDomains(mDNS *const m, DNSQuestion *const question, m
question->qnameOrig = mDNSNULL;
question->AnonInfo = mDNSNULL;
question->pid = mDNSPlatformGetPID();
+ question->euid = 0;
question->QuestionCallback = Callback;
question->QuestionContext = Context;
if (DomainType > mDNS_DomainTypeMax) return(mStatus_BadParamErr);
@@ -12461,26 +12521,20 @@ mDNSlocal void AdvertiseInterface(mDNS *const m, NetworkInterfaceInfo *set)
{
char buffer[MAX_REVERSE_MAPPING_NAME];
NetworkInterfaceInfo *primary;
+ mDNSu8 recordType;
- if (!set->McastTxRx)
- {
- LogInfo("AdvertiseInterface: Returning, not multicast capable %s", set->ifname);
- return;
- }
-#if TARGET_OS_EMBEDDED
- if (!m->AutoTargetServices)
+ if (m->AutoTargetServices == 0)
{
LogInfo("AdvertiseInterface: Returning due to AutoTargetServices zero for %s", set->ifname);
return;
}
-#endif
primary = FindFirstAdvertisedInterface(m);
if (!primary) primary = set; // If no existing advertised interface, this new NetworkInterfaceInfo becomes our new primary
// If interface is marked as a direct link, we can assume the address record is unique
// and does not need to go through the probe phase of the probe/announce packet sequence.
- mDNSu8 recordType = (set->DirectLink ? kDNSRecordTypeKnownUnique : kDNSRecordTypeUnique);
+ recordType = (set->DirectLink ? kDNSRecordTypeKnownUnique : kDNSRecordTypeUnique);
if (set->DirectLink)
LogInfo("AdvertiseInterface: Marking address record as kDNSRecordTypeKnownUnique for %s", set->ifname);
@@ -12555,22 +12609,19 @@ mDNSlocal void AdvertiseInterface(mDNS *const m, NetworkInterfaceInfo *set)
mDNSlocal void DeadvertiseInterface(mDNS *const m, NetworkInterfaceInfo *set)
{
- NetworkInterfaceInfo *intf;
-
- // If we still have address records referring to this one, update them
- NetworkInterfaceInfo *primary = FindFirstAdvertisedInterface(m);
- AuthRecord *A = primary ? &primary->RR_A : mDNSNULL;
- for (intf = m->HostInterfaces; intf; intf = intf->next)
- if (intf->RR_A.RRSet == &set->RR_A)
- intf->RR_A.RRSet = A;
+ if (m->AutoTargetServices == 0)
+ {
+ LogInfo("DeadvertiseInterface: Returning due to AutoTargetServices zero for %s", set->ifname);
+ return;
+ }
// Unregister these records.
// When doing the mDNS_Exit processing, we first call DeadvertiseInterface for each interface, so by the time the platform
// support layer gets to call mDNS_DeregisterInterface, the address and PTR records have already been deregistered for it.
// Also, in the event of a name conflict, one or more of our records will have been forcibly deregistered.
// To avoid unnecessary and misleading warning messages, we check the RecordType before calling mDNS_Deregister_internal().
- if (set->RR_A.resrec.RecordType) mDNS_Deregister_internal(m, &set->RR_A, mDNS_Dereg_normal);
- if (set->RR_PTR.resrec.RecordType) mDNS_Deregister_internal(m, &set->RR_PTR, mDNS_Dereg_normal);
+ if (set->RR_A .resrec.RecordType) mDNS_Deregister_internal(m, &set->RR_A, mDNS_Dereg_normal);
+ if (set->RR_PTR .resrec.RecordType) mDNS_Deregister_internal(m, &set->RR_PTR, mDNS_Dereg_normal);
if (set->RR_HINFO.resrec.RecordType) mDNS_Deregister_internal(m, &set->RR_HINFO, mDNS_Dereg_normal);
#if APPLE_OSX_mDNSResponder
@@ -12594,7 +12645,6 @@ mDNSlocal void AdvertiseAllInterfaceRecords(mDNS *const m)
mDNSlocal void DeadvertiseAllInterfaceRecords(mDNS *const m)
{
-#if TARGET_OS_EMBEDDED
NetworkInterfaceInfo *intf;
for (intf = m->HostInterfaces; intf; intf = intf->next)
{
@@ -12604,15 +12654,11 @@ mDNSlocal void DeadvertiseAllInterfaceRecords(mDNS *const m)
DeadvertiseInterface(m, intf);
}
}
-#else
- (void) m; //unused
-#endif
}
mDNSexport void mDNS_SetFQDN(mDNS *const m)
{
domainname newmname;
- NetworkInterfaceInfo *intf;
AuthRecord *rr;
newmname.c[0] = 0;
@@ -12625,14 +12671,8 @@ mDNSexport void mDNS_SetFQDN(mDNS *const m)
else
{
AssignDomainName(&m->MulticastHostname, &newmname);
-
- // 1. Stop advertising our address records on all interfaces
- for (intf = m->HostInterfaces; intf; intf = intf->next)
- if (intf->Advertise) DeadvertiseInterface(m, intf);
-
- // 2. Start advertising our address records using the new name
- for (intf = m->HostInterfaces; intf; intf = intf->next)
- if (intf->Advertise) AdvertiseInterface(m, intf);
+ DeadvertiseAllInterfaceRecords(m);
+ AdvertiseAllInterfaceRecords(m);
}
// 3. Make sure that any AutoTarget SRV records (and the like) get updated
@@ -12951,6 +12991,9 @@ mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *se
{
NetworkInterfaceInfo **p = &m->HostInterfaces;
mDNSBool revalidate = mDNSfalse;
+ NetworkInterfaceInfo *primary;
+ NetworkInterfaceInfo *intf;
+ AuthRecord *A;
mDNS_Lock(m);
@@ -12967,14 +13010,13 @@ mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *se
if (!set->InterfaceActive)
{
// If this interface not the active member of its set, update the v4/v6Available flags for the active member
- NetworkInterfaceInfo *intf;
for (intf = m->HostInterfaces; intf; intf = intf->next)
if (intf->InterfaceActive && intf->InterfaceID == set->InterfaceID)
UpdateInterfaceProtocols(m, intf);
}
else
{
- NetworkInterfaceInfo *intf = FirstInterfaceForID(m, set->InterfaceID);
+ intf = FirstInterfaceForID(m, set->InterfaceID);
if (intf)
{
LogInfo("mDNS_DeregisterInterface: Another representative of InterfaceID %d %s (%#a) exists;"
@@ -13007,7 +13049,7 @@ mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *se
if (set->McastTxRx && flapping)
{
- LogMsg("DeregisterInterface: Frequent transitions for interface %s (%#a)", set->ifname, &set->ip);
+ LogMsg("mDNS_DeregisterInterface: Frequent transitions for interface %s (%#a)", set->ifname, &set->ip);
m->mDNSStats.InterfaceDownFlap++;
}
@@ -13048,6 +13090,15 @@ mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *se
}
}
+ // If we still have address records referring to this one, update them.
+ // This is safe, because this NetworkInterfaceInfo has already been unlinked from the list,
+ // so the call to FindFirstAdvertisedInterface() won’t accidentally find it.
+ primary = FindFirstAdvertisedInterface(m);
+ A = primary ? &primary->RR_A : mDNSNULL;
+ for (intf = m->HostInterfaces; intf; intf = intf->next)
+ if (intf->RR_A.RRSet == &set->RR_A)
+ intf->RR_A.RRSet = A;
+
// If we were advertising on this interface, deregister those address and reverse-lookup records now
if (set->Advertise) DeadvertiseInterface(m, set);
@@ -13370,8 +13421,6 @@ mDNSexport mStatus mDNS_AddRecordToService(mDNS *const m, ServiceRecordSet *sr,
e = &sr->Extras;
while (*e) e = &(*e)->next;
- if (ttl == 0) ttl = kStandardTTL;
-
extra->r.DependentOn = &sr->RR_SRV;
debugf("mDNS_AddRecordToService adding record to %##s %s %d",
@@ -14025,11 +14074,13 @@ mDNSexport void mDNSCoreReceiveRawPacket(mDNS *const m, const mDNSu8 *const p, c
else if (end >= p+34 && mDNSSameOpaque16(eth->ethertype, Ethertype_IPv4) && (pkt->v4.flagsfrags.b[0] & 0x1F) == 0 && pkt->v4.flagsfrags.b[1] == 0)
{
const mDNSu8 *const trans = p + 14 + (pkt->v4.vlen & 0xF) * 4;
+ const mDNSu8 * transEnd = p + 14 + mDNSVal16(pkt->v4.totlen);
+ if (transEnd > end) transEnd = end;
debugf("Got IPv4 %02X from %.4a to %.4a", pkt->v4.protocol, &pkt->v4.src, &pkt->v4.dst);
src.type = mDNSAddrType_IPv4; src.ip.v4 = pkt->v4.src;
dst.type = mDNSAddrType_IPv4; dst.ip.v4 = pkt->v4.dst;
- if (end >= trans + RequiredCapLen(pkt->v4.protocol))
- mDNSCoreReceiveRawTransportPacket(m, &eth->src, &src, &dst, pkt->v4.protocol, p, (TransportLayerPacket*)trans, end, InterfaceID, 0);
+ if (transEnd >= trans + RequiredCapLen(pkt->v4.protocol))
+ mDNSCoreReceiveRawTransportPacket(m, &eth->src, &src, &dst, pkt->v4.protocol, p, (TransportLayerPacket*)trans, transEnd, InterfaceID, 0);
}
// Is IPv6? Length must be at least 14 + 28 = 42 bytes
else if (end >= p+54 && mDNSSameOpaque16(eth->ethertype, Ethertype_IPv6))
@@ -14160,6 +14211,7 @@ mDNSexport mStatus mDNS_Init(mDNS *const m, mDNS_PlatformSupport *const p,
if (!rrcachestorage) rrcachesize = 0;
m->p = p;
+ m->NetworkChanged = 0;
m->CanReceiveUnicastOn5353 = mDNSfalse; // Assume we can't receive unicasts on 5353, unless platform layer tells us otherwise
m->AdvertiseLocalAddresses = AdvertiseLocalAddresses;
m->DivertMulticastAdvertisements = mDNSfalse;
@@ -14282,13 +14334,20 @@ mDNSexport mStatus mDNS_Init(mDNS *const m, mDNS_PlatformSupport *const p,
m->WABBrowseQueriesCount = 0;
m->WABLBrowseQueriesCount = 0;
m->WABRegQueriesCount = 0;
-#if !TARGET_OS_EMBEDDED
- m->mDNSOppCaching = mDNStrue;
+#if TARGET_OS_EMBEDDED || TARGET_OS_WATCH
+ m->AutoTargetServices = 0;
#else
- m->mDNSOppCaching = mDNSfalse;
+ m->AutoTargetServices = 1;
+#endif
+#if TARGET_OS_WATCH
+ m->NumAllInterfaceRecords = 0;
+ m->NumAllInterfaceQuestions = 0;
+#else
+ // Initialize to 1 for these targets to prevent not joining multicast group for interfaces when
+ // both of these values are zero.
+ m->NumAllInterfaceRecords = 1;
+ m->NumAllInterfaceQuestions = 1;
#endif
- m->AutoTargetServices = 0;
-
// NAT traversal fields
m->LLQNAT.clientCallback = mDNSNULL;
m->LLQNAT.clientContext = mDNSNULL;
@@ -14525,6 +14584,10 @@ mDNSlocal void SetConfigState(mDNS *const m, mDNSBool delete)
ptr->penaltyTime = 0;
NumUnicastDNSServers--;
ptr->flags |= DNSServer_FlagDelete;
+#if APPLE_OSX_mDNSResponder
+ if (ptr->flags & DNSServer_FlagUnreachable)
+ NumUnreachableDNSServers--;
+#endif
}
// We handle the mcast resolvers here itself as mDNSPlatformSetDNSConfig looks at
// mcast resolvers. Today we get both mcast and ucast configuration using the same
@@ -14539,6 +14602,10 @@ mDNSlocal void SetConfigState(mDNS *const m, mDNSBool delete)
ptr->penaltyTime = 0;
NumUnicastDNSServers++;
ptr->flags &= ~DNSServer_FlagDelete;
+#if APPLE_OSX_mDNSResponder
+ if (ptr->flags & DNSServer_FlagUnreachable)
+ NumUnreachableDNSServers++;
+#endif
}
for (mr = m->McastResolvers; mr; mr = mr->next)
mr->flags &= ~McastResolver_FlagDelete;
@@ -14587,7 +14654,7 @@ mDNSexport mStatus uDNS_SetupDNSConfig(mDNS *const m)
// affecting them as they never change.
while (*mres)
{
- if (((*mres)->flags & DNSServer_FlagDelete) != 0)
+ if (((*mres)->flags & McastResolver_FlagDelete) != 0)
{
mr = *mres;
*mres = (*mres)->next;
@@ -14913,7 +14980,6 @@ mDNSlocal void DeregLoop(mDNS *const m, AuthRecord *const start)
mDNSexport void mDNS_StartExit(mDNS *const m)
{
- NetworkInterfaceInfo *intf;
AuthRecord *rr;
mDNS_Lock(m);
@@ -14953,9 +15019,7 @@ mDNSexport void mDNS_StartExit(mDNS *const m)
}
#endif
- for (intf = m->HostInterfaces; intf; intf = intf->next)
- if (intf->Advertise)
- DeadvertiseInterface(m, intf);
+ DeadvertiseAllInterfaceRecords(m);
// Shut down all our active NAT Traversals
while (m->NATTraversals)
@@ -15015,14 +15079,13 @@ mDNSexport void mDNS_StartExit(mDNS *const m)
mDNSexport void mDNS_FinalExit(mDNS *const m)
{
mDNSu32 rrcache_active = 0;
- mDNSu32 rrcache_totalused = 0;
+ mDNSu32 rrcache_totalused = m->rrcache_totalused;
mDNSu32 slot;
AuthRecord *rr;
LogInfo("mDNS_FinalExit: mDNSPlatformClose");
mDNSPlatformClose(m);
- rrcache_totalused = m->rrcache_totalused;
for (slot = 0; slot < CACHE_HASH_SLOTS; slot++)
{
while (m->rrcache_hash[slot])
@@ -15041,7 +15104,7 @@ mDNSexport void mDNS_FinalExit(mDNS *const m)
}
debugf("mDNS_FinalExit: RR Cache was using %ld records, %lu active", rrcache_totalused, rrcache_active);
if (rrcache_active != m->rrcache_active)
- LogMsg("*** ERROR *** rrcache_active %lu != m->rrcache_active %lu", rrcache_active, m->rrcache_active);
+ LogMsg("*** ERROR *** rrcache_totalused %lu; rrcache_active %lu != m->rrcache_active %lu", rrcache_totalused, rrcache_active, m->rrcache_active);
for (rr = m->ResourceRecords; rr; rr = rr->next)
LogMsg("mDNS_FinalExit failed to send goodbye for: %p %02X %s", rr, rr->resrec.RecordType, ARDisplayString(m, rr));
diff --git a/mDNSResponder/mDNSCore/mDNSDebug.h b/mDNSResponder/mDNSCore/mDNSDebug.h
index 5467ae64..68a696ef 100755
--- a/mDNSResponder/mDNSCore/mDNSDebug.h
+++ b/mDNSResponder/mDNSCore/mDNSDebug.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -148,12 +148,18 @@ extern void LogMsgWithLevel(mDNSLogLevel_t logLevel, const char *format, ...) IS
// (or completely overhauled to use the new "log to a separate file" facility)
#define LogMsgNoIdent LogMsg
+#if APPLE_OSX_mDNSResponder
+extern void LogFatalError(const char *format, ...);
+#else
+#define LogFatalError LogMsg
+#endif
+
#if APPLE_OSX_mDNSResponder && MACOSX_MDNS_MALLOC_DEBUGGING >= 1
extern void *mallocL(char *msg, unsigned int size);
extern void freeL(char *msg, void *x);
-extern void LogMemCorruption(const char *format, ...);
extern void uds_validatelists(void);
extern void udns_validatelists(void *const v);
+extern void LogMemCorruption(const char *format, ...);
#else
#define mallocL(X,Y) malloc(Y)
#define freeL(X,Y) free(Y)
diff --git a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
index bafeb026..48f8280d 100755
--- a/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
+++ b/mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,6 +70,7 @@
#include "mDNSDebug.h"
#if APPLE_OSX_mDNSResponder
#include <uuid/uuid.h>
+#include <TargetConditionals.h>
#endif
#ifdef __cplusplus
@@ -90,20 +91,14 @@ extern "C" {
// In order to disable the above features pass the option to your compiler, e.g. -D UNICAST_DISABLED
-// Additionally, the LIMITED_RESOURCES_TARGET compile option will eliminate caching and
-// and reduce the maximum DNS message sizes.
+// Additionally, the LIMITED_RESOURCES_TARGET compile option will reduce the maximum DNS message sizes.
#ifdef LIMITED_RESOURCES_TARGET
// Don't support jumbo frames
-#define AbsoluteMaxDNSMessageData 1500
-// By the time you add IPv6 header (40 bytes) UDP header (8 bytes) and DNS message header (12 bytes)
-// this makes 1560 which is 60 bytes over the standard Ethernet MTU. D'oh!
-
+// 40 (IPv6 header) + 8 (UDP header) + 12 (DNS message header) + 1440 (DNS message body) = 1500 total
+#define AbsoluteMaxDNSMessageData 1440
// StandardAuthRDSize is 264 (256+8), which is large enough to hold a maximum-sized SRV record (6 + 256 bytes)
#define MaximumRDSize 264
-// Don't cache anything
-#define AUTH_HASH_SLOTS 1
-#define CACHE_HASH_SLOTS 1
#endif
// ***************************************************************************
@@ -556,7 +551,7 @@ typedef packedstruct
{
mDNSu8 vlen;
mDNSu8 tos;
- mDNSu16 totlen;
+ mDNSOpaque16 totlen;
mDNSOpaque16 id;
mDNSOpaque16 flagsfrags;
mDNSu8 ttl;
@@ -1320,8 +1315,11 @@ enum
enum
{
- DNSServer_FlagDelete = 1,
- DNSServer_FlagNew = 2
+ DNSServer_FlagDelete = 0x1,
+ DNSServer_FlagNew = 0x2,
+#if APPLE_OSX_mDNSResponder
+ DNSServer_FlagUnreachable = 0x4,
+#endif
};
enum
@@ -1413,7 +1411,7 @@ struct ResourceRecord_struct
// that are interface-specific (e.g. address records, especially linklocal addresses)
const domainname *name;
RData *rdata; // Pointer to storage for this rdata
- DNSServer *rDNSServer; // Unicast DNS server authoritative for this entry;null for multicast
+ DNSServer *rDNSServer; // Unicast DNS server authoritative for this entry; null for multicast
AnonymousInfo *AnonInfo; // Anonymous Information
};
@@ -1502,7 +1500,7 @@ struct AuthRecord_struct
AuthRecord *next; // Next in list; first element of structure for efficiency reasons
// Field Group 1: Common ResourceRecord fields
- ResourceRecord resrec; // 36 bytes when compiling for 32-bit; 48 when compiling for 64-bit
+ ResourceRecord resrec; // 36 bytes when compiling for 32-bit; 48 when compiling for 64-bit (now 44/64)
// Field Group 2: Persistent metadata for Authoritative Records
AuthRecord *Additional1; // Recommended additional record to include in response (e.g. SRV for PTR record)
@@ -1634,7 +1632,7 @@ typedef struct ARListElem
struct CacheRecord_struct
{
CacheRecord *next; // Next in list; first element of structure for efficiency reasons
- ResourceRecord resrec; // 36 bytes when compiling for 32-bit; 48 when compiling for 64-bit
+ ResourceRecord resrec; // 36 bytes when compiling for 32-bit; 48 when compiling for 64-bit (now 44/64)
// Transient state for Cache Records
CacheRecord *NextInKAList; // Link to the next element in the chain of known answers to send
@@ -1658,13 +1656,12 @@ struct CacheRecord_struct
CacheRecord *soa; // SOA record to return for proxy questions
mDNSAddr sourceAddress; // node from which we received this record
- // Size to here is 76 bytes when compiling 32-bit; 104 bytes when compiling 64-bit
+ // Size to here is 76 bytes when compiling 32-bit; 104 bytes when compiling 64-bit (now 160 bytes for 64-bit)
RData_small smallrdatastorage; // Storage for small records is right here (4 bytes header + 68 bytes data = 72 bytes)
};
// Should match the CacheGroup_struct members, except namestorage[]. Only used to calculate
-// the size of the namestorage array in CacheGroup_struct so that
-// sizeof(CacheGroup) == sizeof(CacheRecord)
+// the size of the namestorage array in CacheGroup_struct so that sizeof(CacheGroup) == sizeof(CacheRecord)
struct CacheGroup_base
{
CacheGroup *next;
@@ -1887,6 +1884,17 @@ typedef enum { DNSSECValNotRequired = 0, DNSSECValRequired, DNSSECValInProgress,
// RFC 4122 defines it to be 16 bytes
#define UUID_SIZE 16
+#if TARGET_OS_EMBEDDED
+typedef struct
+{
+ domainname * originalQName; // Name of original A/AAAA record if this question is for a CNAME record.
+ mDNSu32 querySendCount; // Number of queries that have been sent to DNS servers so far.
+ mDNSs32 firstQueryTime; // The time when the first query was sent to a DNS server.
+ mDNSBool answered; // Has this question been answered?
+
+} uDNSMetrics;
+#endif
+
struct DNSQuestion_struct
{
// Internal state fields. These are used internally by mDNSCore; the client layer needn't be concerned with them.
@@ -1997,9 +2005,13 @@ struct DNSQuestion_struct
mDNSu8 ProxyDNSSECOK; // Proxy Question with EDNS0 DNSSEC OK bit set
mDNSs32 pid; // Process ID of the client that is requesting the question
mDNSu8 uuid[UUID_SIZE]; // Unique ID of the client that is requesting the question (valid only if pid is zero)
+ mDNSu32 euid; // Effective User Id of the client that is requesting the question
domainname *qnameOrig; // Copy of the original question name if it is not fully qualified
mDNSQuestionCallback *QuestionCallback;
void *QuestionContext;
+#if TARGET_OS_EMBEDDED
+ uDNSMetrics metrics; // Data used for collecting unicast DNS query metrics.
+#endif
};
typedef struct
@@ -2145,6 +2157,8 @@ struct NetworkInterfaceInfo_struct
mDNSu8 SendGoodbyes; // Send goodbyes on this interface while sleeping
mDNSBool DirectLink; // a direct link, indicating we can skip the probe for
// address records
+ mDNSBool SupportsUnicastMDNSResponse; // Indicates that the interface supports unicast responses
+ // to Bonjour queries. Generally true for an interface.
};
#define SLE_DELETE 0x00000001
@@ -2259,6 +2273,7 @@ typedef struct
mDNSu32 CacheRefreshed; // Number of times the cache was refreshed due to a response
mDNSu32 WakeOnResolves; // Number of times we did a wake on resolve
} mDNSStatistics;
+
extern void LogMDNSStatistics(mDNS *const m);
struct mDNS_struct
@@ -2269,6 +2284,7 @@ struct mDNS_struct
// all required data is passed as parameters to that function.
mDNS_PlatformSupport *p; // Pointer to platform-specific data of indeterminite size
+ mDNSs32 NetworkChanged;
mDNSBool CanReceiveUnicastOn5353;
mDNSBool AdvertiseLocalAddresses;
mDNSBool DivertMulticastAdvertisements; // from interfaces that do not advertise local addresses to local-only
@@ -2368,7 +2384,7 @@ struct mDNS_struct
mDNSs32 ProbeFailTime;
mDNSu32 NumFailedProbes;
mDNSs32 SuppressProbes;
- Platform_t mDNS_plat;
+ Platform_t mDNS_plat; // Why is this here in the “only required for mDNS Responder” section? -- SC
// Unicast-specific data
mDNSs32 NextuDNSEvent; // uDNS next event
@@ -2454,9 +2470,10 @@ struct mDNS_struct
TrustAnchor *TrustAnchors;
int notifyToken;
- int uds_listener_skt; // Listening socket for incoming UDS clients
- mDNSBool mDNSOppCaching; // Opportunistic Caching
+ int uds_listener_skt; // Listening socket for incoming UDS clients. This should not be here -- it's private to uds_daemon.c and nothing to do with mDNSCore -- SC
mDNSu32 AutoTargetServices; // # of services that have AutoTarget set
+ mDNSu32 NumAllInterfaceRecords; // Right now we count *all* multicast records here. Later we may want to change to count interface-specific records separately. (This count includes records on the DuplicateRecords list too.)
+ mDNSu32 NumAllInterfaceQuestions; // Right now we count *all* multicast questions here. Later we may want to change to count interface-specific questions separately.
DNSSECStatistics DNSSECStats;
mDNSStatistics mDNSStats;
@@ -2468,8 +2485,8 @@ struct mDNS_struct
};
#define FORALL_CACHERECORDS(SLOT,CG,CR) \
- for ((SLOT) = 0; (SLOT) < CACHE_HASH_SLOTS; (SLOT)++) \
- for ((CG)=m->rrcache_hash[(SLOT)]; (CG); (CG)=(CG)->next) \
+ for ((SLOT) = 0; (SLOT) < CACHE_HASH_SLOTS; (SLOT)++) \
+ for ((CG)=m->rrcache_hash[(SLOT)]; (CG); (CG)=(CG)->next) \
for ((CR) = (CG)->members; (CR); (CR)=(CR)->next)
// ***************************************************************************
@@ -2530,6 +2547,9 @@ extern const mDNSOpaque64 zeroOpaque64;
extern mDNSBool StrictUnicastOrdering;
extern mDNSu8 NumUnicastDNSServers;
+#if APPLE_OSX_mDNSResponder
+extern mDNSu8 NumUnreachableDNSServers;
+#endif
#define localdomain (*(const domainname *)"\x5" "local")
#define DeviceInfoName (*(const domainname *)"\xC" "_device-info" "\x4" "_tcp")
@@ -2648,7 +2668,6 @@ extern mStatus mDNS_Init (mDNS *const m, mDNS_PlatformSupport *const p,
extern void mDNS_ConfigChanged(mDNS *const m);
extern void mDNS_GrowCache (mDNS *const m, CacheEntity *storage, mDNSu32 numrecords);
-extern void mDNS_GrowAuth (mDNS *const m, AuthEntity *storage, mDNSu32 numrecords);
extern void mDNS_StartExit (mDNS *const m);
extern void mDNS_FinalExit (mDNS *const m);
#define mDNS_Close(m) do { mDNS_StartExit(m); mDNS_FinalExit(m); } while(0)
@@ -2784,7 +2803,7 @@ extern mStatus mDNS_AdvertiseDomains(mDNS *const m, AuthRecord *rr, mDNS_DomainT
#define mDNS_StopAdvertiseDomains mDNS_Deregister
extern mDNSOpaque16 mDNS_NewMessageID(mDNS *const m);
-extern mDNSBool mDNS_AddressIsLocalSubnet(mDNS *const m, const mDNSInterfaceID InterfaceID, const mDNSAddr *addr, mDNSBool *myself);
+extern mDNSBool mDNS_AddressIsLocalSubnet(mDNS *const m, const mDNSInterfaceID InterfaceID, const mDNSAddr *addr);
extern DNSServer *GetServerForQuestion(mDNS *m, DNSQuestion *question);
extern mDNSu32 SetValidDNSServers(mDNS *m, DNSQuestion *question);
@@ -3195,6 +3214,7 @@ extern mStatus mDNSPlatformGetPrimaryInterface(mDNS *const m, mDNSAddr *v4, m
extern void mDNSPlatformDynDNSHostNameStatusChanged(const domainname *const dname, const mStatus status);
extern void mDNSPlatformSetAllowSleep(mDNS *const m, mDNSBool allowSleep, const char *reason);
+extern void mDNSPlatformPreventSleep(mDNS *const m, mDNSu32 timeout, const char *reason);
extern void mDNSPlatformSendWakeupPacket(mDNS *const m, mDNSInterfaceID InterfaceID, char *EthAddr, char *IPAddr, int iteration);
extern mDNSBool mDNSPlatformInterfaceIsD2D(mDNSInterfaceID InterfaceID);
@@ -3317,11 +3337,13 @@ extern void RemoveAutoTunnel6Record(mDNS *const m);
extern mDNSBool RecordReadyForSleep(mDNS *const m, AuthRecord *rr);
// For now this LocalSleepProxy stuff is specific to Mac OS X.
// In the future, if there's demand, we may see if we can abstract it out cleanly into the platform layer
-extern mStatus ActivateLocalProxy(mDNS *const m, NetworkInterfaceInfo *const intf);
+extern mStatus ActivateLocalProxy(mDNS *const m, NetworkInterfaceInfo *const intf, mDNSBool *keepaliveOnly);
extern void mDNSPlatformUpdateDNSStatus(mDNS *const m, DNSQuestion *q);
extern void mDNSPlatformTriggerDNSRetry(mDNS *const m, DNSQuestion *v4q, DNSQuestion *v6q);
extern void mDNSPlatformLogToFile(int log_level, const char *buffer);
extern mDNSBool SupportsInNICProxy(NetworkInterfaceInfo *const intf);
+extern mStatus SymptomReporterDNSServerReachable(mDNS *const m, const mDNSAddr *addr);
+extern mStatus SymptomReporterDNSServerUnreachable(DNSServer *s);
#endif
typedef void ProxyCallback (mDNS *const m, void *socket, void *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
@@ -3336,11 +3358,11 @@ extern mDNSu8 *DNSProxySetAttributes(DNSQuestion *q, DNSMessageHeader *h, DNSMes
extern void mDNSPlatformSleepAssertion(mDNS *const m, double timeout);
#endif
-extern mDNSBool mDNSPlatformAllowPID(mDNS *const m, DNSQuestion *q);
-extern mDNSs32 mDNSPlatformGetServiceID(mDNS *const m, DNSQuestion *q);
+extern void mDNSPlatformGetDNSRoutePolicy(mDNS *const m, DNSQuestion *q, mDNSBool *isBlocked);
extern void mDNSPlatformSetuDNSSocktOpt(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q);
extern mDNSs32 mDNSPlatformGetPID(void);
-
+extern mDNSBool mDNSValidKeepAliveRecord(AuthRecord *rr);
+
// ***************************************************************************
#if 0
#pragma mark -
@@ -3556,21 +3578,18 @@ struct CompileTimeAssertionChecks_mDNS
char sizecheck_AuthRecord [(sizeof(AuthRecord) <= 1208) ? 1 : -1];
char sizecheck_CacheRecord [(sizeof(CacheRecord) <= 232) ? 1 : -1];
char sizecheck_CacheGroup [(sizeof(CacheGroup) <= 232) ? 1 : -1];
- char sizecheck_DNSQuestion [(sizeof(DNSQuestion) <= 832) ? 1 : -1];
+ char sizecheck_DNSQuestion [(sizeof(DNSQuestion) <= 864) ? 1 : -1];
-// Checks commented out when sizeof(DNSQuestion) change cascaded into having to change yet another
-// set of hardcoded size values because these structures contain one or more DNSQuestion
-// instances.
-// char sizecheck_ZoneData [(sizeof(ZoneData) <= 1648) ? 1 : -1];
+ char sizecheck_ZoneData [(sizeof(ZoneData) <= 1700) ? 1 : -1];
char sizecheck_NATTraversalInfo [(sizeof(NATTraversalInfo) <= 200) ? 1 : -1];
char sizecheck_HostnameInfo [(sizeof(HostnameInfo) <= 3050) ? 1 : -1];
char sizecheck_DNSServer [(sizeof(DNSServer) <= 340) ? 1 : -1];
-// char sizecheck_NetworkInterfaceInfo[(sizeof(NetworkInterfaceInfo) <= 6988) ? 1 : -1];
+ char sizecheck_NetworkInterfaceInfo[(sizeof(NetworkInterfaceInfo) <= 7184) ? 1 : -1];
char sizecheck_ServiceRecordSet [(sizeof(ServiceRecordSet) <= 5540) ? 1 : -1];
char sizecheck_DomainAuthInfo [(sizeof(DomainAuthInfo) <= 7888) ? 1 : -1];
-// char sizecheck_ServiceInfoQuery [(sizeof(ServiceInfoQuery) <= 3302) ? 1 : -1];
+ char sizecheck_ServiceInfoQuery [(sizeof(ServiceInfoQuery) <= 3488) ? 1 : -1];
#if APPLE_OSX_mDNSResponder
-// char sizecheck_ClientTunnel [(sizeof(ClientTunnel) <= 1160) ? 1 : -1];
+ char sizecheck_ClientTunnel [(sizeof(ClientTunnel) <= 1208) ? 1 : -1];
#endif
};
diff --git a/mDNSResponder/mDNSCore/nsec.c b/mDNSResponder/mDNSCore/nsec.c
index a9f16b3f..09d27356 100644
--- a/mDNSResponder/mDNSCore/nsec.c
+++ b/mDNSResponder/mDNSCore/nsec.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -611,7 +611,7 @@ mDNSlocal mDNSBool NSECNoDataError(mDNS *const m, ResourceRecord *rr, domainname
{
const domainname *oname = rr->name; // owner name
- if (wildcard) *wildcard = mDNSNULL;
+ *wildcard = mDNSNULL;
// RFC 4035
//
// section 3.1.3.1 : Name matches. Prove that the type does not exist and also CNAME is
@@ -676,10 +676,10 @@ mDNSlocal mDNSBool NSECNoDataError(mDNS *const m, ResourceRecord *rr, domainname
// a subdomain e.g., y.x.example or z.y.x.example and so on.
if (oname->c[0] == 1 && oname->c[1] == '*')
{
- int r, s;
+ int s;
const domainname *ce = SkipLeadingLabels(oname, 1);
- r = DNSSECCanonicalOrder(name, ce, &s);
+ DNSSECCanonicalOrder(name, ce, &s);
if (s)
{
if (RRAssertsExistence(rr, qtype) || RRAssertsExistence(rr, kDNSType_CNAME))
@@ -912,18 +912,18 @@ mDNSlocal void NoDataProof(mDNS *const m, DNSSECVerifier *dv, CacheRecord *ncr)
// First verify wildcard NSEC and then when we are done, we
// will verify the noname nsec
dv->pendingNSEC = r;
- LogDNSSEC("NoDataProof: Verifying wild and noname %s", RRDisplayString(m, nsec_wild));
+ LogDNSSEC("NoDataProof: Verifying wild and noname %s", nsec_wild ? RRDisplayString(m, nsec_wild) : "NULL");
VerifyNSEC(m, nsec_wild, mDNSNULL, dv, ncr, NoDataNSECCallback);
}
else if ((dv->flags & WILDCARD_PROVES_NONAME_EXISTS) ||
(dv->flags & NSEC_PROVES_NOTYPE_EXISTS))
{
- LogDNSSEC("NoDataProof: Verifying wild %s", RRDisplayString(m, nsec_wild));
+ LogDNSSEC("NoDataProof: Verifying wild %s", nsec_wild ? RRDisplayString(m, nsec_wild) : "NULL");
VerifyNSEC(m, nsec_wild, mDNSNULL, dv, ncr, mDNSNULL);
}
else if (dv->flags & NSEC_PROVES_NONAME_EXISTS)
{
- LogDNSSEC("NoDataProof: Verifying noname %s", RRDisplayString(m, nsec_noname));
+ LogDNSSEC("NoDataProof: Verifying noname %s", nsec_noname ? RRDisplayString(m, nsec_noname) : "NULL");
VerifyNSEC(m, nsec_noname, mDNSNULL, dv, ncr, mDNSNULL);
}
return;
diff --git a/mDNSResponder/mDNSCore/nsec.h b/mDNSResponder/mDNSCore/nsec.h
index 3dbb841f..198f57db 100644
--- a/mDNSResponder/mDNSCore/nsec.h
+++ b/mDNSResponder/mDNSCore/nsec.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2012 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#ifndef __NSEC_H
#define __NSEC_H
diff --git a/mDNSResponder/mDNSCore/nsec3.c b/mDNSResponder/mDNSCore/nsec3.c
index a039418a..c16a42d5 100644
--- a/mDNSResponder/mDNSCore/nsec3.c
+++ b/mDNSResponder/mDNSCore/nsec3.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -332,7 +332,7 @@ mDNSlocal mDNSBool NSEC3Find(mDNS *const m, NSEC3FindValues val, CacheRecord *nc
}
}
- if ((val == NSEC3Covers || val == NSEC3CEProof) && !(*closerEncloser))
+ if ((val == NSEC3Covers || val == NSEC3CEProof) && (!closerEncloser || !(*closerEncloser)))
{
if (NSEC3CoversName(m, cr, hashName, hlen, b32Name, b32len))
{
@@ -349,23 +349,22 @@ mDNSlocal mDNSBool NSEC3Find(mDNS *const m, NSEC3FindValues val, CacheRecord *nc
// 2.3) If there is a matching NSEC3 RR in the response and the flag
// was set, then the proof is complete, and SNAME is the closest
// encloser.
- if (val == NSEC3CEProof)
+ if (val == NSEC3CEProof && closestEncloser && *closestEncloser)
{
- if (*closestEncloser && *closerEncloser)
+ if (closerEncloser && *closerEncloser)
{
LogDNSSEC("NSEC3Find: Found closest and closer encloser");
return mDNStrue;
}
-
- // 2.4) If there is a matching NSEC3 RR in the response, but the flag
- // is not set, then the response is bogus.
- //
- // Note: We don't have to wait till we finish trying all the names. If the matchName
- // happens, we found the closest encloser which means we should have found the closer
- // encloser before.
-
- if (*closestEncloser && !(*closerEncloser))
+ else
{
+ // 2.4) If there is a matching NSEC3 RR in the response, but the flag
+ // is not set, then the response is bogus.
+ //
+ // Note: We don't have to wait till we finish trying all the names. If the matchName
+ // happens, we found the closest encloser which means we should have found the closer
+ // encloser before.
+
LogDNSSEC("NSEC3Find: Found closest, but not closer encloser");
return mDNSfalse;
}
@@ -388,8 +387,7 @@ mDNSlocal mDNSBool NSEC3ClosestEncloserProof(mDNS *const m, CacheRecord *ncr, do
// Note: It is possible that closestEncloser and closerEncloser are the same.
if (!closestEncloser || !closerEncloser || !ce)
{
- LogMsg("NSEC3ClosestEncloserProof: ClosestEncloser %p or CloserEncloser %p ce %p, something is NULL", *closestEncloser,
- *closerEncloser, *ce);
+ LogMsg("NSEC3ClosestEncloserProof: ClosestEncloser %p or CloserEncloser %p ce %p, something is NULL", closestEncloser, closerEncloser, ce);
return mDNSfalse;
}
diff --git a/mDNSResponder/mDNSCore/nsec3.h b/mDNSResponder/mDNSCore/nsec3.h
index ce3b85a3..be32b809 100644
--- a/mDNSResponder/mDNSCore/nsec3.h
+++ b/mDNSResponder/mDNSCore/nsec3.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2012 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSCore/uDNS.c b/mDNSResponder/mDNSCore/uDNS.c
index ce12d01a..3ba88b5c 100755
--- a/mDNSResponder/mDNSCore/uDNS.c
+++ b/mDNSResponder/mDNSCore/uDNS.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,6 +51,9 @@ mDNSBool StrictUnicastOrdering = mDNSfalse;
// arbitrary limitation of 64 DNSServers can be removed.
mDNSu8 NumUnicastDNSServers = 0;
#define MAX_UNICAST_DNS_SERVERS 64
+#if APPLE_OSX_mDNSResponder
+mDNSu8 NumUnreachableDNSServers = 0;
+#endif
#define SetNextuDNSEvent(m, rr) { \
if ((m)->NextuDNSEvent - ((rr)->LastAPTime + (rr)->ThisAPInterval) >= 0) \
@@ -164,6 +167,12 @@ mDNSexport DNSServer *mDNS_AddDNSServer(mDNS *const m, const domainname *d, cons
if (tmp)
{
+#if APPLE_OSX_mDNSResponder
+ if (tmp->flags & DNSServer_FlagDelete)
+ {
+ tmp->flags &= ~DNSServer_FlagUnreachable;
+ }
+#endif
tmp->flags &= ~DNSServer_FlagDelete;
*p = tmp; // move to end of list, to ensure ordering from platform layer
}
@@ -214,7 +223,8 @@ mDNSexport void PenalizeDNSServer(mDNS *const m, DNSQuestion *q, mDNSOpaque16 re
{
DNSServer *new;
DNSServer *orig = q->qDNSServer;
-
+ mDNSu8 rcode = '\0';
+
mDNS_CheckLock(m);
LogInfo("PenalizeDNSServer: Penalizing DNS server %#a question for question %p %##s (%s) SuppressUnusable %d",
@@ -224,10 +234,13 @@ mDNSexport void PenalizeDNSServer(mDNS *const m, DNSQuestion *q, mDNSOpaque16 re
// return the error, then return the first error.
if (mDNSOpaque16IsZero(q->responseFlags))
q->responseFlags = responseFlags;
+
+ rcode = (mDNSu8)(responseFlags.b[1] & kDNSFlag1_RC_Mask);
// After we reset the qDNSServer to NULL, we could get more SERV_FAILS that might end up
// peanlizing again.
- if (!q->qDNSServer) goto end;
+ if (!q->qDNSServer)
+ goto end;
// If strict ordering of unicast servers needs to be preserved, we just lookup
// the next best match server below
@@ -246,6 +259,10 @@ mDNSexport void PenalizeDNSServer(mDNS *const m, DNSQuestion *q, mDNSOpaque16 re
{
LogInfo("PenalizeDNSServer: Not Penalizing PTR question");
}
+ else if ((rcode == kDNSFlag1_RC_FormErr) || (rcode == kDNSFlag1_RC_ServFail) || (rcode == kDNSFlag1_RC_NotImpl) || (rcode == kDNSFlag1_RC_Refused))
+ {
+ LogInfo("PenalizeDNSServer: Not Penalizing DNS Server since it at least responded with rcode %d", rcode);
+ }
else
{
LogInfo("PenalizeDNSServer: Penalizing question type %d", q->qtype);
@@ -812,11 +829,8 @@ mDNSexport mStatus mDNS_StartNATOperation_internal(mDNS *const m, NATTraversalIn
{
if (traversal == *n)
{
- LogMsg("Error! Tried to add a NAT traversal that's already in the active list: request %p Prot %d Int %d TTL %d",
+ LogFatalError("Error! Tried to add a NAT traversal that's already in the active list: request %p Prot %d Int %d TTL %d",
traversal, traversal->Protocol, mDNSVal16(traversal->IntPort), traversal->NATLease);
- #if ForceAlerts
- *(long*)0 = 0;
- #endif
return(mStatus_AlreadyRegistered);
}
if (traversal->Protocol && traversal->Protocol == (*n)->Protocol && mDNSSameIPPort(traversal->IntPort, (*n)->IntPort) &&
@@ -1894,6 +1908,7 @@ mDNSlocal mStatus GetZoneData_StartQuery(mDNS *const m, ZoneData *zd, mDNSu16 qt
zd->question.qnameOrig = mDNSNULL;
zd->question.AnonInfo = mDNSNULL;
zd->question.pid = mDNSPlatformGetPID();
+ zd->question.euid = 0;
zd->question.QuestionCallback = GetZoneData_QuestionCallback;
zd->question.QuestionContext = zd;
@@ -2583,6 +2598,7 @@ mDNSlocal void GetStaticHostname(mDNS *m)
q->qnameOrig = mDNSNULL;
q->AnonInfo = mDNSNULL;
q->pid = mDNSPlatformGetPID();
+ q->euid = 0;
q->QuestionCallback = FoundStaticHostname;
q->QuestionContext = mDNSNULL;
@@ -3991,6 +4007,10 @@ mDNSexport void uDNS_ReceiveMsg(mDNS *const m, DNSMessage *const msg, const mDNS
msg->h.numAnswers, msg->h.numAnswers == 1 ? ", " : "s,",
msg->h.numAuthorities, msg->h.numAuthorities == 1 ? "y, " : "ies,",
msg->h.numAdditionals, msg->h.numAdditionals == 1 ? "" : "s", end - msg->data);
+#if APPLE_OSX_mDNSResponder
+ if (NumUnreachableDNSServers > 0)
+ SymptomReporterDNSServerReachable(m, srcaddr);
+#endif
if (QR_OP == StdR)
{
@@ -4141,7 +4161,7 @@ mDNSexport void LLQGotZoneData(mDNS *const m, mStatus err, const ZoneData *zoneI
q->servAddr = zeroAddr;
q->servPort = zeroIPPort;
- if (!err && zoneInfo && !mDNSIPPortIsZero(zoneInfo->Port) && !mDNSAddressIsZero(&zoneInfo->Addr) && zoneInfo->Host.c[0])
+ if (!err && !mDNSIPPortIsZero(zoneInfo->Port) && !mDNSAddressIsZero(&zoneInfo->Addr) && zoneInfo->Host.c[0])
{
q->servAddr = zoneInfo->Addr;
q->servPort = zoneInfo->Port;
@@ -4238,10 +4258,14 @@ mDNSlocal void PrivateQueryGotZoneData(mDNS *const m, mStatus err, const ZoneDat
// Called in normal callback context (i.e. mDNS_busy and mDNS_reentrancy are both 1)
mDNSexport void RecordRegistrationGotZoneData(mDNS *const m, mStatus err, const ZoneData *zoneData)
{
- AuthRecord *newRR = (AuthRecord*)zoneData->ZoneDataContext;
+ AuthRecord *newRR;
AuthRecord *ptr;
int c1, c2;
+ if (!zoneData) { LogMsg("ERROR: RecordRegistrationGotZoneData invoked with NULL result and no error"); return; }
+
+ newRR = (AuthRecord*)zoneData->ZoneDataContext;
+
if (newRR->nta != zoneData)
LogMsg("RecordRegistrationGotZoneData: nta (%p) != zoneData (%p) %##s (%s)", newRR->nta, zoneData, newRR->resrec.name->c, DNSTypeName(newRR->resrec.rrtype));
@@ -4267,8 +4291,6 @@ mDNSexport void RecordRegistrationGotZoneData(mDNS *const m, mStatus err, const
return;
}
- if (!zoneData) { LogMsg("ERROR: RecordRegistrationGotZoneData invoked with NULL result and no error"); return; }
-
if (newRR->resrec.rrclass != zoneData->ZoneClass)
{
LogMsg("ERROR: New resource record's class (%d) does not match zone class (%d)", newRR->resrec.rrclass, zoneData->ZoneClass);
@@ -4656,7 +4678,7 @@ mDNSlocal void handle_unanswered_query(mDNS *const m)
// Note: req_DO affects only DNSSEC_VALIDATION_SECURE_OPTIONAL questions;
// DNSSEC_VALIDATION_SECURE questions ignores req_DO.
- if (q->qDNSServer && !q->qDNSServer->DNSSECAware && q->qDNSServer->req_DO)
+ if (!q->qDNSServer->DNSSECAware && q->qDNSServer->req_DO)
{
q->qDNSServer->retransDO++;
if (q->qDNSServer->retransDO == MAX_DNSSEC_RETRANSMISSIONS)
@@ -4714,6 +4736,9 @@ mDNSexport void uDNS_CheckCurrentQuestion(mDNS *const m)
LogInfo("uDNS_CheckCurrentQuestion: Sent %d unanswered queries for %##s (%s) to %#a:%d (%##s)",
q->unansweredQueries, q->qname.c, DNSTypeName(q->qtype), &orig->addr, mDNSVal16(orig->port), orig->domain.c);
+#if APPLE_OSX_mDNSResponder
+ SymptomReporterDNSServerUnreachable(orig);
+#endif
PenalizeDNSServer(m, q, zeroID);
q->noServerResponse = 1;
}
@@ -4798,7 +4823,19 @@ mDNSexport void uDNS_CheckCurrentQuestion(mDNS *const m)
mDNSPlatformSetuDNSSocktOpt(q->LocalSocket, &q->qDNSServer->addr, q);
}
if (!q->LocalSocket) err = mStatus_NoMemoryErr; // If failed to make socket (should be very rare), we'll try again next time
- else err = mDNSSendDNSMessage(m, &m->omsg, end, q->qDNSServer->interface, q->LocalSocket, &q->qDNSServer->addr, q->qDNSServer->port, mDNSNULL, mDNSNULL, q->UseBackgroundTrafficClass);
+ else
+ {
+ err = mDNSSendDNSMessage(m, &m->omsg, end, q->qDNSServer->interface, q->LocalSocket, &q->qDNSServer->addr, q->qDNSServer->port, mDNSNULL, mDNSNULL, q->UseBackgroundTrafficClass);
+#if TARGET_OS_EMBEDDED
+ if (!err)
+ {
+ if (q->metrics.querySendCount++ == 0)
+ {
+ q->metrics.firstQueryTime = m->timenow;
+ }
+ }
+#endif
+ }
}
}
@@ -4916,7 +4953,6 @@ mDNSexport void uDNS_CheckCurrentQuestion(mDNS *const m)
mDNSexport void CheckNATMappings(mDNS *m)
{
- mStatus err = mStatus_NoError;
mDNSBool rfc1918 = mDNSv4AddrIsRFC1918(&m->AdvertisedV4.ip.v4);
mDNSBool HaveRoutable = !rfc1918 && !mDNSIPv4AddressIsZero(m->AdvertisedV4.ip.v4);
m->NextScheduledNATOp = m->timenow + 0x3FFFFFFF;
@@ -4974,7 +5010,7 @@ mDNSexport void CheckNATMappings(mDNS *m)
cur->retryInterval = NATMAP_INIT_RETRY;
}
- err = uDNS_SendNATMsg(m, cur, mDNStrue); // Will also do UPnP discovery for us, if necessary
+ uDNS_SendNATMsg(m, cur, mDNStrue); // Will also do UPnP discovery for us, if necessary
if (cur->ExpiryTime) // If have active mapping then set next renewal time halfway to expiry
NATSetNextRenewalTime(m, cur);
diff --git a/mDNSResponder/mDNSMacOS9/Mac OS Test Responder.c b/mDNSResponder/mDNSMacOS9/Mac OS Test Responder.c
deleted file mode 100644
index eff6a5f4..00000000
--- a/mDNSResponder/mDNSMacOS9/Mac OS Test Responder.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h> // For printf()
-#include <string.h> // For strlen() etc.
-
-#include <Events.h> // For WaitNextEvent()
-#include <SIOUX.h> // For SIOUXHandleOneEvent()
-
-#include "mDNSEmbeddedAPI.h" // Defines the interface to the client layer above
-
-#include "mDNSMacOS9.h" // Defines the specific types needed to run mDNS on this platform
-
-// These don't have to be globals, but their memory does need to remain valid for as
-// long as the search is going on. They are declared as globals here for simplicity.
-static mDNS m;
-static mDNS_PlatformSupport p;
-static ServiceRecordSet p1, p2, afp, http, njp;
-static AuthRecord browsedomain1, browsedomain2;
-
-// This sample code just calls mDNS_RenameAndReregisterService to automatically pick a new
-// unique name for the service. For a device such as a printer, this may be appropriate.
-// For a device with a user interface, and a screen, and a keyboard, the appropriate
-// response may be to prompt the user and ask them to choose a new name for the service.
-mDNSlocal void Callback(mDNS *const m, ServiceRecordSet *const sr, mStatus result)
- {
- switch (result)
- {
- case mStatus_NoError: debugf("Callback: %##s Name Registered", sr->RR_SRV.resrec.name->c); break;
- case mStatus_NameConflict: debugf("Callback: %##s Name Conflict", sr->RR_SRV.resrec.name->c); break;
- case mStatus_MemFree: debugf("Callback: %##s Memory Free", sr->RR_SRV.resrec.name->c); break;
- default: debugf("Callback: %##s Unknown Result %d", sr->RR_SRV.resrec.name->c, result); break;
- }
-
- if (result == mStatus_NameConflict) mDNS_RenameAndReregisterService(m, sr, mDNSNULL);
- }
-
-// RegisterService() is a simple wrapper function which takes C string
-// parameters, converts them to domainname parameters, and calls mDNS_RegisterService()
-mDNSlocal void RegisterService(mDNS *m, ServiceRecordSet *recordset,
- UInt16 PortAsNumber, const char txtinfo[],
- const domainlabel *const n, const char type[], const char domain[])
- {
- domainname t;
- domainname d;
- char buffer[MAX_ESCAPED_DOMAIN_NAME];
- UInt8 txtbuffer[512];
-
- MakeDomainNameFromDNSNameString(&t, type);
- MakeDomainNameFromDNSNameString(&d, domain);
-
- if (txtinfo)
- {
- strncpy((char*)txtbuffer+1, txtinfo, sizeof(txtbuffer)-1);
- txtbuffer[0] = (UInt8)strlen(txtinfo);
- }
- else
- txtbuffer[0] = 0;
-
- mDNS_RegisterService(m, recordset,
- n, &t, &d, // Name, type, domain
- mDNSNULL, mDNSOpaque16fromIntVal(PortAsNumber),
- txtbuffer, (mDNSu16)(1+txtbuffer[0]), // TXT data, length
- mDNSNULL, 0, // Subtypes (none)
- mDNSInterface_Any, // Interface ID
- Callback, mDNSNULL); // Callback and context
-
- ConvertDomainNameToCString(recordset->RR_SRV.resrec.name, buffer);
- printf("Made Service Records for %s\n", buffer);
- }
-
-// RegisterFakeServiceForTesting() simulates the effect of services being registered on
-// dynamically-allocated port numbers. No real service exists on that port -- this is just for testing.
-mDNSlocal void RegisterFakeServiceForTesting(mDNS *m, ServiceRecordSet *recordset, const char txtinfo[],
- const char name[], const char type[], const char domain[])
- {
- static UInt16 NextPort = 0xF000;
- domainlabel n;
- MakeDomainLabelFromLiteralString(&n, name);
- RegisterService(m, recordset, NextPort++, txtinfo, &n, type, domain);
- }
-
-// CreateProxyRegistrationForRealService() checks to see if the given port is currently
-// in use, and if so, advertises the specified service as present on that port.
-// This is useful for advertising existing real services (Personal Web Sharing, Personal
-// File Sharing, etc.) that currently don't register with mDNS Service Discovery themselves.
-mDNSlocal OSStatus CreateProxyRegistrationForRealService(mDNS *m, UInt16 PortAsNumber, const char txtinfo[],
- const char *servicetype, ServiceRecordSet *recordset)
- {
- InetAddress ia;
- TBind bindReq;
- OSStatus err;
- TEndpointInfo endpointinfo;
- EndpointRef ep = OTOpenEndpoint(OTCreateConfiguration(kTCPName), 0, &endpointinfo, &err);
- if (!ep || err) { printf("OTOpenEndpoint (CreateProxyRegistrationForRealService) failed %d", err); return(err); }
-
- ia.fAddressType = AF_INET;
- ia.fPort = mDNSOpaque16fromIntVal(PortAsNumber).NotAnInteger;
- ia.fHost = 0;
- bindReq.addr.maxlen = sizeof(ia);
- bindReq.addr.len = sizeof(ia);
- bindReq.addr.buf = (UInt8*)&ia;
- bindReq.qlen = 0;
- err = OTBind(ep, &bindReq, NULL);
-
- if (err == kOTBadAddressErr)
- RegisterService(m, recordset, PortAsNumber, txtinfo, &m->nicelabel, servicetype, "local.");
- else if (err)
- debugf("OTBind failed %d", err);
-
- OTCloseProvider(ep);
- return(noErr);
- }
-
-// Done once on startup, and then again every time our address changes
-mDNSlocal OSStatus mDNSResponderTestSetup(mDNS *m)
- {
- char buffer[MAX_ESCAPED_DOMAIN_NAME];
- mDNSv4Addr ip = m->HostInterfaces->ip.ip.v4;
-
- ConvertDomainNameToCString(&m->MulticastHostname, buffer);
- printf("Name %s\n", buffer);
- printf("IP %d.%d.%d.%d\n", ip.b[0], ip.b[1], ip.b[2], ip.b[3]);
-
- printf("\n");
- printf("Registering Service Records\n");
- // Create example printer discovery records
- //static ServiceRecordSet p1, p2;
-
-#define SRSET 0
-#if SRSET==0
- RegisterFakeServiceForTesting(m, &p1, "path=/index.html", "Web Server One", "_http._tcp.", "local.");
- RegisterFakeServiceForTesting(m, &p2, "path=/path.html", "Web Server Two", "_http._tcp.", "local.");
-#elif SRSET==1
- RegisterFakeServiceForTesting(m, &p1, "rn=lpq1", "Epson Stylus 900N", "_printer._tcp.", "local.");
- RegisterFakeServiceForTesting(m, &p2, "rn=lpq2", "HP LaserJet", "_printer._tcp.", "local.");
-#else
- RegisterFakeServiceForTesting(m, &p1, "rn=lpq3", "My Printer", "_printer._tcp.", "local.");
- RegisterFakeServiceForTesting(m, &p2, "lrn=pq4", "My Other Printer", "_printer._tcp.", "local.");
-#endif
-
- // If AFP Server is running, register a record for it
- CreateProxyRegistrationForRealService(m, 548, "", "_afpovertcp._tcp.", &afp);
-
- // If Web Server is running, register a record for it
- CreateProxyRegistrationForRealService(m, 80, "", "_http._tcp.", &http);
-
- // And pretend we always have an NJP server running on port 80 too
- //RegisterService(m, &njp, 80, "NJP/", &m->nicelabel, "_njp._tcp.", "local.");
-
- // Advertise that apple.com. is available for browsing
- mDNS_AdvertiseDomains(m, &browsedomain1, mDNS_DomainTypeBrowse, mDNSInterface_Any, "apple.com.");
- mDNS_AdvertiseDomains(m, &browsedomain2, mDNS_DomainTypeBrowse, mDNSInterface_Any, "IL 2\\4th Floor.apple.com.");
-
- return(kOTNoError);
- }
-
-// YieldSomeTime() just cooperatively yields some time to other processes running on classic Mac OS
-mDNSlocal Boolean YieldSomeTime(UInt32 milliseconds)
- {
- extern Boolean SIOUXQuitting;
- EventRecord e;
- WaitNextEvent(everyEvent, &e, milliseconds / 17, NULL);
- SIOUXHandleOneEvent(&e);
- return(SIOUXQuitting);
- }
-
-int main()
- {
- mStatus err;
- Boolean DoneSetup = false;
-
- SIOUXSettings.asktosaveonclose = false;
- SIOUXSettings.userwindowtitle = "\pMulticast DNS Responder";
-
- printf("Multicast DNS Responder\n\n");
- printf("This software reports errors using MacsBug breaks,\n");
- printf("so if you don't have MacsBug installed your Mac may crash.\n\n");
- printf("******************************************************************************\n");
-
- err = InitOpenTransport();
- if (err) { debugf("InitOpenTransport failed %d", err); return(err); }
-
- err = mDNS_Init(&m, &p, mDNS_Init_NoCache, mDNS_Init_ZeroCacheSize,
- mDNS_Init_AdvertiseLocalAddresses, mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext);
- if (err) return(err);
-
- while (!YieldSomeTime(35))
- {
-#if MDNS_ONLYSYSTEMTASK
- // For debugging, use "#define MDNS_ONLYSYSTEMTASK 1" and call mDNSPlatformIdle() periodically.
- // For shipping code, don't define MDNS_ONLYSYSTEMTASK, and you don't need to call mDNSPlatformIdle()
- extern void mDNSPlatformIdle(mDNS *const m);
- mDNSPlatformIdle(&m); // Only needed for debugging version
-#endif
- if (m.mDNSPlatformStatus == mStatus_NoError && !DoneSetup)
- {
- DoneSetup = true;
- printf("\nListening for mDNS queries...\n");
- mDNSResponderTestSetup(&m);
- }
- }
-
- if (p1.RR_SRV.resrec.RecordType ) mDNS_DeregisterService(&m, &p1);
- if (p2.RR_SRV.resrec.RecordType ) mDNS_DeregisterService(&m, &p2);
- if (afp.RR_SRV.resrec.RecordType ) mDNS_DeregisterService(&m, &afp);
- if (http.RR_SRV.resrec.RecordType) mDNS_DeregisterService(&m, &http);
- if (njp.RR_SRV.resrec.RecordType ) mDNS_DeregisterService(&m, &njp);
-
- mDNS_Close(&m);
-
- return(0);
- }
diff --git a/mDNSResponder/mDNSMacOS9/Mac OS Test Searcher.c b/mDNSResponder/mDNSMacOS9/Mac OS Test Searcher.c
deleted file mode 100644
index 1de64631..00000000
--- a/mDNSResponder/mDNSMacOS9/Mac OS Test Searcher.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h> // For printf()
-#include <Events.h> // For WaitNextEvent()
-#include <SIOUX.h> // For SIOUXHandleOneEvent()
-
-#include "mDNSEmbeddedAPI.h" // Defines the interface to the client layer above
-#include "mDNSMacOS9.h" // Defines the specific types needed to run mDNS on this platform
-
-typedef struct
- {
- OTLIFO serviceinfolist;
- Boolean headerPrinted;
- Boolean lostRecords;
- } SearcherServices;
-
-typedef struct { ServiceInfo i; mDNSBool add; mDNSBool dom; OTLink link; } linkedServiceInfo;
-
-// These don't have to be globals, but their memory does need to remain valid for as
-// long as the search is going on. They are declared as globals here for simplicity.
-#define RR_CACHE_SIZE 1000
-static CacheEntity rrcachestorage[RR_CACHE_SIZE];
-static mDNS mDNSStorage;
-static mDNS_PlatformSupport PlatformSupportStorage;
-static SearcherServices services;
-static DNSQuestion browsequestion, domainquestion;
-
-// PrintServiceInfo prints the service information to standard out
-// A real application might want to do something else with the information
-static void PrintServiceInfo(SearcherServices *services)
- {
- OTLink *link = OTReverseList(OTLIFOStealList(&services->serviceinfolist));
-
- while (link)
- {
- linkedServiceInfo *ls = OTGetLinkObject(link, linkedServiceInfo, link);
- ServiceInfo *s = &ls->i;
-
- if (!services->headerPrinted)
- {
- printf("%-55s Type Domain IP Address Port Info\n", "Name");
- services->headerPrinted = true;
- }
-
- if (ls->dom)
- {
- char c_dom[MAX_ESCAPED_DOMAIN_NAME];
- ConvertDomainNameToCString(&s->name, c_dom);
- if (ls->add) printf("%-55s available for browsing\n", c_dom);
- else printf("%-55s no longer available for browsing\n", c_dom);
- }
- else
- {
- domainlabel name;
- domainname type, domain;
- char c_name[MAX_DOMAIN_LABEL+1], c_type[MAX_ESCAPED_DOMAIN_NAME], c_dom[MAX_ESCAPED_DOMAIN_NAME], c_ip[20];
- DeconstructServiceName(&s->name, &name, &type, &domain);
- ConvertDomainLabelToCString_unescaped(&name, c_name);
- ConvertDomainNameToCString(&type, c_type);
- ConvertDomainNameToCString(&domain, c_dom);
- sprintf(c_ip, "%d.%d.%d.%d", s->ip.ip.v4.b[0], s->ip.ip.v4.b[1], s->ip.ip.v4.b[2], s->ip.ip.v4.b[3]);
-
- printf("%-55s %-16s %-14s ", c_name, c_type, c_dom);
- if (ls->add) printf("%-15s %5d %#s\n", c_ip, mDNSVal16(s->port), s->TXTinfo);
- else printf("Removed\n");
- }
-
- link = link->fNext;
- OTFreeMem(ls);
- }
- }
-
-// When the name, address, port, and txtinfo for a service is found, FoundInstanceInfo()
-// enqueues a record for PrintServiceInfo() to print.
-// Note, a browsing application would *not* normally need to get all this information --
-// all it needs is the name, to display to the user.
-// Finding out the address, port, and txtinfo should be deferred to the time that the user
-// actually needs to contact the service to use it.
-static void FoundInstanceInfo(mDNS *const m, ServiceInfoQuery *query)
- {
- SearcherServices *services = (SearcherServices *)query->ServiceInfoQueryContext;
- linkedServiceInfo *info = (linkedServiceInfo *)(query->info);
- if (query->info->ip.type == mDNSAddrType_IPv4)
- {
- mDNS_StopResolveService(m, query); // For this test code, one answer is sufficient
- OTLIFOEnqueue(&services->serviceinfolist, &info->link);
- OTFreeMem(query);
- }
- }
-
-// When a new named instance of a service is found, FoundInstance() is called.
-// In this sample code we turn around and immediately issue a query to resolve that service name to
-// find its address, port, and txtinfo, but a normal browing application would just display the name.
-static void FoundInstance(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
- {
- #pragma unused (question)
- SearcherServices *services = (SearcherServices *)question->QuestionContext;
- linkedServiceInfo *info;
-
- debugf("FoundInstance %##s PTR %##s", answer->name->c, answer->rdata->u.name.c);
-
- if (answer->rrtype != kDNSType_PTR) return;
- if (!services) { debugf("FoundInstance: services is NULL"); return; }
-
- info = (linkedServiceInfo *)OTAllocMem(sizeof(linkedServiceInfo));
- if (!info) { services->lostRecords = true; return; }
-
- info->i.name = answer->rdata->u.name;
- info->i.InterfaceID = answer->InterfaceID;
- info->i.ip.type = mDNSAddrType_IPv4;
- info->i.ip.ip.v4 = zerov4Addr;
- info->i.port = zeroIPPort;
- info->add = AddRecord;
- info->dom = mDNSfalse;
-
- if (!AddRecord) // If TTL == 0 we're deleting a service,
- OTLIFOEnqueue(&services->serviceinfolist, &info->link);
- else // else we're adding a new service
- {
- ServiceInfoQuery *q = (ServiceInfoQuery *)OTAllocMem(sizeof(ServiceInfoQuery));
- if (!q) { OTFreeMem(info); services->lostRecords = true; return; }
- mDNS_StartResolveService(m, q, &info->i, FoundInstanceInfo, services);
- }
- }
-
-static void FoundDomain(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
- {
- #pragma unused (m)
- #pragma unused (question)
- SearcherServices *services = (SearcherServices *)question->QuestionContext;
- linkedServiceInfo *info;
-
- debugf("FoundDomain %##s PTR %##s", answer->name->c, answer->rdata->u.name.c);
-
- if (answer->rrtype != kDNSType_PTR) return;
- if (!services) { debugf("FoundDomain: services is NULL"); return; }
-
- info = (linkedServiceInfo *)OTAllocMem(sizeof(linkedServiceInfo));
- if (!info) { services->lostRecords = true; return; }
-
- info->i.name = answer->rdata->u.name;
- info->i.InterfaceID = answer->InterfaceID;
- info->i.ip.type = mDNSAddrType_IPv4;
- info->i.ip.ip.v4 = zerov4Addr;
- info->i.port = zeroIPPort;
- info->add = AddRecord;
- info->dom = mDNStrue;
-
- OTLIFOEnqueue(&services->serviceinfolist, &info->link);
- }
-
-// YieldSomeTime() just cooperatively yields some time to other processes running on classic Mac OS
-static Boolean YieldSomeTime(UInt32 milliseconds)
- {
- extern Boolean SIOUXQuitting;
- EventRecord e;
- WaitNextEvent(everyEvent, &e, milliseconds / 17, NULL);
- SIOUXHandleOneEvent(&e);
- return(SIOUXQuitting);
- }
-
-int main()
- {
- mStatus err;
- Boolean DoneSetup = false;
- void *tempmem;
-
- SIOUXSettings.asktosaveonclose = false;
- SIOUXSettings.userwindowtitle = "\pMulticast DNS Searcher";
- SIOUXSettings.rows = 40;
- SIOUXSettings.columns = 132;
-
- printf("Multicast DNS Searcher\n\n");
- printf("This software reports errors using MacsBug breaks,\n");
- printf("so if you don't have MacsBug installed your Mac may crash.\n\n");
- printf("******************************************************************************\n");
-
- err = InitOpenTransport();
- if (err) { debugf("InitOpenTransport failed %d", err); return(err); }
-
- err = mDNS_Init(&mDNSStorage, &PlatformSupportStorage, rrcachestorage, RR_CACHE_SIZE,
- mDNS_Init_DontAdvertiseLocalAddresses, mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext);
- if (err) return(err);
-
- // Make sure OT has a large enough memory pool for us to draw from at OTNotifier (interrupt) time
- tempmem = OTAllocMem(0x10000);
- if (tempmem) OTFreeMem(tempmem);
- else printf("**** Warning: OTAllocMem couldn't pre-allocate 64K for us.\n");
-
- services.serviceinfolist.fHead = NULL;
- services.headerPrinted = false;
- services.lostRecords = false;
-
- while (!YieldSomeTime(35))
- {
-#if MDNS_ONLYSYSTEMTASK
- // For debugging, use "#define MDNS_ONLYSYSTEMTASK 1" and call mDNSPlatformIdle() periodically.
- // For shipping code, don't define MDNS_ONLYSYSTEMTASK, and you don't need to call mDNSPlatformIdle()
- extern void mDNSPlatformIdle(mDNS *const m);
- mDNSPlatformIdle(&mDNSStorage); // Only needed for debugging version
-#endif
- if (mDNSStorage.mDNSPlatformStatus == mStatus_NoError && !DoneSetup)
- {
- domainname srvtype, srvdom;
- DoneSetup = true;
- printf("\nSending mDNS service lookup queries and waiting for responses...\n\n");
- MakeDomainNameFromDNSNameString(&srvtype, "_http._tcp.");
- MakeDomainNameFromDNSNameString(&srvdom, "local.");
- err = mDNS_StartBrowse(&mDNSStorage, &browsequestion, &srvtype, &srvdom, mDNSInterface_Any, mDNSfalse, FoundInstance, &services);
- if (err) break;
- err = mDNS_GetDomains(&mDNSStorage, &domainquestion, mDNS_DomainTypeBrowse, NULL, mDNSInterface_Any, FoundDomain, &services);
- if (err) break;
- }
-
- if (services.serviceinfolist.fHead)
- PrintServiceInfo(&services);
-
- if (services.lostRecords)
- {
- services.lostRecords = false;
- printf("**** Warning: Out of memory: Records have been missed.\n");
- }
- }
-
- mDNS_StopBrowse(&mDNSStorage, &browsequestion);
- mDNS_Close(&mDNSStorage);
- return(0);
- }
diff --git a/mDNSResponder/mDNSMacOS9/README.txt b/mDNSResponder/mDNSMacOS9/README.txt
deleted file mode 100644
index c30c423a..00000000
--- a/mDNSResponder/mDNSMacOS9/README.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-This directory contains support files for running mDNS on Mac OS 9
-(and Carbon).
-
-mDNS.mcp is a CodeWarrior 8 project file.
-
-mDNSMacOS9.c and mDNSMacOS9.h are the Platform Support files that go below
-mDNS Core.
-
-"Mac OS Test Responder.c" and "Mac OS Test Searcher.c" build an example
-standalone (embedded) mDNS Responder and Searcher, respectively.
-
-"mDNSLibrary.c" builds a CFM Shared Library that goes in the Extensions Folder
-
-The CFM Shared Library inplements the same "/usr/include/dns_sd.h" API
-that exists on OS X, Windows, Linux, etc., one exception:
-
- - You don't need to call DNSServiceRefSockFD() to get a file descriptor,
- and add that file descriptor to your select loop (or equivalent),
- wait for data,
- and then call DNSServiceProcessResult() every time data arrives.
-
- On OS 9, your callback functions are called "by magic" without having
- to do any of this. Of course no magic comes without a price, and
- the magic being used here is an OT Notifier function. Your callback
- functions are called directly from the OT Notifier function that
- received the UDP packet from the wire, which is fast and efficient,
- but it does mean that you're being called at OT Notifier time -- so
- no QuickDraw calls. If you need to allocate memory in your callback
- function, use OTAllocMem(), not NewPtr() or NewHandle(). Typically
- what you'll do in your callback function is just update your program's
- data structures, and leave screen updating and UI to some foreground
- code.
-
-"Searcher.c" and "Responder.c" build sample applications that link with
-this CFM Shared Library in the Extensions Folder. You'll see that if
-you try to run them without first putting the "Multicast DNS & DNS-SD"
-library in the Extensions Folder and restarting, they will report an
-error message.
-
-"Searcher.c" builds a sample application that browses for HTTP servers.
-
-"Responder.c" builds a sample application that advertises some test
-services. By default it advertises a couple of (nonexistent) HTTP servers
-called "Web Server One" and "Web Server Two". In addition, if it finds that
-TCP port 548 is occupied, then it concludes that personal file sharing is
-running, and advertises the existence of an AFP server. Similarly, if it
-finds that TCP port 80 is occupied, then it concludes that personal Web
-sharing is running, advertises the existence of an HTTP server.
diff --git a/mDNSResponder/mDNSMacOS9/Responder.c b/mDNSResponder/mDNSMacOS9/Responder.c
deleted file mode 100644
index 78851a62..00000000
--- a/mDNSResponder/mDNSMacOS9/Responder.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h> // For printf()
-#include <string.h> // For strcpy()
-
-#include <Events.h> // For WaitNextEvent()
-
-#include <OpenTransport.h>
-#include <OpenTptInternet.h>
-
-#include <SIOUX.h> // For SIOUXHandleOneEvent()
-
-#include "dns_sd.h"
-
-typedef union { UInt8 b[2]; UInt16 NotAnInteger; } mDNSOpaque16;
-static UInt16 mDNSVal16(mDNSOpaque16 x) { return((UInt16)(x.b[0]<<8 | x.b[1])); }
-static mDNSOpaque16 mDNSOpaque16fromIntVal(UInt16 v)
-{ mDNSOpaque16 x; x.b[0] = (UInt8)(v >> 8); x.b[1] = (UInt8)(v & 0xFF); return(x); }
-
-typedef struct RegisteredService_struct RegisteredService;
-struct RegisteredService_struct
-{
- RegisteredService *next;
- DNSServiceRef sdRef;
- Boolean gotresult;
- DNSServiceErrorType errorCode;
- char namestr[64];
- char typestr[kDNSServiceMaxDomainName];
- char domstr [kDNSServiceMaxDomainName];
-};
-
-static RegisteredService p1, p2, afp, http, njp;
-static RegisteredService *services = NULL, **nextservice = &services;
-
-static void RegCallback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode,
- const char *name, const char *regtype, const char *domain, void *context)
-{
- RegisteredService *rs = (RegisteredService *)context;
- (void)sdRef; // Unused
- (void)flags; // Unused
- rs->gotresult = true;
- rs->errorCode = errorCode;
- strcpy(rs->namestr, name);
- strcpy(rs->typestr, regtype);
- strcpy(rs->domstr, domain);
-}
-
-static DNSServiceErrorType RegisterService(RegisteredService *rs, mDNSOpaque16 OpaquePort,
- const char name[], const char type[], const char domain[], const char txtinfo[])
-{
- DNSServiceErrorType err;
- unsigned char txtbuffer[257];
- strncpy((char*)txtbuffer+1, txtinfo, 255);
- txtbuffer[256] = 0;
- txtbuffer[0] = (unsigned char)strlen((char*)txtbuffer);
- rs->gotresult = 0;
- rs->errorCode = kDNSServiceErr_NoError;
- err = DNSServiceRegister(&rs->sdRef, /* kDNSServiceFlagsAutoRename*/ 0, 0,
- name, type, domain, NULL, OpaquePort.NotAnInteger, (unsigned short)(1+txtbuffer[0]), txtbuffer, RegCallback, rs);
- if (err)
- printf("RegisterService(%s %s %s) failed %d\n", name, type, domain, err);
- else
- { *nextservice = rs; nextservice = &rs->next; }
- return(err);
-}
-
-// RegisterFakeServiceForTesting() simulates the effect of services being registered on
-// dynamically-allocated port numbers. No real service exists on that port -- this is just for testing.
-static DNSServiceErrorType RegisterFakeServiceForTesting(RegisteredService *rs,
- const char name[], const char type[], const char domain[], const char txtinfo[])
-{
- static UInt16 NextPort = 0xF000;
- return RegisterService(rs, mDNSOpaque16fromIntVal(NextPort++), name, type, domain, txtinfo);
-}
-
-// CreateProxyRegistrationForRealService() checks to see if the given port is currently
-// in use, and if so, advertises the specified service as present on that port.
-// This is useful for advertising existing real services (Personal Web Sharing, Personal
-// File Sharing, etc.) that currently don't register with mDNS Service Discovery themselves.
-static DNSServiceErrorType CreateProxyRegistrationForRealService(RegisteredService *rs,
- const char *servicetype, UInt16 PortAsNumber, const char txtinfo[])
-{
- mDNSOpaque16 OpaquePort = mDNSOpaque16fromIntVal(PortAsNumber);
- InetAddress ia;
- TBind bindReq;
- OSStatus err;
- TEndpointInfo endpointinfo;
- EndpointRef ep = OTOpenEndpoint(OTCreateConfiguration(kTCPName), 0, &endpointinfo, &err);
- if (!ep || err) { printf("OTOpenEndpoint (CreateProxyRegistrationForRealService) failed %d", err); return(err); }
-
- ia.fAddressType = AF_INET;
- ia.fPort = OpaquePort.NotAnInteger;
- ia.fHost = 0;
- bindReq.addr.maxlen = sizeof(ia);
- bindReq.addr.len = sizeof(ia);
- bindReq.addr.buf = (UInt8*)&ia;
- bindReq.qlen = 0;
- err = OTBind(ep, &bindReq, NULL);
-
- if (err == kOTBadAddressErr)
- err = RegisterService(rs, OpaquePort, "", servicetype, "local.", txtinfo);
- else if (err)
- printf("OTBind failed %d", err);
-
- OTCloseProvider(ep);
- return(err);
-}
-
-// YieldSomeTime() just cooperatively yields some time to other processes running on classic Mac OS
-static Boolean YieldSomeTime(UInt32 milliseconds)
-{
- extern Boolean SIOUXQuitting;
- EventRecord e;
- WaitNextEvent(everyEvent, &e, milliseconds / 17, NULL);
- SIOUXHandleOneEvent(&e);
- return(SIOUXQuitting);
-}
-
-int main()
-{
- OSStatus err;
- RegisteredService *s;
-
- SIOUXSettings.asktosaveonclose = false;
- SIOUXSettings.userwindowtitle = "\pMulticast DNS Responder";
-
- printf("Multicast DNS Responder\n\n");
- printf("This software reports errors using MacsBug breaks,\n");
- printf("so if you don't have MacsBug installed your Mac may crash.\n\n");
- printf("******************************************************************************\n\n");
-
- err = InitOpenTransport();
- if (err) { printf("InitOpenTransport failed %d", err); return(err); }
-
- printf("Advertising Services...\n");
-
-#define SRSET 0
-#if SRSET==0
- RegisterFakeServiceForTesting(&p1, "Web Server One", "_http._tcp.", "local.", "path=/index.html");
- RegisterFakeServiceForTesting(&p2, "Web Server Two", "_http._tcp.", "local.", "path=/path.html");
-#elif SRSET==1
- RegisterFakeServiceForTesting(&p1, "Epson Stylus 900N", "_printer._tcp.", "local.", "rn=lpq1");
- RegisterFakeServiceForTesting(&p2, "HP LaserJet", "_printer._tcp.", "local.", "rn=lpq2");
-#else
- RegisterFakeServiceForTesting(&p1, "My Printer", "_printer._tcp.", "local.", "rn=lpq3");
- RegisterFakeServiceForTesting(&p2, "My Other Printer", "_printer._tcp.", "local.", "lrn=pq4");
-#endif
-
- // If AFP Server is running, register a record for it
- CreateProxyRegistrationForRealService(&afp, "_afpovertcp._tcp.", 548, "");
-
- // If Web Server is running, register a record for it
- CreateProxyRegistrationForRealService(&http, "_http._tcp.", 80, "path=/index.html");
-
- while (!YieldSomeTime(35))
- for (s = services; s; s = s->next)
- if (s->gotresult)
- {
- printf("%s %s %s registered\n", s->namestr, s->typestr, s->domstr);
- s->gotresult = false;
- }
-
- for (s = services; s; s = s->next)
- if (s->sdRef) DNSServiceRefDeallocate(s->sdRef);
-
- CloseOpenTransport();
- return(0);
-}
diff --git a/mDNSResponder/mDNSMacOS9/Searcher.c b/mDNSResponder/mDNSMacOS9/Searcher.c
deleted file mode 100644
index a1096839..00000000
--- a/mDNSResponder/mDNSMacOS9/Searcher.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h> // For printf()
-#include <string.h> // For strcpy()
-
-#include <Events.h> // For WaitNextEvent()
-#include <CodeFragments.h> // For SIOkUnresolvedCFragSymbolAddress
-
-#include <SIOUX.h> // For SIOUXHandleOneEvent()
-
-#include <OpenTransport.h>
-#include <OpenTptInternet.h>
-
-#include "dns_sd.h"
-
-#define ns_c_in 1
-#define ns_t_a 1
-
-typedef union { UInt8 b[2]; UInt16 NotAnInteger; } mDNSOpaque16;
-static UInt16 mDNSVal16(mDNSOpaque16 x) { return((UInt16)(x.b[0]<<8 | x.b[1])); }
-static mDNSOpaque16 mDNSOpaque16fromIntVal(UInt16 v)
-{ mDNSOpaque16 x; x.b[0] = (UInt8)(v >> 8); x.b[1] = (UInt8)(v & 0xFF); return(x); }
-
-typedef struct
-{
- OTLIFO serviceinfolist;
- Boolean headerPrinted;
- Boolean lostRecords;
-} SearcherServices;
-
-typedef struct
-{
- SearcherServices *services;
- char name[kDNSServiceMaxDomainName];
- char type[kDNSServiceMaxDomainName];
- char domn[kDNSServiceMaxDomainName];
- char host[kDNSServiceMaxDomainName];
- char text[kDNSServiceMaxDomainName];
- InetHost address;
- mDNSOpaque16 notAnIntPort;
- DNSServiceRef sdRef;
- Boolean add;
- Boolean dom;
- OTLink link;
-} linkedServiceInfo;
-
-static SearcherServices services;
-
-// PrintServiceInfo prints the service information to standard out
-// A real application might want to do something else with the information
-static void PrintServiceInfo(SearcherServices *services)
-{
- OTLink *link = OTReverseList(OTLIFOStealList(&services->serviceinfolist));
-
- while (link)
- {
- linkedServiceInfo *s = OTGetLinkObject(link, linkedServiceInfo, link);
-
- if (!services->headerPrinted)
- {
- printf("%-55s Type Domain Target Host IP Address Port Info\n", "Name");
- services->headerPrinted = true;
- }
-
- if (s->dom)
- {
- if (s->add) printf("%-55s available for browsing\n", s->domn);
- else printf("%-55s no longer available for browsing\n", s->domn);
- }
- else
- {
- char ip[16];
- unsigned char *p = (unsigned char *)&s->address;
- sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
- printf("%-55s %-16s %-14s ", s->name, s->type, s->domn);
- if (s->add) printf("%-15s %-15s %5d %s\n", s->host, ip, mDNSVal16(s->notAnIntPort), s->text);
- else printf("Removed\n");
- }
-
- link = link->fNext;
- OTFreeMem(s);
- }
-}
-
-static void FoundInstanceAddress(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode,
- const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, void *context)
-{
- linkedServiceInfo *info = (linkedServiceInfo *)context;
- SearcherServices *services = info->services;
- (void)sdRef; // Unused
- (void)interfaceIndex; // Unused
- (void)fullname; // Unused
- (void)ttl; // Unused
- if (errorCode == kDNSServiceErr_NoError)
- if (flags & kDNSServiceFlagsAdd)
- if (rrclass == ns_c_in && rrtype == ns_t_a && rdlen == sizeof(info->address))
- {
- memcpy(&info->address, rdata, sizeof(info->address));
- DNSServiceRefDeallocate(info->sdRef);
- OTLIFOEnqueue(&services->serviceinfolist, &info->link);
- }
-}
-
-static void FoundInstanceInfo(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex,
- DNSServiceErrorType errorCode, const char *fullname, const char *hosttarget, uint16_t notAnIntPort,
- uint16_t txtLen, const unsigned char *txtRecord, void *context)
-{
- linkedServiceInfo *info = (linkedServiceInfo *)context;
- SearcherServices *services = info->services;
- (void)sdRef; // Unused
- (void)flags; // Unused
- (void)interfaceIndex; // Unused
- (void)errorCode; // Unused
- (void)fullname; // Unused
- strcpy(info->host, hosttarget);
- if (txtLen == 0) info->text[0] = 0;
- else
- {
- strncpy(info->text, (char *)txtRecord+1, txtRecord[0]);
- info->text[txtRecord[0]] = 0;
- }
- info->notAnIntPort.NotAnInteger = notAnIntPort;
- DNSServiceRefDeallocate(info->sdRef);
- DNSServiceQueryRecord(&info->sdRef, 0, 0, info->host, ns_t_a, ns_c_in, FoundInstanceAddress, info);
-}
-
-// When a new named instance of a service is found, FoundInstance() is called.
-// In this sample code we turn around and immediately to a DNSServiceResolve() to resolve that service name
-// to find its target host, port, and txtinfo, but a normal browing application would just display the name.
-// Resolving every single thing you find can be quite hard on the network, so you shouldn't do this
-// in a real application. Defer resolving until the client has picked which instance from the
-// long list of services is the one they want to use, and then resolve only that one.
-static void FoundInstance(DNSServiceRef client, DNSServiceFlags flags, uint32_t interface, DNSServiceErrorType errorCode,
- const char *replyName, const char *replyType, const char *replyDomain, void *context)
-{
-#pragma unused(client, interface, errorCode)
- SearcherServices *services = (SearcherServices *)context;
- linkedServiceInfo *info;
-
- if (!services) { DebugStr("\pFoundInstance: services is NULL"); return; }
-
- info = (linkedServiceInfo *)OTAllocMem(sizeof(linkedServiceInfo));
- if (!info) { services->lostRecords = true; return; }
-
- info->services = services;
- strcpy(info->name, replyName);
- strcpy(info->type, replyType);
- strcpy(info->domn, replyDomain);
- info->text[0] = 0;
- info->add = (flags & kDNSServiceFlagsAdd) ? true : false;
- info->dom = false;
-
- if (!info->add) // If TTL == 0 we're deleting a service,
- OTLIFOEnqueue(&services->serviceinfolist, &info->link);
- else // else we're adding a new service
- DNSServiceResolve(&info->sdRef, 0, 0, info->name, info->type, info->domn, FoundInstanceInfo, info);
-}
-
-// YieldSomeTime() just cooperatively yields some time to other processes running on classic Mac OS
-static Boolean YieldSomeTime(UInt32 milliseconds)
-{
- extern Boolean SIOUXQuitting;
- EventRecord e;
- WaitNextEvent(everyEvent, &e, milliseconds / 17, NULL);
- SIOUXHandleOneEvent(&e);
- return(SIOUXQuitting);
-}
-
-int main()
-{
- OSStatus err;
- void *tempmem;
- DNSServiceRef sdRef;
- DNSServiceErrorType dse;
-
- SIOUXSettings.asktosaveonclose = false;
- SIOUXSettings.userwindowtitle = "\pMulticast DNS Searcher";
- SIOUXSettings.rows = 40;
- SIOUXSettings.columns = 160;
-
- printf("DNS-SD Search Client\n\n");
- printf("This software reports errors using MacsBug breaks,\n");
- printf("so if you don't have MacsBug installed your Mac may crash.\n\n");
- printf("******************************************************************************\n\n");
-
- if (DNSServiceBrowse == (void*)kUnresolvedCFragSymbolAddress)
- {
- printf("Before you can use mDNS/DNS-SD clients, you need to place the \n");
- printf("\"Multicast DNS & DNS-SD\" Extension in the Extensions Folder and restart\n");
- return(-1);
- }
-
- err = InitOpenTransport();
- if (err) { printf("InitOpenTransport failed %d", err); return(err); }
-
- // Make sure OT has a large enough memory pool for us to draw from at OTNotifier (interrupt) time
- tempmem = OTAllocMem(0x10000);
- if (tempmem) OTFreeMem(tempmem);
- else printf("**** Warning: OTAllocMem couldn't pre-allocate 64K for us.\n");
-
- services.serviceinfolist.fHead = NULL;
- services.headerPrinted = false;
- services.lostRecords = false;
-
- printf("Sending mDNS service lookup queries and waiting for responses...\n\n");
- dse = DNSServiceBrowse(&sdRef, 0, 0, "_http._tcp", "", FoundInstance, &services);
- if (dse == kDNSServiceErr_NoError)
- {
- while (!YieldSomeTime(35))
- {
- if (services.serviceinfolist.fHead)
- PrintServiceInfo(&services);
-
- if (services.lostRecords)
- {
- services.lostRecords = false;
- printf("**** Warning: Out of memory: Records have been missed.\n");
- }
- }
- }
-
- DNSServiceRefDeallocate(sdRef);
- CloseOpenTransport();
- return(0);
-}
diff --git a/mDNSResponder/mDNSMacOS9/ShowInitIcon.c b/mDNSResponder/mDNSMacOS9/ShowInitIcon.c
deleted file mode 100755
index 15d02216..00000000
--- a/mDNSResponder/mDNSMacOS9/ShowInitIcon.c
+++ /dev/null
@@ -1,160 +0,0 @@
-// ShowInitIcon - version 1.0.1, May 30th, 1995
-// This code is intended to let INIT writers easily display an icon at startup time.
-// View in Geneva 9pt, 4-space tabs
-
-// Written by: Peter N Lewis <peter@mail.peter.com.au>, Jim Walker <JWWalker@aol.com>
-// and François Pottier <pottier@dmi.ens.fr>, with thanks to previous ShowINIT authors.
-// Send comments and bug reports to François Pottier.
-
-// This version features:
-// - Short and readable code.
-// - Correctly wraps around when more than one row of icons has been displayed.
-// - works with System 6
-// - Built with Universal Headers & CodeWarrior. Should work with other headers/compilers.
-
-#include <Memory.h>
-#include <Resources.h>
-#include <Icons.h>
-#include <OSUtils.h>
-#include "ShowInitIcon.h"
-
-// You should set SystemSixOrLater in your headers to avoid including glue for SysEnvirons.
-
-// ---------------------------------------------------------------------------------------------------------------------
-// Set this flag to 1 if you want to compile this file into a stand-alone resource (see note below).
-// Set it to 0 if you want to include this source file into your INIT project.
-
-#if 0
-#define ShowInitIcon main
-#endif
-
-// ---------------------------------------------------------------------------------------------------------------------
-// The ShowINIT mechanism works by having each INIT read/write data from these globals.
-// The MPW C compiler doesn't accept variables declared at an absolute address, so I use these macros instead.
-// Only one macro is defined per variable; there is no need to define a Set and a Get accessor like in <LowMem.h>.
-
-#define LMVCheckSum (*(unsigned short*) 0x928)
-#define LMVCoord (*( short*) 0x92A)
-#define LMHCoord (*( short*) 0x92C)
-#define LMHCheckSum (*(unsigned short*) 0x92E)
-
-// ---------------------------------------------------------------------------------------------------------------------
-// Prototypes for the subroutines. The main routine comes first; this is necessary to make THINK C's "Custom Header" option work.
-
-static unsigned short CheckSum (short x);
-static void ComputeIconRect (Rect* iconRect, Rect* screenBounds);
-static void AdvanceIconPosition (Rect* iconRect);
-static void DrawBWIcon (short iconID, Rect *iconRect);
-
-// ---------------------------------------------------------------------------------------------------------------------
-// Main routine.
-
-typedef struct {
- QDGlobals qd; // Storage for the QuickDraw globals
- long qdGlobalsPtr; // A5 points to this place; it will contain a pointer to qd
-} QDStorage;
-
-pascal void ShowInitIcon (short iconFamilyID, Boolean advance)
-{
- long oldA5; // Original value of register A5
- QDStorage qds; // Fake QD globals
- CGrafPort colorPort;
- GrafPort bwPort;
- Rect destRect;
- SysEnvRec environment; // Machine configuration.
-
- oldA5 = SetA5((long) &qds.qdGlobalsPtr); // Tell A5 to point to the end of the fake QD Globals
- InitGraf(&qds.qd.thePort); // Initialize the fake QD Globals
-
- SysEnvirons(curSysEnvVers, &environment); // Find out what kind of machine this is
-
- ComputeIconRect(&destRect, &qds.qd.screenBits.bounds); // Compute where the icon should be drawn
-
- if (environment.systemVersion >= 0x0700 && environment.hasColorQD) {
- OpenCPort(&colorPort);
- PlotIconID(&destRect, atNone, ttNone, iconFamilyID);
- CloseCPort(&colorPort);
- }
- else {
- OpenPort(&bwPort);
- DrawBWIcon(iconFamilyID, &destRect);
- ClosePort(&bwPort);
- }
-
- if (advance)
- AdvanceIconPosition (&destRect);
-
- SetA5(oldA5); // Restore A5 to its previous value
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-// A checksum is used to make sure that the data in there was left by another ShowINIT-aware INIT.
-
-static unsigned short CheckSum (short x)
-{
- return (unsigned short)(((x << 1) | (x >> 15)) ^ 0x1021);
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-// ComputeIconRect computes where the icon should be displayed.
-
-static void ComputeIconRect (Rect* iconRect, Rect* screenBounds)
-{
- if (CheckSum(LMHCoord) != LMHCheckSum) // If we are first, we need to initialize the shared data.
- LMHCoord = 8;
- if (CheckSum(LMVCoord) != LMVCheckSum)
- LMVCoord = (short)(screenBounds->bottom - 40);
-
- if (LMHCoord + 34 > screenBounds->right) { // Check whether we must wrap
- iconRect->left = 8;
- iconRect->top = (short)(LMVCoord - 40);
- }
- else {
- iconRect->left = LMHCoord;
- iconRect->top = LMVCoord;
- }
- iconRect->right = (short)(iconRect->left + 32);
- iconRect->bottom = (short)(iconRect->top + 32);
-}
-
-// AdvanceIconPosition updates the shared global variables so that the next extension will draw its icon beside ours.
-
-static void AdvanceIconPosition (Rect* iconRect)
-{
- LMHCoord = (short)(iconRect->left + 40); // Update the shared data
- LMVCoord = iconRect->top;
- LMHCheckSum = CheckSum(LMHCoord);
- LMVCheckSum = CheckSum(LMVCoord);
-}
-
-// DrawBWIcon draws the 'ICN#' member of the icon family. It works under System 6.
-
-static void DrawBWIcon (short iconID, Rect *iconRect)
-{
- Handle icon;
- BitMap source, destination;
- GrafPtr port;
-
- icon = Get1Resource('ICN#', iconID);
- if (icon != NULL) {
- HLock(icon);
- // Prepare the source and destination bitmaps.
- source.baseAddr = *icon + 128; // Mask address.
- source.rowBytes = 4;
- SetRect(&source.bounds, 0, 0, 32, 32);
- GetPort(&port);
- destination = port->portBits;
- // Transfer the mask.
- CopyBits(&source, &destination, &source.bounds, iconRect, srcBic, nil);
- // Then the icon.
- source.baseAddr = *icon;
- CopyBits(&source, &destination, &source.bounds, iconRect, srcOr, nil);
- }
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-// Notes
-
-// Checking for PlotIconID:
-// We (PNL) now check for system 7 and colour QD, and use colour graf ports and PlotIconID only if both are true
-// Otherwise we use B&W grafport and draw using PlotBWIcon.
diff --git a/mDNSResponder/mDNSMacOS9/ShowInitIcon.h b/mDNSResponder/mDNSMacOS9/ShowInitIcon.h
deleted file mode 100755
index cbf680c0..00000000
--- a/mDNSResponder/mDNSMacOS9/ShowInitIcon.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __ShowInitIcon__
-#define __ShowInitIcon__
-
-#include <Types.h>
-
-// Usage: pass the ID of your icon family (ICN#/icl4/icl8) to have it drawn in the right spot.
-// If 'advance' is true, the next INIT icon will be drawn to the right of your icon. If it is false, the next INIT icon will overwrite
-// yours. You can use it to create animation effects by calling ShowInitIcon several times with 'advance' set to false.
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-pascal void ShowInitIcon (short iconFamilyID, Boolean advance);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __ShowInitIcon__ */
diff --git a/mDNSResponder/mDNSMacOS9/SubTypeTester.c b/mDNSResponder/mDNSMacOS9/SubTypeTester.c
deleted file mode 100644
index 4845dfb0..00000000
--- a/mDNSResponder/mDNSMacOS9/SubTypeTester.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h> // For printf()
-#include <string.h> // For strlen() etc.
-
-#include <Events.h> // For WaitNextEvent()
-#include <SIOUX.h> // For SIOUXHandleOneEvent()
-
-#include "mDNSEmbeddedAPI.h" // Defines the interface to the client layer above
-
-#include "mDNSMacOS9.h" // Defines the specific types needed to run mDNS on this platform
-
-// These don't have to be globals, but their memory does need to remain valid for as
-// long as the search is going on. They are declared as globals here for simplicity.
-static mDNS m;
-static mDNS_PlatformSupport p;
-static ServiceRecordSet p1, p2;
-static AuthRecord availRec1, availRec2;
-static Boolean availRec2Active;
-
-// This sample code just calls mDNS_RenameAndReregisterService to automatically pick a new
-// unique name for the service. For a device such as a printer, this may be appropriate.
-// For a device with a user interface, and a screen, and a keyboard, the appropriate
-// response may be to prompt the user and ask them to choose a new name for the service.
-mDNSlocal void Callback(mDNS *const m, ServiceRecordSet *const sr, mStatus result)
-{
- switch (result)
- {
- case mStatus_NoError: debugf("Callback: %##s Name Registered", sr->RR_SRV.resrec.name.c); break;
- case mStatus_NameConflict: debugf("Callback: %##s Name Conflict", sr->RR_SRV.resrec.name.c); break;
- case mStatus_MemFree: debugf("Callback: %##s Memory Free", sr->RR_SRV.resrec.name.c); break;
- default: debugf("Callback: %##s Unknown Result %d", sr->RR_SRV.resrec.name.c, result); break;
- }
-
- if (result == mStatus_NameConflict) mDNS_RenameAndReregisterService(m, sr, mDNSNULL);
-}
-
-// RegisterService() is a simple wrapper function which takes C string
-// parameters, converts them to domainname parameters, and calls mDNS_RegisterService()
-mDNSlocal void RegisterService(mDNS *m, ServiceRecordSet *recordset,
- UInt16 PortAsNumber, const char txtinfo[],
- const domainlabel *const n, const char type[], const char domain[])
-{
- domainname t;
- domainname d;
- char buffer[MAX_ESCAPED_DOMAIN_NAME];
- UInt8 txtbuffer[512];
-
- MakeDomainNameFromDNSNameString(&t, type);
- MakeDomainNameFromDNSNameString(&d, domain);
-
- if (txtinfo)
- {
- strncpy((char*)txtbuffer+1, txtinfo, sizeof(txtbuffer)-1);
- txtbuffer[0] = (UInt8)strlen(txtinfo);
- }
- else
- txtbuffer[0] = 0;
-
- mDNS_RegisterService(m, recordset,
- n, &t, &d, // Name, type, domain
- mDNSNULL, mDNSOpaque16fromIntVal(PortAsNumber),
- txtbuffer, (mDNSu16)(1+txtbuffer[0]), // TXT data, length
- mDNSNULL, 0, // Subtypes (none)
- mDNSInterface_Any, // Interface ID
- Callback, mDNSNULL, 0); // Callback, context, flags
-
- ConvertDomainNameToCString(recordset->RR_SRV.resrec.name, buffer);
- printf("Made Service Records for %s\n", buffer);
-}
-
-// RegisterFakeServiceForTesting() simulates the effect of services being registered on
-// dynamically-allocated port numbers. No real service exists on that port -- this is just for testing.
-mDNSlocal void RegisterFakeServiceForTesting(mDNS *m, ServiceRecordSet *recordset, const char txtinfo[],
- const char name[], const char type[], const char domain[])
-{
- static UInt16 NextPort = 0xF000;
- domainlabel n;
- MakeDomainLabelFromLiteralString(&n, name);
- RegisterService(m, recordset, NextPort++, txtinfo, &n, type, domain);
-}
-
-// Done once on startup, and then again every time our address changes
-mDNSlocal OSStatus mDNSResponderTestSetup(mDNS *m)
-{
- char buffer[MAX_ESCAPED_DOMAIN_NAME];
- mDNSv4Addr ip = m->HostInterfaces->ip.ip.v4;
-
- ConvertDomainNameToCString(&m->MulticastHostname, buffer);
- printf("Name %s\n", buffer);
- printf("IP %d.%d.%d.%d\n", ip.b[0], ip.b[1], ip.b[2], ip.b[3]);
-
- printf("\n");
- printf("Registering Service Records\n");
- // Create example printer discovery records
- //static ServiceRecordSet p1, p2;
-
- RegisterFakeServiceForTesting(m, &p1, "", "One", "_raop._tcp.", "local.");
- RegisterFakeServiceForTesting(m, &p2, "", "Two", "_raop._tcp.", "local.");
-
- return(kOTNoError);
-}
-
-mDNSlocal void AvailCallback(mDNS *const m, AuthRecord *const rr, mStatus result)
-{
- Boolean *b = (Boolean *)rr->RecordContext;
- (void)m; // Unused
- // Signal that our record is now free for re-use
- if (result == mStatus_MemFree) *b = false;
-}
-
-mDNSlocal OSStatus mDNSResponderSetAvail(mDNS *m, AuthRecord *rr, ServiceRecordSet *sr)
-{
- // 1. Initialize required fields of AuthRecord
- // 2. Set name of subtype PTR record to our special subtype name denoting "available" instances
- // 3. Set target of subtype PTR record to point to our SRV record (exactly the same as the main service PTR record)
- // 4. And register it
- mDNS_SetupResourceRecord(rr, mDNSNULL, mDNSInterface_Any, kDNSType_PTR, 2*3600, kDNSRecordTypeShared, AvailCallback, &availRec2Active);
- MakeDomainNameFromDNSNameString(rr->resrec.name, "a._sub._raop._tcp.local.");
- AssignDomainName(&rr->resrec.rdata->u.name, sr->RR_SRV.resrec.name);
- return(mDNS_Register(m, rr));
-}
-
-// YieldSomeTime() just cooperatively yields some time to other processes running on classic Mac OS
-mDNSlocal Boolean YieldSomeTime(UInt32 milliseconds)
-{
- extern Boolean SIOUXQuitting;
- EventRecord e;
- WaitNextEvent(everyEvent, &e, milliseconds / 17, NULL);
- SIOUXHandleOneEvent(&e);
- return(SIOUXQuitting);
-}
-
-int main()
-{
- mStatus err;
- Boolean DoneSetup = false;
- mDNSs32 nextAvail, nextBusy;
-
- SIOUXSettings.asktosaveonclose = false;
- SIOUXSettings.userwindowtitle = "\pMulticast DNS Responder";
-
- printf("Multicast DNS Responder\n\n");
- printf("This software reports errors using MacsBug breaks,\n");
- printf("so if you don't have MacsBug installed your Mac may crash.\n\n");
- printf("******************************************************************************\n");
-
- err = InitOpenTransport();
- if (err) { debugf("InitOpenTransport failed %d", err); return(err); }
-
- err = mDNS_Init(&m, &p, mDNS_Init_NoCache, mDNS_Init_ZeroCacheSize,
- mDNS_Init_AdvertiseLocalAddresses, mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext);
- if (err) return(err);
-
- while (!YieldSomeTime(35))
- {
-#if MDNS_ONLYSYSTEMTASK
- // For debugging, use "#define MDNS_ONLYSYSTEMTASK 1" and call mDNSPlatformIdle() periodically.
- // For shipping code, don't define MDNS_ONLYSYSTEMTASK, and you don't need to call mDNSPlatformIdle()
- extern void mDNSPlatformIdle(mDNS *const m);
- mDNSPlatformIdle(&m); // Only needed for debugging version
-#endif
- if (m.mDNSPlatformStatus == mStatus_NoError && !DoneSetup)
- {
- DoneSetup = true;
- printf("\nListening for mDNS queries...\n");
- mDNSResponderTestSetup(&m);
- mDNSResponderSetAvail(&m, &availRec1, &p1);
- availRec2Active = false;
- nextAvail = mDNS_TimeNow(&m) + mDNSPlatformOneSecond * 10;
- nextBusy = mDNS_TimeNow(&m) + mDNSPlatformOneSecond * 15;
- }
-
- if (DoneSetup)
- {
- // We check availRec2.RecordType because we don't want to re-register this record
- // if the previous mDNS_Deregister() has not yet completed
- if (mDNS_TimeNow(&m) - nextAvail > 0 && !availRec2Active)
- {
- printf("Setting Two now available\n");
- availRec2Active = true;
- mDNSResponderSetAvail(&m, &availRec2, &p2);
- nextAvail = nextBusy + mDNSPlatformOneSecond * 10;
- }
- else if (mDNS_TimeNow(&m) - nextBusy > 0)
- {
- printf("Setting Two now busy\n");
- mDNS_Deregister(&m, &availRec2);
- nextBusy = nextAvail + mDNSPlatformOneSecond * 5;
- }
- }
- }
-
- if (p1.RR_SRV.resrec.RecordType) mDNS_DeregisterService(&m, &p1);
- if (p2.RR_SRV.resrec.RecordType) mDNS_DeregisterService(&m, &p2);
- if (availRec1.resrec.RecordType) mDNS_Deregister(&m, &availRec1);
- if (availRec2Active) mDNS_Deregister(&m, &availRec2);
-
- mDNS_Close(&m);
-
- return(0);
-}
diff --git a/mDNSResponder/mDNSMacOS9/mDNS.mcp b/mDNSResponder/mDNSMacOS9/mDNS.mcp
deleted file mode 100644
index 24cdedd7..00000000
--- a/mDNSResponder/mDNSMacOS9/mDNS.mcp
+++ /dev/null
Binary files differ
diff --git a/mDNSResponder/mDNSMacOS9/mDNSLibrary.c b/mDNSResponder/mDNSMacOS9/mDNSLibrary.c
deleted file mode 100644
index 6328395c..00000000
--- a/mDNSResponder/mDNSMacOS9/mDNSLibrary.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Define the required CFM Shared Library entry and exit points
-#include <CodeFragments.h>
-#include "mDNSEmbeddedAPI.h" // Defines the interface to the client layer above
-#include "mDNSMacOS9.h" // Defines the specific types needed to run mDNS on this platform
-
-mDNS mDNSStorage;
-static mDNS_PlatformSupport PlatformSupportStorage;
-// Start off with a default cache of 16K (about 100 records)
-#define RR_CACHE_SIZE ((16*1024) / sizeof(CacheRecord))
-static CacheEntity rrcachestorage[RR_CACHE_SIZE];
-
-mDNSlocal void mDNS_StatusCallback(mDNS *const m, mStatus result)
-{
- if (result == mStatus_GrowCache)
- {
- // Allocate another chunk of cache storage
- CacheEntity *storage = OTAllocMem(sizeof(CacheEntity) * RR_CACHE_SIZE);
- if (storage) mDNS_GrowCache(m, storage, RR_CACHE_SIZE);
- }
-}
-
-extern pascal OSErr mDNS_CFMInit(const CFragInitBlock *theInitBlock);
-pascal OSErr mDNS_CFMInit(const CFragInitBlock *theInitBlock)
-{
- extern pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
- __initialize(theInitBlock); // MUST do this first!
- {
- mStatus err;
- THz oldZone = GetZone();
- SetZone(SystemZone());
- LogMsg("mDNS/DNS-SD with Macsbug breaks -- do not ship this version to customers");
- err = mDNS_Init(&mDNSStorage, &PlatformSupportStorage, rrcachestorage, RR_CACHE_SIZE,
- mDNS_Init_AdvertiseLocalAddresses, mDNS_StatusCallback, mDNS_Init_NoInitCallbackContext);
- SetZone(oldZone);
- return((OSErr)err);
- }
-}
-
-extern void mDNS_CFMTerm(void);
-void mDNS_CFMTerm(void)
-{
- extern pascal void __terminate(void);
- LogMsg("mDNS_CFMTerm");
- mDNS_Close(&mDNSStorage);
- __terminate();
-}
diff --git a/mDNSResponder/mDNSMacOS9/mDNSLibraryLoader.c b/mDNSResponder/mDNSMacOS9/mDNSLibraryLoader.c
deleted file mode 100644
index 584ff9e2..00000000
--- a/mDNSResponder/mDNSMacOS9/mDNSLibraryLoader.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <Resources.h>
-#include <CodeFragments.h>
-#include "ShowInitIcon.h"
-
-extern pascal OSErr FragRegisterFileLibs(ConstFSSpecPtr fss, Boolean unregister);
-
-extern void main(void)
-{
- OSStatus err;
- FCBPBRec fcbPB;
- FSSpec fss;
-
- // 1. Show our "icon march" icon
- ShowInitIcon(128, true);
-
- // 2. Find our FSSpec
- fss.name[0] = 0;
- fcbPB.ioNamePtr = fss.name;
- fcbPB.ioVRefNum = 0;
- fcbPB.ioRefNum = (short)CurResFile();
- fcbPB.ioFCBIndx = 0;
- err = PBGetFCBInfoSync(&fcbPB);
-
- // 3. Tell CFM that we're a CFM library container file
- fss.vRefNum = fcbPB.ioFCBVRefNum;
- fss.parID = fcbPB.ioFCBParID;
- if (err == noErr) err = FragRegisterFileLibs(&fss, false);
-
- // 4. Now that CFM knows we're a library container, tell it to go and get our library
- if (err == noErr)
- {
- CFragConnectionID c;
- Ptr m;
- Str255 e;
- THz oldZone = GetZone();
- SetZone(SystemZone());
- err = GetSharedLibrary("\pDarwin;mDNS", kPowerPCCFragArch, kLoadCFrag, &c, &m, e);
- SetZone(oldZone);
- }
-}
-
-// There's no CFM stub library for the FragRegisterFileLibs() call, so we'll make our own
-#if __ide_target("FragRegisterFileLibsStub")
-#pragma export on
-pascal OSErr FragRegisterFileLibs(ConstFSSpecPtr fss, Boolean unregister)
-{
- (void)fss; // Unused
- (void)unregister; // Unused
- return(0);
-}
-#endif
diff --git a/mDNSResponder/mDNSMacOS9/mDNSLibraryResources.r b/mDNSResponder/mDNSMacOS9/mDNSLibraryResources.r
deleted file mode 100644
index e3a200a0..00000000
--- a/mDNSResponder/mDNSMacOS9/mDNSLibraryResources.r
+++ /dev/null
@@ -1,197 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __TYPES.R__
-#include "Types.r"
-#endif
-
-/* Format is :
- * Two-char BCD major version (0-99)
- * One-char BCD minor version, One-char BCD bugfix version (0-9, 0-9)
- * development/alpha/beta/final
- * One-byte non-final build number (0-255)
- * Version numbers can therefore range from 0.0.0 to 99.9.9,
- * with a following build stage and build number (e.g. 2.0.1 beta 219)
- */
-
-resource 'vers' (1, purgeable)
- {
- 0x01, 0x00, alpha, 130, verUS,
- "1.0a130",
- "Multicast DNS & DNS Service Discovery 1.0a130"
- };
-
-resource 'vers' (2, purgeable)
- {
- 0x01, 0x00, alpha, 130, verUS,
- "1.0a130",
- "developer.apple.com/darwin/projects/bonjour/"
- };
-
-/* We need to load OT, so make sure the system heap has enough space for it */
-type 'sysz' { longint; };
-resource 'sysz' (0, purgeable) { 2500000 };
-
-resource 'BNDL' (128, purgeable, protected) {
- 'mDNS',
- 0,
- { /* array TypeArray: 2 elements */
- /* [1] */
- 'FREF',
- { /* array IDArray: 1 elements */
- /* [1] */
- 0, 128
- },
- /* [2] */
- 'ICN#',
- { /* array IDArray: 1 elements */
- /* [1] */
- 0, 128
- }
- }
-};
-
-resource 'FREF' (128, purgeable, protected) {
- 'INIT',
- 0,
- ""
-};
-
-resource 'icl8' (128, purgeable, protected) {
- $"FDFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
- $"FFFF FFFF FFFF FFFF FFFF FFFF FD00 0000"
- $"FF00 0000 0000 0000 0000 0000 0000 0000"
- $"0000 0000 0000 0000 0000 00F6 FF00 0000"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
- $"F6F6 F6F6 F6F6 F6F6 F6F6 F6F9 FF00 0000"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
- $"F6F6 F6F6 F6F6 F6F6 F6F6 F6F9 FD00 0000"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
- $"F6F6 F6F6 F6F6 F6F6 F6F6 F6F9 FE00 0000"
- $"FF00 F6F6 F6F6 F6F6 F62B 07F6 F6F6 F6F6"
- $"F6F6 F6F6 F6F6 F6F6 F6F6 F6F9 FE00 0000"
- $"FF00 F6F6 F6F6 F6F6 3A16 402B F7F6 F6F6"
- $"F6F6 F656 F9F9 F956 2BF6 F6F9 FE00 0000"
- $"FF00 F6F6 F6F6 2B08 4116 4008 F8FA 2BF6"
- $"F6F7 FAFA FA81 FAFA FAF7 F6F9 FE00 0000"
- $"FF00 F9F6 F62B F92B 163A 172B F881 FAF6"
- $"2BF8 F6F6 2BF7 8181 FA81 F6F9 FE00 FD00"
- $"FF00 FFF9 F6F9 F9F8 2B2C 2BF6 F6F6 F8FA"
- $"2BF6 F6F6 F6F6 F781 F956 F8F9 FEFD FFFD"
- $"FFFF 00FE F5FA FA81 F7F6 F6F6 F6F6 F656"
- $"56F6 F6F6 F6F6 F62B 2B2B F6F9 FEFF 00FF"
- $"0000 00FF F5FA FAFA F6F6 F6F6 F6F6 2BF6"
- $"F7F8 F6F6 F6F6 F607 3A16 39F9 FF00 F9FF"
- $"0000 00FF 00FA 81FA F6F6 F6F6 F62B 2BF6"
- $"F6F8 F6F6 F6F6 F633 1C3B 1CF6 F6F6 F9FF"
- $"0000 00FE 0056 81FA F6F6 F6F6 F6F8 F6F6"
- $"F6F6 F8F6 F6F6 F62C 163A 3AF6 F6F6 F9FF"
- $"0000 00FE 00F6 8181 2BF6 F6F6 F72B F6F6"
- $"F6F6 F62B F6F6 2B2B 2C32 F6F6 F6F6 F9FF"
- $"0000 00FE 00F6 2BFA 81F6 F6F6 F9F6 F6F6"
- $"F6F6 F62B F6F7 FA81 F8F6 F6F6 F6F6 F9FF"
- $"0000 00FE 00F6 F6F6 F7F9 F72B F9F6 F6F6"
- $"F62B F756 F9FA F9F7 F6F6 F6F6 F6F6 F9FF"
- $"0000 00FE 00F6 F6F6 F6F6 F6F9 F82B 2BF7"
- $"F7F7 F72B F8F6 F6F6 F6F6 F6F6 F6F6 F9FF"
- $"0000 00FE 00F6 F6F6 F6F6 F681 2BF6 F6F6"
- $"F6F6 F6F6 F7F6 F6F6 F6F6 F6F6 F6F6 F9FF"
- $"0000 00FE 00F6 F6F6 F6F6 2B81 F7F6 F6F6"
- $"F6F6 F6F6 562B F6F6 F6F6 F6F6 F9F6 F9FF"
- $"0000 00FE 00F6 F6F6 F6F6 F7FB F7F6 F6F6"
- $"F6F6 F6F6 FAF7 F6F6 F6F6 F6F9 FEF9 F9FF"
- $"FFFF 00FE 00F6 F6F6 F6F6 F7F7 2BF6 F6F6"
- $"F6F6 F6F8 81F7 F6F6 F6F6 F6F9 FEFF F9FF"
- $"FF00 FF00 00F6 F6F6 F6F6 F60E 3A16 32F6"
- $"F6F6 56FA 812B F6F6 F6F6 F6F9 FEFD FFFD"
- $"FF00 0000 F6F6 F6F6 F6F6 F640 1640 16F6"
- $"F9F9 FA81 F9F6 F6F6 F6F6 F6F9 FE00 FD00"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F633 173A 332B"
- $"FAFA 8181 2BF6 F6F6 F6F6 F6F9 FE00 0000"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 3232 F6F9"
- $"8181 FA2B F6F6 F6F6 F6F6 F6F9 FE00 0000"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 2BF8"
- $"F82B F6F6 F6F6 F6F6 F6F6 F6F9 FE00 0000"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
- $"F6F6 F6F6 F6F6 F6F6 F6F6 F6F9 FE00 0000"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
- $"F6F6 F6F6 F6F6 F6F6 F6F6 F6F9 FD00 0000"
- $"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
- $"F6F6 F6F6 F6F6 F6F6 F6F6 F6F9 FF00 0000"
- $"FFF6 F9F9 F9F9 F9F9 F9F9 F9F9 F9F9 F9F9"
- $"F9F9 F9F9 F9F9 F9F9 F9F9 F9F9 FF00 0000"
- $"FDFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
- $"FFFF FFFF FFFF FFFF FFFF FFFF FD"
-};
-
-data 'mDNS' (0, "Owner resource") {
- $"0644 6172 7769 6E" /* .Darwin */
-};
-
-resource 'ICN#' (128) {
- { /* array: 2 elements */
- /* [1] */
- $"FFFF FFF8 8000 0008 8000 0008 8000 0008"
- $"8000 0008 80E0 0408 81FC 3F88 83FE 7FC8"
- $"87FF EFEA A7E3 83EF D781 81ED 1F02 C1E9"
- $"1706 61F1 1704 21E1 178C 33C1 13C8 1781"
- $"10F8 FF01 101F F801 1018 0801 1038 0C01"
- $"1038 0C09 D03C 1C0D A01E 7C0F 801F F80A"
- $"801F F808 800F F008 8003 C008 8000 0008"
- $"8000 0008 8000 0008 8000 0008 FFFF FFF8",
- /* [2] */
- $"FFFF FFF8 FFFF FFF8 FFFF FFF8 FFFF FFF8"
- $"FFFF FFF8 FFFF FFF8 FFFF FFF8 FFFF FFF8"
- $"FFFF FFFA FFFF FFFF DFFF FFFF 1FFF FFFF"
- $"1FFF FFFF 1FFF FFFF 1FFF FFFF 1FFF FFFF"
- $"1FFF FFFF 1FFF FFFF 1FFF FFFF 1FFF FFFF"
- $"1FFF FFFF DFFF FFFF FFFF FFFF FFFF FFFA"
- $"FFFF FFF8 FFFF FFF8 FFFF FFF8 FFFF FFF8"
- $"FFFF FFF8 FFFF FFF8 FFFF FFF8 FFFF FFF8"
- }
-};
-
-resource 'ics#' (128, purgeable) {
- { /* array: 2 elements */
- /* [1] */
- $"FFFE 8002 8002 8C02 DE73 D19B 5299 5451"
- $"4C61 47C1 C443 C483 8702 8302 8002 FFFE",
- /* [2] */
- $"FFFE FFFE FFFE FFFE FFFF FFFF 7FFF 7FFF"
- $"7FFF 7FFF FFFF FFFF FFFE FFFE FFFE FFFE"
- }
-};
-
-resource 'ics8' (128) {
- $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FF00"
- $"FFF6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 FD00"
- $"FFF6 F6F6 32F6 F6F6 F6F6 F7F7 F6F6 FF00"
- $"FFF6 F632 2233 81F6 2B56 81AC FBF6 FF00"
- $"FFFE FAF9 2CF6 2BFA 2BF6 F6F8 FAF8 FEFF"
- $"FFFD FCFA F6F6 F62B F8F6 F6F6 3333 FEFF"
- $"00FE 81F9 F6F6 2BF6 F62B F6F6 4040 F6FF"
- $"00FF 2BFB 2BF6 F7F6 F62B F6F9 32F6 F6FF"
- $"00FE F6F6 F7F8 F7F6 2BF8 56F8 F6F6 F6FF"
- $"00FE F6F6 F6FA F6F6 F6F6 F7F6 F6F6 F6FF"
- $"FFFE F6F6 F6FA 2BF6 F6F6 FAF6 F6F6 FEFF"
- $"FFFE F6F6 F632 3AF6 2BF9 81F6 F6F6 FEFF"
- $"FFF6 F6F6 F632 4632 FCAC F7F6 F6F6 FE00"
- $"FFF6 F6F6 F6F6 F6F8 562B F6F6 F6F6 FE00"
- $"FFF6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 FE00"
- $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FF"
-};
-
diff --git a/mDNSResponder/mDNSMacOS9/mDNSMacOS9.c b/mDNSResponder/mDNSMacOS9/mDNSMacOS9.c
deleted file mode 100644
index 24b03f22..00000000
--- a/mDNSResponder/mDNSMacOS9/mDNSMacOS9.c
+++ /dev/null
@@ -1,687 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdarg.h> // For va_list support
-
-#include <LowMem.h> // For LMGetCurApName()
-#include <TextUtils.h> // For smSystemScript
-#include <UnicodeConverter.h> // For ConvertFromPStringToUnicode()
-
-#include "mDNSEmbeddedAPI.h" // Defines the interface provided to the client layer above
-
-#include "mDNSMacOS9.h" // Defines the specific types needed to run mDNS on this platform
-
-// ***************************************************************************
-// Constants
-
-static const TSetBooleanOption kReusePortOption =
-{ kOTBooleanOptionSize, INET_IP, IP_REUSEPORT, 0, true };
-
-// IP_RCVDSTADDR with TSetByteOption/kOTOneByteOptionSize works on OS 9, OS X Classic, and OS 9 Carbon,
-// but gives error #-3151 (kOTBadOptionErr) on OS X Carbon.
-// If we instead use TSetBooleanOption/kOTBooleanOptionSize then OTOptionManagement on OS X Carbon
-// no longer returns -3151 but it still doesn't actually work -- no destination addresses
-// are delivered by OTRcvUData. I think it's just a bug in OS X Carbon.
-static const TSetByteOption kRcvDestAddrOption =
-{ kOTOneByteOptionSize, INET_IP, IP_RCVDSTADDR, 0, true };
-//static const TSetBooleanOption kRcvDestAddrOption =
-// { kOTBooleanOptionSize, INET_IP, IP_RCVDSTADDR, 0, true };
-
-static const TSetByteOption kSetUnicastTTLOption =
-{ kOTOneByteOptionSize, INET_IP, IP_TTL, 0, 255 };
-
-static const TSetByteOption kSetMulticastTTLOption =
-{ kOTOneByteOptionSize, INET_IP, IP_MULTICAST_TTL, 0, 255 };
-
-static const TIPAddMulticastOption kAddLinkMulticastOption =
-{ sizeof(TIPAddMulticastOption), INET_IP, IP_ADD_MEMBERSHIP, 0, { 224, 0, 0,251 }, { 0,0,0,0 } };
-
-//static const TIPAddMulticastOption kAddAdminMulticastOption =
-// { sizeof(TIPAddMulticastOption), INET_IP, IP_ADD_MEMBERSHIP, 0, { 239,255,255,251 }, { 0,0,0,0 } };
-
-// Bind endpoint to port number. Don't specify any specific IP address --
-// we want to receive unicasts on all interfaces, as well as multicasts.
-typedef struct { OTAddressType fAddressType; mDNSIPPort fPort; mDNSv4Addr fHost; UInt8 fUnused[8]; } mDNSInetAddress;
-//static const mDNSInetAddress mDNSPortInetAddress = { AF_INET, { 0,0 }, { 0,0,0,0 } }; // For testing legacy client support
-#define MulticastDNSPortAsNumber 5353
-static const mDNSInetAddress mDNSPortInetAddress = { AF_INET, { MulticastDNSPortAsNumber >> 8, MulticastDNSPortAsNumber & 0xFF }, { 0,0,0,0 } };
-static const TBind mDNSbindReq = { sizeof(mDNSPortInetAddress), sizeof(mDNSPortInetAddress), (UInt8*)&mDNSPortInetAddress, 0 };
-
-static const TNetbuf zeroTNetbuf = { 0 };
-
-// ***************************************************************************
-// Functions
-
-mDNSlocal void SafeDebugStr(unsigned char *buffer)
-{
- int i;
- // Don't want semicolons in MacsBug messages -- they signify commands to execute
- for (i=1; i<= buffer[0]; i++) if (buffer[i] == ';') buffer[i] = '.';
- DebugStr(buffer);
-}
-
-#if MDNS_DEBUGMSGS
-mDNSexport void debugf_(const char *format, ...)
-{
- unsigned char buffer[256];
- va_list ptr;
- va_start(ptr,format);
- buffer[0] = (unsigned char)mDNS_vsnprintf((char*)buffer+1, 255, format, ptr);
- va_end(ptr);
-#if MDNS_ONLYSYSTEMTASK
- buffer[1+buffer[0]] = 0;
- fprintf(stderr, "%s\n", buffer+1);
- fflush(stderr);
-#else
- SafeDebugStr(buffer);
-#endif
-}
-#endif
-
-#if MDNS_BUILDINGSHAREDLIBRARY >= 2
-// When building the non-debug version of the Extension, intended to go on end-user systems, we don't want
-// MacsBug breaks for *anything*, not even for the serious LogMsg messages that on OS X would be written to syslog
-mDNSexport void LogMsg(const char *format, ...) { (void)format; }
-#else
-mDNSexport void LogMsg(const char *format, ...)
-{
- unsigned char buffer[256];
- va_list ptr;
- va_start(ptr,format);
- buffer[0] = (unsigned char)mDNS_vsnprintf((char*)buffer+1, 255, format, ptr);
- va_end(ptr);
-#if MDNS_ONLYSYSTEMTASK
- buffer[1+buffer[0]] = 0;
- fprintf(stderr, "%s\n", buffer+1);
- fflush(stderr);
-#else
- SafeDebugStr(buffer);
-#endif
-}
-#endif
-
-mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const msg, const mDNSu8 *const end,
- mDNSInterfaceID InterfaceID, const mDNSAddr *dst, mDNSIPPort dstPort)
-{
- // Note: If we did multi-homing, we'd have to use the InterfaceID parameter to specify from which interface to send this response
- #pragma unused(InterfaceID)
-
- InetAddress InetDest;
- TUnitData senddata;
-
- if (dst->type != mDNSAddrType_IPv4) return(mStatus_NoError);
-
- InetDest.fAddressType = AF_INET;
- InetDest.fPort = dstPort.NotAnInteger;
- InetDest.fHost = dst->ip.v4.NotAnInteger;
-
- senddata.addr.maxlen = sizeof(InetDest);
- senddata.addr.len = sizeof(InetDest);
- senddata.addr.buf = (UInt8*)&InetDest;
- senddata.opt = zeroTNetbuf;
- senddata.udata.maxlen = (UInt32)((UInt8*)end - (UInt8*)msg);
- senddata.udata.len = (UInt32)((UInt8*)end - (UInt8*)msg);
- senddata.udata.buf = (UInt8*)msg;
-
- return(OTSndUData(m->p->ep, &senddata));
-}
-
-mDNSlocal OSStatus readpacket(mDNS *m)
-{
- mDNSAddr senderaddr, destaddr;
- mDNSInterfaceID interface;
- mDNSIPPort senderport;
- InetAddress sender;
- char options[256];
- DNSMessage packet;
- TUnitData recvdata;
- OTFlags flags = 0;
- OSStatus err;
-
- recvdata.addr.maxlen = sizeof(sender);
- recvdata.addr.len = 0;
- recvdata.addr.buf = (UInt8*)&sender;
- recvdata.opt.maxlen = sizeof(options);
- recvdata.opt.len = 0;
- recvdata.opt.buf = (UInt8*)&options;
- recvdata.udata.maxlen = sizeof(packet);
- recvdata.udata.len = 0;
- recvdata.udata.buf = (UInt8*)&packet;
-
- err = OTRcvUData(m->p->ep, &recvdata, &flags);
- if (err && err != kOTNoDataErr) debugf("OTRcvUData error %d", err);
-
- if (err) return(err);
-
- senderaddr.type = mDNSAddrType_IPv4;
- senderaddr.ip.v4.NotAnInteger = sender.fHost;
- senderport.NotAnInteger = sender.fPort;
-
- destaddr.type = mDNSAddrType_IPv4;
- destaddr.ip.v4 = zerov4Addr;
-
- #if OTCARBONAPPLICATION
- // IP_RCVDSTADDR is known to fail on OS X Carbon, so we'll just assume the packet was probably multicast
- destaddr.ip.v4 = AllDNSLinkGroup_v4.ip.v4;
- #endif
-
- if (recvdata.opt.len)
- {
- TOption *c = nil;
- while (1)
- {
- err = OTNextOption(recvdata.opt.buf, recvdata.opt.len, &c);
- if (err || !c) break;
- if (c->level == INET_IP && c->name == IP_RCVDSTADDR && c->len - kOTOptionHeaderSize == sizeof(destaddr.ip.v4))
- mDNSPlatformMemCopy(&destaddr.ip.v4, c->value, sizeof(destaddr.ip.v4));
- }
- }
-
- interface = m->HostInterfaces->InterfaceID;
-
- if (flags & T_MORE) debugf("ERROR: OTRcvUData() buffer too small (T_MORE set)");
- else if (recvdata.addr.len < sizeof(InetAddress)) debugf("ERROR: recvdata.addr.len (%d) too short", recvdata.addr.len);
- else mDNSCoreReceive(m, &packet, recvdata.udata.buf + recvdata.udata.len, &senderaddr, senderport, &destaddr, MulticastDNSPort, interface);
-
- return(err);
-}
-
-mDNSexport TCPSocket *mDNSPlatformTCPSocket(mDNS * const m, TCPSocketFlags flags, mDNSIPPort * port)
-{
- (void)m; // Unused
- (void)flags; // Unused
- (void)port; // Unused
- return NULL;
-}
-
-mDNSexport TCPSocket *mDNSPlatformTCPAccept(TCPSocketFlags flags, int sd)
-{
- (void)flags; // Unused
- (void)sd; // Unused
- return NULL;
-}
-
-mDNSexport int mDNSPlatformTCPGetFD(TCPSocket *sock)
-{
- (void)sock; // Unused
- return -1;
-}
-
-mDNSexport mStatus mDNSPlatformTCPConnect(TCPSocket *sock, const mDNSAddr * dst, mDNSOpaque16 dstport, mDNSInterfaceID InterfaceID,
- TCPConnectionCallback callback, void * context)
-{
- (void)sock; // Unused
- (void)dst; // Unused
- (void)dstport; // Unused
- (void)InterfaceID; // Unused
- (void)callback; // Unused
- (void)context; // Unused
- return(mStatus_UnsupportedErr);
-}
-
-mDNSexport void mDNSPlatformTCPCloseConnection(TCPSocket *sd)
-{
- (void)sd; // Unused
-}
-
-mDNSexport long mDNSPlatformReadTCP(TCPSocket *sock, void *buf, unsigned long buflen, mDNSBool *closed)
-{
- (void)sock; // Unused
- (void)buf; // Unused
- (void)buflen; // Unused
- (void)closed; // Unused
- return(0);
-}
-
-mDNSexport long mDNSPlatformWriteTCP(TCPSocket *sock, const char *msg, unsigned long len)
-{
- (void)sock; // Unused
- (void)msg; // Unused
- (void)len; // Unused
- return(0);
-}
-
-mDNSexport UDPSocket *mDNSPlatformUDPSocket(mDNS * const m, mDNSIPPort port)
-{
- (void)m; // Unused
- (void)port; // Unused
- return NULL;
-}
-
-mDNSexport void mDNSPlatformUDPClose(UDPSocket *sock)
-{
- (void)sock; // Unused
-}
-
-mDNSlocal void mDNSOptionManagement(mDNS *const m)
-{
- OSStatus err;
-
- // Make sure the length in the TNetbuf agrees with the length in the TOptionHeader
- m->p->optReq.opt.len = m->p->optBlock.h.len;
- m->p->optReq.opt.maxlen = m->p->optBlock.h.len;
- if (m->p->optReq.opt.maxlen < 4)
- m->p->optReq.opt.maxlen = 4;
-
- err = OTOptionManagement(m->p->ep, &m->p->optReq, NULL);
- if (err) LogMsg("OTOptionManagement failed %d", err);
-}
-
-mDNSlocal void mDNSinitComplete(mDNS *const m, mStatus result)
-{
- m->mDNSPlatformStatus = result;
- mDNSCoreInitComplete(m, mStatus_NoError);
-}
-
-mDNSlocal pascal void mDNSNotifier(void *contextPtr, OTEventCode code, OTResult result, void *cookie)
-{
- mDNS *const m = (mDNS *const)contextPtr;
- if (!m) debugf("mDNSNotifier FATAL ERROR! No context");
- switch (code)
- {
- case T_OPENCOMPLETE:
- {
- OSStatus err;
- InetInterfaceInfo interfaceinfo;
- if (result) { LogMsg("T_OPENCOMPLETE failed %d", result); mDNSinitComplete(m, result); return; }
- //debugf("T_OPENCOMPLETE");
- m->p->ep = (EndpointRef)cookie;
- //debugf("OTInetGetInterfaceInfo");
- // (In future may want to loop over all interfaces instead of just using kDefaultInetInterface)
- err = OTInetGetInterfaceInfo(&interfaceinfo, kDefaultInetInterface);
- if (err) { LogMsg("OTInetGetInterfaceInfo failed %d", err); mDNSinitComplete(m, err); return; }
-
- // Make our basic standard host resource records (address, PTR, etc.)
- m->p->interface.InterfaceID = (mDNSInterfaceID)&m->p->interface;
- m->p->interface.ip.type = mDNSAddrType_IPv4;
- m->p->interface.ip.ip.v4.NotAnInteger = interfaceinfo.fAddress;
- m->p->interface.mask.type = mDNSAddrType_IPv4;
- m->p->interface.mask.ip.v4.NotAnInteger = interfaceinfo.fNetmask;
- m->p->interface.ifname[0] = 0;
- m->p->interface.Advertise = m->AdvertiseLocalAddresses;
- m->p->interface.McastTxRx = mDNStrue;
- }
-
- case T_OPTMGMTCOMPLETE:
- case T_BINDCOMPLETE:
- // IP_RCVDSTADDR is known to fail on OS X Carbon, so we don't want to abort for that error
- // (see comment above at the definition of kRcvDestAddrOption)
- #if OTCARBONAPPLICATION
- if (result && m->p->mOTstate == mOT_RcvDestAddr)
- LogMsg("Carbon IP_RCVDSTADDR option failed %d; continuing anyway", result);
- else
- #endif
- if (result) { LogMsg("T_OPTMGMTCOMPLETE/T_BINDCOMPLETE %d failed %d", m->p->mOTstate, result); mDNSinitComplete(m, result); return; }
- //LogMsg("T_OPTMGMTCOMPLETE/T_BINDCOMPLETE %d", m->p->mOTstate);
- switch (++m->p->mOTstate)
- {
- case mOT_ReusePort: m->p->optBlock.b = kReusePortOption; mDNSOptionManagement(m); break;
- case mOT_RcvDestAddr: m->p->optBlock.i = kRcvDestAddrOption; mDNSOptionManagement(m); break;
- case mOT_SetUTTL: m->p->optBlock.i = kSetUnicastTTLOption; mDNSOptionManagement(m); break;
- case mOT_SetMTTL: m->p->optBlock.i = kSetMulticastTTLOption; mDNSOptionManagement(m); break;
- case mOT_LLScope: m->p->optBlock.m = kAddLinkMulticastOption; mDNSOptionManagement(m); break;
-// case mOT_AdminScope: m->p->optBlock.m = kAddAdminMulticastOption; mDNSOptionManagement(m); break;
- case mOT_Bind: OTBind(m->p->ep, (TBind*)&mDNSbindReq, NULL); break;
- case mOT_Ready: mDNSinitComplete(m, mStatus_NoError);
- // Can't do mDNS_RegisterInterface until *after* mDNSinitComplete has set m->mDNSPlatformStatus to mStatus_NoError
- mDNS_RegisterInterface(m, &m->p->interface, mDNSfalse);
- break;
- default: LogMsg("Unexpected m->p->mOTstate %d", m->p->mOTstate-1);
- }
- break;
-
- case T_DATA:
- //debugf("T_DATA");
- while (readpacket(m) == kOTNoError) continue; // Read packets until we run out
- break;
-
- case kOTProviderWillClose: LogMsg("kOTProviderWillClose"); break;
- case kOTProviderIsClosed: // Machine is going to sleep, shutting down, or reconfiguring IP
- LogMsg("kOTProviderIsClosed");
- if (m->p->mOTstate == mOT_Ready)
- {
- m->p->mOTstate = mOT_Closed;
- mDNS_DeregisterInterface(m, &m->p->interface, mDNSfalse);
- }
- if (m->p->ep) { OTCloseProvider(m->p->ep); m->p->ep = NULL; }
- break; // Do we need to do anything?
-
- default: debugf("mDNSNotifier: Unexpected OTEventCode %X", code);
- break;
- }
-}
-
-#if MDNS_ONLYSYSTEMTASK
-
-static Boolean ONLYSYSTEMTASKevent;
-static void *ONLYSYSTEMTASKcontextPtr;
-static OTEventCode ONLYSYSTEMTASKcode;
-static OTResult ONLYSYSTEMTASKresult;
-static void *ONLYSYSTEMTASKcookie;
-
-mDNSlocal pascal void CallmDNSNotifier(void *contextPtr, OTEventCode code, OTResult result, void *cookie)
-{
- ONLYSYSTEMTASKcontextPtr = contextPtr;
- ONLYSYSTEMTASKcode = code;
- ONLYSYSTEMTASKresult = result;
- ONLYSYSTEMTASKcookie = cookie;
-}
-
-#else
-
-mDNSlocal pascal void CallmDNSNotifier(void *contextPtr, OTEventCode code, OTResult result, void *cookie)
-{
- mDNS *const m = (mDNS *const)contextPtr;
- if (!m) debugf("mDNSNotifier FATAL ERROR! No context");
- if (m->p->nesting) LogMsg("CallmDNSNotifier ERROR! OTEnterNotifier is supposed to suppress notifier callbacks");
- mDNSNotifier(contextPtr, code, result, cookie);
-}
-
-#endif
-
-static OTNotifyUPP CallmDNSNotifierUPP;
-
-mDNSlocal OSStatus mDNSOpenEndpoint(const mDNS *const m)
-{
- OSStatus err;
- // m->optReq is pre-set to point to the shared m->optBlock
- // m->optBlock is filled in by each OTOptionManagement call
- m->p->optReq.opt.maxlen = sizeof(m->p->optBlock);
- m->p->optReq.opt.len = sizeof(m->p->optBlock);
- m->p->optReq.opt.buf = (UInt8*)&m->p->optBlock;
- m->p->optReq.flags = T_NEGOTIATE;
-
- // Open an endpoint and start answering queries
- //printf("Opening endpoint now...\n");
- m->p->ep = NULL;
- m->p->mOTstate = mOT_Start;
- err = OTAsyncOpenEndpoint(OTCreateConfiguration(kUDPName), 0, NULL, CallmDNSNotifierUPP, (void*)m);
- if (err) { LogMsg("ERROR: OTAsyncOpenEndpoint(UDP) failed with error <%d>", err); return(err); }
- return(kOTNoError);
-}
-
-// Define these here because they're not in older versions of OpenTransport.h
-enum
-{
- xOTStackIsLoading = 0x27000001, /* Sent before Open Transport attempts to load the TCP/IP protocol stack.*/
- xOTStackWasLoaded = 0x27000002, /* Sent after the TCP/IP stack has been successfully loaded.*/
- xOTStackIsUnloading = 0x27000003 /* Sent before Open Transport unloads the TCP/IP stack.*/
-};
-
-static mDNS *ClientNotifierContext;
-
-mDNSlocal pascal void ClientNotifier(void *contextPtr, OTEventCode code, OTResult result, void *cookie)
-{
- mDNS *const m = ClientNotifierContext;
-
- #pragma unused(contextPtr) // Usually zero (except one in the 'xOTStackIsLoading' case)
- #pragma unused(cookie) // Usually 'ipv4' (except for kOTPortNetworkChange)
- #pragma unused(result) // Usually zero
-
- switch (code)
- {
- case xOTStackIsLoading: break;
- case xOTStackWasLoaded: if (m->p->mOTstate == mOT_Closed)
- {
- LogMsg("kOTStackWasLoaded: Re-opening endpoint");
- if (m->p->ep)
- LogMsg("kOTStackWasLoaded: ERROR: m->p->ep already set");
- m->mDNSPlatformStatus = mStatus_Waiting;
- m->p->mOTstate = mOT_Reset;
- #if !MDNS_ONLYSYSTEMTASK
- mDNSOpenEndpoint(m);
- #endif
- }
- else
- LogMsg("kOTStackWasLoaded (no action)");
- break;
- case xOTStackIsUnloading: break;
- case kOTPortNetworkChange: break;
- default: debugf("ClientNotifier unknown code %X, %X, %d", contextPtr, code, result); break;
- }
-}
-
-#if TARGET_API_MAC_CARBON
-
-mDNSlocal void GetUserSpecifiedComputerName(domainlabel *const namelabel)
-{
- CFStringRef cfs = CSCopyMachineName();
- CFStringGetPascalString(cfs, namelabel->c, sizeof(*namelabel), kCFStringEncodingUTF8);
- CFRelease(cfs);
-}
-
-#else
-
-mDNSlocal OSStatus ConvertStringHandleToUTF8(const StringHandle machineName, UInt8 *const utf8, ByteCount maxlen)
-{
- OSStatus status;
- TextEncoding utf8TextEncoding, SystemTextEncoding;
- UnicodeMapping theMapping;
- TextToUnicodeInfo textToUnicodeInfo;
- ByteCount unicodelen = 0;
-
- if (maxlen > 255) maxlen = 255; // Can't put more than 255 in a Pascal String
-
- utf8TextEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, kTextEncodingDefaultVariant, kUnicodeUTF8Format);
- UpgradeScriptInfoToTextEncoding(smSystemScript, kTextLanguageDontCare, kTextRegionDontCare, NULL, &SystemTextEncoding);
- theMapping.unicodeEncoding = utf8TextEncoding;
- theMapping.otherEncoding = SystemTextEncoding;
- theMapping.mappingVersion = kUnicodeUseLatestMapping;
- status = CreateTextToUnicodeInfo(&theMapping, &textToUnicodeInfo);
- if (status == noErr)
- {
- status = ConvertFromPStringToUnicode(textToUnicodeInfo, *machineName, maxlen, &unicodelen, (UniCharArrayPtr)&(utf8[1]));
- DisposeTextToUnicodeInfo(&textToUnicodeInfo);
- }
- utf8[0] = (UInt8)unicodelen;
- return(status);
-}
-
-mDNSlocal void GetUserSpecifiedComputerName(domainlabel *const namelabel)
-{
- StringHandle machineName = GetString(-16413); // Get machine name set in file sharing
- if (machineName)
- {
- char machineNameState = HGetState((Handle)machineName);
- HLock((Handle)machineName);
- ConvertStringHandleToUTF8(machineName, namelabel->c, MAX_DOMAIN_LABEL);
- HSetState((Handle)machineName, machineNameState);
- }
-}
-
-#endif
-
-static pascal void mDNSTimerTask(void *arg)
-{
-#if MDNS_ONLYSYSTEMTASK
-#pragma unused(arg)
- ONLYSYSTEMTASKevent = true;
-#else
- mDNS *const m = (mDNS *const)arg;
- if (!m->p->ep) LogMsg("mDNSTimerTask NO endpoint");
- if (m->mDNS_busy) LogMsg("mDNS_busy");
- if (m->p->nesting) LogMsg("mDNSTimerTask ERROR! OTEnterNotifier is supposed to suppress timer callbacks too");
-
- // If our timer fires at a time when we have no endpoint, ignore it --
- // once we reopen our endpoint and get our T_BINDCOMPLETE message we'll call
- // mDNS_RegisterInterface(), which does a lock/unlock, which retriggers the timer.
- // Likewise, if m->mDNS_busy or m->p->nesting, we'll catch this on the unlock
- if (m->p->ep && m->mDNS_busy == 0 && m->p->nesting == 0) mDNS_Execute(m);
-#endif
-}
-
-#if TEST_SLEEP
-long sleep, wake, mode;
-#endif
-
-mDNSexport mStatus mDNSPlatformInit (mDNS *const m)
-{
- OSStatus err = InitOpenTransport();
-
- ClientNotifierContext = m;
- // Note: OTRegisterAsClient returns kOTNotSupportedErr when running as Carbon code on OS X
- // -- but that's okay, we don't need a ClientNotifier when running as Carbon code on OS X
- OTRegisterAsClient(NULL, NewOTNotifyUPP(ClientNotifier));
-
- m->p->OTTimerTask = OTCreateTimerTask(NewOTProcessUPP(mDNSTimerTask), m);
- m->p->nesting = 0;
-
-#if TEST_SLEEP
- sleep = TickCount() + 600;
- wake = TickCount() + 1200;
- mode = 0;
-#endif
-
- // Set up the nice label
- m->nicelabel.c[0] = 0;
- GetUserSpecifiedComputerName(&m->nicelabel);
-// m->nicelabel = *(domainlabel*)"\pStu"; // For conflict testing
- if (m->nicelabel.c[0] == 0) MakeDomainLabelFromLiteralString(&m->nicelabel, "Macintosh");
-
- // Set up the RFC 1034-compliant label
- m->hostlabel.c[0] = 0;
- ConvertUTF8PstringToRFC1034HostLabel(m->nicelabel.c, &m->hostlabel);
- if (m->hostlabel.c[0] == 0) MakeDomainLabelFromLiteralString(&m->hostlabel, "Macintosh");
-
- mDNS_SetFQDN(m);
-
- // When it's finished mDNSOpenEndpoint asynchronously calls mDNSinitComplete() and then mDNS_RegisterInterface()
- CallmDNSNotifierUPP = NewOTNotifyUPP(CallmDNSNotifier);
- err = mDNSOpenEndpoint(m);
- if (err)
- {
- LogMsg("mDNSOpenEndpoint failed %d", err);
- if (m->p->OTTimerTask) OTDestroyTimerTask(m->p->OTTimerTask);
- OTUnregisterAsClient();
- CloseOpenTransport();
- }
- return(err);
-}
-
-extern void mDNSPlatformClose (mDNS *const m)
-{
- if (m->p->mOTstate == mOT_Ready)
- {
- m->p->mOTstate = mOT_Closed;
- mDNS_DeregisterInterface(m, &m->p->interface, mDNSfalse);
- }
- if (m->p->ep) { OTCloseProvider (m->p->ep); m->p->ep = NULL; }
- if (m->p->OTTimerTask) { OTDestroyTimerTask(m->p->OTTimerTask); m->p->OTTimerTask = 0; }
-
- OTUnregisterAsClient();
- CloseOpenTransport();
-}
-
-#if MDNS_ONLYSYSTEMTASK
-extern void mDNSPlatformIdle(mDNS *const m);
-mDNSexport void mDNSPlatformIdle(mDNS *const m)
-{
- while (ONLYSYSTEMTASKcontextPtr)
- {
- void *contextPtr = ONLYSYSTEMTASKcontextPtr;
- ONLYSYSTEMTASKcontextPtr = NULL;
- mDNSNotifier(contextPtr, ONLYSYSTEMTASKcode, ONLYSYSTEMTASKresult, ONLYSYSTEMTASKcookie);
- }
- if (ONLYSYSTEMTASKevent)
- {
- ONLYSYSTEMTASKevent = false;
- mDNS_Execute(m);
- }
-
- if (m->p->mOTstate == mOT_Reset)
- {
- printf("\n");
- printf("******************************************************************************\n");
- printf("\n");
- printf("Reopening endpoint\n");
- mDNSOpenEndpoint(m);
- m->ResourceRecords = NULL;
- }
-
-#if TEST_SLEEP
- switch (mode)
- {
- case 0: if ((long)TickCount() - sleep >= 0) { mDNSCoreMachineSleep(m, 1); mode++; }
- break;
- case 1: if ((long)TickCount() - wake >= 0) { mDNSCoreMachineSleep(m, 0); mode++; }
- break;
- }
-#endif
-}
-#endif
-
-mDNSexport void mDNSPlatformLock(const mDNS *const m)
-{
- if (!m) { DebugStr("\pmDNSPlatformLock m NULL!"); return; }
- if (!m->p) { DebugStr("\pmDNSPlatformLock m->p NULL!"); return; }
-
- // If we try to call OTEnterNotifier and fail because we're already running at
- // Notifier context, then make sure we don't do the matching OTLeaveNotifier() on exit.
- // If we haven't even opened our endpoint yet, then just increment m->p->nesting for the same reason
- if (m->p->mOTstate == mOT_Ready && !m->p->ep) DebugStr("\pmDNSPlatformLock: m->p->mOTstate == mOT_Ready && !m->p->ep");
- if (!m->p->ep || m->p->nesting || OTEnterNotifier(m->p->ep) == false) m->p->nesting++;
-}
-
-mDNSlocal void ScheduleNextTimerCallback(const mDNS *const m)
-{
- if (m->mDNSPlatformStatus == mStatus_NoError)
- {
- SInt32 interval = m->NextScheduledEvent - mDNS_TimeNow_NoLock(m);
- if (interval < 1) interval = 1;
- else if (interval > 0x70000000 / 1000) interval = 0x70000000 / mDNSPlatformOneSecond;
- else interval = (interval * 1000 + mDNSPlatformOneSecond-1)/ mDNSPlatformOneSecond;
- OTScheduleTimerTask(m->p->OTTimerTask, (OTTimeout)interval);
- }
-}
-
-mDNSexport void mDNSPlatformUnlock(const mDNS *const m)
-{
- if (!m) { DebugStr("\pmDNSPlatformUnlock m NULL!"); return; }
- if (!m->p) { DebugStr("\pmDNSPlatformUnlock m->p NULL!"); return; }
-
- if (m->p->ep && m->mDNS_busy == 0) ScheduleNextTimerCallback(m);
-
- if (m->p->nesting) m->p->nesting--;
- else OTLeaveNotifier(m->p->ep);
-}
-
-mDNSexport void mDNSPlatformStrCopy( void *dst, const void *src) { OTStrCopy((char*)dst, (char*)src); }
-mDNSexport UInt32 mDNSPlatformStrLen ( const void *src) { return(OTStrLength((char*)src)); }
-mDNSexport void mDNSPlatformMemCopy( void *dst, const void *src, UInt32 len) { OTMemcpy(dst, src, len); }
-mDNSexport mDNSBool mDNSPlatformMemSame(const void *dst, const void *src, UInt32 len) { return(OTMemcmp(dst, src, len)); }
-mDNSexport void mDNSPlatformMemZero( void *dst, UInt32 len) { OTMemzero(dst, len); }
-mDNSexport void * mDNSPlatformMemAllocate(mDNSu32 len) { return(OTAllocMem(len)); }
-mDNSexport void mDNSPlatformMemFree(void *mem) { OTFreeMem(mem); }
-mDNSexport mDNSu32 mDNSPlatformRandomSeed(void) { return(TickCount()); }
-mDNSexport mStatus mDNSPlatformTimeInit(void) { return(mStatus_NoError); }
-mDNSexport SInt32 mDNSPlatformRawTime() { return((SInt32)TickCount()); }
-mDNSexport SInt32 mDNSPlatformOneSecond = 60;
-
-mDNSexport mDNSs32 mDNSPlatformUTC(void)
-{
- // Classic Mac OS since Midnight, 1st Jan 1904
- // Standard Unix counts from 1970
- // This value adjusts for the 66 years and 17 leap-days difference
- mDNSu32 SecsSince1904;
- MachineLocation ThisLocation;
- #define TIME_ADJUST (((1970 - 1904) * 365 + 17) * 24 * 60 * 60)
- #define ThisLocationGMTdelta ((ThisLocation.u.gmtDelta << 8) >> 8)
- GetDateTime(&SecsSince1904);
- ReadLocation(&ThisLocation);
- return((mDNSs32)(SecsSince1904 - ThisLocationGMTdelta - TIME_ADJUST));
-}
diff --git a/mDNSResponder/mDNSMacOS9/mDNSMacOS9.h b/mDNSResponder/mDNSMacOS9/mDNSMacOS9.h
deleted file mode 100755
index 496c07f7..00000000
--- a/mDNSResponder/mDNSMacOS9/mDNSMacOS9.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// ***************************************************************************
-// Classic Mac (Open Transport) structures
-
-//#include <Files.h> // OpenTransport.h requires this
-#include <OpenTransport.h>
-#include <OpenTptInternet.h>
-#include <OpenTptClient.h>
-
-typedef enum
-{
- mOT_Closed = 0, // We got kOTProviderIsClosed message
- mOT_Reset, // We got xOTStackWasLoaded message
- mOT_Start, // We've called OTAsyncOpenEndpoint
- mOT_ReusePort, // Have just done kReusePortOption
- mOT_RcvDestAddr, // Have just done kRcvDestAddrOption
- mOT_SetUTTL, // Have just done kSetUnicastTTLOption
- mOT_SetMTTL, // Have just done kSetMulticastTTLOption
- mOT_LLScope, // Have just done kAddLinkMulticastOption
-// mOT_AdminScope, // Have just done kAddAdminMulticastOption
- mOT_Bind, // We've just called OTBind
- mOT_Ready // Got T_BINDCOMPLETE; Interface is registered and active
-} mOT_State;
-
-typedef struct { TOptionHeader h; mDNSv4Addr multicastGroupAddress; mDNSv4Addr InterfaceAddress; } TIPAddMulticastOption;
-typedef struct { TOptionHeader h; UInt8 val; } TSetByteOption;
-typedef struct { TOptionHeader h; UInt32 flag; } TSetBooleanOption;
-
-// TOptionBlock is a union of various types.
-// What they all have in common is that they all start with a TOptionHeader.
-typedef union { TOptionHeader h; TIPAddMulticastOption m; TSetByteOption i; TSetBooleanOption b; } TOptionBlock;
-
-struct mDNS_PlatformSupport_struct
-{
- EndpointRef ep;
- UInt32 mOTstate; // mOT_State enum
- TOptionBlock optBlock;
- TOptMgmt optReq;
- long OTTimerTask;
- UInt32 nesting;
- NetworkInterfaceInfo interface;
-};
diff --git a/mDNSResponder/mDNSMacOS9/mDNSPrefix.h b/mDNSResponder/mDNSMacOS9/mDNSPrefix.h
deleted file mode 100644
index cf6cec8a..00000000
--- a/mDNSResponder/mDNSMacOS9/mDNSPrefix.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Global definitions that apply to all source files
-//
-// Symbols that are defined here are available within all source files.
-// This is the equivalent of using using "-d SYMBOL=VALUE" in a Makefile
-// in command-line build environments.
-
-// For normal DeferredTask time execution, set MDNS_ONLYSYSTEMTASK to 0
-// For easier debugging, set MDNS_ONLYSYSTEMTASK to 1, and OT Notifier executions
-// will be deferred until SystemTask time. (This option is available only for building
-// the standalone application samples that have their own event loop -- don't try
-// to build the System Extension with MDNS_ONLYSYSTEMTASK set because it won't work.)
-
-#if __ide_target("Standalone TestResponder") || __ide_target("Standalone TestSearcher") || __ide_target("Standalone SubTypeTester")
-#define TARGET_API_MAC_CARBON 1
-#define OTCARBONAPPLICATION 1
-#define MDNS_ONLYSYSTEMTASK 0
-#define MDNS_DEBUGMSGS 0
-
-#elif __ide_target("Standalone TestResponder (Debug)") || __ide_target("Standalone TestSearcher (Debug)")
-#define TARGET_API_MAC_CARBON 1
-#define OTCARBONAPPLICATION 1
-#define MDNS_ONLYSYSTEMTASK 1
-#define MDNS_DEBUGMSGS 1
-
-#elif __ide_target("Standalone TestResponder (Classic)") || __ide_target("Standalone TestSearcher (Classic)")
-#define MDNS_ONLYSYSTEMTASK 0
-#define MDNS_DEBUGMSGS 0
-
-#elif __ide_target("CFM Library for Extensions Folder")
-#define MDNS_BUILDINGSHAREDLIBRARY 2
-
-#elif __ide_target("CFM Library for Extensions (Debug)")
-#define MDNS_DEBUGMSGS 0
-#define MDNS_BUILDINGSHAREDLIBRARY 1
-
-#elif __ide_target("CFM Stub for clients to link against")
-#define MDNS_BUILDINGSTUBLIBRARY 1
-
-#else
-#error Options for this target not found in prefix file
-#endif
-
-// dnssd_clientlib.c assumes malloc() and free(), so we #define them here to be the OT equivalents
-#if MDNS_BUILDINGSHAREDLIBRARY || MDNS_BUILDINGSTUBLIBRARY
-#define malloc(x) OTAllocMem(x)
-#define free(x) OTFreeMem(x)
-#endif
diff --git a/mDNSResponder/mDNSMacOSX/BonjourEvents.c b/mDNSResponder/mDNSMacOSX/BonjourEvents.c
index f4f3e83c..e06106e8 100644
--- a/mDNSResponder/mDNSMacOSX/BonjourEvents.c
+++ b/mDNSResponder/mDNSMacOSX/BonjourEvents.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2010-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -291,7 +291,8 @@ void * UserEventAgentFactory(CFAllocatorRef allocator, CFUUIDRef typeID)
(void)allocator;
BonjourUserEventsPlugin * result = NULL;
- if (typeID && CFEqual(typeID, kUserEventAgentTypeID)) {
+ if (typeID && CFEqual(typeID, kUserEventAgentTypeID))
+ {
result = Alloc(kUserEventAgentFactoryID);
}
@@ -604,8 +605,6 @@ NetBrowserInfo* CreateBrowser(BonjourUserEventsPlugin* plugin, CFStringRef type,
// Add the dictionary to the browsers dictionary.
CFDictionarySetValue(plugin->_browsers, browser, browserDict);
- NetBrowserInfoRelease(NULL, browser);
-
// Release Memory
CFRelease(browserDict);
}
diff --git a/mDNSResponder/mDNSMacOSX/CUPolicy.c b/mDNSResponder/mDNSMacOSX/CUPolicy.c
deleted file mode 100644
index 187748e1..00000000
--- a/mDNSResponder/mDNSMacOSX/CUPolicy.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2013 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "mDNSMacOSX.h"
-#include <network/config.h>
-
-#if TARGET_OS_IPHONE
-
-mDNSexport void CUPInit(mDNS *const m)
-{
-
- m->p->handle = cellular_usage_policy_create_client();
- if (!m->p->handle)
- {
- LogMsg("CUPInit: cellular_usage_policy_create_client failed");
- }
-}
-
-mDNSexport mDNSBool mDNSPlatformAllowPID(mDNS *const m, DNSQuestion *q)
-{
- // Currently the policy applies only for DNS requests sent over cellular interface
- if (m->p->handle && q->qDNSServer && q->qDNSServer->cellIntf)
- {
- mDNSBool allowed;
- if (q->pid)
- {
- allowed = (mDNSBool) cellular_usage_policy_is_data_allowed_for_pid(m->p->handle, q->pid);
- if (!allowed)
- {
- xpc_object_t pidx = xpc_uint64_create(q->pid);
- if (pidx)
- {
- network_config_cellular_blocked_notify(pidx, NULL, NULL);
- LogInfo("mDNSPlaformAllowPID: Notified PID(%d) for %##s (%s)", q->pid, q->qname.c, DNSTypeName(q->qtype));
- xpc_release(pidx);
- }
- }
- }
- else
- {
- xpc_object_t uuidx = xpc_uuid_create(q->uuid);
- if (uuidx)
- {
- allowed = (mDNSBool) cellular_usage_policy_is_data_allowed_for_uuid(m->p->handle, uuidx);
- if (!allowed)
- {
- network_config_cellular_blocked_notify(NULL, uuidx, NULL);
- LogInfo("mDNSPlaformAllowPID: Notified UUID for %##s (%s)", q->qname.c, DNSTypeName(q->qtype));
- }
- xpc_release(uuidx);
- }
- else
- {
- allowed = false;
- }
- }
- return allowed;
- }
- else
- {
- return mDNStrue;
- }
-}
-
-#else // TARGET_OS_IPHONE
-
-mDNSexport void CUPInit(mDNS *const m)
-{
- (void)m; //unused
-}
-
-mDNSexport mDNSBool mDNSPlatformAllowPID(mDNS *const m, DNSQuestion *q)
-{
- (void)m; //unused
- (void)q; //unused
- //LogMsg("mDNSPlatformAllowPID: %##s (%s)", q->qname.c, DNSTypeName(q->qtype));
- return mDNStrue;
-}
-
-#endif // TARGET_OS_IPHONE
-
diff --git a/mDNSResponder/mDNSMacOSX/CryptoSupport.c b/mDNSResponder/mDNSMacOSX/CryptoSupport.c
index 408b3a22..57c70179 100644
--- a/mDNSResponder/mDNSMacOSX/CryptoSupport.c
+++ b/mDNSResponder/mDNSMacOSX/CryptoSupport.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -350,18 +350,18 @@ mDNSlocal mStatus rsa_sha_add(AlgContext *ctx, const void *data, mDNSu32 len)
mDNSlocal SecKeyRef rfc3110_import(const mDNSu8 *data, const mDNSu32 len)
{
- static const int max_key_bytes = 4096 / 8; // max DNSSEC supported modulus is 4096 bits
- static const int max_exp_bytes = 3; // DNSSEC supports 1 or 3 bytes for exponent
- static const int asn1_cmd_bytes = 3; // since there is an ASN1 SEQ and two INTs
- //static const int asn1_max_len_bytes = asn1_cmd_bytes * 3; // capped at 3 due to max payload size
- static const int asn1_max_len_bytes = 3 * 3; // capped at 3 due to max payload size
- unsigned char asn1[max_key_bytes + 1 + max_exp_bytes + asn1_cmd_bytes + asn1_max_len_bytes]; // +1 is for leading 0 for non negative asn1 number
+ static const int max_modulus_bytes = 512; // Modulus is limited to 4096 bits (512 octets) in length.
+ static const int max_exp_bytes = 512; // Exponent is limited to 4096 bits (512 octets) in length.
+ static const int asn1_type_bytes = 3; // Since there is an ASN1 SEQ and two INTs.
+ static const int asn1_max_len_bytes = 3 * 3; // Capped at 3 due to max payload size.
+ unsigned char asn1[max_modulus_bytes + 1 + max_exp_bytes + asn1_type_bytes + asn1_max_len_bytes]; // +1 is for leading 0 for non negative asn1 number
const mDNSu8 *modulus;
unsigned int modulus_length;
+ const mDNSu8 *exponent;
unsigned int exp_length;
+ unsigned int num_length_bytes;
mDNSu32 index = 0;
mDNSu32 asn1_length = 0;
- unsigned int i;
// Validate Input
if (!data)
@@ -372,16 +372,33 @@ mDNSlocal SecKeyRef rfc3110_import(const mDNSu8 *data, const mDNSu32 len)
return NULL;
// Parse Modulus and Exponent
- exp_length = data[0];
- // we have to have at least len byte + size of exponent
- if (len < 1+exp_length)
+ // If the first byte is zero, then the exponent length is in the three-byte format, otherwise the length is in the first byte.
+ if (data[0] == 0)
+ {
+ if (len < 3)
+ return NULL;
+ exp_length = (data[1] << 8) | data[2];
+ num_length_bytes = 3;
+ }
+ else
+ {
+ exp_length = data[0];
+ num_length_bytes = 1;
+ }
+
+ // RFC3110 limits the exponent length to 4096 bits (512 octets).
+ if (exp_length > 512)
+ return NULL;
+
+ // We have to have at least len bytes + size of exponent.
+ if (len < (num_length_bytes + exp_length))
return NULL;
- // -1 is for the exp_length byte
- modulus_length = len - 1 - exp_length;
+ // The modulus is the remaining space.
+ modulus_length = len - (num_length_bytes + exp_length);
- // rfc3110 limits modulus to 4096 bits
+ // RFC3110 limits the modulus length to 4096 bits (512 octets).
if (modulus_length > 512)
return NULL;
@@ -391,18 +408,30 @@ mDNSlocal SecKeyRef rfc3110_import(const mDNSu8 *data, const mDNSu32 len)
// add 1 to modulus length for pre-ceding 0 t make ASN1 value non-negative
++modulus_length;
- // 1 is to skip exp_length byte
- modulus = &data[1+exp_length];
+ exponent = &data[num_length_bytes];
+ modulus = &data[num_length_bytes + exp_length];
// 2 bytes for commands since first doesn't count
// 2 bytes for min 1 byte length field
asn1_length = modulus_length + exp_length + 2 + 2;
- // account for modulus length causing INT length field to grow
- if (modulus_length > 0xFF)
- asn1_length += 2;
- else if (modulus_length >= 128)
- ++asn1_length;
+ // Account for modulus length causing INT length field to grow.
+ if (modulus_length >= 128)
+ {
+ if (modulus_length > 255)
+ asn1_length += 2;
+ else
+ asn1_length += 1;
+ }
+
+ // Account for exponent length causing INT length field to grow.
+ if (exp_length >= 128)
+ {
+ if (exp_length > 255)
+ asn1_length += 2;
+ else
+ asn1_length += 1;
+ }
// Construct ASN1 formatted public key
// Write ASN1 SEQ byte
@@ -415,8 +444,8 @@ mDNSlocal SecKeyRef rfc3110_import(const mDNSu8 *data, const mDNSu32 len)
}
else
{
- asn1[index++] = (0x80 | ((asn1_length & 0xFF00) ? 2 : 1));
- if (asn1_length & 0xFF00)
+ asn1[index++] = (0x80 | ((asn1_length > 255) ? 2 : 1));
+ if (asn1_length > 255)
asn1[index++] = (asn1_length & 0xFF00) >> 8;
asn1[index++] = asn1_length & 0xFF;
}
@@ -426,12 +455,12 @@ mDNSlocal SecKeyRef rfc3110_import(const mDNSu8 *data, const mDNSu32 len)
// Write ASN1 length for INT
if (modulus_length < 128)
{
- asn1[index++] = asn1_length & 0xFF;
+ asn1[index++] = modulus_length & 0xFF;
}
else
{
- asn1[index++] = 0x80 | ((modulus_length & 0xFF00) ? 2 : 1);
- if (modulus_length & 0xFF00)
+ asn1[index++] = 0x80 | ((modulus_length > 255) ? 2 : 1);
+ if (modulus_length > 255)
asn1[index++] = (modulus_length & 0xFF00) >> 8;
asn1[index++] = modulus_length & 0xFF;
}
@@ -439,16 +468,26 @@ mDNSlocal SecKeyRef rfc3110_import(const mDNSu8 *data, const mDNSu32 len)
// Write preceding 0 so our integer isn't negative
asn1[index++] = 0x00;
// Write actual modulus (-1 for preceding 0)
- memcpy(&asn1[index], (void *)modulus, modulus_length-1);
- index += modulus_length-1;
+ memcpy(&asn1[index], modulus, modulus_length - 1);
+ index += (modulus_length - 1);
// Write ASN1 INT for exponent
asn1[index++] = 0x02;
// Write ASN1 length for INT
- asn1[index++] = exp_length & 0xFF;
+ if (exp_length < 128)
+ {
+ asn1[index++] = exp_length & 0xFF;
+ }
+ else
+ {
+ asn1[index++] = 0x80 | ((exp_length > 255) ? 2 : 1);
+ if (exp_length > 255)
+ asn1[index++] = (exp_length & 0xFF00) >> 8;
+ asn1[index++] = exp_length & 0xFF;
+ }
// Write exponent bytes
- for (i = 1; i <= exp_length; i++)
- asn1[index++] = data[i];
+ memcpy(&asn1[index], exponent, exp_length);
+ index += exp_length;
#if TARGET_OS_IPHONE
// index contains bytes written, use it for length
@@ -605,6 +644,8 @@ mDNSlocal Boolean VerifyData(SecKeyRef key, CFStringRef digestStr, mDNSu8 *diges
}
CFBooleanRef boolRef = SecTransformExecute(verifyXForm, &error);
+ ret = boolRef ? CFBooleanGetValue(boolRef) : false;
+ if (boolRef) CFRelease(boolRef);
CFRelease(verifyXForm);
if (error != NULL)
@@ -618,11 +659,12 @@ mDNSlocal Boolean VerifyData(SecKeyRef key, CFStringRef digestStr, mDNSu8 *diges
{
LogMsg("VerifyData: CFStringGetCString failed");
}
+ CFRelease(errStr);
}
LogMsg("VerifyData: SecTransformExecute failed with %s", errorbuf);
return false;
}
- return CFEqual(boolRef, kCFBooleanTrue);
+ return ret;
err:
CFRelease(verifyXForm);
return false;
diff --git a/mDNSResponder/mDNSMacOSX/CryptoSupport.h b/mDNSResponder/mDNSMacOSX/CryptoSupport.h
index 9c0fd079..8625ba76 100644
--- a/mDNSResponder/mDNSMacOSX/CryptoSupport.h
+++ b/mDNSResponder/mDNSMacOSX/CryptoSupport.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#ifndef __CRYPTO_SUPPORT_H
#define __CRYPTO_SUPPORT_H
diff --git a/mDNSResponder/mDNSMacOSX/DNSProxySupport.c b/mDNSResponder/mDNSMacOSX/DNSProxySupport.c
index 042bbc80..34f21a57 100644
--- a/mDNSResponder/mDNSMacOSX/DNSProxySupport.c
+++ b/mDNSResponder/mDNSMacOSX/DNSProxySupport.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "mDNSEmbeddedAPI.h"
#include "mDNSMacOSX.h"
@@ -261,11 +262,9 @@ mDNSlocal mStatus SetupUDPProxySocket(mDNS *const m, int skt, KQSocketSet *cp, u
int *s = (sa_family == AF_INET) ? &cp->sktv4 : &cp->sktv6;
KQueueEntry *k = (sa_family == AF_INET) ? &cp->kqsv4 : &cp->kqsv6;
const int on = 1;
- mDNSIPPort port;
mStatus err = mStatus_NoError;
cp->m = m;
- port = cp->port;
cp->closeFlag = mDNSNULL;
// set default traffic class
@@ -339,11 +338,9 @@ mDNSlocal mStatus SetupTCPProxySocket(mDNS *const m, int skt, KQSocketSet *cp, u
{
int *s = (sa_family == AF_INET) ? &cp->sktv4 : &cp->sktv6;
KQueueEntry *k = (sa_family == AF_INET) ? &cp->kqsv4 : &cp->kqsv6;
- mDNSIPPort port;
mStatus err;
cp->m = m;
- port = cp->port;
// XXX may not be used by the TCP codepath
cp->closeFlag = mDNSNULL;
@@ -384,7 +381,7 @@ mDNSlocal void BindDPSocket(int fd, int sa_family)
err = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on));
if (err < 0)
- LogMsg("BindDPSocket: setsockopt SO_REUSEPORT failed for V4 %d errno %d (%s)", fd, errno, strerror(errno));
+ LogMsg("BindDPSocket: setsockopt SO_REUSEPORT failed for IPv4 %d errno %d (%s)", fd, errno, strerror(errno));
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
diff --git a/mDNSResponder/mDNSMacOSX/DNSSECSupport.c b/mDNSResponder/mDNSMacOSX/DNSSECSupport.c
index e1255c4d..6e5ae108 100644
--- a/mDNSResponder/mDNSMacOSX/DNSSECSupport.c
+++ b/mDNSResponder/mDNSMacOSX/DNSSECSupport.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2012 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2012-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -449,9 +449,13 @@ mDNSlocal void FetchRootTA(mDNS *const m)
return;
}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// If we can't fetch the XML file e.g., network problems, trigger a timer. All other failures
// should hardly happen in practice for which schedule the normal interval to refetch the TA.
- if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, url, &xmlData, NULL, NULL, NULL))
+ Boolean success = CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, url, &xmlData, NULL, NULL, NULL);
+#pragma clang diagnostic pop
+ if (!success)
{
LogInfo("FetchRootTA: CFURLCreateDataAndPropertiesFromResource error");
CFRelease(url);
@@ -479,7 +483,8 @@ mDNSlocal void FetchRootTA(mDNS *const m)
xmlDocPtr tadoc = xmlReadMemory((const char*)CFDataGetBytePtr(xmlData),
(int)CFDataGetLength(xmlData), xmlFileName, NULL, 0);
- CFRelease(fileRef);
+ if (fileRef)
+ CFRelease(fileRef);
CFRelease(url);
CFRelease(xmlData);
diff --git a/mDNSResponder/mDNSMacOSX/DNSSECSupport.h b/mDNSResponder/mDNSMacOSX/DNSSECSupport.h
index 2310fc2a..eaaf36e2 100644
--- a/mDNSResponder/mDNSMacOSX/DNSSECSupport.h
+++ b/mDNSResponder/mDNSMacOSX/DNSSECSupport.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2012 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2012-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.c b/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.c
index 717efca2..efd61b30 100644
--- a/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.c
+++ b/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2012 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -453,7 +453,6 @@ DNSServiceRegistrationReplyErrorType DNSServiceRegistrationRemoveRecord(dns_serv
void DNSServiceDiscovery_handleReply(void *replyMsg)
{
- unsigned long result = 0xFFFFFFFF;
mach_msg_header_t * msgSendBufPtr;
mach_msg_header_t * receivedMessage;
unsigned msgSendBufLength;
@@ -466,7 +465,7 @@ void DNSServiceDiscovery_handleReply(void *replyMsg)
// Call DNSServiceDiscoveryReply_server to change mig-generated message into a
// genuine mach message. It will then cause the callback to get called.
- result = DNSServiceDiscoveryReply_server ( receivedMessage, msgSendBufPtr );
+ DNSServiceDiscoveryReply_server ( receivedMessage, msgSendBufPtr );
( void ) mach_msg_send ( msgSendBufPtr );
free(msgSendBufPtr);
}
diff --git a/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.h b/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.h
index ae736477..a743dd74 100644
--- a/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.h
+++ b/mDNSResponder/mDNSMacOSX/DNSServiceDiscovery.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2006, 2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryDefines.h b/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryDefines.h
index cfad0a41..22687b90 100644
--- a/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryDefines.h
+++ b/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryDefines.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2003, 2006, 2009, 2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryReply.defs b/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryReply.defs
index b918bee4..993c9553 100644
--- a/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryReply.defs
+++ b/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryReply.defs
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2003, 2006 Apple Computer, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryRequest.defs b/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryRequest.defs
index ad06bdb5..d3fe292a 100644
--- a/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryRequest.defs
+++ b/mDNSResponder/mDNSMacOSX/DNSServiceDiscoveryRequest.defs
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2004, 2006 Apple Computer, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo-Tiger.helper.plist b/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo-Tiger.helper.plist
deleted file mode 100644
index 895287c7..00000000
--- a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo-Tiger.helper.plist
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>com.apple.mDNSResponderHelper</string>
- <key>OnDemand</key>
- <false/>
- <key>ProgramArguments</key>
- <array>
- <string>/usr/sbin/mDNSResponderHelper</string>
- <string>-t</string>
- <string>0</string>
- </array>
- <key>ServiceIPC</key>
- <false/>
-</dict>
-</plist>
diff --git a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo-Tiger.plist b/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo-Tiger.plist
deleted file mode 100644
index e91b7751..00000000
--- a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo-Tiger.plist
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>com.apple.mDNSResponder</string>
- <key>OnDemand</key>
- <false/>
- <key>ProgramArguments</key>
- <array>
- <string>/usr/sbin/mDNSResponder</string>
- <string>-launchdaemon</string>
- </array>
- <key>ServiceIPC</key>
- <false/>
-</dict>
-</plist>
diff --git a/mDNSResponder/mDNSMacOSX/LegacyNATTraversal.c b/mDNSResponder/mDNSMacOSX/LegacyNATTraversal.c
index e7cd65f0..acfb3dca 100644
--- a/mDNSResponder/mDNSMacOSX/LegacyNATTraversal.c
+++ b/mDNSResponder/mDNSMacOSX/LegacyNATTraversal.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2004-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
#include "assert.h" // For assert()
#if defined( WIN32 )
+# include "CommonServices.h"
# include <winsock2.h>
# include <ws2tcpip.h>
# define strcasecmp _stricmp
@@ -82,8 +83,11 @@ mDNSlocal mStatus SendPortMapRequest(mDNS *m, NATTraversalInfo *n);
mDNSlocal void AllocAndCopy(mDNSu8 **const dst, const mDNSu8 *const src)
{
if (src == mDNSNULL) return;
- if ((*dst = mDNSPlatformMemAllocate((mDNSu32)strlen((char*)src) + 1)) == mDNSNULL)
- { LogMsg("AllocAndCopy: can't allocate string"); return; }
+ if ((strlen((char*)src)) >= UINT32_MAX || (*dst = mDNSPlatformMemAllocate((mDNSu32)strlen((char*)src) + 1)) == mDNSNULL)
+ {
+ LogMsg("AllocAndCopy: can't allocate string");
+ return;
+ }
strcpy((char*)*dst, (char*)src);
}
@@ -279,7 +283,7 @@ mDNSlocal void handleLNTDeviceDescriptionResponse(tcpLNTInfo *tcpInfo)
LogInfo("handleLNTDeviceDescriptionResponse: found URLBase");
ptr += 8; // skip over "URLBase>"
// find the end of the URLBase element
- for (stop = ptr; stop < end; stop++) { if (*stop == '<') { end = stop; break; } }
+ for (stop = ptr; stop < end; stop++) { if (stop && *stop == '<') { end = stop; break; } }
if (ParseHttpUrl(ptr, end, &m->UPnPSOAPAddressString, &m->UPnPSOAPPort, mDNSNULL) != mStatus_NoError)
{
LogInfo("handleLNTDeviceDescriptionResponse: failed to parse URLBase");
@@ -412,8 +416,6 @@ mDNSlocal void tcpConnectionCallback(TCPSocket *sock, void *context, mDNSBool Co
long nsent = 0;
static int LNTERRORcount = 0;
- if (tcpInfo == mDNSNULL) { LogInfo("tcpConnectionCallback: no tcpInfo context"); status = mStatus_Invalid; goto exit; }
-
if (tcpInfo->sock != sock)
{
LogMsg("tcpConnectionCallback: WARNING- tcpInfo->sock(%p) != sock(%p) !!! Printing tcpInfo struct", tcpInfo->sock, sock);
@@ -793,7 +795,7 @@ mDNSexport void LNT_ConfigureRouterInfo(mDNS *m, const mDNSInterfaceID Interface
{
const mDNSu8 *ptr = data;
const mDNSu8 *end = data + len;
- const mDNSu8 *stop = ptr;
+ const mDNSu8 *stop;
if (!mDNSIPPortIsZero(m->UPnPRouterPort)) return; // already have the info we need
diff --git a/mDNSResponder/mDNSMacOS9/CarbonResource.r b/mDNSResponder/mDNSMacOSX/Metrics.h
index 3bd7fa64..a9dea79a 100644
--- a/mDNSResponder/mDNSMacOS9/CarbonResource.r
+++ b/mDNSResponder/mDNSMacOSX/Metrics.h
@@ -1,13 +1,13 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2016 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,4 +15,23 @@
* limitations under the License.
*/
-data 'carb' (0) { };
+#include "mDNSEmbeddedAPI.h"
+
+#ifndef __Metrics_h
+#define __Metrics_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if TARGET_OS_EMBEDDED
+mStatus MetricsInit(void);
+void MetricsUpdateUDNSStats(const domainname *inQueryName, mDNSBool inAnswered, mDNSu32 inSendCount, mDNSu32 inLatencyMs, mDNSBool inForCellular);
+void LogMetrics(void);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __Metrics_h
diff --git a/mDNSResponder/mDNSMacOSX/Metrics.m b/mDNSResponder/mDNSMacOSX/Metrics.m
new file mode 100644
index 00000000..56467dfc
--- /dev/null
+++ b/mDNSResponder/mDNSMacOSX/Metrics.m
@@ -0,0 +1,531 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2016 Apple Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import "Metrics.h"
+
+#if TARGET_OS_EMBEDDED
+#import <CoreUtils/SoftLinking.h>
+#import <WirelessDiagnostics/AWDDNSDomainStats.h>
+#import <WirelessDiagnostics/AWDMDNSResponderDNSStatistics.h>
+#import <WirelessDiagnostics/AWDMetricIds_MDNSResponder.h>
+#import <WirelessDiagnostics/WirelessDiagnostics.h>
+
+#import "DNSCommon.h"
+#import "mDNSMacOSX.h"
+#import "DebugServices.h"
+
+//===========================================================================================================================
+// External Frameworks
+//===========================================================================================================================
+
+SOFT_LINK_FRAMEWORK(PrivateFrameworks, WirelessDiagnostics)
+
+SOFT_LINK_CLASS(WirelessDiagnostics, AWDServerConnection)
+#define AWDServerConnectionSoft getAWDServerConnectionClass()
+
+SOFT_LINK_CLASS(WirelessDiagnostics, AWDMDNSResponderDNSStatistics)
+#define AWDMDNSResponderDNSStatisticsSoft getAWDMDNSResponderDNSStatisticsClass()
+
+SOFT_LINK_CLASS(WirelessDiagnostics, AWDDNSDomainStats)
+#define AWDDNSDomainStatsSoft getAWDDNSDomainStatsClass()
+
+//===========================================================================================================================
+// Macros
+//===========================================================================================================================
+
+#define countof(X) (sizeof(X) / sizeof(X[0]))
+
+//===========================================================================================================================
+// Constants
+//===========================================================================================================================
+
+#define kUDNSStatsMaxQuerySendCount 10
+
+// Important: Do not update this list without getting privacy approval. See <rdar://problem/24155761>.
+
+static const char * const kUDNSStatsDomains[] =
+{
+ ".",
+ "apple.com.",
+ "icloud.com.",
+ "me.com.",
+ "google.com.",
+ "facebook.com.",
+ "youtube.com.",
+ "baidu.com.",
+ "amazon.com.",
+ "yahoo.com.",
+ "wikipedia.org."
+};
+
+static const mDNSu32 kResponseLatencyMsLimits[] =
+{
+ 1, 2, 3, 4, 5,
+ 10, 20, 30, 40, 50, 60, 70, 80, 90,
+ 100, 110, 120, 130, 140, 150, 160, 170, 180, 190,
+ 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950,
+ 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500,
+ 5000, 6000, 7000, 8000, 9000,
+ 10000
+};
+
+//===========================================================================================================================
+// Data structures
+//===========================================================================================================================
+
+typedef struct
+{
+ uint32_t answeredQuerySendCountBins[kUDNSStatsMaxQuerySendCount + 1];
+ uint32_t unansweredQuerySendCountBins[kUDNSStatsMaxQuerySendCount + 1];
+ uint32_t responseLatencyBins[countof(kResponseLatencyMsLimits) + 1];
+
+} DNSStats;
+
+typedef struct DNSDomainStats * DNSDomainStatsRef;
+struct DNSDomainStats
+{
+ DNSDomainStatsRef next;
+ domainname domain;
+ int domainLabelCount;
+ char * domainStr;
+ DNSStats stats;
+ DNSStats statsCellular;
+};
+
+//===========================================================================================================================
+// Globals
+//===========================================================================================================================
+
+extern mDNS mDNSStorage;
+
+static DNSDomainStatsRef gDomainStatsList = NULL;
+static AWDServerConnection * gAWDServerConnection = nil;
+
+//===========================================================================================================================
+// Local Prototypes
+//===========================================================================================================================
+
+mDNSlocal mStatus DNSDomainStatsCreate(const char *inDomain, DNSDomainStatsRef *outStats);
+mDNSlocal void DNSDomainStatsFree(DNSDomainStatsRef inStats);
+mDNSlocal void DNSDomainStatsFreeList(DNSDomainStatsRef inList);
+
+mDNSlocal mStatus CreateDomainStatsList(DNSDomainStatsRef *outList);
+mDNSlocal void UpdateDNSStats(DNSStats *inStats, mDNSBool inAnswered, mDNSu32 inQuerySendCount, mDNSu32 inLatencyMs);
+mDNSlocal mStatus SubmitAWDMetric(void);
+mDNSlocal mStatus CreateAWDDNSDomainStats(DNSStats *inStats, const char *inDomain, mDNSBool inIsForCellular, AWDDNSDomainStats **outAWDStats);
+mDNSlocal void LogDNSStats(const DNSStats *inStats);
+
+//===========================================================================================================================
+// MetricsInit
+//===========================================================================================================================
+
+mStatus MetricsInit(void)
+{
+ mStatus err;
+
+ err = CreateDomainStatsList(&gDomainStatsList);
+ require_noerr_quiet(err, exit);
+
+ @autoreleasepool
+ {
+ gAWDServerConnection = [[AWDServerConnectionSoft alloc]
+ initWithComponentId: AWDComponentId_MDNSResponder
+ andBlockOnConfiguration: NO];
+
+ if (gAWDServerConnection)
+ {
+ [gAWDServerConnection
+ registerQueriableMetricCallback: ^(UInt32 metricId)
+ {
+ mStatus localErr;
+
+ (void) metricId;
+
+ localErr = SubmitAWDMetric();
+ if (localErr) LogMsg("SubmitAWDMetric failed with error %d", localErr);
+ }
+ forIdentifier: (UInt32)AWDMetricId_MDNSResponder_DNSStatistics];
+ }
+ }
+exit:
+ return (err);
+}
+
+//===========================================================================================================================
+// MetricsUpdateUDNSStats
+//===========================================================================================================================
+
+mDNSexport void MetricsUpdateUDNSStats(const domainname *inQueryName, mDNSBool inAnswered, mDNSu32 inSendCount, mDNSu32 inLatencyMs, mDNSBool inForCellular)
+{
+ DNSStats * stats;
+ DNSDomainStatsRef domainStats;
+ int queryLabelCount;
+ mDNSBool isQueryInDomain;
+
+ queryLabelCount = CountLabels(inQueryName);
+
+ for (domainStats = gDomainStatsList; domainStats; domainStats = domainStats->next)
+ {
+ isQueryInDomain = mDNSfalse;
+ if (strcmp(domainStats->domainStr, ".") == 0)
+ {
+ // All queries are in the root domain.
+ isQueryInDomain = mDNStrue;
+ }
+ else
+ {
+ int skipCount;
+ const domainname * queryParentDomain;
+
+ skipCount = queryLabelCount - domainStats->domainLabelCount;
+ if (skipCount >= 0)
+ {
+ queryParentDomain = SkipLeadingLabels(inQueryName, skipCount);
+ isQueryInDomain = SameDomainName(queryParentDomain, &domainStats->domain);
+ }
+ }
+
+ if (isQueryInDomain)
+ {
+ stats = inForCellular ? &domainStats->statsCellular : &domainStats->stats;
+ UpdateDNSStats(stats, inAnswered, inSendCount, inLatencyMs);
+ }
+ }
+}
+
+//===========================================================================================================================
+// CreateDomainStatsList
+//===========================================================================================================================
+
+mDNSlocal mStatus CreateDomainStatsList(DNSDomainStatsRef *outList)
+{
+ mStatus err;
+ size_t i;
+ DNSDomainStatsRef domainStats;
+ DNSDomainStatsRef * p;
+ DNSDomainStatsRef list = NULL;
+
+ p = &list;
+ for (i = 0; i < countof(kUDNSStatsDomains); ++i)
+ {
+ err = DNSDomainStatsCreate(kUDNSStatsDomains[i], &domainStats);
+ require_noerr_quiet(err, exit);
+
+ *p = domainStats;
+ p = &domainStats->next;
+ }
+
+ *outList = list;
+ list = NULL;
+
+exit:
+ DNSDomainStatsFreeList(list);
+ return (err);
+}
+
+//===========================================================================================================================
+// UpdateDNSStats
+//===========================================================================================================================
+
+mDNSlocal void UpdateDNSStats(DNSStats *inStats, mDNSBool inAnswered, mDNSu32 inQuerySendCount, mDNSu32 inLatencyMs)
+{
+ size_t i;
+
+ if (inAnswered)
+ {
+ i = (inQuerySendCount <= kUDNSStatsMaxQuerySendCount) ? inQuerySendCount : kUDNSStatsMaxQuerySendCount;
+ inStats->answeredQuerySendCountBins[i]++;
+
+ if (inQuerySendCount > 0)
+ {
+ for (i = 0; (i < countof(kResponseLatencyMsLimits)) && (inLatencyMs >= kResponseLatencyMsLimits[i]); ++i) {}
+ inStats->responseLatencyBins[i]++;
+ }
+ }
+ else if (inQuerySendCount > 0)
+ {
+ i = (inQuerySendCount <= kUDNSStatsMaxQuerySendCount) ? inQuerySendCount : kUDNSStatsMaxQuerySendCount;
+ inStats->unansweredQuerySendCountBins[i]++;
+ }
+}
+
+//===========================================================================================================================
+// SubmitAWDMetric
+//===========================================================================================================================
+
+mDNSlocal mStatus SubmitAWDMetric(void)
+{
+ mStatus err;
+ BOOL success;
+ DNSDomainStatsRef domainStats;
+ DNSDomainStatsRef newDomainStatsList;
+ DNSDomainStatsRef domainStatsList = NULL;
+ AWDMetricContainer * container = nil;
+ AWDMDNSResponderDNSStatistics * metric = nil;
+ AWDDNSDomainStats * awdDomainStats = nil;
+
+ err = CreateDomainStatsList(&newDomainStatsList);
+ require_noerr_quiet(err, exit);
+
+ domainStatsList = gDomainStatsList;
+
+ KQueueLock(&mDNSStorage);
+ gDomainStatsList = newDomainStatsList;
+ KQueueUnlock(&mDNSStorage, "SubmitAWDMetric");
+
+ container = [gAWDServerConnection newMetricContainerWithIdentifier:AWDMetricId_MDNSResponder_DNSStatistics];
+ require_action_quiet(container, exit, err = mStatus_UnknownErr);
+
+ metric = [[AWDMDNSResponderDNSStatisticsSoft alloc] init];
+ require_action_quiet(metric, exit, err = mStatus_UnknownErr);
+
+ for (domainStats = domainStatsList; domainStats; domainStats = domainStats->next)
+ {
+ err = CreateAWDDNSDomainStats(&domainStats->stats, domainStats->domainStr, mDNSfalse, &awdDomainStats);
+ require_noerr_quiet(err, exit);
+
+ [metric addStats:awdDomainStats];
+ [awdDomainStats release];
+ awdDomainStats = nil;
+
+ err = CreateAWDDNSDomainStats(&domainStats->statsCellular, domainStats->domainStr, mDNStrue, &awdDomainStats);
+ require_noerr_quiet(err, exit);
+
+ [metric addStats:awdDomainStats];
+ [awdDomainStats release];
+ awdDomainStats = nil;
+ }
+
+ container.metric = metric;
+ success = [gAWDServerConnection submitMetric:container];
+ LogMsg("SubmitAWDMetric: metric submission %s.", success ? "succeeded" : "failed" );
+ err = success ? mStatus_NoError : mStatus_UnknownErr;
+
+exit:
+ [awdDomainStats release];
+ [metric release];
+ [container release];
+ DNSDomainStatsFreeList(domainStatsList);
+ return (err);
+}
+
+//===========================================================================================================================
+// DNSDomainStatsCreate
+//===========================================================================================================================
+
+mDNSlocal mStatus DNSDomainStatsCreate(const char *inDomain, DNSDomainStatsRef *outStats)
+{
+ mStatus err;
+ DNSDomainStatsRef obj;
+ mDNSu8 * ptr;
+
+ obj = (DNSDomainStatsRef) calloc(1, sizeof(*obj));
+ require_action_quiet(obj, exit, err = mStatus_NoMemoryErr);
+
+ obj->domainStr = strdup(inDomain);
+ require_action_quiet(obj, exit, err = mStatus_NoMemoryErr);
+
+ // Initialize domainname for non-root domains.
+
+ if (strcmp(obj->domainStr, ".") != 0)
+ {
+ ptr = MakeDomainNameFromDNSNameString(&obj->domain, obj->domainStr);
+ require_action_quiet(ptr, exit, err = mStatus_Invalid);
+ obj->domainLabelCount = CountLabels(&obj->domain);
+ }
+
+ *outStats = obj;
+ obj = NULL;
+ err = mStatus_NoError;
+
+exit:
+ if (obj) DNSDomainStatsFree(obj);
+ return (err);
+}
+
+//===========================================================================================================================
+// DNSDomainStatsFree
+//===========================================================================================================================
+
+mDNSlocal void DNSDomainStatsFree(DNSDomainStatsRef inStats)
+{
+ if (inStats->domainStr) free(inStats->domainStr);
+ free(inStats);
+}
+
+//===========================================================================================================================
+// DNSDomainStatsFreeList
+//===========================================================================================================================
+
+mDNSlocal void DNSDomainStatsFreeList(DNSDomainStatsRef inList)
+{
+ DNSDomainStatsRef stats;
+
+ while ((stats = inList) != NULL)
+ {
+ inList = stats->next;
+ DNSDomainStatsFree(stats);
+ }
+}
+
+//===========================================================================================================================
+// CreateAWDDNSDomainStats
+//===========================================================================================================================
+
+mDNSlocal mStatus CreateAWDDNSDomainStats(DNSStats *inStats, const char *inDomain, mDNSBool inIsCellType, AWDDNSDomainStats **outAWDStats)
+{
+ mStatus err;
+ AWDDNSDomainStats * awdStats = nil;
+ NSString * domain = nil;
+
+ awdStats = [[AWDDNSDomainStatsSoft alloc] init];
+ require_action_quiet(awdStats, exit, err = mStatus_UnknownErr);
+
+ domain = [[NSString alloc] initWithUTF8String:inDomain];
+ require_action_quiet(domain, exit, err = mStatus_UnknownErr);
+
+ awdStats.domain = domain;
+ awdStats.networkType = inIsCellType ? AWDDNSDomainStats_NetworkType_Cellular : AWDDNSDomainStats_NetworkType_NonCellular;
+
+ [awdStats
+ setAnsweredQuerySendCounts: inStats->answeredQuerySendCountBins
+ count: (NSUInteger)countof(inStats->answeredQuerySendCountBins)];
+
+ [awdStats
+ setUnansweredQuerySendCounts: inStats->unansweredQuerySendCountBins
+ count: (NSUInteger)countof(inStats->unansweredQuerySendCountBins)];
+
+ [awdStats
+ setResponseLatencyMs: inStats->responseLatencyBins
+ count: (NSUInteger)countof(inStats->responseLatencyBins)];
+
+ *outAWDStats = awdStats;
+ awdStats = nil;
+ err = mStatus_NoError;
+
+exit:
+ [domain release];
+ [awdStats release];
+ return (err);
+}
+
+//===========================================================================================================================
+// LogDNSStats
+//===========================================================================================================================
+
+#define Percent(N, D) ((N) * 100) / (D), (((N) * 10000) / (D)) % 100
+#define PercentFmt "%3u.%02u"
+#define LogStat(LABEL, COUNT, ACCUMULATOR, TOTAL) \
+ LogMsgNoIdent("%s %5u " PercentFmt " " PercentFmt, (LABEL), (COUNT), Percent(COUNT, TOTAL), Percent(ACCUMULATOR, TOTAL))
+
+mDNSlocal void LogDNSStats(const DNSStats *inStats)
+{
+ uint32_t total;
+ uint32_t totalUnanswered;
+ size_t i;
+ char label[16];
+
+ totalUnanswered = 0;
+ for (i = 0; i < countof(inStats->unansweredQuerySendCountBins); ++i)
+ {
+ totalUnanswered += inStats->unansweredQuerySendCountBins[i];
+ }
+
+ total = 0;
+ for (i = 0; i <= countof(inStats->answeredQuerySendCountBins); ++i)
+ {
+ total += inStats->answeredQuerySendCountBins[i];
+ }
+
+ LogMsgNoIdent("Answered questions %5u", total);
+ LogMsgNoIdent("Unanswered questions %5u", totalUnanswered);
+ LogMsgNoIdent("+++ Number of queries sent +++");
+ if (total > 0)
+ {
+ uint32_t accumulator = 0;
+
+ for (i = 0; i < countof(inStats->answeredQuerySendCountBins); ++i)
+ {
+ uint32_t count;
+ const char * suffix;
+
+ count = inStats->answeredQuerySendCountBins[i];
+ accumulator += count;
+ suffix = (i < (countof(inStats->answeredQuerySendCountBins) - 1)) ? " " : "+";
+ snprintf(label, sizeof(label), "%2d%s", (int)i, suffix);
+ LogStat(label, count, accumulator, total);
+ }
+ }
+ else
+ {
+ LogMsgNoIdent("No data.");
+ }
+
+ total = 0;
+ for (i = 0; i < countof(inStats->responseLatencyBins); ++i)
+ {
+ total += inStats->responseLatencyBins[i];
+ }
+
+ LogMsgNoIdent("+++++++ Response times +++++++");
+ if (total > 0)
+ {
+ uint32_t accumulator = 0;
+
+ for (i = 0; i < countof(inStats->responseLatencyBins); ++i)
+ {
+ uint32_t count;
+
+ count = inStats->responseLatencyBins[i];
+ accumulator += count;
+ if (i < countof(kResponseLatencyMsLimits))
+ {
+ snprintf(label, sizeof(label), "< %5u ms", kResponseLatencyMsLimits[i]);
+ }
+ else
+ {
+ snprintf(label, sizeof(label), "< ∞ ms");
+ }
+ LogStat(label, count, accumulator, total);
+ if (accumulator == total) break;
+ }
+ }
+ else
+ {
+ LogMsgNoIdent("No data.");
+ }
+}
+
+//===========================================================================================================================
+// LogMetrics
+//===========================================================================================================================
+
+mDNSexport void LogMetrics(void)
+{
+ DNSDomainStatsRef domainStats;
+
+ LogMsgNoIdent("---- DNS stats by domain -----");
+
+ for (domainStats = gDomainStatsList; domainStats; domainStats = domainStats->next)
+ {
+ LogMsgNoIdent("Domain: %s (non-cellular)", domainStats->domainStr);
+ LogDNSStats(&domainStats->stats);
+ LogMsgNoIdent("Domain: %s (cellular)", domainStats->domainStr);
+ LogDNSStats(&domainStats->statsCellular);
+ }
+}
+#endif // TARGET_OS_EMBEDDED
diff --git a/mDNSResponder/mDNSMacOSX/P2PPacketFilter.c b/mDNSResponder/mDNSMacOSX/P2PPacketFilter.c
index 1ab8a02f..0665103f 100644
--- a/mDNSResponder/mDNSMacOSX/P2PPacketFilter.c
+++ b/mDNSResponder/mDNSMacOSX/P2PPacketFilter.c
@@ -1,4 +1,4 @@
-/*
+/* -*- Mode: C; tab-width: 4 -*-
*
* Copyright (c) 2011 Apple Inc. All rights reserved.
*
@@ -250,7 +250,8 @@ int P2PPacketFilterAddBonjourRuleSet(const char * interfaceName, u_int32_t count
require( result == 0, exit );
// open inbound port for each service
- for (i = 0; i < count; i++) {
+ for (i = 0; i < count; i++)
+ {
initPortRule( &pr, interfaceName, ticket, poolTicket, anchorPath, portArray[i], protocolArray[i] );
result = addRule( devFD, &pr );
require( result == 0, exit );
diff --git a/mDNSResponder/mDNSMacOSX/P2PPacketFilter.h b/mDNSResponder/mDNSMacOSX/P2PPacketFilter.h
index 9c196577..904b43ba 100644
--- a/mDNSResponder/mDNSMacOSX/P2PPacketFilter.h
+++ b/mDNSResponder/mDNSMacOSX/P2PPacketFilter.h
@@ -1,4 +1,4 @@
-/*
+/* -*- Mode: C; tab-width: 4 -*-
*
* Copyright (c) 2011 Apple Inc. All rights reserved.
*
diff --git a/mDNSResponder/mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.m b/mDNSResponder/mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.m
index 063bc724..26e3eaf0 100644
--- a/mDNSResponder/mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.m
+++ b/mDNSResponder/mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.m
@@ -3,9 +3,9 @@
Abstract: System Preference Pane for Dynamic DNS and Wide-Area DNS Service Discovery
- Copyright: (c) Copyright 2005-2011 Apple Computer, Inc. All rights reserved.
+ Copyright: (c) Copyright 2005-2011 Apple Inc. All rights reserved.
- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
constitutes acceptance of these terms. If you do not agree with these terms,
@@ -19,7 +19,7 @@
the Apple Software in its entirety and without modifications, you must retain
this notice and the following text and disclaimers in all such redistributions of
the Apple Software. Neither the name, trademarks, service marks or logos of
- Apple Computer, Inc. may be used to endorse or promote products derived from the
+ Apple Inc. may be used to endorse or promote products derived from the
Apple Software without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or implied,
are granted by Apple herein, including but not limited to any patent rights that
@@ -96,8 +96,7 @@ static void ServiceDomainEnumReply( DNSServiceRef sdRef, DNSServiceFlags flags,
NSMutableArray * defaultBrowseDomainsArray = nil;
NSComboBox * domainComboBox;
NSString * domainString;
- NSString * currentDomain = nil;
- char decodedDomainString[kDNSServiceMaxDomainName] = "\0";
+ char decodedDomainString[kDNSServiceMaxDomainName] = "\0";
char nextLabel[256] = "\0";
char * buffer = (char *)replyDomain;
@@ -115,7 +114,6 @@ static void ServiceDomainEnumReply( DNSServiceRef sdRef, DNSServiceFlags flags,
if (enumType & kDNSServiceFlagsRegistrationDomains) {
domainArray = [me registrationDataSource];
domainComboBox = [me regDomainsComboBox];
- currentDomain = [me currentRegDomain];
} else {
domainArray = [me browseDataSource];
domainComboBox = [me browseDomainsComboBox];
@@ -261,6 +259,7 @@ MyDNSServiceAddServiceToRunLoop(MyDNSServiceState * query)
assert(rls != NULL);
CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopCommonModes);
+ CFRelease(rls);
CFRelease(keys);
CFRelease(store);
@@ -334,7 +333,7 @@ MyDNSServiceAddServiceToRunLoop(MyDNSServiceState * query)
currentHostName = [[NSString alloc] initWithString:@""];
}
- [origDict release];
+ CFRelease((CFDictionaryRef)origDict);
CFRelease(store);
}
@@ -394,6 +393,7 @@ MyDNSServiceAddServiceToRunLoop(MyDNSServiceState * query)
[browseDomainsArray replaceObjectAtIndex:[tableView clickedRow] withObject:browseDomainDict];
[tableView reloadData];
[self updateApplyButtonState];
+ [browseDomainDict release];
}
@@ -681,12 +681,8 @@ MyDNSServiceAddServiceToRunLoop(MyDNSServiceState * query)
{
NSString *hostNameString = [hostName stringValue];
NSString *regDomainString = [regDomainsComboBox stringValue];
-
- NSComparisonResult hostNameResult = [hostNameString compare:currentHostName];
- NSComparisonResult regDomainResult = [regDomainString compare:currentRegDomain];
-
- if ((currentHostName && (hostNameResult != NSOrderedSame)) ||
- (currentRegDomain && (regDomainResult != NSOrderedSame) && ([wideAreaCheckBox state])) ||
+ if ((currentHostName && ([hostNameString compare:currentHostName] != NSOrderedSame)) ||
+ (currentRegDomain && ([regDomainString compare:currentRegDomain] != NSOrderedSame) && ([wideAreaCheckBox state])) ||
(currentHostName == nil && ([hostNameString length]) > 0) ||
(currentRegDomain == nil && ([regDomainString length]) > 0) ||
(currentWideAreaState != [wideAreaCheckBox state]) ||
@@ -946,7 +942,7 @@ MyDNSServiceAddServiceToRunLoop(MyDNSServiceState * query)
}
CFRelease(itemRef);
}
- return keyName;
+ return [keyName autorelease];
}
@@ -1000,7 +996,6 @@ MyDNSServiceAddServiceToRunLoop(MyDNSServiceState * query)
-(void)savePreferences
{
NSString *hostNameString = [hostName stringValue];
- NSString *browseDomainString = [browseDomainsComboBox stringValue];
NSString *regDomainString = [regDomainsComboBox stringValue];
NSString *tempHostNameSharedSecretName = hostNameSharedSecretName;
NSString *tempRegSharedSecretName = regSharedSecretName;
@@ -1010,7 +1005,6 @@ MyDNSServiceAddServiceToRunLoop(MyDNSServiceState * query)
OSStatus err = noErr;
hostNameString = [self trimCharactersFromDomain:hostNameString];
- browseDomainString = [self trimCharactersFromDomain:browseDomainString];
regDomainString = [self trimCharactersFromDomain:regDomainString];
tempHostNameSharedSecretName = [self trimCharactersFromDomain:tempHostNameSharedSecretName];
tempRegSharedSecretName = [self trimCharactersFromDomain:tempRegSharedSecretName];
diff --git a/mDNSResponder/mDNSMacOSX/PreferencePane/English.lproj/InfoPlist.strings b/mDNSResponder/mDNSMacOSX/PreferencePane/English.lproj/InfoPlist.strings
index e2dfa991..71d52de8 100644
--- a/mDNSResponder/mDNSMacOSX/PreferencePane/English.lproj/InfoPlist.strings
+++ b/mDNSResponder/mDNSMacOSX/PreferencePane/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/mDNSResponder/mDNSMacOSX/PreferencePane/PrivilegedOperations.c b/mDNSResponder/mDNSMacOSX/PreferencePane/PrivilegedOperations.c
index 4c0ffa0e..efb41497 100644
--- a/mDNSResponder/mDNSMacOSX/PreferencePane/PrivilegedOperations.c
+++ b/mDNSResponder/mDNSMacOSX/PreferencePane/PrivilegedOperations.c
@@ -3,9 +3,9 @@
Abstract: Interface to "ddnswriteconfig" setuid root tool.
- Copyright: (c) Copyright 2005 Apple Computer, Inc. All rights reserved.
+ Copyright: (c) Copyright 2005-2015 Apple Inc. All rights reserved.
- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
constitutes acceptance of these terms. If you do not agree with these terms,
@@ -19,7 +19,7 @@
the Apple Software in its entirety and without modifications, you must retain
this notice and the following text and disclaimers in all such redistributions of
the Apple Software. Neither the name, trademarks, service marks or logos of
- Apple Computer, Inc. may be used to endorse or promote products derived from the
+ Apple Inc. may be used to endorse or promote products derived from the
Apple Software without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or implied,
are granted by Apple herein, including but not limited to any patent rights that
@@ -48,24 +48,23 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-#include <unistd.h>
+#include <spawn.h>
#include <sys/wait.h>
#include <AssertMacros.h>
#include <Security/Security.h>
+extern char **environ;
Boolean gToolApproved = false;
-static pid_t execTool(const char *args[])
-// fork/exec and return new pid
+static pid_t execTool(const char *args[])
{
pid_t child;
- child = vfork();
- if (child == 0)
+ int err = posix_spawn(&child, args[0], NULL, NULL, (char *const *)args, environ);
+ if (err)
{
- execv(args[0], (char *const *)args);
- printf("exec of %s failed; errno = %d\n", args[0], errno);
- _exit(-1); // exec failed
+ printf("exec of %s failed; err = %d\n", args[0], err);
+ return -1;
}
else
return child;
@@ -119,11 +118,14 @@ OSStatus EnsureToolInstalled(void)
{
char *installerargs[] = { toolSourcePath, NULL };
err = AuthorizationExecuteWithPrivileges(authRef, toolInstallerPath, 0, installerargs, (FILE**) NULL);
- if (err == noErr) {
+ if (err == noErr)
+ {
int pid = wait(&status);
- if (pid > 0 && WIFEXITED(status)) {
+ if (pid > 0 && WIFEXITED(status))
+ {
err = WEXITSTATUS(status);
- if (err == noErr) {
+ if (err == noErr)
+ {
gToolApproved = true;
}
} else {
@@ -181,7 +183,8 @@ static OSStatus ExecWithCmdAndParam(const char *subCmd, CFDataRef paramData)
write(commFD, buff, len);
child = execTool(args);
- if (child > 0) {
+ if (child > 0)
+ {
int status;
waitpid(child, &status, 0);
if (WIFEXITED(status))
diff --git a/mDNSResponder/mDNSMacOSX/PreferencePane/ddnswriteconfig.m b/mDNSResponder/mDNSMacOSX/PreferencePane/ddnswriteconfig.m
index 437879bc..8e64fc46 100644
--- a/mDNSResponder/mDNSMacOSX/PreferencePane/ddnswriteconfig.m
+++ b/mDNSResponder/mDNSMacOSX/PreferencePane/ddnswriteconfig.m
@@ -87,18 +87,23 @@ WriteArrayToDynDNS(CFStringRef arrayKey, CFArrayRef domainArray)
require_action(true == SCPreferencesLock( store, true), LockFailed, err=coreFoundationUnknownErr;);
origDict = SCPreferencesPathGetValue(store, scKey);
- if (origDict) {
+ if (origDict)
+ {
dict = CFDictionaryCreateMutableCopy(NULL, 0, origDict);
}
- if (!dict) {
+ if (!dict)
+ {
dict = CFDictionaryCreateMutable(NULL, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
}
require_action( dict != NULL, NoDict, err=memFullErr;);
- if (CFArrayGetCount(domainArray) > 0) {
+ if (CFArrayGetCount(domainArray) > 0)
+ {
CFDictionarySetValue(dict, arrayKey, domainArray);
- } else {
+ }
+ else
+ {
CFDictionaryRemoveValue(dict, arrayKey);
}
@@ -138,10 +143,13 @@ readTaggedBlock(int fd, u_int32_t *pTag, u_int32_t *pLen, char **ppBuff)
require_action(*ppBuff != NULL, AllocFailed, result = -1;);
num = read(fd, *ppBuff, len);
- if (num == (ssize_t)len) {
+ if (num == (ssize_t)len)
+ {
*pTag = tag;
*pLen = len;
- } else {
+ }
+ else
+ {
free(*ppBuff);
result = -1;
}
@@ -166,7 +174,8 @@ SetAuthInfo( int fd)
require( len == sizeof(AuthorizationExternalForm), ReadParamsFailed);
require( len == kAuthorizationExternalFormLength, ReadParamsFailed);
- if (gAuthRef != 0) {
+ if (gAuthRef != 0)
+ {
(void) AuthorizationFree(gAuthRef, kAuthorizationFlagDefaults);
gAuthRef = 0;
}
@@ -199,10 +208,15 @@ HandleWriteDomain(int fd, int domainType)
domainData = CFDataCreate(NULL, (UInt8 *)p, len);
domainArray = (CFArrayRef)[NSUnarchiver unarchiveObjectWithData:(NSData *)domainData];
+ CFRelease(domainData);
+ free(p);
- if (domainType) {
+ if (domainType)
+ {
result = WriteArrayToDynDNS(SC_DYNDNS_REGDOMAINS_KEY, domainArray);
- } else {
+ }
+ else
+ {
result = WriteArrayToDynDNS(SC_DYNDNS_BROWSEDOMAINS_KEY, domainArray);
}
@@ -232,6 +246,8 @@ HandleWriteHostname(int fd)
domainData = CFDataCreate(NULL, (const UInt8 *)p, len);
domainArray = (CFArrayRef)[NSUnarchiver unarchiveObjectWithData:(NSData *)domainData];
result = WriteArrayToDynDNS(SC_DYNDNS_HOSTNAMES_KEY, domainArray);
+ CFRelease(domainData);
+ free(p);
ReadParamsFailed:
return result;
@@ -341,6 +357,8 @@ SetKeychainEntry(int fd)
secretData = CFDataCreate(NULL, (UInt8 *)p, len);
secretDictionary = (CFDictionaryRef)[NSUnarchiver unarchiveObjectWithData:(NSData *)secretData];
+ CFRelease(secretData);
+ free(p);
keyNameString = (CFStringRef)CFDictionaryGetValue(secretDictionary, SC_DYNDNS_KEYNAME_KEY);
assert(keyNameString != NULL);
@@ -356,9 +374,11 @@ SetKeychainEntry(int fd)
CFStringGetCString(secretString, secret, kDNSServiceMaxDomainName, kCFStringEncodingUTF8);
result = SecKeychainSetPreferenceDomain(kSecPreferencesDomainSystem);
- if (result == noErr) {
+ if (result == noErr)
+ {
result = SecKeychainFindGenericPassword(NULL, strlen(domain), domain, 0, NULL, 0, NULL, &item);
- if (result == noErr) {
+ if (result == noErr)
+ {
result = SecKeychainItemDelete(item);
if (result != noErr) fprintf(stderr, "SecKeychainItemDelete returned %d\n", result);
}
diff --git a/mDNSResponder/mDNSMacOSX/Private/dns_sd_private.h b/mDNSResponder/mDNSMacOSX/Private/dns_sd_private.h
new file mode 100644
index 00000000..e0b65cce
--- /dev/null
+++ b/mDNSResponder/mDNSMacOSX/Private/dns_sd_private.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2015 Apple Inc. All rights reserved.
+ */
+
+#ifndef _DNS_SD_PRIVATE_H
+#define _DNS_SD_PRIVATE_H
+
+/* DNSServiceCreateDelegateConnection()
+ *
+ * Parameters:
+ *
+ * sdRef: A pointer to an uninitialized DNSServiceRef. Deallocating
+ * the reference (via DNSServiceRefDeallocate()) severs the
+ * connection and deregisters all records registered on this connection.
+ *
+ * pid : Process ID of the delegate
+ *
+ * uuid: UUID of the delegate
+ *
+ * Note that only one of the two arguments (pid or uuid) can be specified. If pid
+ * is zero, uuid will be assumed to be a valid value; otherwise pid will be used.
+ *
+ * return value: Returns kDNSServiceErr_NoError on success, otherwise returns
+ * an error code indicating the specific failure that occurred (in which
+ * case the DNSServiceRef is not initialized). kDNSServiceErr_NotAuth is
+ * returned to indicate that the calling process does not have entitlements
+ * to use this API.
+ */
+DNSServiceErrorType DNSSD_API DNSServiceCreateDelegateConnection(DNSServiceRef *sdRef, int32_t pid, uuid_t uuid);
+
+#endif
diff --git a/mDNSResponder/mDNSMacOSX/Private/dns_services.c b/mDNSResponder/mDNSMacOSX/Private/dns_services.c
index 1df3b21d..794e2526 100644
--- a/mDNSResponder/mDNSMacOSX/Private/dns_services.c
+++ b/mDNSResponder/mDNSMacOSX/Private/dns_services.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2012-2015 Apple Inc. All rights reserved.
*
* PRIVATE DNSX CLIENT LIBRARY --FOR Apple Platforms ONLY OSX/iOS--
* Resides in /usr/lib/libdns_services.dylib
@@ -10,10 +10,10 @@
#include "dns_xpc.h"
#include <xpc/xpc.h>
#include <Block.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <syslog.h>
+#define LOG_NOW LOG_INFO
+
//*************************************************************************************************************
// Globals
@@ -22,7 +22,7 @@
struct _DNSXConnRef_t
{
connection_t conn_ref; // xpc_connection between client and daemon
- dispatch_queue_t lib_q; // internal queue created in library itself
+ dispatch_queue_t lib_q; // internal queue created in library itself
void *AppCallBack; // Callback function ptr for Client
dispatch_queue_t client_q; // Queue specified by client for scheduling its Callback
};
@@ -37,11 +37,11 @@ static bool LogDebugEnabled()
static void LogDebug(const char *prefix, xpc_object_t o)
{
- if (!LogDebugEnabled())
+ if (!LogDebugEnabled())
return;
char *desc = xpc_copy_description(o);
- syslog(LOG_INFO, "%s: %s", prefix, desc);
+ syslog(LOG_NOW, "%s: %s", prefix, desc);
free(desc);
}
@@ -49,164 +49,201 @@ static void LogDebug(const char *prefix, xpc_object_t o)
void DNSXRefDeAlloc(DNSXConnRef connRef)
{
- if (!connRef)
+ if (connRef == NULL)
{
- syslog(LOG_WARNING, "dns_services: DNSXRefDeAlloc called with NULL DNSXConnRef");
+ syslog(LOG_WARNING, "dns_services DD: DNSXRefDeAlloc called with NULL DNSXConnRef");
return;
}
-
+
// Schedule this work on the internal library queue
dispatch_sync(connRef->lib_q, ^{
-
+ xpc_connection_set_event_handler((connRef)->conn_ref, ^(__unused xpc_object_t event){}); // ignore any more events
xpc_release(connRef->conn_ref);
+ connRef->conn_ref = NULL;
+ dispatch_release(connRef->lib_q);
+ connRef->lib_q = NULL;
connRef->AppCallBack = NULL;
- dispatch_release(connRef->client_q);
-
+ syslog(LOG_NOW, "dns_services DD: DNSXRefDeAlloc successfully DeAllocated conn_ref & lib_q");
+
+ dispatch_async((connRef)->client_q, ^{
+ dispatch_release(connRef->client_q);
+ connRef->client_q = NULL;
+ free(connRef);
+ syslog(LOG_NOW, "dns_services DD: DNSXRefDeAlloc successfully DeAllocated client_q & freed connRef");
+ });
});
-
- dispatch_release(connRef->lib_q);
- free(connRef);
-
- syslog(LOG_INFO, "dns_services: DNSXRefDeAlloc successfully DeAllocated connRef");
-
+
+ // DO NOT reference connRef after this comment, as it may have been freed
+ syslog(LOG_NOW, "dns_services DD: DNSXRefDeAlloc successfully DeAllocated connRef");
+
}
-// Sends the Msg(Dictionary) to the Server
-static DNSXErrorType SendMsgToServer(DNSXConnRef *connRef, xpc_object_t msg, bool old_conn)
+// Sends the Msg(Dictionary) to the Server Daemon
+static DNSXErrorType SendMsgToServer(DNSXConnRef connRef, xpc_object_t msg)
{
DNSXErrorType errx = kDNSX_NoError;
-
- LogDebug("dns_services: SendMsgToServer", msg);
- xpc_connection_set_event_handler((*connRef)->conn_ref, ^(xpc_object_t recv_msg)
+ LogDebug("dns_services DD: SendMsgToServer Sending msg to Daemon", msg);
+
+ xpc_connection_send_message_with_reply((connRef)->conn_ref, msg, (connRef)->lib_q, ^(xpc_object_t recv_msg)
{
xpc_type_t type = xpc_get_type(recv_msg);
-
+
if (type == XPC_TYPE_DICTIONARY)
{
- LogDebug("dns_services: SendMsgToServer SUCCESS CALLBACK FROM SERVER", recv_msg);
- syslog(LOG_INFO, "dns_services: Successfully Sent Msg to the Daemon");
+ LogDebug("dns_services DD: SendMsgToServer Received reply msg from Daemon", recv_msg);
uint64_t daemon_status = xpc_dictionary_get_uint64(recv_msg, kDNSDaemonReply);
-
- // Schedule the AppCallBacks on the Client Specified Queue
- switch (daemon_status)
- {
- case kDNSDaemonEngaged:
- dispatch_async((*connRef)->client_q, ^{
- ((DNSXEnableProxyReply)(*connRef)->AppCallBack)((*connRef), kDNSX_Engaged);
- });
- break;
- case kDNSMsgReceived:
- dispatch_async((*connRef)->client_q, ^{
- ((DNSXEnableProxyReply)(*connRef)->AppCallBack)((*connRef), kDNSX_NoError);
- });
- break;
- default:
- dispatch_async((*connRef)->client_q, ^{
- ((DNSXEnableProxyReply)(*connRef)->AppCallBack)((*connRef), kDNSX_UnknownErr);
- });
- break;
- }
-
+
+ if (connRef == NULL || connRef->client_q == NULL || connRef->AppCallBack == NULL)
+ {
+ // If connRef is bad, do not schedule any callbacks to the client
+ syslog(LOG_WARNING, "dns_services DD: SendMsgToServer: connRef is BAD Daemon status code [%llu]", daemon_status);
+ }
+ else
+ {
+ switch (daemon_status)
+ {
+ case kDNSMsg_NoError:
+ dispatch_async((connRef)->client_q, ^{
+ if (connRef->AppCallBack != NULL)
+ ((DNSXEnableProxyReply)connRef->AppCallBack)(connRef, kDNSX_NoError);
+ });
+ break;
+
+ case kDNSMsg_BadArg:
+ dispatch_async((connRef)->client_q, ^{
+ if (connRef->AppCallBack != NULL)
+ ((DNSXEnableProxyReply)connRef->AppCallBack)(connRef, kDNSX_BadParam);
+ });
+ break;
+
+ default:
+ dispatch_async((connRef)->client_q, ^{
+ if (connRef->AppCallBack != NULL)
+ ((DNSXEnableProxyReply)connRef->AppCallBack)(connRef, kDNSX_UnknownErr);
+ });
+ break;
+ }
+ }
}
else
{
- LogDebug("dns_services: SendMsgToServer UNEXPECTED CALLBACK FROM SERVER", recv_msg);
- syslog(LOG_WARNING, "dns_services: Connection failed since NO privileges to access service OR Daemon NOT Running");
- dispatch_async((*connRef)->client_q, ^{
- ((DNSXEnableProxyReply)(*connRef)->AppCallBack)((*connRef), kDNSX_DaemonNotRunning);
- });
+ syslog(LOG_WARNING, "dns_services DD: SendMsgToServer Received unexpected reply from daemon [%s]",
+ xpc_dictionary_get_string(recv_msg, XPC_ERROR_KEY_DESCRIPTION));
+ LogDebug("dns_services DD: SendMsgToServer Unexpected Reply contents", recv_msg);
}
});
- // To prevent Over-Resume of a connection
- if (!old_conn)
- xpc_connection_resume((*connRef)->conn_ref);
- xpc_connection_send_message((*connRef)->conn_ref, msg);
- if (!errx)
- syslog(LOG_INFO, "dns_services: SendMSgToServer sent Msg Dict successfully to Daemon");
return errx;
}
-// Creates a new DNSX Connection Reference(DNSXConnRef).
-// If DNSXConnRef exists, you may want to use that depending on the use case
-static DNSXErrorType InitConnection(DNSXConnRef *connRef, const char *servname, dispatch_queue_t clientq, void *AppCallBack)
+// Creates a new DNSX Connection Reference(DNSXConnRef)
+static DNSXErrorType InitConnection(DNSXConnRef *connRefOut, const char *servname, dispatch_queue_t clientq, void *AppCallBack)
{
- if (!connRef)
+ if (connRefOut == NULL)
+ return kDNSX_BadParam;
+
+ // Use a DNSXConnRef on the stack to be captured in the blocks below, rather than capturing the DNSXConnRef* owned by the client
+ DNSXConnRef connRef = malloc(sizeof(struct _DNSXConnRef_t));
+ if (connRef == NULL)
{
- syslog(LOG_WARNING, "dns_services: InitConnection() called with NULL DNSXConnRef");
- return kDNSX_BadParam;
+ syslog(LOG_WARNING, "dns_services DD: InitConnection() No memory to allocate!");
+ return kDNSX_NoMem;
}
-
- *connRef = malloc(sizeof(struct _DNSXConnRef_t));
- if (!(*connRef))
+
+ // Initialize the DNSXConnRef
+ dispatch_retain(clientq);
+ connRef->client_q = clientq;
+ connRef->AppCallBack = AppCallBack;
+ connRef->lib_q = dispatch_queue_create("com.apple.mDNSResponder.libdns_services.q", DISPATCH_QUEUE_SERIAL);
+ connRef->conn_ref = xpc_connection_create_mach_service(servname, connRef->lib_q, XPC_CONNECTION_MACH_SERVICE_PRIVILEGED);
+
+ if (connRef->conn_ref == NULL || connRef->lib_q == NULL)
{
- syslog(LOG_WARNING, "dns_services: InitConnection() No memory to allocate");
+ syslog(LOG_WARNING, "dns_services DD: InitConnection() conn_ref/lib_q is NULL");
+ if (connRef != NULL)
+ free(connRef);
return kDNSX_NoMem;
}
-
- // Initialize the DNSXConnRef
- dispatch_retain(clientq);
- (*connRef)->client_q = clientq;
- (*connRef)->AppCallBack = AppCallBack;
- (*connRef)->lib_q = dispatch_queue_create("com.apple.mDNSResponder.libdns_services.q", NULL);
- (*connRef)->conn_ref = xpc_connection_create_mach_service(servname, (*connRef)->lib_q, XPC_CONNECTION_MACH_SERVICE_PRIVILEGED);
-
- syslog(LOG_INFO, "dns_services: InitConnection() successfully create a new DNSXConnRef");
+
+ xpc_connection_set_event_handler(connRef->conn_ref, ^(xpc_object_t event)
+ {
+ if (connRef == NULL || connRef->client_q == NULL || connRef->AppCallBack == NULL)
+ {
+ // If connRef is bad, do not schedule any callbacks to the client
+ syslog(LOG_WARNING, "dns_services DD: InitConnection: connRef is BAD Unexpected Connection Error [%s]",
+ xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION));
+ }
+ else
+ {
+ syslog(LOG_WARNING, "dns_services DD: InitConnection: Unexpected Connection Error [%s] Ping the client",
+ xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION));
+ dispatch_async(connRef->client_q, ^{
+ if (connRef->AppCallBack != NULL)
+ ((DNSXEnableProxyReply)connRef->AppCallBack)(connRef, kDNSX_DaemonNotRunning);
+ });
+ }
+
+ });
+ xpc_connection_resume(connRef->conn_ref);
+
+ *connRefOut = connRef;
+
return kDNSX_NoError;
}
-DNSXErrorType DNSXEnableProxy(DNSXConnRef *connRef, DNSProxyParameters proxyparam, IfIndex inIfindexArr[MaxInputIf],
- IfIndex outIfindex, dispatch_queue_t clientq, DNSXEnableProxyReply callBack)
+DNSXErrorType DNSXEnableProxy(DNSXConnRef *connRef, DNSProxyParameters proxyparam, IfIndex inIfindexArr[MaxInputIf],
+ IfIndex outIfindex, dispatch_queue_t clientq, DNSXEnableProxyReply callBack)
{
-
+
DNSXErrorType errx = kDNSX_NoError;
- bool old_conn = false;
-
+
// Sanity Checks
- if (!connRef || !callBack || !clientq)
+ if (connRef == NULL || callBack == NULL || clientq == NULL)
{
- syslog(LOG_WARNING, "dns_services: DNSXEnableProxy called with NULL DNSXConnRef OR Callback OR ClientQ parameter");
+ syslog(LOG_WARNING, "dns_services DD: DNSXEnableProxy called with NULL DNSXConnRef OR Callback OR ClientQ parameter");
return kDNSX_BadParam;
- }
-
- // If no connRef, get it from InitConnection()
- if (!*connRef)
+ }
+
+ // Get connRef from InitConnection()
+ if (*connRef == NULL)
{
errx = InitConnection(connRef, kDNSProxyService, clientq, callBack);
if (errx) // On error InitConnection() leaves *connRef set to NULL
{
- syslog(LOG_WARNING, "dns_services: Since InitConnection() returned %d error returning w/o sending msg", errx);
+ syslog(LOG_WARNING, "dns_services DD: Since InitConnection() returned %d error returning w/o sending msg", errx);
return errx;
}
}
- else // Client already has a valid connRef
+ else // Client already has a connRef and this is not valid use for this SPI
{
- old_conn = true;
+ syslog(LOG_WARNING, "dns_services DD: Client already has a valid connRef! This is incorrect usage from the client");
+ return kDNSX_BadParam;
}
-
+
// Create Dictionary To Send
- xpc_object_t dict = xpc_dictionary_create(NULL, NULL, 0);
- if (!dict)
+ xpc_object_t dict = xpc_dictionary_create(NULL, NULL, 0);
+ if (dict == NULL)
{
- syslog(LOG_WARNING, "dns_services: DNSXEnableProxy could not create the Msg Dict To Send!");
+ syslog(LOG_WARNING, "dns_services DD: DNSXEnableProxy could not create the Msg Dict To Send!");
DNSXRefDeAlloc(*connRef);
- return kDNSX_DictError;
+ return kDNSX_NoMem;
}
-
+
xpc_dictionary_set_uint64(dict, kDNSProxyParameters, proxyparam);
-
+
xpc_dictionary_set_uint64(dict, kDNSInIfindex0, inIfindexArr[0]);
xpc_dictionary_set_uint64(dict, kDNSInIfindex1, inIfindexArr[1]);
- xpc_dictionary_set_uint64(dict, kDNSInIfindex2, inIfindexArr[2]);
+ xpc_dictionary_set_uint64(dict, kDNSInIfindex2, inIfindexArr[2]);
xpc_dictionary_set_uint64(dict, kDNSInIfindex3, inIfindexArr[3]);
xpc_dictionary_set_uint64(dict, kDNSInIfindex4, inIfindexArr[4]);
-
+
xpc_dictionary_set_uint64(dict, kDNSOutIfindex, outIfindex);
-
- errx = SendMsgToServer(connRef, dict, old_conn);
+
+ errx = SendMsgToServer(*connRef, dict);
xpc_release(dict);
-
- return errx;
+ dict = NULL;
+
+ return errx;
}
diff --git a/mDNSResponder/mDNSMacOSX/Private/dns_services.h b/mDNSResponder/mDNSMacOSX/Private/dns_services.h
index 7b74e10d..25b911f1 100644
--- a/mDNSResponder/mDNSMacOSX/Private/dns_services.h
+++ b/mDNSResponder/mDNSMacOSX/Private/dns_services.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2012-2015 Apple Inc. All rights reserved.
*
*
* @header Interface to DNSX SPI
@@ -21,15 +21,12 @@ typedef enum
{
kDNSX_NoError = 0,
kDNSX_UnknownErr = -65537, /* 0xFFFE FFFF */
- kDNSX_NoMem = -65539,
- kDNSX_BadParam = -65540,
- kDNSX_DaemonNotRunning = -65563, /* Background daemon not running */
- kDNSX_DictError = -65565, /* Dictionary Error */
- kDNSX_Engaged = -65566, /* DNS Proxy is in use by another client */
- kDNSX_Timeout = -65568
+ kDNSX_NoMem = -65539, /* No Memory */
+ kDNSX_BadParam = -65540, /* Client passes invalid arg/Bad use of SPI */
+ kDNSX_DaemonNotRunning = -65563 /* Daemon not running */
} DNSXErrorType;
-// A max of 5 input interfaces can be processed at one time
+// A max of 5 input interfaces can be processed
#define MaxInputIf 5
#define IfIndex uint64_t
#define kDNSIfindexAny 0
@@ -42,10 +39,10 @@ typedef enum
} DNSProxyParameters;
/*********************************************************************************************
-*
-* Enable DNS Proxy Functionality
-*
-*********************************************************************************************/
+ *
+ * Enable DNS Proxy Functionality
+ *
+ *********************************************************************************************/
/* DNSXEnableProxy : Turns ON the DNS Proxy (Details below)
*
@@ -53,27 +50,26 @@ typedef enum
*
* connRef: The DNSXConnRef initialized by DNSXEnableProxy().
*
- * errCode: Will be kDNSX_NoError on success, otherwise will indicate the
- * failure that occurred. Other parameters are undefined if
- * errCode is nonzero.
+ * errCode: Will be kDNSX_NoError on success, otherwise will indicate the
+ * failure that occurred.
*
*/
typedef void (*DNSXEnableProxyReply)
(
DNSXConnRef connRef,
- DNSXErrorType errCode
+ DNSXErrorType errCode
);
/* DNSXEnableProxy
- *
- * Enables the DNS Proxy functionality which will remain ON until the client terminates explictly (or exits/crashes).
- * Client can turn it OFF by passing the returned DNSXConnRef to DNSXRefDeAlloc()
- *
+ *
+ * Enables the DNS Proxy functionality which will remain ON until the client explicitly turns it OFF
+ * by passing the returned DNSXConnRef to DNSXRefDeAlloc(), or the client exits or crashes.
+ *
* DNSXEnableProxy() Parameters:
*
- * connRef: A pointer to DNSXConnRef that is initialized to NULL when called for the first
- * time. If the call succeeds it will be initialized to a non-NULL value.
+ * connRef: A pointer to DNSXConnRef that is initialized to NULL.
+ * If the call succeeds it will be initialized to a non-NULL value.
* Client terminates the DNS Proxy by passing this DNSXConnRef to DNSXRefDeAlloc().
*
* proxyparam: Enable DNS Proxy functionality with parameters that are described in
@@ -88,16 +84,19 @@ typedef void (*DNSXEnableProxyReply)
* outIfindex: Output interface on which the query will be forwarded.
* Passing kDNSIfindexAny causes DNS Queries to be sent on the primary interface.
*
+ * Note: It is the responsibility of the client to ensure the input/output interface
+ * indexes are valid.
+ *
* clientq: Queue the client wants to schedule the callBack on (Note: Must not be NULL)
*
* callBack: CallBack function for the client that indicates success or failure.
- * Note: callback may be invoked more than once, For eg. if enabling DNS Proxy
- * first succeeds and the daemon possibly crashes sometime later.
+ * Note: callback may be invoked more than once, For e.g. if enabling DNS Proxy
+ * first succeeds and the daemon possibly crashes sometime later.
*
* return value: Returns kDNSX_NoError when no error otherwise returns an error code indicating
- * the error that occurred. Note: A return value of kDNSX_NoError does not mean
+ * the error that occurred. Note: A return value of kDNSX_NoError does not mean
* that DNS Proxy was successfully enabled. The callBack may asynchronously
- * return an error (such as kDNSX_DaemonNotRunning/ kDNSX_Engaged)
+ * return an error (such as kDNSX_DaemonNotRunning)
*
*/
@@ -109,7 +108,7 @@ DNSXErrorType DNSXEnableProxy
IfIndex outIfindex,
dispatch_queue_t clientq,
DNSXEnableProxyReply callBack
-);
+ );
/* DNSXRefDeAlloc()
*
@@ -121,4 +120,4 @@ DNSXErrorType DNSXEnableProxy
*/
void DNSXRefDeAlloc(DNSXConnRef connRef);
-#endif /* _DNS_SERVICES_H */
+#endif
diff --git a/mDNSResponder/mDNSMacOSX/Private/dns_xpc.h b/mDNSResponder/mDNSMacOSX/Private/dns_xpc.h
index 10ae01fa..4c961a84 100644
--- a/mDNSResponder/mDNSMacOSX/Private/dns_xpc.h
+++ b/mDNSResponder/mDNSMacOSX/Private/dns_xpc.h
@@ -26,8 +26,8 @@
typedef enum
{
- kDNSMsgReceived = 0,
- kDNSDaemonEngaged
+ kDNSMsg_NoError = 0,
+ kDNSMsg_BadArg
} DaemonReplyStatusCodes;
#endif // DNS_XPC_H
diff --git a/mDNSResponder/mDNSMacOSX/Private/xpc_services.c b/mDNSResponder/mDNSMacOSX/Private/xpc_services.c
index 7a0e29fb..fb357806 100644
--- a/mDNSResponder/mDNSMacOSX/Private/xpc_services.c
+++ b/mDNSResponder/mDNSMacOSX/Private/xpc_services.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2012-2015 Apple Inc. All rights reserved.
*
* xpc_services.c
* mDNSResponder
@@ -90,7 +90,7 @@ mDNSlocal void handle_dps_request(xpc_object_t req)
xpc_object_t reply = xpc_dictionary_create(NULL, NULL, 0);
if (reply)
{
- xpc_dictionary_set_uint64(reply, kDNSDaemonReply, kDNSDaemonEngaged);
+ xpc_dictionary_set_uint64(reply, kDNSDaemonReply, kDNSMsg_BadArg);
xpc_connection_send_message(remote_conn, reply);
xpc_release(reply);
}
@@ -104,12 +104,13 @@ mDNSlocal void handle_dps_request(xpc_object_t req)
return;
}
}
-
+
+
+ xpc_object_t response = xpc_dictionary_create_reply(req);
// Return Success Status to the client
- xpc_object_t response = xpc_dictionary_create(NULL, NULL, 0);
if (response)
{
- xpc_dictionary_set_uint64(response, kDNSDaemonReply, kDNSMsgReceived);
+ xpc_dictionary_set_uint64(response, kDNSDaemonReply, kDNSMsg_NoError);
xpc_connection_send_message(remote_conn, response);
xpc_release(response);
}
@@ -155,21 +156,26 @@ mDNSlocal mDNSBool IsEntitled(xpc_connection_t conn, const char *password)
LogMsg("IsEntitled: Client Entitlement is NULL");
}
+ if (!entitled)
+ LogMsg("IsEntitled: DNSProxyService Client is missing Entitlement!");
+
return entitled;
}
mDNSlocal void accept_dps_client(xpc_connection_t conn)
{
- uid_t euid;
- euid = xpc_connection_get_euid(conn);
+ uid_t c_euid;
+ int c_pid;
+ c_euid = xpc_connection_get_euid(conn);
+ c_pid = xpc_connection_get_pid(conn);
- if (euid != 0 || !IsEntitled(conn, kDNSProxyService))
+ if (c_euid != 0 || !IsEntitled(conn, kDNSProxyService))
{
- LogMsg("accept_dps_client: DNSProxyService Client Pid[%d] is missing Entitlement or is not root!", (int) xpc_connection_get_pid(conn));
+ LogMsg("accept_dps_client: DNSProxyService Client PID[%d] is missing Entitlement or is not running as root!", c_pid);
xpc_connection_cancel(conn);
return;
}
-
+
xpc_retain(conn);
xpc_connection_set_target_queue(conn, dps_queue);
xpc_connection_set_event_handler(conn, ^(xpc_object_t req_msg)
@@ -180,16 +186,16 @@ mDNSlocal void accept_dps_client(xpc_connection_t conn)
{
handle_dps_request(req_msg);
}
- // We hit the case below only if Client Terminated DPS Connection OR Crashed
- else
+ else // We hit this case ONLY if Client Terminated DPS Connection OR Crashed
{
LogInfo("accept_dps_client: DPS Client %p teared down the connection or Crashed", (void *) conn);
// Only the Client that has activated DPS should be able to terminate it
- if (((int)xpc_connection_get_pid(conn)) == dps_client_pid)
+ if (c_pid == dps_client_pid)
handle_dps_terminate();
xpc_release(conn);
}
});
+
xpc_connection_resume(conn);
}
@@ -215,8 +221,7 @@ mDNSlocal void init_dnsproxy_service(void)
LogInfo("init_dnsproxy_service: New DNSProxyService Client %p", eventmsg);
accept_dps_client(eventmsg);
}
- // Ideally, we would never hit the cases below
- else if (type == XPC_TYPE_ERROR)
+ else if (type == XPC_TYPE_ERROR) // Ideally, we would never hit these cases
{
LogMsg("init_dnsproxy_service: XPCError: %s", xpc_dictionary_get_string(eventmsg, XPC_ERROR_KEY_DESCRIPTION));
return;
@@ -227,6 +232,7 @@ mDNSlocal void init_dnsproxy_service(void)
return;
}
});
+
xpc_connection_resume(dps_listener);
}
diff --git a/mDNSResponder/mDNSMacOSX/SymptomReporter.c b/mDNSResponder/mDNSMacOSX/SymptomReporter.c
new file mode 100644
index 00000000..39ce0d41
--- /dev/null
+++ b/mDNSResponder/mDNSMacOSX/SymptomReporter.c
@@ -0,0 +1,187 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2015 Apple Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mDNSEmbeddedAPI.h"
+
+#include <arpa/inet.h>
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/socket.h>
+#include <Symptoms/SymptomReporter.h>
+
+#define SYMPTOM_REPORTER_mDNSResponder_NUMERIC_ID 101
+#define SYMPTOM_REPORTER_mDNSResponder_TEXT_ID "com.apple.mDNSResponder"
+
+#define SYMPTOM_DNS_NO_REPLIES 0x00065001
+#define SYMPTOM_DNS_RESUMED_RESPONDING 0x00065002
+
+static symptom_framework_t symptomReporter;
+static symptom_framework_t (*symptom_framework_init_f)(symptom_ident_t id, const char *originator_string) = mDNSNULL;
+static symptom_t (*symptom_new_f)(symptom_framework_t framework, symptom_ident_t id) = mDNSNULL;
+static int (*symptom_set_additional_qualifier_f)(symptom_t symptom, uint32_t qualifier_type, size_t qualifier_len, void *qualifier_data) = mDNSNULL;
+static int (*symptom_send_f)(symptom_t symptom) = mDNSNULL;
+
+mDNSlocal mStatus SymptomReporterInitCheck(void)
+{
+ mStatus err;
+ static mDNSBool isInitialized = mDNSfalse;
+ static void *symptomReporterLib = mDNSNULL;
+ static const char path[] = "/System/Library/PrivateFrameworks/Symptoms.framework/Frameworks/SymptomReporter.framework/SymptomReporter";
+
+ if (!isInitialized)
+ {
+ if (!symptomReporterLib)
+ {
+ symptomReporterLib = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
+ if (!symptomReporterLib)
+ goto exit;
+ }
+
+ if (!symptom_framework_init_f)
+ {
+ symptom_framework_init_f = dlsym(symptomReporterLib, "symptom_framework_init");
+ if (!symptom_framework_init_f)
+ goto exit;
+ }
+
+ if (!symptom_new_f)
+ {
+ symptom_new_f = dlsym(symptomReporterLib, "symptom_new");
+ if (!symptom_new_f)
+ goto exit;
+ }
+
+ if (!symptom_set_additional_qualifier_f)
+ {
+ symptom_set_additional_qualifier_f = dlsym(symptomReporterLib, "symptom_set_additional_qualifier");
+ if (!symptom_set_additional_qualifier_f)
+ goto exit;
+ }
+
+ if (!symptom_send_f)
+ {
+ symptom_send_f = dlsym(symptomReporterLib, "symptom_send");
+ if (!symptom_send_f)
+ goto exit;
+ }
+
+ symptomReporter = symptom_framework_init_f(SYMPTOM_REPORTER_mDNSResponder_NUMERIC_ID, SYMPTOM_REPORTER_mDNSResponder_TEXT_ID);
+ isInitialized = mDNStrue;
+ }
+
+exit:
+ err = isInitialized ? mStatus_NoError : mStatus_NotInitializedErr;
+ return err;
+}
+
+mDNSlocal mStatus SymptomReporterReportDNSReachability(const mDNSAddr *addr, mDNSBool isReachable)
+{
+ mStatus err;
+ symptom_t symptom;
+ struct sockaddr_storage sockAddr;
+ size_t sockAddrSize;
+
+ LogInfo("SymptomReporterReportDNSReachability: DNS server %#a is %sreachable", addr, isReachable ? "" : "un");
+
+ if (addr->type == mDNSAddrType_IPv4)
+ {
+ struct sockaddr_in *sin = (struct sockaddr_in *)&sockAddr;
+ sockAddrSize = sizeof(*sin);
+ mDNSPlatformMemZero(sin, sockAddrSize);
+ sin->sin_len = sockAddrSize;
+ sin->sin_family = AF_INET;
+ sin->sin_addr.s_addr = addr->ip.v4.NotAnInteger;
+ }
+ else if (addr->type == mDNSAddrType_IPv6)
+ {
+ struct sockaddr_in6* sin6 = (struct sockaddr_in6*)&sockAddr;
+ sockAddrSize = sizeof(*sin6);
+ mDNSPlatformMemZero(sin6, sockAddrSize);
+ sin6->sin6_len = sockAddrSize;
+ sin6->sin6_family = AF_INET6;
+ sin6->sin6_addr = *(struct in6_addr *)&addr->ip.v6;
+ }
+ else
+ {
+ LogMsg("SymptomReporterReportDNSReachability: addr is not an IPv4 or IPv6 address!");
+ err = mStatus_BadParamErr;
+ goto exit;
+ }
+
+ symptom = symptom_new_f(symptomReporter, isReachable ? SYMPTOM_DNS_RESUMED_RESPONDING : SYMPTOM_DNS_NO_REPLIES);
+ symptom_set_additional_qualifier_f(symptom, 1, sockAddrSize, (void *)&sockAddr);
+ symptom_send_f(symptom);
+ err = mStatus_NoError;
+
+exit:
+ return err;
+}
+
+mDNSexport mStatus SymptomReporterDNSServerReachable(mDNS *const m, const mDNSAddr *addr)
+{
+ mStatus err;
+ DNSServer *s;
+ mDNSBool found = mDNSfalse;
+
+ err = SymptomReporterInitCheck();
+ if (err != mStatus_NoError)
+ goto exit;
+
+ for (s = m->DNSServers; s; s = s->next)
+ {
+ if (s->flags & DNSServer_FlagDelete)
+ continue;
+ if ((s->flags & DNSServer_FlagUnreachable) && mDNSSameAddress(addr, &s->addr))
+ {
+ s->flags &= ~DNSServer_FlagUnreachable;
+ NumUnreachableDNSServers--;
+ found = mDNStrue;
+ }
+ }
+
+ if (!found)
+ {
+ err = mStatus_NoSuchNameErr;
+ goto exit;
+ }
+
+ err = SymptomReporterReportDNSReachability(addr, mDNStrue);
+
+exit:
+ return err;
+}
+
+mDNSexport mStatus SymptomReporterDNSServerUnreachable(DNSServer *s)
+{
+ mStatus err;
+
+ err = SymptomReporterInitCheck();
+ if (err != mStatus_NoError)
+ goto exit;
+
+ if ((s->flags & DNSServer_FlagDelete) || (s->flags & DNSServer_FlagUnreachable))
+ goto exit;
+
+ s->flags |= DNSServer_FlagUnreachable;
+ NumUnreachableDNSServers++;
+
+ err = SymptomReporterReportDNSReachability(&s->addr, mDNSfalse);
+
+exit:
+ return err;
+}
diff --git a/mDNSResponder/mDNSMacOSX/VPNService.c b/mDNSResponder/mDNSMacOSX/VPNService.c
deleted file mode 100644
index 623ddbf4..00000000
--- a/mDNSResponder/mDNSMacOSX/VPNService.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2013 Apple Computer, Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "mDNSMacOSX.h"
-#include <SystemConfiguration/VPNAppLayerPrivate.h>
-
-mDNSexport mDNSs32 mDNSPlatformGetServiceID(mDNS *const m, DNSQuestion *q)
-{
- (void) m;
- int sid;
-
- if (q->pid)
- sid = VPNAppLayerGetMatchingServiceIdentifier(q->pid, NULL);
- else
- sid = VPNAppLayerGetMatchingServiceIdentifier(0, q->uuid);
-
- LogInfo("mDNSPlatformGetServiceID: returning %d for %##s (%s)", sid, q->qname.c, DNSTypeName(q->qtype));
-
- return sid;
-}
diff --git a/mDNSResponder/mDNSMacOSX/base.xcconfig b/mDNSResponder/mDNSMacOSX/base.xcconfig
deleted file mode 100644
index 28d9c732..00000000
--- a/mDNSResponder/mDNSMacOSX/base.xcconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-PUBLIC_HEADERS_FOLDER_PATH = /usr/include
-PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include
diff --git a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.dnsextd.plist b/mDNSResponder/mDNSMacOSX/com.apple.dnsextd.plist
index e31b391f..e31b391f 100644
--- a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.dnsextd.plist
+++ b/mDNSResponder/mDNSMacOSX/com.apple.dnsextd.plist
diff --git a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.plist b/mDNSResponder/mDNSMacOSX/com.apple.mDNSResponder.plist
index 4226c795..8f5a6408 100644
--- a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.plist
+++ b/mDNSResponder/mDNSMacOSX/com.apple.mDNSResponder.plist
@@ -20,8 +20,8 @@
<dict>
<key>com.apple.mDNSResponder</key>
<true/>
- <key>com.apple.mDNSResponder.dnsproxy</key>
- <true/>
+ <key>com.apple.mDNSResponder.dnsproxy</key>
+ <true/>
</dict>
<key>Sockets</key>
<dict>
@@ -35,11 +35,9 @@
<integer>438</integer>
</dict>
</dict>
- <key>EnableTransactions</key>
- <true/>
- <key>BeginTransactionAtShutdown</key>
- <true/>
<key>POSIXSpawnType</key>
<string>Interactive</string>
+ <key>EnablePressuredExit</key>
+ <false/>
</dict>
</plist>
diff --git a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.helper.plist b/mDNSResponder/mDNSMacOSX/com.apple.mDNSResponderHelper.plist
index 09b61e08..f1e3027b 100644
--- a/mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.helper.plist
+++ b/mDNSResponder/mDNSMacOSX/com.apple.mDNSResponderHelper.plist
@@ -15,10 +15,6 @@
<key>com.apple.mDNSResponderHelper</key>
<true/>
</dict>
- <key>EnableTransactions</key>
- <true/>
- <key>BeginTransactionAtShutdown</key>
- <true/>
<key>POSIXSpawnType</key>
<string>Interactive</string>
</dict>
diff --git a/mDNSResponder/mDNSMacOSX/daemon.c b/mDNSResponder/mDNSMacOSX/daemon.c
index 1b257ea2..c1cabb1a 100644
--- a/mDNSResponder/mDNSMacOSX/daemon.c
+++ b/mDNSResponder/mDNSMacOSX/daemon.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <mach/mach.h>
@@ -26,7 +25,6 @@
#include <fcntl.h>
#include <launch.h>
#include <launch_priv.h> // for launch_socket_service_check_in()
-#include <vproc.h>
#include <pwd.h>
#include <sys/event.h>
#include <pthread.h>
@@ -51,16 +49,33 @@
#include "../mDNSMacOSX/DNSServiceDiscovery.h"
#include "helper.h"
+#if TARGET_OS_EMBEDDED
+#include "Metrics.h"
+#endif
+
static aslclient log_client = NULL;
static aslmsg log_msg = NULL;
-// Used on Embedded Side for Reading mDNSResponder Managed Preferences Profile
+// Used on iOS ONLY for reading mDNSResponder Managed Preferences Profile
#if TARGET_OS_EMBEDDED
#define kmDNSEnableLoggingStr CFSTR("EnableLogging")
#define kmDNSResponderPrefIDStr "com.apple.mDNSResponder.plist"
#define kmDNSResponderPrefID CFSTR(kmDNSResponderPrefIDStr)
#endif
+
+// Used on OSX(10.11.x onwards) for manipulating mDNSResponder program arguments
+#if APPLE_OSX_mDNSResponder && !TARGET_OS_EMBEDDED
+// plist file to read the user's preferences
+#define kProgramArguments CFSTR("/Library/Preferences/com.apple.mDNSResponder.plist")
+// possible arguments for external customers
+#define kDebugLogging CFSTR("DebugLogging")
+#define kUnicastPacketLogging CFSTR("UnicastPacketLogging")
+#define kAlwaysAppendSearchDomains CFSTR("AlwaysAppendSearchDomains")
+#define kNoMulticastAdvertisements CFSTR("NoMulticastAdvertisements")
+#define kStrictUnicastOrdering CFSTR("StrictUnicastOrdering")
+#endif
+
//*************************************************************************************************************
#if COMPILER_LIKES_PRAGMA_MARK
#pragma mark - Globals
@@ -68,12 +83,13 @@ static aslmsg log_msg = NULL;
static mDNS_PlatformSupport PlatformStorage;
-// Start off with a default cache of 16K (99 records)
-// Each time we grow the cache we add another 99 records
-// 99 * 164 = 16236 bytes.
-// This fits in four 4kB pages, with 148 bytes spare for memory block headers and similar overhead
-#define RR_CACHE_SIZE ((16*1024) / sizeof(CacheRecord))
+// Start off with a default cache of 32K (141 records of 232 bytes each)
+// Each time we grow the cache we add another 141 records
+// 141 * 164 = 32712 bytes.
+// This fits in eight 4kB pages, with 56 bytes spare for memory block headers and similar overhead
+#define RR_CACHE_SIZE ((32*1024) / sizeof(CacheRecord))
static CacheEntity rrcachestorage[RR_CACHE_SIZE];
+struct CompileTimeAssertionChecks_RR_CACHE_SIZE { char a[(RR_CACHE_SIZE >= 141) ? 1 : -1]; };
static mach_port_t m_port = MACH_PORT_NULL;
@@ -85,7 +101,7 @@ static mach_port_t signal_port = MACH_PORT_NULL;
#endif // MDNSRESPONDER_USES_LIB_DISPATCH_AS_PRIMARY_EVENT_LOOP_MECHANISM
static dnssd_sock_t *launchd_fds = mDNSNULL;
-static mDNSu32 launchd_fds_count = 0;
+static size_t launchd_fds_count = 0;
// mDNS Mach Message Timeout, in milliseconds.
// We need this to be short enough that we don't deadlock the mDNSResponder if a client
@@ -214,22 +230,16 @@ static KQSocketEventSource *gEventSources;
char _malloc_options[] = "AXZ";
-mDNSexport void LogMemCorruption(const char *format, ...)
-{
- char buffer[512];
- va_list ptr;
- va_start(ptr,format);
- buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0;
- va_end(ptr);
- LogMsg("!!!! %s !!!!", buffer);
- NotifyOfElusiveBug("Memory Corruption", buffer);
-#if ForceAlerts
- *(long*)0 = 0; // Trick to crash and get a stack trace right here, if that's what we want
+mDNSlocal void validatelists(mDNS *const m, bool checkCRActiveQuestion)
+{
+#if TARGET_OS_WATCH
+ mDNSu32 NumAllInterfaceRecords = 0;
+ mDNSu32 NumAllInterfaceQuestions = 0;
+#else
+ mDNSu32 NumAllInterfaceRecords = 1;
+ mDNSu32 NumAllInterfaceQuestions = 1;
#endif
-}
-mDNSlocal void validatelists(mDNS *const m)
-{
// Check local lists
KQSocketEventSource *k;
for (k = gEventSources; k; k=k->next)
@@ -269,11 +279,15 @@ mDNSlocal void validatelists(mDNS *const m)
if (rr->resrec.name != &rr->namestorage)
LogMemCorruption("ResourceRecords list: %p name %p does not point to namestorage %p %##s",
rr, rr->resrec.name->c, rr->namestorage.c, rr->namestorage.c);
+ if (!AuthRecord_uDNS(rr) && !RRLocalOnly(rr)) NumAllInterfaceRecords++;
}
for (rr = m->DuplicateRecords; rr; rr=rr->next)
+ {
if (rr->next == (AuthRecord *)~0 || rr->resrec.RecordType == 0 || rr->resrec.RecordType == 0xFF)
LogMemCorruption("DuplicateRecords list: %p is garbage (%X)", rr, rr->resrec.RecordType);
+ if (!AuthRecord_uDNS(rr) && !RRLocalOnly(rr)) NumAllInterfaceRecords++;
+ }
rr = m->NewLocalRecords;
if (rr)
@@ -287,20 +301,26 @@ mDNSlocal void validatelists(mDNS *const m)
DNSQuestion *q;
for (q = m->Questions; q; q=q->next)
+ {
if (q->next == (DNSQuestion*)~0 || q->ThisQInterval == (mDNSs32) ~0)
LogMemCorruption("Questions list: %p is garbage (%lX %p)", q, q->ThisQInterval, q->next);
+ if (q->InterfaceID != mDNSInterface_LocalOnly && q->InterfaceID != mDNSInterface_P2P && mDNSOpaque16IsZero(q->TargetQID))
+ NumAllInterfaceQuestions++;
+ }
- CacheGroup *cg;
- CacheRecord *cr;
- mDNSu32 slot;
- FORALL_CACHERECORDS(slot, cg, cr)
- {
- if (cr->resrec.RecordType == 0 || cr->resrec.RecordType == 0xFF)
- LogMemCorruption("Cache slot %lu: %p is garbage (%X)", slot, cr, cr->resrec.RecordType);
- if (cr->CRActiveQuestion)
+ if (checkCRActiveQuestion) {
+ CacheGroup *cg;
+ CacheRecord *cr;
+ mDNSu32 slot;
+ FORALL_CACHERECORDS(slot, cg, cr)
{
- for (q = m->Questions; q; q=q->next) if (q == cr->CRActiveQuestion) break;
- if (!q) LogMemCorruption("Cache slot %lu: CRActiveQuestion %p not in m->Questions list %s", slot, cr->CRActiveQuestion, CRDisplayString(m, cr));
+ if (cr->resrec.RecordType == 0 || cr->resrec.RecordType == 0xFF)
+ LogMemCorruption("Cache slot %lu: %p is garbage (%X)", slot, cr, cr->resrec.RecordType);
+ if (cr->CRActiveQuestion)
+ {
+ for (q = m->Questions; q; q=q->next) if (q == cr->CRActiveQuestion) break;
+ if (!q) LogMemCorruption("Cache slot %lu: CRActiveQuestion %p not in m->Questions list %s", slot, cr->CRActiveQuestion, CRDisplayString(m, cr));
+ }
}
}
@@ -317,6 +337,14 @@ mDNSlocal void validatelists(mDNS *const m)
for (t = m->TunnelClients; t; t=t->next)
if (t->next == (ClientTunnel *)~0 || t->dstname.c[0] > 63)
LogMemCorruption("m->TunnelClients: %p is garbage (%d)", t, t->dstname.c[0]);
+
+#if TARGET_OS_WATCH
+ if (m->NumAllInterfaceRecords != NumAllInterfaceRecords)
+ LogMemCorruption("NumAllInterfaceRecords is %d should be %d", m->NumAllInterfaceRecords, NumAllInterfaceRecords);
+
+ if (m->NumAllInterfaceQuestions != NumAllInterfaceQuestions)
+ LogMemCorruption("NumAllInterfaceQuestions is %d should be %d", m->NumAllInterfaceQuestions, NumAllInterfaceQuestions);
+#endif
}
mDNSexport void *mallocL(char *msg, unsigned int size)
@@ -327,13 +355,13 @@ mDNSexport void *mallocL(char *msg, unsigned int size)
{ LogMsg("malloc( %s : %d ) failed", msg, size); return(NULL); }
else
{
- if (size > 24000) LogMsg("malloc( %s : %lu ) = %p suspiciously large", msg, size, &mem[2]);
- else if (MACOSX_MDNS_MALLOC_DEBUGGING >= 2) LogMsg("malloc( %s : %lu ) = %p", msg, size, &mem[2]);
+ if (size > 32768) LogMsg("malloc( %s : %lu ) @ %p suspiciously large", msg, size, &mem[2]);
+ else if (MACOSX_MDNS_MALLOC_DEBUGGING >= 2) LogMsg("malloc( %s : %lu ) @ %p", msg, size, &mem[2]);
mem[0] = 0xDEAD1234;
mem[1] = size;
//mDNSPlatformMemZero(&mem[2], size);
memset(&mem[2], 0xFF, size);
- validatelists(&mDNSStorage);
+ validatelists(&mDNSStorage, true);
return(&mem[2]);
}
}
@@ -345,12 +373,13 @@ mDNSexport void freeL(char *msg, void *x)
else
{
mDNSu32 *mem = ((mDNSu32 *)x) - 2;
- if (mem[0] != 0xDEAD1234) { LogMsg("free( %s @ %p ) !!!! NOT ALLOCATED !!!!", msg, &mem[2]); return; }
- if (mem[1] > 24000) LogMsg("free( %s : %ld @ %p) suspiciously large", msg, mem[1], &mem[2]);
- else if (MACOSX_MDNS_MALLOC_DEBUGGING >= 2) LogMsg("free( %s : %ld @ %p)", msg, mem[1], &mem[2]);
- //mDNSPlatformMemZero(mem, sizeof(mDNSu32) * 2 + mem[1]);
- memset(mem, 0xFF, sizeof(mDNSu32) * 2 + mem[1]);
- validatelists(&mDNSStorage);
+ if (mem[0] == 0xDEADDEAD) { LogMemCorruption("free( %s : %lu @ %p ) !!!! ALREADY DISPOSED !!!!", msg, mem[1], &mem[2]); return; }
+ if (mem[0] != 0xDEAD1234) { LogMemCorruption("free( %s : %lu @ %p ) !!!! NEVER ALLOCATED !!!!", msg, mem[1], &mem[2]); return; }
+ if (mem[1] > 32768) LogMsg("free( %s : %lu @ %p) suspiciously large", msg, mem[1], &mem[2]);
+ else if (MACOSX_MDNS_MALLOC_DEBUGGING >= 2) LogMsg("free( %s : %ld @ %p)", msg, mem[1], &mem[2]);
+ mem[0] = 0xDEADDEAD;
+ memset(mem+2, 0xFF, mem[1]);
+ validatelists(&mDNSStorage, false);
free(mem);
}
}
@@ -1272,6 +1301,8 @@ mDNSlocal void mDNSPreferencesSetNames(mDNS *const m, int key, domainlabel *old,
!SameDomainLabelCS(old->c, prevold->c) ||
!SameDomainLabelCS(new->c, prevnew->c))
{
+// Work around bug radar:21397654
+#ifndef __clang_analyzer__
if (old)
*prevold = *old;
else
@@ -1280,6 +1311,7 @@ mDNSlocal void mDNSPreferencesSetNames(mDNS *const m, int key, domainlabel *old,
*prevnew = *new;
else
prevnew->c[0] = 0;
+#endif
mDNSPreferencesSetName(key, old, new);
}
else
@@ -1319,6 +1351,12 @@ mDNSlocal void mDNS_StatusCallback(mDNS *const m, mStatus result)
else if (result == mStatus_GrowCache)
{
// Allocate another chunk of cache storage
+ static unsigned int allocated = 0;
+#if TARGET_OS_IPHONE
+ if (allocated >= 1000000) return; // For now we limit the cache to at most 1MB on iOS devices
+#endif
+ allocated += sizeof(CacheEntity) * RR_CACHE_SIZE;
+ // LogMsg("GrowCache %d * %d = %d; total so far %6u", sizeof(CacheEntity), RR_CACHE_SIZE, sizeof(CacheEntity) * RR_CACHE_SIZE, allocated);
CacheEntity *storage = mallocL("mStatus_GrowCache", sizeof(CacheEntity) * RR_CACHE_SIZE);
//LogInfo("GrowCache %d * %d = %d", sizeof(CacheEntity), RR_CACHE_SIZE, sizeof(CacheEntity) * RR_CACHE_SIZE);
if (storage) mDNS_GrowCache(m, storage, RR_CACHE_SIZE);
@@ -1454,7 +1492,7 @@ mDNSlocal mStatus UpdateRecord(ServiceRecordSet *srs, mach_port_t client, AuthRe
{
errormsg = "mDNS_Update";
freeL("RData", newrdata);
- return err;
+ goto fail;
}
return(mStatus_NoError);
@@ -1544,6 +1582,7 @@ mDNSexport kern_return_t provide_DNSServiceRegistrationRemoveRecord_rpc(mach_por
if ((natural_t)e->ClientID == reference)
{
err = RemoveRecord(&si->srs, e, client);
+ if (err) { errormsg = "RemoveRecord failed"; goto fail; }
break;
}
}
@@ -1708,6 +1747,7 @@ mDNSlocal void HandleSIG(int sig)
mDNSlocal void INFOCallback(void)
{
mDNSs32 utc = mDNSPlatformUTC();
+ const mDNSs32 now = mDNS_TimeNow(&mDNSStorage);
NetworkInterfaceInfoOSX *i;
DNSServer *s;
McastResolver *mr;
@@ -1720,6 +1760,14 @@ mDNSlocal void INFOCallback(void)
LogMsg("---- BEGIN STATE LOG ---- %s %s %d", mDNSResponderVersionString, OSXVers ? "OSXVers" : "iOSVers", OSXVers ? OSXVers : iOSVers);
udsserver_info(&mDNSStorage);
+
+ LogMsgNoIdent("----- Platform Timers -----");
+ LogTimer("m->NextCacheCheck ", mDNSStorage.NextCacheCheck);
+ LogTimer("m->NetworkChanged ", mDNSStorage.NetworkChanged);
+ LogTimer("m->p->NotifyUser ", mDNSStorage.p->NotifyUser);
+ LogTimer("m->p->HostNameConflict ", mDNSStorage.p->HostNameConflict);
+ LogTimer("m->p->KeyChainTimer ", mDNSStorage.p->KeyChainTimer);
+
xpcserver_info(&mDNSStorage);
LogMsgNoIdent("----- KQSocketEventSources -----");
@@ -1787,7 +1835,7 @@ mDNSlocal void INFOCallback(void)
s->DNSSECAware ? "DNSSECAware" : "!DNSSECAware");
}
}
- mDNSs32 now = mDNS_TimeNow(&mDNSStorage);
+
LogMsgNoIdent("v4answers %d", mDNSStorage.p->v4answers);
LogMsgNoIdent("v6answers %d", mDNSStorage.p->v6answers);
LogMsgNoIdent("Last DNS Trigger: %d ms ago", (now - mDNSStorage.p->DNSTrigger));
@@ -1800,6 +1848,9 @@ mDNSlocal void INFOCallback(void)
LogMsgNoIdent("Mcast Resolver %##s timeout %u", mr->domain.c, mr->timeout);
}
+#if TARGET_OS_EMBEDDED
+ LogMetrics();
+#endif
LogMsgNoIdent("Timenow 0x%08lX (%d)", (mDNSu32)now, now);
LogMsg("---- END STATE LOG ---- %s %s %d", mDNSResponderVersionString, OSXVers ? "OSXVers" : "iOSVers", OSXVers ? OSXVers : iOSVers);
@@ -1963,10 +2014,6 @@ mDNSlocal void SignalCallback(CFMachPortRef port, void *msg, CFIndex size, void
KQueueLock(m);
switch(msg_header->msgh_id)
{
- case SIGURG:
- m->mDNSOppCaching = m->mDNSOppCaching ? mDNSfalse : mDNStrue;
- LogMsg("SIGURG: Opportunistic Caching %s", m->mDNSOppCaching ? "Enabled" : "Disabled");
- // FALL THROUGH to purge the cache so that we re-do the caching based on the new setting
case SIGHUP: {
mDNSu32 slot;
CacheGroup *cg;
@@ -2144,7 +2191,6 @@ mDNSlocal kern_return_t mDNSDaemonInitialize(void)
mDNSSetupSignal(queue, SIGINFO);
mDNSSetupSignal(queue, SIGUSR1);
mDNSSetupSignal(queue, SIGUSR2);
- mDNSSetupSignal(queue, SIGURG);
// Create a custom handler for doing the housekeeping work. This is either triggered
// by the timer or an event source
@@ -2197,16 +2243,16 @@ mDNSlocal mDNSs32 mDNSDaemonIdle(mDNS *const m)
// mDNS_Execute() generates packets, including multicasts that are looped back to ourself.
// If we call mDNS_Execute() first, and generate packets, and then call mDNSMacOSXNetworkChanged() immediately afterwards
// we then systematically lose our own looped-back packets.
- if (m->p->NetworkChanged && now - m->p->NetworkChanged >= 0) mDNSMacOSXNetworkChanged(m);
+ if (m->NetworkChanged && now - m->NetworkChanged >= 0) mDNSMacOSXNetworkChanged(m);
if (m->p->RequestReSleep && now - m->p->RequestReSleep >= 0) { m->p->RequestReSleep = 0; mDNSPowerRequest(0, 0); }
// 3. Call mDNS_Execute() to let mDNSCore do what it needs to do
mDNSs32 nextevent = mDNS_Execute(m);
- if (m->p->NetworkChanged)
- if (nextevent - m->p->NetworkChanged > 0)
- nextevent = m->p->NetworkChanged;
+ if (m->NetworkChanged)
+ if (nextevent - m->NetworkChanged > 0)
+ nextevent = m->NetworkChanged;
if (m->p->KeyChainTimer)
if (nextevent - m->p->KeyChainTimer > 0)
@@ -2411,6 +2457,7 @@ mDNSlocal mDNSBool AllowSleepNow(mDNS *const m, mDNSs32 now)
//interval = 48; // For testing
+#if !TARGET_OS_EMBEDDED
#ifdef kIOPMAcknowledgmentOptionSystemCapabilityRequirements
if (m->p->IOPMConnection) // If lightweight-wake capability is available, use that
{
@@ -2423,7 +2470,7 @@ mDNSlocal mDNSBool AllowSleepNow(mDNS *const m, mDNSs32 now)
if (!Requirements) LogMsg("ScheduleNextWake: CFNumberCreate failed");
else
{
- const void *OptionKeys[2] = { CFSTR("WakeDate"), CFSTR("Requirements") };
+ const void *OptionKeys[2] = { kIOPMAckDHCPRenewWakeDate, kIOPMAckSystemCapabilityRequirements };
const void *OptionVals[2] = { WakeDate, Requirements };
opts = CFDictionaryCreate(NULL, (void*)OptionKeys, (void*)OptionVals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
if (!opts) LogMsg("ScheduleNextWake: CFDictionaryCreate failed");
@@ -2434,7 +2481,8 @@ mDNSlocal mDNSBool AllowSleepNow(mDNS *const m, mDNSs32 now)
LogSPS("AllowSleepNow: Will request lightweight wakeup in %d seconds", interval);
}
else // else schedule the wakeup using the old API instead to
-#endif
+#endif // kIOPMAcknowledgmentOptionSystemCapabilityRequirements
+#endif // TARGET_OS_EMBEDDED
{
// If we wake within +/- 30 seconds of our requested time we'll assume the system woke for us,
// so we should put it back to sleep. To avoid frustrating the user, we always request at least
@@ -2594,9 +2642,9 @@ mDNSlocal void KQWokenFlushBytes(int fd, __unused short filter, __unused void *c
mDNSlocal void SetLowWater(const KQSocketSet *const k, const int r)
{
- if (setsockopt(k->sktv4, SOL_SOCKET, SO_RCVLOWAT, &r, sizeof(r)) < 0)
+ if (k->sktv4 >=0 && setsockopt(k->sktv4, SOL_SOCKET, SO_RCVLOWAT, &r, sizeof(r)) < 0)
LogMsg("SO_RCVLOWAT IPv4 %d error %d errno %d (%s)", k->sktv4, r, errno, strerror(errno));
- if (setsockopt(k->sktv6, SOL_SOCKET, SO_RCVLOWAT, &r, sizeof(r)) < 0)
+ if (k->sktv6 >=0 && setsockopt(k->sktv6, SOL_SOCKET, SO_RCVLOWAT, &r, sizeof(r)) < 0)
LogMsg("SO_RCVLOWAT IPv6 %d error %d errno %d (%s)", k->sktv6, r, errno, strerror(errno));
}
@@ -2634,6 +2682,10 @@ mDNSlocal void * KQueueLoop(void *m_param)
if (end - start >= WatchDogReportingThreshold)
LogInfo("WARNING: Idle task took %dms to complete", end - start);
+#if APPLE_OSX_mDNSResponder && MACOSX_MDNS_MALLOC_DEBUGGING >= 1
+ validatelists(m, true);
+#endif
+
mDNSs32 now = mDNS_TimeNow(m);
if (m->ShutdownTime)
@@ -2761,53 +2813,8 @@ mDNSlocal void * KQueueLoop(void *m_param)
mDNSlocal void LaunchdCheckin(void)
{
// Ask launchd for our socket
- launch_data_t resp_sd = launch_socket_service_check_in();
- if (!resp_sd)
- {
- LogMsg("launch_socket_service_check_in returned NULL");
- return;
- }
- else
- {
- launch_data_t skts = launch_data_dict_lookup(resp_sd, LAUNCH_JOBKEY_SOCKETS);
- if (!skts) LogMsg("launch_data_dict_lookup LAUNCH_JOBKEY_SOCKETS returned NULL");
- else
- {
- launch_data_t skt = launch_data_dict_lookup(skts, "Listeners");
- if (!skt) LogMsg("launch_data_dict_lookup Listeners returned NULL");
- else
- {
- launchd_fds_count = launch_data_array_get_count(skt);
- if (launchd_fds_count == 0) LogMsg("launch_data_array_get_count(skt) returned 0");
- else
- {
- launchd_fds = mallocL("LaunchdCheckin", sizeof(dnssd_sock_t) * launchd_fds_count);
- if (!launchd_fds) LogMsg("LaunchdCheckin: malloc failed");
- else
- {
- size_t i;
- for(i = 0; i < launchd_fds_count; i++)
- {
- launch_data_t s = launch_data_array_get_index(skt, i);
- if (!s)
- {
- launchd_fds[i] = dnssd_InvalidSocket;
- LogMsg("launch_data_array_get_index(skt, %d) returned NULL", i);
- }
- else
- {
- launchd_fds[i] = launch_data_get_fd(s);
- LogInfo("Launchd Unix Domain Socket [%d]: %d", i, launchd_fds[i]);
- }
- }
- }
- // In some early versions of 10.4.x, the permissions on the UDS were not set correctly, so we fix them here
- chmod(MDNS_UDS_SERVERPATH, S_IRUSR|S_IWUSR | S_IRGRP|S_IWGRP | S_IROTH|S_IWOTH);
- }
- }
- }
- }
- launch_data_free(resp_sd);
+ int result = launch_activate_socket("Listeners", &launchd_fds, &launchd_fds_count);
+ if (result != 0) { LogMsg("launch_activate_socket() failed errno %d (%s)", errno, strerror(errno)); }
}
static mach_port_t RegisterMachService(const char *service_name)
@@ -2838,19 +2845,22 @@ mDNSexport int main(int argc, char **argv)
int i;
kern_return_t status;
+ log_client = asl_open(NULL, "mDNSResponder", 0);
+ log_msg = asl_new(ASL_TYPE_MSG);
+
mDNSMacOSXSystemBuildNumber(NULL);
LogMsg("%s starting %s %d", mDNSResponderVersionString, OSXVers ? "OSXVers" : "iOSVers", OSXVers ? OSXVers : iOSVers);
#if 0
- LogMsg("CacheRecord %d", sizeof(CacheRecord));
- LogMsg("CacheGroup %d", sizeof(CacheGroup));
- LogMsg("ResourceRecord %d", sizeof(ResourceRecord));
- LogMsg("RData_small %d", sizeof(RData_small));
-
- LogMsg("sizeof(CacheEntity) %d", sizeof(CacheEntity));
- LogMsg("RR_CACHE_SIZE %d", RR_CACHE_SIZE);
- LogMsg("block usage %d", sizeof(CacheEntity) * RR_CACHE_SIZE);
- LogMsg("block wastage %d", 16*1024 - sizeof(CacheEntity) * RR_CACHE_SIZE);
+ LogMsg("CacheRecord %5d", sizeof(CacheRecord));
+ LogMsg("CacheGroup %5d", sizeof(CacheGroup));
+ LogMsg("ResourceRecord %5d", sizeof(ResourceRecord));
+ LogMsg("RData_small %5d", sizeof(RData_small));
+
+ LogMsg("sizeof(CacheEntity) %5d", sizeof(CacheEntity));
+ LogMsg("RR_CACHE_SIZE %5d", RR_CACHE_SIZE);
+ LogMsg("block bytes used %5d", sizeof(CacheEntity) * RR_CACHE_SIZE);
+ LogMsg("block bytes wasted %5d", 32*1024 - sizeof(CacheEntity) * RR_CACHE_SIZE);
#endif
if (0 == geteuid())
@@ -2874,8 +2884,76 @@ mDNSexport int main(int argc, char **argv)
if (!strcasecmp(argv[i], "-AlwaysAppendSearchDomains")) AlwaysAppendSearchDomains = mDNStrue;
}
+
+#if APPLE_OSX_mDNSResponder && !TARGET_OS_EMBEDDED
+/* Reads the external user's program arguments for mDNSResponder starting 10.11.x(El Capitan) on OSX. The options for external user are:
+ DebugLogging, UnicastPacketLogging, NoMulticastAdvertisements, StrictUnicastOrdering and AlwaysAppendSearchDomains
+
+ To turn ON the particular option, here is what the user should do (as an example of setting two options)
+ 1] sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist AlwaysAppendSearchDomains -bool YES
+ 2] sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool YES
+ 3] sudo reboot
+
+ To turn OFF all options, here is what the user should do
+ 1] sudo defaults delete /Library/Preferences/com.apple.mDNSResponder.plist
+ 2] sudo reboot
+
+ To view the current options set, here is what the user should do
+ 1] plutil -p /Library/Preferences/com.apple.mDNSResponder.plist
+ OR
+ 1] sudo defaults read /Library/Preferences/com.apple.mDNSResponder.plist
+
+*/
+ CFBooleanRef enabled = NULL;
+
+ enabled = CFPreferencesCopyValue(kDebugLogging, kProgramArguments, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
+ if (enabled != NULL)
+ {
+ if ((CFGetTypeID(enabled) == CFBooleanGetTypeID()) && CFBooleanGetValue(enabled))
+ mDNS_LoggingEnabled = mDNStrue;
+ CFRelease(enabled);
+ }
+
+ enabled = CFPreferencesCopyValue(kUnicastPacketLogging, kProgramArguments, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
+ if (enabled != NULL)
+ {
+ if ((CFGetTypeID(enabled) == CFBooleanGetTypeID()) && CFBooleanGetValue(enabled))
+ mDNS_PacketLoggingEnabled = mDNStrue;
+ CFRelease(enabled);
+ }
+
+ enabled = CFPreferencesCopyValue(kNoMulticastAdvertisements, kProgramArguments, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
+ if (enabled != NULL)
+ {
+ if ((CFGetTypeID(enabled) == CFBooleanGetTypeID()) && CFBooleanGetValue(enabled))
+ advertise = mDNS_Init_DontAdvertiseLocalAddresses;
+ CFRelease(enabled);
+ }
+
+ enabled = CFPreferencesCopyValue(kStrictUnicastOrdering, kProgramArguments, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
+ if (enabled != NULL)
+ {
+ if ((CFGetTypeID(enabled) == CFBooleanGetTypeID()) && CFBooleanGetValue(enabled))
+ StrictUnicastOrdering = mDNStrue;
+ CFRelease(enabled);
+ }
+
+ enabled = CFPreferencesCopyValue(kAlwaysAppendSearchDomains, kProgramArguments, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
+ if (enabled != NULL)
+ {
+ if ((CFGetTypeID(enabled) == CFBooleanGetTypeID()) && CFBooleanGetValue(enabled))
+ AlwaysAppendSearchDomains = mDNStrue;
+ CFRelease(enabled);
+ }
+#endif
+
// Note that mDNSPlatformInit will set DivertMulticastAdvertisements in the mDNS structure
- if (!advertise) LogMsg("Administratively prohibiting multicast advertisements");
+ if (!advertise)
+ LogMsg("-NoMulticastAdvertisements is set: Administratively prohibiting multicast advertisements");
+ if (AlwaysAppendSearchDomains)
+ LogMsg("-AlwaysAppendSearchDomains is set");
+ if (StrictUnicastOrdering)
+ LogMsg("-StrictUnicastOrdering is set");
#ifndef MDNSRESPONDER_USES_LIB_DISPATCH_AS_PRIMARY_EVENT_LOOP_MECHANISM
@@ -2886,7 +2964,6 @@ mDNSexport int main(int argc, char **argv)
signal(SIGINFO, HandleSIG); // (Debugging) Write state snapshot to syslog
signal(SIGUSR1, HandleSIG); // (Debugging) Enable Logging
signal(SIGUSR2, HandleSIG); // (Debugging) Enable Packet Logging
- signal(SIGURG, HandleSIG); // (Debugging) Toggle Opportunistic Caching
signal(SIGPROF, HandleSIG); // (Debugging) Toggle Multicast Logging
signal(SIGTSTP, HandleSIG); // (Debugging) Disable all Debug Logging (USR1/USR2/PROF)
@@ -2931,6 +3008,8 @@ mDNSexport int main(int argc, char **argv)
char *sandbox_msg;
uint64_t sandbox_flags = SANDBOX_NAMED;
+ (void)confstr(_CS_DARWIN_USER_CACHE_DIR, NULL, 0);
+
int sandbox_err = sandbox_init("mDNSResponder", sandbox_flags, &sandbox_msg);
if (sandbox_err)
{
@@ -2945,13 +3024,6 @@ mDNSexport int main(int argc, char **argv)
}
#endif // MDNS_NO_SANDBOX
- // We use BeginTransactionAtShutdown in the plist that ensures that we will
- // receive a SIGTERM during shutdown rather than a SIGKILL. But launchd (due to some
- // limitation) currently requires us to still start and end the transaction for
- // its proper initialization.
- vproc_transaction_t vt = vproc_transaction_begin(NULL);
- if (vt) vproc_transaction_end(NULL, vt);
-
m_port = RegisterMachService(kmDNSResponderServName);
// We should ALWAYS receive our Mach port from RegisterMachService() but sanity check before initializing daemon
if (m_port == MACH_PORT_NULL)
@@ -2960,15 +3032,17 @@ mDNSexport int main(int argc, char **argv)
return -1;
}
+#if TARGET_OS_EMBEDDED
+ status = MetricsInit();
+ if (status) { LogMsg("Daemon start: MetricsInit failed (%d)", status); }
+#endif
+
status = mDNSDaemonInitialize();
if (status) { LogMsg("Daemon start: mDNSDaemonInitialize failed"); goto exit; }
status = udsserver_init(launchd_fds, launchd_fds_count);
if (status) { LogMsg("Daemon start: udsserver_init failed"); goto exit; }
- log_client = asl_open(NULL, "mDNSResponder", 0);
- log_msg = asl_new(ASL_TYPE_MSG);
-
#if TARGET_OS_EMBEDDED
_scprefs_observer_watch(scprefs_observer_type_global, kmDNSResponderPrefIDStr, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
diff --git a/mDNSResponder/mDNSMacOSX/helper-error.h b/mDNSResponder/mDNSMacOSX/helper-error.h
index 2e463b0a..6465b734 100644
--- a/mDNSResponder/mDNSMacOSX/helper-error.h
+++ b/mDNSResponder/mDNSMacOSX/helper-error.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/helper-main.c b/mDNSResponder/mDNSMacOSX/helper-main.c
index 52779e85..5e4d9481 100644
--- a/mDNSResponder/mDNSMacOSX/helper-main.c
+++ b/mDNSResponder/mDNSMacOSX/helper-main.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2012 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,6 @@
#include "helper-server.h"
#include "helpermsg.h"
#include "helpermsgServer.h"
-#include <vproc.h>
#if TARGET_OS_EMBEDDED
#define NO_SECURITYFRAMEWORK 1
@@ -104,7 +103,7 @@ static void handle_sigterm(int sig)
static void initialize_logging(void)
{
- logclient = asl_open(NULL, kmDNSHelperServiceName, (opt_debug ? ASL_OPT_STDERR : 0));
+ logclient = asl_open(NULL, "mDNSResponderHelper", (opt_debug ? ASL_OPT_STDERR : 0));
if (NULL == logclient) { fprintf(stderr, "Could not initialize ASL logging.\n"); fflush(stderr); return; }
if (opt_debug) asl_set_filter(logclient, ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG));
}
@@ -124,9 +123,10 @@ static void initialize_id(void)
static void diediedie(CFRunLoopTimerRef timer, void *context)
{
- debug("entry %p %p %d", timer, context, maxidle);
+ debug("entry %p %p %d", timer, context, actualidle);
assert(gTimer == timer);
- if (maxidle)
+ helplog(ASL_LEVEL_INFO, "mDNSResponder exiting after %d seconds", actualidle);
+ if (actualidle)
(void)proxy_mDNSExit(gPort);
}
@@ -228,6 +228,8 @@ int main(int ac, char *av[])
}
ac -= optind;
av += optind;
+ (void)ac; // Unused
+ (void)av; // Unused
initialize_logging();
helplog(ASL_LEVEL_INFO, "Starting");
@@ -246,13 +248,6 @@ int main(int ac, char *av[])
signal(SIGTERM, handle_sigterm);
- // We use BeginTransactionAtShutdown in the plist that ensures that we will
- // receive a SIGTERM during shutdown rather than a SIGKILL. But launchd (due to some
- // limitation) currently requires us to still start and end the transaction for
- // its proper initialization.
- vproc_transaction_t vt = vproc_transaction_begin(NULL);
- if (vt) vproc_transaction_end(NULL, vt);
-
if (initialize_timer()) exit(EXIT_FAILURE);
for (n=0; n<100000; n++) if (!gRunLoop) usleep(100);
if (!gRunLoop)
diff --git a/mDNSResponder/mDNSMacOSX/helper-server.h b/mDNSResponder/mDNSMacOSX/helper-server.h
index 1c391a01..eb0e6ae1 100644
--- a/mDNSResponder/mDNSMacOSX/helper-server.h
+++ b/mDNSResponder/mDNSMacOSX/helper-server.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/helper-stubs.c b/mDNSResponder/mDNSMacOSX/helper-stubs.c
index 29fd9aed..e08f5050 100644
--- a/mDNSResponder/mDNSMacOSX/helper-stubs.c
+++ b/mDNSResponder/mDNSMacOSX/helper-stubs.c
@@ -1,5 +1,6 @@
-/*
- * Copyright (c) 2007-2012 Apple Inc. All rights reserved.
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2007-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -169,26 +170,28 @@ void mDNSNotify(const char *title, const char *msg) // Both strings are UTF-8 te
if (title)
{
+ // Don’t try to call mDNSPlatformMem* routines here, because they call validatelists,
+ // which calls back into mDNSNotify, resulting an infinite loop until stack space is exhausted
int len = strlen(title);
- titleCopy = mDNSPlatformMemAllocate(len + 1);
+ titleCopy = malloc(len + 1);
if (!titleCopy)
{
LogMsg("mDNSNotify: titleCopy NULL for %s", msg);
return;
}
- mDNSPlatformMemCopy(titleCopy, title, len);
+ memcpy(titleCopy, title, len);
titleCopy[len] = 0;
}
if (msg)
{
int len = strlen(msg);
- msgCopy = mDNSPlatformMemAllocate(len + 1);
+ msgCopy = malloc(len + 1);
if (!msgCopy)
{
LogMsg("mDNSNotify: msgCopy NULL for %s", msg);
return;
}
- mDNSPlatformMemCopy(msgCopy, msg, len);
+ memcpy(msgCopy, msg, len);
msgCopy[len] = 0;
}
@@ -203,10 +206,10 @@ void mDNSNotify(const char *title, const char *msg) // Both strings are UTF-8 te
kr = proxy_mDNSNotify(getHelperPort(retry), titleCopy, msgCopy);
MACHRETRYLOOP_END(kr, retry, err, fin);
fin:
- if (titleCopy)
- mDNSPlatformMemFree(titleCopy);
- if (msgCopy)
- mDNSPlatformMemFree(msgCopy);
+ // Don’t try to call mDNSPlatformMem* routines here, because they call validatelists,
+ // which calls back into mDNSNotify, resulting an infinite loop until stack space is exhausted
+ free(titleCopy);
+ free(msgCopy);
(void)err;
});
}
@@ -231,7 +234,7 @@ int mDNSKeychainGetSecrets(CFArrayRef *result)
LogMsg("%s: CFDataCreateWithBytesNoCopy failed", __func__);
goto fin;
}
- if (NULL == (plist = CFPropertyListCreateFromXMLData(kCFAllocatorDefault, bytes, kCFPropertyListImmutable, NULL)))
+ if (NULL == (plist = CFPropertyListCreateWithData(kCFAllocatorDefault, bytes, kCFPropertyListImmutable, NULL, NULL)))
{
err = kmDNSHelperInvalidPList;
LogMsg("%s: CFPropertyListCreateFromXMLData failed", __func__);
@@ -456,7 +459,7 @@ void mDNSGetRemoteMAC(mDNS *const m, int family, v6addr_t raddr)
// the values and schedule a task to update the MAC address in the TCP Keepalive record.
if (kr == KERN_SUCCESS)
{
- addrMapping = (IPAddressMACMapping *)malloc(sizeof(IPAddressMACMapping));
+ addrMapping = mDNSPlatformMemAllocate(sizeof(IPAddressMACMapping));
snprintf(addrMapping->ethaddr, sizeof(addrMapping->ethaddr), "%02x:%02x:%02x:%02x:%02x:%02x",
eth[0], eth[1], eth[2], eth[3], eth[4], eth[5]);
if (family == AF_INET)
diff --git a/mDNSResponder/mDNSMacOSX/helper.c b/mDNSResponder/mDNSMacOSX/helper.c
index deb33e93..7cf0e523 100644
--- a/mDNSResponder/mDNSMacOSX/helper.c
+++ b/mDNSResponder/mDNSMacOSX/helper.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2007-2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,6 +61,8 @@
#include <netinet/ip.h>
#include <netinet/tcp.h>
+#include <IOKit/pwr_mgt/IOPMLibPrivate.h>
+
#ifndef RTF_IFSCOPE
#define RTF_IFSCOPE 0x1000000
#endif
@@ -183,13 +185,24 @@ kern_return_t do_mDNSPowerRequest(__unused mach_port_t port, int key, int interv
}
else if (key > 0)
{
- CFDateRef w = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent() + interval);
- if (w)
+ CFDateRef wakeTime = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent() + interval);
+ if (wakeTime)
{
- IOReturn r = IOPMSchedulePowerEvent(w, CFSTR("mDNSResponderHelper"), key ? CFSTR(kIOPMAutoWake) : CFSTR(kIOPMAutoSleep));
- if (r) { usleep(100000); helplog(ASL_LEVEL_ERR, "IOPMSchedulePowerEvent(%d) %d %x", interval, r, r); }
+ CFMutableDictionaryRef scheduleDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+
+ CFDictionaryAddValue(scheduleDict, CFSTR(kIOPMPowerEventTimeKey), wakeTime);
+ CFDictionaryAddValue(scheduleDict, CFSTR(kIOPMPowerEventAppNameKey), CFSTR("mDNSResponderHelper"));
+ CFDictionaryAddValue(scheduleDict, CFSTR(kIOPMPowerEventTypeKey), key ? CFSTR(kIOPMAutoWake) : CFSTR(kIOPMAutoSleep));
+
+ IOReturn r = IOPMRequestSysWake(scheduleDict);
+ if (r)
+ {
+ usleep(100000);
+ helplog(ASL_LEVEL_ERR, "IOPMRequestSysWake(%d) %d %x", interval, r, r);
+ }
*err = r;
- CFRelease(w);
+ CFRelease(wakeTime);
+ CFRelease(scheduleDict);
}
}
fin:
@@ -332,7 +345,8 @@ kern_return_t do_mDNSNotify(__unused mach_port_t port, const char *title, const
if (!authorized(&token)) return KERN_SUCCESS;
#ifndef NO_CFUSERNOTIFICATION
- static const char footer[] = "(Note: This message only appears on machines with 17.x.x.x IP addresses — i.e. at Apple — not on customer machines.)";
+ static const char footer[] = "(Note: This message only appears on machines with 17.x.x.x IP addresses"
+ " or on debugging builds with ForceAlerts set — i.e. only at Apple — not on customer machines.)";
CFStringRef alertHeader = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8);
CFStringRef alertBody = CFStringCreateWithCString(NULL, msg, kCFStringEncodingUTF8);
CFStringRef alertFooter = CFStringCreateWithCString(NULL, footer, kCFStringEncodingUTF8);
@@ -429,7 +443,7 @@ static void ShowNameConflictNotification(CFMutableArrayRef header, CFStringRef s
CFRelease(dictionary);
}
-static CFMutableArrayRef GetHeader(const char* oldname, const char* newname, const CFStringRef msg, const char* suffix)
+static CFMutableArrayRef CreateAlertHeader(const char* oldname, const char* newname, const CFStringRef msg, const char* suffix)
{
CFMutableArrayRef alertHeader = NULL;
@@ -464,18 +478,21 @@ static CFMutableArrayRef GetHeader(const char* oldname, const char* newname, con
CFStringRef userName = SCDynamicStoreCopyConsoleUser(NULL, &uid, &gid);
if (userName)
{
- CFRelease(userName);
- CFArrayAppendValue(alertHeader, msg); // Opening phrase of message, provided by caller
- CFArrayAppendValue(alertHeader, CFS_OQ); CFArrayAppendValue(alertHeader, s1); CFArrayAppendValue(alertHeader, CFS_CQ);
- CFArrayAppendValue(alertHeader, CFSTR(" is already in use on this network. "));
- if (s2)
+ if (!CFEqual(userName, CFSTR("_mbsetupuser")))
{
- CFArrayAppendValue(alertHeader, CFSTR("The name has been changed to "));
- CFArrayAppendValue(alertHeader, CFS_OQ); CFArrayAppendValue(alertHeader, s2); CFArrayAppendValue(alertHeader, CFS_CQ);
- CFArrayAppendValue(alertHeader, CFSTR("."));
+ CFArrayAppendValue(alertHeader, msg); // Opening phrase of message, provided by caller
+ CFArrayAppendValue(alertHeader, CFS_OQ); CFArrayAppendValue(alertHeader, s1); CFArrayAppendValue(alertHeader, CFS_CQ);
+ CFArrayAppendValue(alertHeader, CFSTR(" is already in use on this network. "));
+ if (s2)
+ {
+ CFArrayAppendValue(alertHeader, CFSTR("The name has been changed to "));
+ CFArrayAppendValue(alertHeader, CFS_OQ); CFArrayAppendValue(alertHeader, s2); CFArrayAppendValue(alertHeader, CFS_CQ);
+ CFArrayAppendValue(alertHeader, CFSTR("."));
+ }
+ else
+ CFArrayAppendValue(alertHeader, CFSTR("All attempts to find an available name by adding a number to the name were also unsuccessful."));
}
- else
- CFArrayAppendValue(alertHeader, CFSTR("All attempts to find an available name by adding a number to the name were also unsuccessful."));
+ CFRelease(userName);
}
}
if (s1) CFRelease(s1);
@@ -494,16 +511,20 @@ static void update_notification(void)
debug("entry ucn=%s, uhn=%s, lcn=%s, lhn=%s", usercompname, userhostname, lastcompname, lasthostname);
if (!CFS_OQ)
{
- // Note: the "\xEF\xBB\xBF" byte sequence in the CFS_Format string is the UTF-8 encoding of the zero-width non-breaking space character.
+ // Note: The "\xEF\xBB\xBF" byte sequence (U+FEFF) in the CFS_Format string is the UTF-8 encoding of the zero-width non-breaking space character.
// By appending this invisible character on the end of literal names, we ensure the these strings cannot inadvertently match any string
// in the localization file -- since we know for sure that none of our strings in the localization file contain the ZWNBS character.
- //
- // For languages that are written right to left, when we mix English (host names could be in english with brackets etc. and the
- // rest in Arabic) we need unicode markups for proper formatting. The Unicode sequence 202C (UTF8 E2 80 AC), 200E (UTF8 E2 80 8E) and
- // 202B (UTF8 E2 80 AB) helps with the formatting. See <rdar://problem/8629082> for more details.
- CFS_OQ = CFStringCreateWithCString(NULL, "“\xE2\x80\xAB", kCFStringEncodingUTF8);
- CFS_CQ = CFStringCreateWithCString(NULL, "\xE2\x80\xAC”", kCFStringEncodingUTF8);
- CFS_Format = CFStringCreateWithCString(NULL, "%@%s\xEF\xBB\xBF\xE2\x80\x8E", kCFStringEncodingUTF8);
+ CFS_Format = CFStringCreateWithCString(NULL, "%@%s\xEF\xBB\xBF", kCFStringEncodingUTF8);
+
+ // The strings CFS_OQ, CFS_CQ and the others below are the localization keys for the “Localizable.strings” files,
+ // and MUST NOT BE CHANGED, or localization substitution will be broken.
+ // To change the text displayed to the user, edit the values in the appropriate “Localizable.strings” file, not the keys here.
+ // This includes making changes for adding appropriate directionality overrides like LRM, LRE, RLE, PDF, etc. These need to go in the values
+ // in the appropriate “Localizable.strings” entries, not in the keys here (which then won’t match *any* entry in the localization files).
+ // These localization keys here were broken in <rdar://problem/8629082> and then subsequently repaired in
+ // <rdar://problem/21071535> [mDNSResponder]: TA: Gala15A185: Incorrect punctuation marks when Change the host name to an exist one
+ CFS_OQ = CFStringCreateWithCString(NULL, "“", kCFStringEncodingUTF8); // DO NOT CHANGE THIS STRING
+ CFS_CQ = CFStringCreateWithCString(NULL, "”", kCFStringEncodingUTF8); // DO NOT CHANGE THIS STRING
CFS_ComputerName = CFStringCreateWithCString(NULL, "The name of your computer ", kCFStringEncodingUTF8);
CFS_ComputerNameMsg = CFStringCreateWithCString(NULL, "To change the name of your computer, "
"open System Preferences and click Sharing, then type the name in the Computer Name field.", kCFStringEncodingUTF8);
@@ -529,17 +550,17 @@ static void update_notification(void)
CFStringRef* subtext = NULL;
if (userhostname[0] && !lasthostname[0]) // we've given up trying to construct a name that doesn't conflict
{
- header = GetHeader(userhostname, NULL, CFS_LocalHostName, ".local");
+ header = CreateAlertHeader(userhostname, NULL, CFS_LocalHostName, ".local");
subtext = &CFS_Problem;
}
else if (usercompname[0])
{
- header = GetHeader(usercompname, lastcompname, CFS_ComputerName, "");
+ header = CreateAlertHeader(usercompname, lastcompname, CFS_ComputerName, "");
subtext = &CFS_ComputerNameMsg;
}
else
{
- header = GetHeader(userhostname, lasthostname, CFS_LocalHostName, ".local");
+ header = CreateAlertHeader(userhostname, lasthostname, CFS_LocalHostName, ".local");
subtext = &CFS_LocalHostNameMsg;
}
ShowNameConflictNotification(header, *subtext);
@@ -912,6 +933,8 @@ do_mDNSKeychainGetSecrets(__unused mach_port_t port, __unused unsigned int *nums
*err = kmDNSHelperKeychainCopyDefaultFailed;
goto fin;
}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (noErr != (status = SecKeychainSearchCreateFromAttributes(skc, kSecGenericPasswordItemClass, NULL, &search)))
{
*err = kmDNSHelperKeychainSearchCreationFailed;
@@ -932,6 +955,7 @@ do_mDNSKeychainGetSecrets(__unused mach_port_t port, __unused unsigned int *nums
SecKeychainItemFreeAttributesAndData(attributes, NULL);
CFRelease(item);
}
+#pragma clang diagnostic pop
if (errSecItemNotFound != status)
helplog(ASL_LEVEL_ERR, "%s: SecKeychainSearchCopyNext failed: %d",
__func__, status);
@@ -944,8 +968,8 @@ do_mDNSKeychainGetSecrets(__unused mach_port_t port, __unused unsigned int *nums
goto fin;
}
CFWriteStreamOpen(stream);
- if (0 == CFPropertyListWriteToStream(keys, stream,
- kCFPropertyListBinaryFormat_v1_0, NULL))
+ if (0 == CFPropertyListWrite(keys, stream,
+ kCFPropertyListBinaryFormat_v1_0, 0, NULL))
{
*err = kmDNSHelperPListWriteFailed;
debug("CFPropertyListWriteToStream failed");
@@ -1017,11 +1041,16 @@ static const char g_racoon_config_dir_old[] = "/etc/racoon/remote/";
CF_EXPORT CFDictionaryRef _CFCopySystemVersionDictionary(void);
CF_EXPORT const CFStringRef _kCFSystemVersionBuildVersionKey;
-// Major version 6 is 10.2.x (Jaguar)
-// Major version 7 is 10.3.x (Panther)
-// Major version 8 is 10.4.x (Tiger)
-// Major version 9 is 10.5.x (Leopard)
-// Major version 10 is 10.6.x (SnowLeopard)
+// Major version 6 is 10.2.x (Jaguar)
+// Major version 7 is 10.3.x (Panther)
+// Major version 8 is 10.4.x (Tiger)
+// Major version 9 is 10.5.x (Leopard)
+// Major version 10 is 10.6.x (SnowLeopard)
+// Major version 11 is 10.7.x (Lion)
+// Major version 12 is 10.8.x (MountainLion)
+// Major version 13 is 10.9.x (Mavericks)
+// Major version 14 is 10.10.x (Yosemite)
+// Major version 15 is 10.11.x (ElCapitan)
static int MacOSXSystemBuildNumber(char* letter_out, int* minor_out)
{
int major = 0, minor = 0;
@@ -2332,13 +2361,15 @@ in_cksum(unsigned short *ptr,int nbytes)
* all the carry bits from the top 16 bits into the lower 16 bits.
*/
sum = 0;
- while (nbytes > 1) {
+ while (nbytes > 1)
+ {
sum += *ptr++;
nbytes -= 2;
}
/* mop up an odd byte, if necessary */
- if (nbytes == 1) {
+ if (nbytes == 1)
+ {
/* make sure top half is zero */
oddbyte = 0;
@@ -2726,20 +2757,42 @@ static int getMACAddress(int family, v6addr_t raddr, v6addr_t gaddr, int *gfamil
sin6 = (struct sockaddr_in6 *) (rtm +1);
sdl = (struct sockaddr_dl *) (sin6->sin6_len + (char *) sin6);
}
+
+ if (!sdl)
+ {
+ helplog(ASL_LEVEL_ERR, "do_mDNSGetRemoteMAC: sdl is NULL for family %d", family);
+ close(sock);
+ return -1;
+ }
+
// If the address is not on the local net, we get the IP address of the gateway.
// We would have to repeat the process to get the MAC address of the gateway
*gfamily = sdl->sdl_family;
if (sdl->sdl_family == AF_INET)
{
- struct sockaddr_in *new_sin = (struct sockaddr_in *)(sin->sin_len +(char*) sin);
- memcpy(gaddr, &new_sin->sin_addr, sizeof(struct in_addr));
+ if (sin)
+ {
+ struct sockaddr_in *new_sin = (struct sockaddr_in *)(sin->sin_len +(char*) sin);
+ memcpy(gaddr, &new_sin->sin_addr, sizeof(struct in_addr));
+ }
+ else
+ {
+ helplog(ASL_LEVEL_ERR, "do_mDNSGetRemoteMAC: sin is NULL");
+ }
close(sock);
return -1;
}
else if (sdl->sdl_family == AF_INET6)
{
- struct sockaddr_in6 *new_sin6 = (struct sockaddr_in6 *)(sin6->sin6_len +(char*) sin6);
- memcpy(gaddr, &new_sin6->sin6_addr, sizeof(struct in6_addr));
+ if (sin6)
+ {
+ struct sockaddr_in6 *new_sin6 = (struct sockaddr_in6 *)(sin6->sin6_len +(char*) sin6);
+ memcpy(gaddr, &new_sin6->sin6_addr, sizeof(struct in6_addr));
+ }
+ else
+ {
+ helplog(ASL_LEVEL_ERR, "do_mDNSGetRemoteMAC: sin6 is NULL");
+ }
close(sock);
return -1;
}
diff --git a/mDNSResponder/mDNSMacOSX/helper.h b/mDNSResponder/mDNSMacOSX/helper.h
index a2982372..04332eff 100644
--- a/mDNSResponder/mDNSMacOSX/helper.h
+++ b/mDNSResponder/mDNSMacOSX/helper.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2007-2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/helpermsg-types.h b/mDNSResponder/mDNSMacOSX/helpermsg-types.h
index ca5b140a..88411800 100644
--- a/mDNSResponder/mDNSMacOSX/helpermsg-types.h
+++ b/mDNSResponder/mDNSMacOSX/helpermsg-types.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/helpermsg.defs b/mDNSResponder/mDNSMacOSX/helpermsg.defs
index 58363082..35239967 100644
--- a/mDNSResponder/mDNSMacOSX/helpermsg.defs
+++ b/mDNSResponder/mDNSMacOSX/helpermsg.defs
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2007-2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/ipsec_strerror.h b/mDNSResponder/mDNSMacOSX/ipsec_strerror.h
index ecacf3b2..b15fc28a 100644
--- a/mDNSResponder/mDNSMacOSX/ipsec_strerror.h
+++ b/mDNSResponder/mDNSMacOSX/ipsec_strerror.h
@@ -1,5 +1,6 @@
-/*
- * Copyright (c) 2003-2007 Apple Computer, Inc. All rights reserved.
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2003-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/* $FreeBSD: src/lib/libipsec/ipsec_strerror.h,v 1.1.2.2 2001/07/03 11:01:14 ume Exp $ */
/* $KAME: ipsec_strerror.h,v 1.8 2000/07/30 00:45:12 itojun Exp $ */
diff --git a/mDNSResponder/mDNSMacOSX/libpfkey.h b/mDNSResponder/mDNSMacOSX/libpfkey.h
index 98d192d8..24f1b085 100644
--- a/mDNSResponder/mDNSMacOSX/libpfkey.h
+++ b/mDNSResponder/mDNSMacOSX/libpfkey.h
@@ -1,5 +1,6 @@
-/*
- * Copyright (c) 2003-2007 Apple Computer, Inc. All rights reserved.
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2003-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/* $FreeBSD: src/lib/libipsec/libpfkey.h,v 1.1.2.2 2001/07/03 11:01:14 ume Exp $ */
/* $KAME: libpfkey.h,v 1.6 2001/03/05 18:22:17 thorpej Exp $ */
diff --git a/mDNSResponder/mDNSMacOSX/mDNSMacOSX.c b/mDNSResponder/mDNSMacOSX/mDNSMacOSX.c
index f904c8b2..deae0d1a 100644
--- a/mDNSResponder/mDNSMacOSX/mDNSMacOSX.c
+++ b/mDNSResponder/mDNSMacOSX/mDNSMacOSX.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,7 +61,6 @@
#include <netinet/in_systm.h> // For n_long, required by <netinet/ip.h> below
#include <netinet/ip.h> // For IPTOS_LOWDELAY etc.
#include <netinet6/in6_var.h> // For IN6_IFF_NOTREADY etc.
-#include <netinet6/nd6.h> // For ND6_INFINITE_LIFETIME etc.
#include <netinet/tcp.h>
@@ -86,12 +85,20 @@
#include <asl.h>
#include <SystemConfiguration/SCPrivate.h>
+#if TARGET_OS_IPHONE
+// For WiFiManagerClientRef etc, declarations.
+#include <MobileGestalt.h>
+#include <MobileWiFi/WiFiManagerClient.h>
+#include <dlfcn.h>
+#endif // TARGET_OS_IPHONE
+
// Include definition of opaque_presence_indication for KEV_DL_NODE_PRESENCE handling logic.
#include <Kernel/IOKit/apple80211/apple80211_var.h>
#if APPLE_OSX_mDNSResponder
#include <DeviceToDeviceManager/DeviceToDeviceManager.h>
#include <AWACS.h>
+#include <ne_session.h> // for ne_session_set_socket_attributes()
#if !NO_D2D
D2DStatus D2DInitialize(CFRunLoopRef runLoop, D2DServiceCallback serviceCallback, void* userData) __attribute__((weak_import));
D2DStatus D2DRetain(D2DServiceInstance instanceHandle, D2DTransportType transportType) __attribute__((weak_import));
@@ -122,6 +129,8 @@ D2DStatus D2DTerminate() __attribute__((weak_import));
#define mDNS_IOREG_KA_KEY "mDNS_Keepalive"
#define mDNS_USER_CLIENT_CREATE_TYPE 'mDNS'
+#define DARK_WAKE_TIME 16 // Time we hold an idle sleep assertion for maintenance after a wake notification
+
// cache the InterfaceID of the AWDL interface
static mDNSInterfaceID AWDLInterfaceID;
@@ -213,9 +222,9 @@ mDNSexport void D2D_start_advertising_interface(NetworkInterfaceInfo *interface)
LogInfo("D2D_start_advertising_interface: %s", interface->ifname);
if (interface->RR_A.resrec.RecordType)
- external_start_advertising_service(&interface->RR_A.resrec, NULL);
+ external_start_advertising_service(&interface->RR_A.resrec, 0);
if (interface->RR_PTR.resrec.RecordType)
- external_start_advertising_service(&interface->RR_PTR.resrec, NULL);
+ external_start_advertising_service(&interface->RR_PTR.resrec, 0);
}
}
@@ -228,9 +237,9 @@ mDNSexport void D2D_stop_advertising_interface(NetworkInterfaceInfo *interface)
LogInfo("D2D_stop_advertising_interface: %s", interface->ifname);
if (interface->RR_A.resrec.RecordType)
- external_stop_advertising_service(&interface->RR_A.resrec, NULL);
+ external_stop_advertising_service(&interface->RR_A.resrec, 0);
if (interface->RR_PTR.resrec.RecordType)
- external_stop_advertising_service(&interface->RR_PTR.resrec, NULL);
+ external_stop_advertising_service(&interface->RR_PTR.resrec, 0);
}
}
@@ -960,8 +969,8 @@ mDNSexport void external_start_resolving_service(mDNSInterfaceID InterfaceID, co
if (AWDL_used && AWDLInterfaceID)
{
LogInfo("external_start_resolving_service: browse for TXT and SRV over AWDL");
- external_start_browsing_for_service(AWDLInterfaceID, fqdn, kDNSType_TXT, NULL);
- external_start_browsing_for_service(AWDLInterfaceID, fqdn, kDNSType_SRV, NULL);
+ external_start_browsing_for_service(AWDLInterfaceID, fqdn, kDNSType_TXT, 0);
+ external_start_browsing_for_service(AWDLInterfaceID, fqdn, kDNSType_SRV, 0);
}
}
@@ -1006,8 +1015,8 @@ mDNSexport void external_stop_resolving_service(mDNSInterfaceID InterfaceID, con
if (AWDL_used && AWDLInterfaceID)
{
LogInfo("external_stop_resolving_service: stop browse for TXT and SRV on AWDL");
- external_stop_browsing_for_service(AWDLInterfaceID, fqdn, kDNSType_TXT, NULL);
- external_stop_browsing_for_service(AWDLInterfaceID, fqdn, kDNSType_SRV, NULL);
+ external_stop_browsing_for_service(AWDLInterfaceID, fqdn, kDNSType_TXT, 0);
+ external_stop_browsing_for_service(AWDLInterfaceID, fqdn, kDNSType_SRV, 0);
}
}
@@ -1037,22 +1046,17 @@ mDNSexport void external_stop_resolving_service(const domainname *const fqdn, DN
// to run up the user's bill sending multicast traffic over a link where there's only a single device at the
// other end, and that device (e.g. a modem bank) is probably not answering Multicast DNS queries anyway.
-// We also don't want to use multicast on *any* interface on very constrained devices.
-#if TARGET_OS_NANO
-#define MulticastInterface(i) (mDNSfalse)
+// We also don't want to use multicast on *any* physical interface on very constrained devices.
+#if 0
+#define MulticastInterface(i) ((i)->ifa_flags & IFF_LOOPBACK)
+#elif TARGET_OS_WATCH
+#define MulticastInterface(i) ((i)->m->NumAllInterfaceRecords + (i)->m->NumAllInterfaceQuestions > 0 && ((i)->ifa_flags & IFF_MULTICAST) && !((i)->ifa_flags & IFF_POINTOPOINT))
#else
#define MulticastInterface(i) (((i)->ifa_flags & IFF_MULTICAST) && !((i)->ifa_flags & IFF_POINTOPOINT))
#endif
mDNSexport void NotifyOfElusiveBug(const char *title, const char *msg) // Both strings are UTF-8 text
{
- static int notifyCount = 0;
- if (notifyCount) return;
-
- // If we display our alert early in the boot process, then it vanishes once the desktop appears.
- // To avoid this, we don't try to display alerts in the first three minutes after boot.
- if ((mDNSu32)(mDNSPlatformRawTime()) < (mDNSu32)(mDNSPlatformOneSecond * 180)) return;
-
// Unless ForceAlerts is defined, we only show these bug report alerts on machines that have a 17.x.x.x address
#if !ForceAlerts
{
@@ -1065,16 +1069,54 @@ mDNSexport void NotifyOfElusiveBug(const char *title, const char *msg) // Both
}
#endif
- LogMsg("%s", title);
- LogMsg("%s", msg);
- // Display a notification to the user
- notifyCount++;
+ LogMsg("NotifyOfElusiveBug: %s", title);
+ LogMsg("NotifyOfElusiveBug: %s", msg);
+
+ // If we display our alert early in the boot process, then it vanishes once the desktop appears.
+ // To avoid this, we don't try to display alerts in the first three minutes after boot.
+ if ((mDNSu32)(mDNSPlatformRawTime()) < (mDNSu32)(mDNSPlatformOneSecond * 180))
+ { LogMsg("Suppressing notification early in boot: %d", mDNSPlatformRawTime()); return; }
#ifndef NO_CFUSERNOTIFICATION
- mDNSNotify(title, msg);
+ static int notifyCount = 0; // To guard against excessive display of warning notifications
+ if (notifyCount < 5) { notifyCount++; mDNSNotify(title, msg); }
#endif /* NO_CFUSERNOTIFICATION */
}
+// Write a syslog message and display an alert, then if ForceAlerts is set, generate a stack trace
+#if APPLE_OSX_mDNSResponder && MACOSX_MDNS_MALLOC_DEBUGGING >= 1
+mDNSexport void LogMemCorruption(const char *format, ...)
+{
+ char buffer[512];
+ va_list ptr;
+ va_start(ptr,format);
+ buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0;
+ va_end(ptr);
+ LogMsg("!!!! %s !!!!", buffer);
+ NotifyOfElusiveBug("Memory Corruption", buffer);
+#if ForceAlerts
+ *(volatile long*)0 = 0; // Trick to crash and get a stack trace right here, if that's what we want
+#endif
+}
+#endif
+
+// Like LogMemCorruption above, but only display the alert if ForceAlerts is set and we're going to generate a stack trace
+#if APPLE_OSX_mDNSResponder
+mDNSexport void LogFatalError(const char *format, ...)
+{
+ char buffer[512];
+ va_list ptr;
+ va_start(ptr,format);
+ buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0;
+ va_end(ptr);
+ LogMsg("!!!! %s !!!!", buffer);
+#if ForceAlerts
+ NotifyOfElusiveBug("Fatal Error. See /Library/Logs/DiagnosticReports", buffer);
+ *(volatile long*)0 = 0; // Trick to crash and get a stack trace right here, if that's what we want
+#endif
+}
+#endif
+
// Returns true if it is an AppleTV based hardware running iOS, false otherwise
mDNSlocal mDNSBool IsAppleTV(void)
{
@@ -1121,7 +1163,6 @@ mDNSlocal void DynamicStoreWrite(int key, const char* subkey, uintptr_t value, s
Boolean release_sckey = FALSE;
CFDataRef bytes = NULL;
CFPropertyListRef plist = NULL;
- SCDynamicStoreRef store = NULL;
switch ((enum mDNSDynamicStoreSetConfigKey)key)
{
@@ -1161,29 +1202,20 @@ mDNSlocal void DynamicStoreWrite(int key, const char* subkey, uintptr_t value, s
LogMsg("CFDataCreateWithBytesNoCopy of value failed");
goto fin;
}
- if (NULL == (plist = CFPropertyListCreateFromXMLData(NULL, bytes,
- kCFPropertyListImmutable, NULL)))
+ if (NULL == (plist = CFPropertyListCreateWithData(NULL, bytes, kCFPropertyListImmutable, NULL, NULL)))
{
- LogMsg("CFPropertyListCreateFromXMLData of bytes failed");
+ LogMsg("CFPropertyListCreateWithData of bytes failed");
goto fin;
}
CFRelease(bytes);
bytes = NULL;
- if (NULL == (store = SCDynamicStoreCreate(NULL,
- CFSTR(kmDNSResponderServName), NULL, NULL)))
- {
- LogMsg("SCDynamicStoreCreate failed: %s", SCErrorString(SCError()));
- goto fin;
- }
- SCDynamicStoreSetValue(store, sckey, plist);
+ SCDynamicStoreSetValue(NULL, sckey, plist);
fin:
if (NULL != bytes)
CFRelease(bytes);
if (NULL != plist)
CFRelease(plist);
- if (NULL != store)
- CFRelease(store);
if (release_sckey && sckey)
CFRelease(sckey);
}
@@ -1210,6 +1242,7 @@ mDNSexport void mDNSDynamicStoreSetConfig(int key, const char *subkey, CFPropert
if (!subkeyCopy)
{
LogMsg("mDNSDynamicStoreSetConfig: ERROR subkeyCopy NULL");
+ CFRelease(valueCopy);
return;
}
mDNSPlatformMemCopy(subkeyCopy, subkey, len);
@@ -1219,7 +1252,6 @@ mDNSexport void mDNSDynamicStoreSetConfig(int key, const char *subkey, CFPropert
dispatch_async(DynamicStoreQueue, ^{
CFWriteStreamRef stream = NULL;
CFDataRef bytes = NULL;
- CFStringRef error;
CFIndex ret;
if (NULL == (stream = CFWriteStreamCreateWithAllocatedBuffers(NULL, NULL)))
@@ -1228,7 +1260,7 @@ mDNSexport void mDNSDynamicStoreSetConfig(int key, const char *subkey, CFPropert
goto END;
}
CFWriteStreamOpen(stream);
- ret = CFPropertyListWriteToStream(valueCopy, stream, kCFPropertyListBinaryFormat_v1_0, &error);
+ ret = CFPropertyListWrite(valueCopy, stream, kCFPropertyListBinaryFormat_v1_0, 0, NULL);
if (ret == 0)
{
LogMsg("mDNSDynamicStoreSetConfig : CFPropertyListWriteToStream failed (Could not write property list to stream)");
@@ -1298,8 +1330,6 @@ mDNSlocal mDNSBool GetmDNSManagedPrefKeyVal(SCPreferencesRef prefs, CFStringRef
LogMsg("GetmDNSManagedPrefKeyVal: mDNSManagedPrefs are NULL!");
val = mDNSfalse;
}
- if (val_cf)
- CFRelease(val_cf);
return (val);
}
@@ -1702,6 +1732,8 @@ mDNSexport void mDNSPlatformSetuDNSSocktOpt(UDPSocket *src, const mDNSAddr *dst,
if (src)
{
int s;
+ char unenc_name[MAX_ESCAPED_DOMAIN_NAME];
+ ConvertDomainNameToCString(&q->qname, unenc_name);
if (dst->type == mDNSAddrType_IPv4)
s = src->ss.sktv4;
@@ -1719,6 +1751,10 @@ mDNSexport void mDNSPlatformSetuDNSSocktOpt(UDPSocket *src, const mDNSAddr *dst,
LogInfo("mDNSPlatformSetuDNSSocktOpt: Delegate UUID failed %s", strerror(errno));
}
+ // set the domain on the UDP socket
+ if (!(ne_session_set_socket_attributes(s, unenc_name, NULL)))
+ LogInfo("mDNSPlatformSetuDNSSocktOpt: ne_session_set_socket_attributes()-> setting domain failed for %s", unenc_name);
+
#if defined(SO_NOWAKEFROMSLEEP)
int nowake = 1;
if (setsockopt(s, SOL_SOCKET, SO_NOWAKEFROMSLEEP, &nowake, sizeof(nowake)) == -1)
@@ -1818,14 +1854,14 @@ mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const ms
{
if (errno != ENOPROTOOPT) LogInfo("mDNSPlatformSendUDP: setsockopt: IP_MUTLTICAST_IFINDEX returned %d", errno);
err = setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &info->ifa_v4addr, sizeof(info->ifa_v4addr));
- if (err < 0 && !m->p->NetworkChanged)
+ if (err < 0 && !m->NetworkChanged)
LogMsg("setsockopt - IP_MULTICAST_IF error %.4a %d errno %d (%s)", &info->ifa_v4addr, err, errno, strerror(errno));
}
}
#else
{
err = setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &info->ifa_v4addr, sizeof(info->ifa_v4addr));
- if (err < 0 && !m->p->NetworkChanged)
+ if (err < 0 && !m->NetworkChanged)
LogMsg("setsockopt - IP_MULTICAST_IF error %.4a %d errno %d (%s)", &info->ifa_v4addr, err, errno, strerror(errno));
}
@@ -1855,14 +1891,23 @@ mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const ms
LogInfo("setsockopt - IPV6_MUTLICAST_IF scopeid %d, not a valid interface", info->scope_id);
}
}
+#ifdef IPV6_BOUND_IF
+ if (info) // Specify outgoing interface for non-multicast destination
+ {
+ if (!mDNSAddrIsDNSMulticast(dst))
+ {
+ if (info->scope_id == 0)
+ LogInfo("IPV6_BOUND_IF socket option not set -- info %p (%s) scope_id is zero", info, ifa_name);
+ else
+ setsockopt(s, IPPROTO_IPV6, IPV6_BOUND_IF, &info->scope_id, sizeof(info->scope_id));
+ }
+ }
+#endif
}
else
{
- LogMsg("mDNSPlatformSendUDP: dst is not an IPv4 or IPv6 address!");
-#if ForceAlerts
- *(long*)0 = 0;
-#endif
+ LogFatalError("mDNSPlatformSendUDP: dst is not an IPv4 or IPv6 address!");
return mStatus_BadParamErr;
}
@@ -1899,7 +1944,7 @@ mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const ms
// but this means that sometimes it starts before configd has finished setting up the multicast routing entries.
if (errno == EHOSTUNREACH && (mDNSu32)(mDNSPlatformRawTime()) < (mDNSu32)(mDNSPlatformOneSecond * 180)) return(mStatus_TransientErr);
// Don't report EADDRNOTAVAIL ("Can't assign requested address") if we're in the middle of a network configuration change
- if (errno == EADDRNOTAVAIL && m->p->NetworkChanged) return(mStatus_TransientErr);
+ if (errno == EADDRNOTAVAIL && m->NetworkChanged) return(mStatus_TransientErr);
if (errno == EHOSTUNREACH || errno == EADDRNOTAVAIL || errno == ENETDOWN)
LogInfo("mDNSPlatformSendUDP sendto(%d) failed to send packet on InterfaceID %p %5s/%d to %#a:%d skt %d error %d errno %d (%s) %lu",
s, InterfaceID, ifa_name, dst->type, dst, mDNSVal16(dstPort), s, err, errno, strerror(errno), (mDNSu32)(m->timenow));
@@ -2006,6 +2051,7 @@ mDNSexport ssize_t myrecvfrom(const int s, void *const buffer, const size_t max,
return(n);
}
+// What is this for, and why does it use xor instead of a simple quality check? -- SC
mDNSlocal mDNSInterfaceID FindMyInterface(mDNS *const m, const mDNSAddr *addr)
{
NetworkInterfaceInfo *intf;
@@ -2043,6 +2089,12 @@ mDNSlocal mDNSInterfaceID FindMyInterface(mDNS *const m, const mDNSAddr *addr)
return(mDNSInterface_Any);
}
+// This is a stupid hack and we should get rid of it.
+// The chance of there being a second unicast UDP packet already waiting in the kernel before we’ve
+// finished processing the previous one is virtually nil, and will only happen by luck on very rare
+// occasions when running on a machine with a fast network connection and a slow or busy processor.
+// The idea that we’d rely for correctness on this random chance event occurring is ridiculous.
+// -- SC
mDNSexport mDNSBool mDNSPlatformPeekUDP(mDNS *const m, UDPSocket *src)
{
// We should have a DNSMessage header followed by the question and an answer
@@ -2165,6 +2217,15 @@ mDNSexport void myKQSocketCallBack(int s1, short filter, void *context)
if (!closed) ss->closeFlag = mDNSNULL;
}
+ // If a client application is put in the background, it's socket to us can go defunct and
+ // we'll get an ENOTCONN error on that connection. Just close the socket in that case.
+ if (err < 0 && errno == ENOTCONN)
+ {
+ LogInfo("myKQSocketCallBack: ENOTCONN, closing socket");
+ close(s1);
+ return;
+ }
+
if (err < 0 && (errno != EWOULDBLOCK || count == 0))
{
// Something is busted here.
@@ -3057,7 +3118,7 @@ mDNSlocal mStatus SetupSocket(KQSocketSet *cp, const mDNSIPPort port, u_short sa
// We want to receive packet TTL value so we can check it
err = setsockopt(skt, IPPROTO_IP, IP_RECVTTL, &on, sizeof(on));
- // We ignore errors here -- we already know Jaguar doesn't support this, but we can get by without it
+ if (err < 0) { errstr = "setsockopt - IP_RECVTTL"; goto fail; }
// Send unicast packets with TTL 255
err = setsockopt(skt, IPPROTO_IP, IP_TTL, &twofivefive, sizeof(twofivefive));
@@ -3139,7 +3200,7 @@ mDNSlocal mStatus SetupSocket(KQSocketSet *cp, const mDNSIPPort port, u_short sa
#endif
KQueueSet(*s, EV_ADD, EVFILT_READ, k);
- return(err);
+ return(mStatus_NoError);
fail:
// For "bind" failures, only write log messages for our shared mDNS port, or for binding to zero
@@ -3247,7 +3308,7 @@ mDNSexport void mDNSPlatformSetLocalAddressCacheEntry(mDNS *const m, const mDNSA
if (info == NULL) { LogMsg("mDNSPlatformSetLocalAddressCacheEntry: Invalid interface index %p", InterfaceID); return; }
// Manually inject an entry into our local ARP cache.
// (We can't do this by sending an ARP broadcast, because the kernel only pays attention to incoming ARP packets, not outgoing.)
- if (!mDNS_AddressIsLocalSubnet(m, InterfaceID, tpa, mDNSNULL))
+ if (!mDNS_AddressIsLocalSubnet(m, InterfaceID, tpa))
LogSPS("Don't need address cache entry for %s %#a %.6a", info->ifinfo.ifname, tpa, tha);
else
{
@@ -3348,20 +3409,16 @@ mDNSexport void mDNSPlatformSendKeepalive(mDNSAddr *sadd, mDNSAddr *dadd, mDNSIP
mDNSexport mStatus mDNSPlatformClearSPSMACAddr(void)
{
- SCDynamicStoreRef store = NULL;
CFStringRef entityname = NULL;
- if ((store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:ClearSPSMACAddress"), NULL, NULL)))
+ if ((entityname = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%s%s%s"), "State:/Network/Interface/", "[^/]", "/BonjourSleepProxyAddress")))
{
- if ((entityname = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%s%s%s"), "State:/Network/Interface/", "[^/]", "/BonjourSleepProxyAddress")))
- {
- if (SCDynamicStoreRemoveValue(store, entityname) == false)
- LogMsg("mDNSPlatformClearSPSMACAddr: Unable to remove key");
- }
+ if (SCDynamicStoreRemoveValue(NULL, entityname) == false)
+ LogSPS("mDNSPlatformClearSPSMACAddr: Unable to remove key");
}
- if (entityname) CFRelease(entityname);
- if (store) CFRelease(store);
+ if (entityname)
+ CFRelease(entityname);
return KERN_SUCCESS;
}
@@ -3578,7 +3635,7 @@ mDNSexport void mDNSPlatformUpdateProxyList(mDNS *const m, const mDNSInterfaceID
LogSPS("mDNSPlatformUpdateProxyList: No need for filter");
if (m->timenow == 0) LogMsg("mDNSPlatformUpdateProxyList: m->timenow == 0");
// Schedule check to see if we can close this BPF_fd now
- if (!m->p->NetworkChanged) m->p->NetworkChanged = NonZeroTime(m->timenow + mDNSPlatformOneSecond * 2);
+ if (!m->NetworkChanged) m->NetworkChanged = NonZeroTime(m->timenow + mDNSPlatformOneSecond * 2);
// prog.bf_len = 0; This seems to panic the kernel
if (x->BPF_fd < 0) return; // If we've already closed our BPF_fd, no need to generate an error message below
}
@@ -3671,46 +3728,48 @@ mDNSexport void mDNSPlatformReceiveBPF_fd(mDNS *const m, int fd)
#endif
#ifndef NO_SECURITYFRAMEWORK
-mDNSlocal CFArrayRef GetCertChain(SecIdentityRef identity)
+mDNSlocal CFArrayRef CopyCertChain(SecIdentityRef identity)
{
CFMutableArrayRef certChain = NULL;
- if (!identity) { LogMsg("getCertChain: identity is NULL"); return(NULL); }
+ if (!identity) { LogMsg("CopyCertChain: identity is NULL"); return(NULL); }
SecCertificateRef cert;
OSStatus err = SecIdentityCopyCertificate(identity, &cert);
- if (err || !cert) LogMsg("getCertChain: SecIdentityCopyCertificate() returned %d", (int) err);
+ if (err || !cert) LogMsg("CopyCertChain: SecIdentityCopyCertificate() returned %d", (int) err);
else
{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
SecPolicySearchRef searchRef;
err = SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_X509_BASIC, NULL, &searchRef);
- if (err || !searchRef) LogMsg("getCertChain: SecPolicySearchCreate() returned %d", (int) err);
+ if (err || !searchRef) LogMsg("CopyCertChain: SecPolicySearchCreate() returned %d", (int) err);
else
{
SecPolicyRef policy;
err = SecPolicySearchCopyNext(searchRef, &policy);
- if (err || !policy) LogMsg("getCertChain: SecPolicySearchCopyNext() returned %d", (int) err);
+ if (err || !policy) LogMsg("CopyCertChain: SecPolicySearchCopyNext() returned %d", (int) err);
else
{
CFArrayRef wrappedCert = CFArrayCreate(NULL, (const void**) &cert, 1, &kCFTypeArrayCallBacks);
- if (!wrappedCert) LogMsg("getCertChain: wrappedCert is NULL");
+ if (!wrappedCert) LogMsg("CopyCertChain: wrappedCert is NULL");
else
{
SecTrustRef trust;
err = SecTrustCreateWithCertificates(wrappedCert, policy, &trust);
- if (err || !trust) LogMsg("getCertChain: SecTrustCreateWithCertificates() returned %d", (int) err);
+ if (err || !trust) LogMsg("CopyCertChain: SecTrustCreateWithCertificates() returned %d", (int) err);
else
{
err = SecTrustEvaluate(trust, NULL);
- if (err) LogMsg("getCertChain: SecTrustEvaluate() returned %d", (int) err);
+ if (err) LogMsg("CopyCertChain: SecTrustEvaluate() returned %d", (int) err);
else
{
CFArrayRef rawCertChain;
CSSM_TP_APPLE_EVIDENCE_INFO *statusChain = NULL;
err = SecTrustGetResult(trust, NULL, &rawCertChain, &statusChain);
- if (err || !rawCertChain || !statusChain) LogMsg("getCertChain: SecTrustGetResult() returned %d", (int) err);
+ if (err || !rawCertChain || !statusChain) LogMsg("CopyCertChain: SecTrustGetResult() returned %d", (int) err);
else
{
certChain = CFArrayCreateMutableCopy(NULL, 0, rawCertChain);
- if (!certChain) LogMsg("getCertChain: certChain is NULL");
+ if (!certChain) LogMsg("CopyCertChain: certChain is NULL");
else
{
// Replace the SecCertificateRef at certChain[0] with a SecIdentityRef per documentation for SSLSetCertificate:
@@ -3734,6 +3793,7 @@ mDNSlocal CFArrayRef GetCertChain(SecIdentityRef identity)
}
CFRelease(searchRef);
}
+#pragma clang diagnostic pop
CFRelease(cert);
}
return certChain;
@@ -3749,6 +3809,8 @@ mDNSexport mStatus mDNSPlatformTLSSetupCerts(void)
SecIdentitySearchRef srchRef = nil;
OSStatus err;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// search for "any" identity matching specified key use
// In this app, we expect there to be exactly one
err = SecIdentitySearchCreate(NULL, CSSM_KEYUSE_DECRYPT, &srchRef);
@@ -3756,13 +3818,14 @@ mDNSexport mStatus mDNSPlatformTLSSetupCerts(void)
err = SecIdentitySearchCopyNext(srchRef, &identity);
if (err) { LogMsg("ERROR: mDNSPlatformTLSSetupCerts: SecIdentitySearchCopyNext returned %d", (int) err); return err; }
+#pragma clang diagnostic pop
if (CFGetTypeID(identity) != SecIdentityGetTypeID())
{ LogMsg("ERROR: mDNSPlatformTLSSetupCerts: SecIdentitySearchCopyNext CFTypeID failure"); return mStatus_UnknownErr; }
- // Found one. Call getCertChain to create the correct certificate chain.
- ServerCerts = GetCertChain(identity);
- if (ServerCerts == nil) { LogMsg("ERROR: mDNSPlatformTLSSetupCerts: getCertChain error"); return mStatus_UnknownErr; }
+ // Found one. Call CopyCertChain to create the correct certificate chain.
+ ServerCerts = CopyCertChain(identity);
+ if (ServerCerts == nil) { LogMsg("ERROR: mDNSPlatformTLSSetupCerts: CopyCertChain error"); return mStatus_UnknownErr; }
return mStatus_NoError;
#endif /* NO_SECURITYFRAMEWORK */
@@ -3841,26 +3904,22 @@ mDNSlocal mStatus SetupAddr(mDNSAddr *ip, const struct sockaddr *const sa)
mDNSlocal mDNSEthAddr GetBSSID(char *ifa_name)
{
mDNSEthAddr eth = zeroEthAddr;
- SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:GetBSSID"), NULL, NULL);
- if (!store)
- LogMsg("GetBSSID: SCDynamicStoreCreate failed: %s", SCErrorString(SCError()));
- else
+
+ CFStringRef entityname = CFStringCreateWithFormat(NULL, NULL, CFSTR("State:/Network/Interface/%s/AirPort"), ifa_name);
+ if (entityname)
{
- CFStringRef entityname = CFStringCreateWithFormat(NULL, NULL, CFSTR("State:/Network/Interface/%s/AirPort"), ifa_name);
- if (entityname)
+ CFDictionaryRef dict = SCDynamicStoreCopyValue(NULL, entityname);
+ if (dict)
{
- CFDictionaryRef dict = SCDynamicStoreCopyValue(store, entityname);
- if (dict)
- {
- CFRange range = { 0, 6 }; // Offset, length
- CFDataRef data = CFDictionaryGetValue(dict, CFSTR("BSSID"));
- if (data && CFDataGetLength(data) == 6) CFDataGetBytes(data, range, eth.b);
- CFRelease(dict);
- }
- CFRelease(entityname);
+ CFRange range = { 0, 6 }; // Offset, length
+ CFDataRef data = CFDictionaryGetValue(dict, CFSTR("BSSID"));
+ if (data && CFDataGetLength(data) == 6)
+ CFDataGetBytes(data, range, eth.b);
+ CFRelease(dict);
}
- CFRelease(store);
+ CFRelease(entityname);
}
+
return(eth);
}
@@ -4005,6 +4064,134 @@ mDNSlocal u_int64_t getExtendedFlags(char * ifa_name)
return ifr.ifr_eflags;
}
+#if TARGET_OS_IPHONE
+
+// Function pointers for the routines we use in the MobileWiFi framework.
+static WiFiManagerClientRef (*WiFiManagerClientCreate_p)(CFAllocatorRef allocator, WiFiClientType type) = mDNSNULL;
+static CFArrayRef (*WiFiManagerClientCopyDevices_p)(WiFiManagerClientRef manager) = mDNSNULL;
+static WiFiNetworkRef (*WiFiDeviceClientCopyCurrentNetwork_p)(WiFiDeviceClientRef device) = mDNSNULL;
+static bool (*WiFiNetworkIsCarPlay_p)(WiFiNetworkRef network) = mDNSNULL;
+
+mDNSlocal mDNSBool MobileWiFiLibLoad(void)
+{
+ static mDNSBool isInitialized = mDNSfalse;
+ static void *MobileWiFiLib_p = mDNSNULL;
+ static const char path[] = "/System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi";
+
+ if (!isInitialized)
+ {
+ if (!MobileWiFiLib_p)
+ {
+ MobileWiFiLib_p = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
+ if (!MobileWiFiLib_p)
+ {
+ LogInfo("MobileWiFiLibLoad: dlopen() failed.");
+ goto exit;
+ }
+ }
+
+ if (!WiFiManagerClientCreate_p)
+ {
+ WiFiManagerClientCreate_p = dlsym(MobileWiFiLib_p, "WiFiManagerClientCreate");
+ if (!WiFiManagerClientCreate_p)
+ {
+ LogInfo("MobileWiFiLibLoad: load of WiFiManagerClientCreate symbol failed.");
+ goto exit;
+ }
+ }
+
+ if (!WiFiManagerClientCopyDevices_p)
+ {
+ WiFiManagerClientCopyDevices_p = dlsym(MobileWiFiLib_p, "WiFiManagerClientCopyDevices");
+ if (!WiFiManagerClientCopyDevices_p)
+ {
+ LogInfo("MobileWiFiLibLoad: load of WiFiManagerClientCopyDevices symbol failed.");
+ goto exit;
+ }
+ }
+
+ if (!WiFiDeviceClientCopyCurrentNetwork_p)
+ {
+ WiFiDeviceClientCopyCurrentNetwork_p = dlsym(MobileWiFiLib_p, "WiFiDeviceClientCopyCurrentNetwork");
+ if (!WiFiDeviceClientCopyCurrentNetwork_p)
+ {
+ LogInfo("MobileWiFiLibLoad: load of WiFiDeviceClientCopyCurrentNetwork symbol failed.");
+ goto exit;
+ }
+ }
+
+ if (!WiFiNetworkIsCarPlay_p)
+ {
+ WiFiNetworkIsCarPlay_p = dlsym(MobileWiFiLib_p, "WiFiNetworkIsCarPlay");
+ if (!WiFiNetworkIsCarPlay_p)
+ {
+ LogInfo("MobileWiFiLibLoad: load of WiFiNetworkIsCarPlay symbol failed.");
+ goto exit;
+ }
+ }
+
+ isInitialized = mDNStrue;
+ }
+
+exit:
+ return isInitialized;
+}
+
+// Return true if the interface is associate to a CarPlay hosted SSID.
+mDNSlocal mDNSBool IsCarPlaySSID(char *ifa_name)
+{
+ mDNSBool rvalue = mDNSfalse;
+
+ if (!MobileWiFiLibLoad())
+ return mDNSfalse;
+
+ // If we have associated with a CarPlay hosted SSID, then use the same
+ // optimizations that are used if an interface has the IFEF_DIRECTLINK flag set.
+
+ WiFiManagerClientRef manager;
+
+ manager = WiFiManagerClientCreate_p(NULL, kWiFiClientTypeNormal);
+ if (manager != NULL)
+ {
+ CFArrayRef devices;
+
+ devices = WiFiManagerClientCopyDevices_p(manager);
+ if (devices != NULL)
+ {
+ WiFiDeviceClientRef device;
+ WiFiNetworkRef network;
+
+ device = (WiFiDeviceClientRef)CFArrayGetValueAtIndex(devices, 0);
+ network = WiFiDeviceClientCopyCurrentNetwork_p(device);
+ if (network != NULL)
+ {
+ if (WiFiNetworkIsCarPlay_p(network))
+ {
+ LogInfo("%s is CarPlay hosted", ifa_name);
+ rvalue = mDNStrue;
+ }
+ CFRelease(network);
+ }
+ CFRelease(devices);
+ }
+ CFRelease(manager);
+ }
+
+ return rvalue;
+}
+
+#else // TARGET_OS_IPHONE
+
+mDNSlocal mDNSBool IsCarPlaySSID(char *ifa_name)
+{
+ (void)ifa_name; // unused
+
+ // OSX WifiManager currently does not implement WiFiNetworkIsCarPlay()
+ return mDNSfalse;;
+}
+
+#endif // TARGET_OS_IPHONE
+
// Returns pointer to newly created NetworkInterfaceInfoOSX object, or
// pointer to already-existing NetworkInterfaceInfoOSX object found in list, or
// may return NULL if out of memory (unlikely) or parameters are invalid for some reason
@@ -4050,7 +4237,7 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(mDNS *const m, struct ifad
{
mDNS_Lock(m);
if (NetWake) mDNS_ActivateNetWake_internal (m, &(*p)->ifinfo);
- else mDNS_DeactivateNetWake_internal(m, &(*p)->ifinfo);
+ else mDNS_DeactivateNetWake_internal(m, &(*p)->ifinfo);
mDNS_Unlock(m);
}
}
@@ -4075,7 +4262,11 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(mDNS *const m, struct ifad
i->ifinfo.McastTxRx = mDNSfalse; // For now; will be set up later at the end of UpdateInterfaceList
i->ifinfo.Loopback = ((ifa->ifa_flags & IFF_LOOPBACK) != 0) ? mDNStrue : mDNSfalse;
i->ifinfo.IgnoreIPv4LL = ((eflags & IFEF_ARPLL) != 0) ? mDNSfalse : mDNStrue;
- i->ifinfo.DirectLink = (eflags & IFEF_DIRECTLINK) ? mDNStrue: mDNSfalse;
+
+ if (eflags & IFEF_DIRECTLINK)
+ i->ifinfo.DirectLink = mDNStrue;
+ else
+ i->ifinfo.DirectLink = IsCarPlaySSID(ifa->ifa_name);
i->next = mDNSNULL;
i->m = m;
@@ -4085,9 +4276,17 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(mDNS *const m, struct ifad
i->D2DInterface = (eflags & IFEF_LOCALNET_PRIVATE) ? mDNStrue: mDNSfalse;
if (eflags & IFEF_AWDL)
{
+ // Set SupportsUnicastMDNSResponse false for the AWDL interface since unicast reserves
+ // limited AWDL resources so we don't set the kDNSQClass_UnicastResponse bit in
+ // Bonjour requests over the AWDL interface.
+ i->ifinfo.SupportsUnicastMDNSResponse = mDNSfalse;
AWDLInterfaceID = i->ifinfo.InterfaceID;
LogInfo("AddInterfaceToList: AWDLInterfaceID = %d", (int) AWDLInterfaceID);
}
+ else
+ {
+ i->ifinfo.SupportsUnicastMDNSResponse = mDNStrue;
+ }
i->AppearanceTime = utc; // Brand new interface; AppearanceTime is now
i->LastSeen = utc;
i->ifa_flags = ifa->ifa_flags;
@@ -4100,7 +4299,7 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(mDNS *const m, struct ifad
i->Registered = mDNSNULL;
// Do this AFTER i->BSSID has been set up
- i->ifinfo.NetWake = NetWakeInterface(i);
+ i->ifinfo.NetWake = (eflags & IFEF_EXPENSIVE)? mDNSfalse : NetWakeInterface(i);
GetMAC(&i->ifinfo.MAC, scope_id);
if (i->ifinfo.NetWake && !i->ifinfo.MAC.l[0])
LogMsg("AddInterfaceToList: Bad MAC address %.6a for %d %s %#a", &i->ifinfo.MAC, scope_id, i->ifinfo.ifname, &ip);
@@ -4203,7 +4402,6 @@ mDNSlocal void UpdateAutoTunnelDomainStatus(const mDNS *const m, const DomainAut
const NATTraversalInfo *const llq = m->LLQNAT.clientCallback ? &m->LLQNAT : mDNSNULL;
const NATTraversalInfo *const tun = m->AutoTunnelNAT.clientContext ? &m->AutoTunnelNAT : mDNSNULL;
char buffer[1024];
- mDNSu32 buflen = 0;
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFStringRef domain = NULL;
CFStringRef tmp = NULL;
@@ -4222,7 +4420,7 @@ mDNSlocal void UpdateAutoTunnelDomainStatus(const mDNS *const m, const DomainAut
if (!dict) { LogMsg("UpdateAutoTunnelDomainStatus: Could not create CFDictionary dict"); return; }
- buflen = mDNS_snprintf(buffer, sizeof(buffer), "%##s", info->domain.c);
+ mDNS_snprintf(buffer, sizeof(buffer), "%##s", info->domain.c);
domain = CFStringCreateWithCString(NULL, buffer, kCFStringEncodingUTF8);
if (!domain) { LogMsg("UpdateAutoTunnelDomainStatus: Could not create CFString domain"); return; }
@@ -5204,6 +5402,7 @@ mDNSexport void AddNewClientTunnel(mDNS *const m, DNSQuestion *const q)
p->q.qnameOrig = mDNSNULL;
p->q.AnonInfo = mDNSNULL;
p->q.pid = mDNSPlatformGetPID();
+ p->q.euid = 0;
p->q.QuestionCallback = AutoTunnelCallback;
p->q.QuestionContext = p;
@@ -5222,7 +5421,7 @@ mDNSlocal mStatus UpdateInterfaceList(mDNS *const m, mDNSs32 utc)
{
mDNSBool foundav4 = mDNSfalse;
mDNSBool foundav6 = mDNSfalse;
- struct ifaddrs *ifa = myGetIfAddrs(1);
+ struct ifaddrs *ifa = myGetIfAddrs(0);
struct ifaddrs *v4Loopback = NULL;
struct ifaddrs *v6Loopback = NULL;
char defaultname[64];
@@ -5402,14 +5601,14 @@ mDNSlocal mStatus UpdateInterfaceList(mDNS *const m, mDNSs32 utc)
namechange = mDNStrue;
}
-#if APPLE_OSX_mDNSResponder
if (namechange) // If either name has changed, we need to tickle our AutoTunnel state machine to update its registered records
{
+#if APPLE_OSX_mDNSResponder
DomainAuthInfo *info;
for (info = m->AuthInfoList; info; info = info->next)
if (info->AutoTunnel) AutoTunnelHostNameChanged(m, info);
- }
#endif // APPLE_OSX_mDNSResponder
+ }
return(mStatus_NoError);
}
@@ -5430,7 +5629,7 @@ mDNSlocal int CountMaskBits(mDNSAddr *mask)
return(bits);
}
-// returns count of non-link local V4 addresses registered
+// Returns count of non-link local V4 addresses registered (why? -- SC)
mDNSlocal int SetupActiveInterfaces(mDNS *const m, mDNSs32 utc)
{
NetworkInterfaceInfoOSX *i;
@@ -5452,9 +5651,7 @@ mDNSlocal int SetupActiveInterfaces(mDNS *const m, mDNSs32 utc)
{
// Note: If i->Registered is set, that means we've called mDNS_RegisterInterface() for this interface,
// so we need to make sure we call mDNS_DeregisterInterface() before disposing it.
- // If i->Registered is NOT set, then we haven't registered it and we should not try to deregister it
- //
-
+ // If i->Registered is NOT set, then we haven't registered it and we should not try to deregister it.
i->Registered = primary;
// If i->LastSeen == utc, then this is a brand-new interface, just created, or an interface that never went away.
@@ -5463,7 +5660,7 @@ mDNSlocal int SetupActiveInterfaces(mDNS *const m, mDNSs32 utc)
i->Occulting = !(i->ifa_flags & IFF_LOOPBACK) && (utc - i->LastSeen > 0 && utc - i->LastSeen < 60);
// Temporary fix to handle P2P flapping. P2P reuses the scope-id, mac address and the IP address
- // everytime it creates a new interface. We think it is a duplicate and hence consider it
+ // every time it creates a new interface. We think it is a duplicate and hence consider it
// as flashing and occulting, that is, flapping. If an interface is marked as flapping,
// mDNS_RegisterInterface() changes the probe delay from 1/2 second to 5 seconds and
// logs a warning message to system.log noting frequent interface transitions.
@@ -5488,7 +5685,42 @@ mDNSlocal int SetupActiveInterfaces(mDNS *const m, mDNSs32 utc)
n->InterfaceActive ? " (Primary)" : "");
if (!n->McastTxRx)
+ {
debugf("SetupActiveInterfaces: No Tx/Rx on %5s(%lu) %.6a InterfaceID %p %#a", i->ifinfo.ifname, i->scope_id, &i->BSSID, i->ifinfo.InterfaceID, &n->ip);
+#if TARGET_OS_WATCH
+ // We join the Bonjour multicast group on the watch only when a client request is active,
+ // so we leave the multicast group here to clear any residual group membership.
+ if (i->sa_family == AF_INET)
+ {
+ struct ip_mreq imr;
+ primary->ifa_v4addr.s_addr = n->ip.ip.v4.NotAnInteger;
+ imr.imr_multiaddr.s_addr = AllDNSLinkGroup_v4.ip.v4.NotAnInteger;
+ imr.imr_interface = primary->ifa_v4addr;
+
+ if (SearchForInterfaceByName(m, i->ifinfo.ifname, AF_INET) == i)
+ {
+ LogInfo("SetupActiveInterfaces: %5s(%lu) Doing IP_DROP_MEMBERSHIP for %.4a on %.4a", i->ifinfo.ifname, i->scope_id, &imr.imr_multiaddr, &imr.imr_interface);
+ mStatus err = setsockopt(m->p->permanentsockets.sktv4, IPPROTO_IP, IP_DROP_MEMBERSHIP, &imr, sizeof(imr));
+ if (err < 0 && (errno != EADDRNOTAVAIL))
+ LogMsg("setsockopt - IP_DROP_MEMBERSHIP error %d errno %d (%s)", err, errno, strerror(errno));
+ }
+ }
+ if (i->sa_family == AF_INET6)
+ {
+ struct ipv6_mreq i6mr;
+ i6mr.ipv6mr_interface = primary->scope_id;
+ i6mr.ipv6mr_multiaddr = *(struct in6_addr*)&AllDNSLinkGroup_v6.ip.v6;
+
+ if (SearchForInterfaceByName(m, i->ifinfo.ifname, AF_INET6) == i)
+ {
+ LogInfo("SetupActiveInterfaces: %5s(%lu) Doing IPV6_LEAVE_GROUP for %.16a on %u", i->ifinfo.ifname, i->scope_id, &i6mr.ipv6mr_multiaddr, i6mr.ipv6mr_interface);
+ mStatus err = setsockopt(m->p->permanentsockets.sktv6, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &i6mr, sizeof(i6mr));
+ if (err < 0 && (errno != EADDRNOTAVAIL))
+ LogMsg("setsockopt - IPV6_LEAVE_GROUP error %d errno %d (%s) group %.16a on %u", err, errno, strerror(errno), &i6mr.ipv6mr_multiaddr, i6mr.ipv6mr_interface);
+ }
+ }
+#endif // TARGET_OS_WATCH
+ }
else
{
if (i->sa_family == AF_INET)
@@ -5559,7 +5791,7 @@ mDNSlocal void MarkAllInterfacesInactive(mDNS *const m, mDNSs32 utc)
}
}
-// returns count of non-link local V4 addresses deregistered
+// Returns count of non-link local V4 addresses deregistered (why? -- SC)
mDNSlocal int ClearInactiveInterfaces(mDNS *const m, mDNSs32 utc)
{
// First pass:
@@ -5585,7 +5817,7 @@ mDNSlocal int ClearInactiveInterfaces(mDNS *const m, mDNSs32 utc)
i->ifinfo.InterfaceActive ? " (Primary)" : "");
// Temporary fix to handle P2P flapping. P2P reuses the scope-id, mac address and the IP address
- // everytime it creates a new interface. We think it is a duplicate and hence consider it
+ // every time it creates a new interface. We think it is a duplicate and hence consider it
// as flashing and occulting. The "core" does not flush the cache for this case. This leads to
// stale data returned to the application even after the interface is removed. The application
// then starts to send data but the new interface is not yet created.
@@ -5801,7 +6033,6 @@ mDNSlocal void ConfigDNSServers(mDNS *const m, dns_resolver_t *r, mDNSInterfaceI
domainname d;
int serviceID = 0;
mDNSBool cellIntf = mDNSfalse;
- mDNSBool scopedDNS = mDNSfalse;
mDNSBool reqA, reqAAAA;
if (!r->domain || !*r->domain)
@@ -5814,11 +6045,7 @@ mDNSlocal void ConfigDNSServers(mDNS *const m, dns_resolver_t *r, mDNSInterfaceI
return;
}
// Parse the resolver specific attributes that affects all the DNS servers.
- if (scope == kScopeInterfaceID)
- {
- scopedDNS = mDNStrue;
- }
- else if (scope == kScopeServiceID)
+ if (scope == kScopeServiceID)
{
serviceID = r->service_identifier;
}
@@ -6107,124 +6334,114 @@ mDNSlocal void SetupActiveDirectoryDomain(dns_config_t *config)
mDNSlocal void SetupDDNSDomains(domainname *const fqdn, DNameListElem **RegDomains, DNameListElem **BrowseDomains)
{
int i;
- char buf[MAX_ESCAPED_DOMAIN_NAME]; // Max legal C-string name, including terminating NUL
+ char buf[MAX_ESCAPED_DOMAIN_NAME]; // Max legal C-string name, including terminating NULL
domainname d;
- SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:SetupDDNSDomains"), NULL, NULL);
- if (!store)
- {
- LogMsg("SetupDDNSDomains: SCDynamicStoreCreate failed: %s", SCErrorString(SCError()));
- }
- else
+ CFDictionaryRef ddnsdict = SCDynamicStoreCopyValue(NULL, NetworkChangedKey_DynamicDNS);
+ if (ddnsdict)
{
- CFDictionaryRef ddnsdict = SCDynamicStoreCopyValue(store, NetworkChangedKey_DynamicDNS);
- if (ddnsdict)
+ if (fqdn)
{
- if (fqdn)
+ CFArrayRef fqdnArray = CFDictionaryGetValue(ddnsdict, CFSTR("HostNames"));
+ if (fqdnArray && CFArrayGetCount(fqdnArray) > 0)
{
- CFArrayRef fqdnArray = CFDictionaryGetValue(ddnsdict, CFSTR("HostNames"));
- if (fqdnArray && CFArrayGetCount(fqdnArray) > 0)
+ // for now, we only look at the first array element. if we ever support multiple configurations, we will walk the list
+ CFDictionaryRef fqdnDict = CFArrayGetValueAtIndex(fqdnArray, 0);
+ if (fqdnDict && DictionaryIsEnabled(fqdnDict))
{
- // for now, we only look at the first array element. if we ever support multiple configurations, we will walk the list
- CFDictionaryRef fqdnDict = CFArrayGetValueAtIndex(fqdnArray, 0);
- if (fqdnDict && DictionaryIsEnabled(fqdnDict))
+ CFStringRef name = CFDictionaryGetValue(fqdnDict, CFSTR("Domain"));
+ if (name)
{
- CFStringRef name = CFDictionaryGetValue(fqdnDict, CFSTR("Domain"));
- if (name)
- {
- if (!CFStringGetCString(name, buf, sizeof(buf), kCFStringEncodingUTF8) ||
- !MakeDomainNameFromDNSNameString(fqdn, buf) || !fqdn->c[0])
- LogMsg("GetUserSpecifiedDDNSConfig SCDynamicStore bad DDNS host name: %s", buf[0] ? buf : "(unknown)");
- else debugf("GetUserSpecifiedDDNSConfig SCDynamicStore DDNS host name: %s", buf);
- }
+ if (!CFStringGetCString(name, buf, sizeof(buf), kCFStringEncodingUTF8) ||
+ !MakeDomainNameFromDNSNameString(fqdn, buf) || !fqdn->c[0])
+ LogMsg("GetUserSpecifiedDDNSConfig SCDynamicStore bad DDNS host name: %s", buf[0] ? buf : "(unknown)");
+ else
+ debugf("GetUserSpecifiedDDNSConfig SCDynamicStore DDNS host name: %s", buf);
}
}
}
-
- if (RegDomains)
+ }
+ if (RegDomains)
+ {
+ CFArrayRef regArray = CFDictionaryGetValue(ddnsdict, CFSTR("RegistrationDomains"));
+ if (regArray && CFArrayGetCount(regArray) > 0)
{
- CFArrayRef regArray = CFDictionaryGetValue(ddnsdict, CFSTR("RegistrationDomains"));
- if (regArray && CFArrayGetCount(regArray) > 0)
+ CFDictionaryRef regDict = CFArrayGetValueAtIndex(regArray, 0);
+ if (regDict && DictionaryIsEnabled(regDict))
{
- CFDictionaryRef regDict = CFArrayGetValueAtIndex(regArray, 0);
- if (regDict && DictionaryIsEnabled(regDict))
+ CFStringRef name = CFDictionaryGetValue(regDict, CFSTR("Domain"));
+ if (name)
{
- CFStringRef name = CFDictionaryGetValue(regDict, CFSTR("Domain"));
- if (name)
+ if (!CFStringGetCString(name, buf, sizeof(buf), kCFStringEncodingUTF8) ||
+ !MakeDomainNameFromDNSNameString(&d, buf) || !d.c[0])
+ LogMsg("GetUserSpecifiedDDNSConfig SCDynamicStore bad DDNS registration domain: %s", buf[0] ? buf : "(unknown)");
+ else
{
- if (!CFStringGetCString(name, buf, sizeof(buf), kCFStringEncodingUTF8) ||
- !MakeDomainNameFromDNSNameString(&d, buf) || !d.c[0])
- LogMsg("GetUserSpecifiedDDNSConfig SCDynamicStore bad DDNS registration domain: %s", buf[0] ? buf : "(unknown)");
- else
- {
- debugf("GetUserSpecifiedDDNSConfig SCDynamicStore DDNS registration domain: %s", buf);
- AppendDNameListElem(&RegDomains, 0, &d);
- }
+ debugf("GetUserSpecifiedDDNSConfig SCDynamicStore DDNS registration domain: %s", buf);
+ AppendDNameListElem(&RegDomains, 0, &d);
}
}
}
}
-
- if (BrowseDomains)
+ }
+ if (BrowseDomains)
+ {
+ CFArrayRef browseArray = CFDictionaryGetValue(ddnsdict, CFSTR("BrowseDomains"));
+ if (browseArray)
{
- CFArrayRef browseArray = CFDictionaryGetValue(ddnsdict, CFSTR("BrowseDomains"));
- if (browseArray)
+ for (i = 0; i < CFArrayGetCount(browseArray); i++)
{
- for (i = 0; i < CFArrayGetCount(browseArray); i++)
+ CFDictionaryRef browseDict = CFArrayGetValueAtIndex(browseArray, i);
+ if (browseDict && DictionaryIsEnabled(browseDict))
{
- CFDictionaryRef browseDict = CFArrayGetValueAtIndex(browseArray, i);
- if (browseDict && DictionaryIsEnabled(browseDict))
+ CFStringRef name = CFDictionaryGetValue(browseDict, CFSTR("Domain"));
+ if (name)
{
- CFStringRef name = CFDictionaryGetValue(browseDict, CFSTR("Domain"));
- if (name)
+ if (!CFStringGetCString(name, buf, sizeof(buf), kCFStringEncodingUTF8) ||
+ !MakeDomainNameFromDNSNameString(&d, buf) || !d.c[0])
+ LogMsg("GetUserSpecifiedDDNSConfig SCDynamicStore bad DDNS browsing domain: %s", buf[0] ? buf : "(unknown)");
+ else
{
- if (!CFStringGetCString(name, buf, sizeof(buf), kCFStringEncodingUTF8) ||
- !MakeDomainNameFromDNSNameString(&d, buf) || !d.c[0])
- LogMsg("GetUserSpecifiedDDNSConfig SCDynamicStore bad DDNS browsing domain: %s", buf[0] ? buf : "(unknown)");
- else
- {
- debugf("GetUserSpecifiedDDNSConfig SCDynamicStore DDNS browsing domain: %s", buf);
- AppendDNameListElem(&BrowseDomains, 0, &d);
- }
+ debugf("GetUserSpecifiedDDNSConfig SCDynamicStore DDNS browsing domain: %s", buf);
+ AppendDNameListElem(&BrowseDomains, 0, &d);
}
}
}
}
}
- CFRelease(ddnsdict);
}
-
- if (RegDomains)
+ CFRelease(ddnsdict);
+ }
+ if (RegDomains)
+ {
+ CFDictionaryRef btmm = SCDynamicStoreCopyValue(NULL, NetworkChangedKey_BackToMyMac);
+ if (btmm)
{
- CFDictionaryRef btmm = SCDynamicStoreCopyValue(store, NetworkChangedKey_BackToMyMac);
- if (btmm)
+ CFIndex size = CFDictionaryGetCount(btmm);
+ const void *key[size];
+ const void *val[size];
+ CFDictionaryGetKeysAndValues(btmm, key, val);
+ for (i = 0; i < size; i++)
{
- CFIndex size = CFDictionaryGetCount(btmm);
- const void *key[size];
- const void *val[size];
- CFDictionaryGetKeysAndValues(btmm, key, val);
- for (i = 0; i < size; i++)
+ LogInfo("BackToMyMac %d", i);
+ if (!CFStringGetCString(key[i], buf, sizeof(buf), kCFStringEncodingUTF8))
+ LogMsg("Can't read BackToMyMac %d key %s", i, buf);
+ else
{
- LogInfo("BackToMyMac %d", i);
- if (!CFStringGetCString(key[i], buf, sizeof(buf), kCFStringEncodingUTF8))
- LogMsg("Can't read BackToMyMac %d key %s", i, buf);
- else
+ mDNSu32 uid = atoi(buf);
+ if (!CFStringGetCString(val[i], buf, sizeof(buf), kCFStringEncodingUTF8))
+ LogMsg("Can't read BackToMyMac %d val %s", i, buf);
+ else if (MakeDomainNameFromDNSNameString(&d, buf) && d.c[0])
{
- mDNSu32 uid = atoi(buf);
- if (!CFStringGetCString(val[i], buf, sizeof(buf), kCFStringEncodingUTF8))
- LogMsg("Can't read BackToMyMac %d val %s", i, buf);
- else if (MakeDomainNameFromDNSNameString(&d, buf) && d.c[0])
- {
- LogInfo("BackToMyMac %d %d %##s", i, uid, d.c);
- AppendDNameListElem(&RegDomains, uid, &d);
- }
+ LogInfo("BackToMyMac %d %d %##s", i, uid, d.c);
+ AppendDNameListElem(&RegDomains, uid, &d);
}
}
- CFRelease(btmm);
}
+ CFRelease(btmm);
}
- CFRelease(store);
}
+
}
// Returns mDNSfalse, if it does not set the configuration i.e., if the DNS configuration did not change
@@ -6296,7 +6513,6 @@ mDNSexport mDNSBool mDNSPlatformSetDNSConfig(mDNS *const m, mDNSBool setservers,
dns_config_t *config = dns_configuration_copy();
if (!config)
{
- // When running on 10.3 (build 7xxx) and earlier, we don't expect dns_configuration_copy() to succeed
// On 10.4, calls to dns_configuration_copy() early in the boot process often fail.
// Apparently this is expected behaviour -- "not a bug".
// Accordingly, we suppress syslog messages for the first three minutes after boot.
@@ -6355,8 +6571,6 @@ mDNSexport mDNSBool mDNSPlatformSetDNSConfig(mDNS *const m, mDNSBool setservers,
}
dns_configuration_free(config);
if (setsearch) FinalizeSearchDomainHash(m, &sdc);
- setservers = mDNSfalse; // Done these now -- no need to fetch the same data from SCDynamicStore
- setsearch = mDNSfalse;
}
}
#endif // MDNS_NO_DNSINFO
@@ -6369,81 +6583,78 @@ mDNSexport mStatus mDNSPlatformGetPrimaryInterface(mDNS *const m, mDNSAddr *v4,
{
char buf[256];
(void)m; // Unused
-
- SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:mDNSPlatformGetPrimaryInterface"), NULL, NULL);
- if (!store)
- LogMsg("mDNSPlatformGetPrimaryInterface: SCDynamicStoreCreate failed: %s", SCErrorString(SCError()));
- else
+
+ CFDictionaryRef dict = SCDynamicStoreCopyValue(NULL, NetworkChangedKey_IPv4);
+ if (dict)
{
- CFDictionaryRef dict = SCDynamicStoreCopyValue(store, NetworkChangedKey_IPv4);
- if (dict)
+ r->type = mDNSAddrType_IPv4;
+ r->ip.v4 = zerov4Addr;
+ CFStringRef string = CFDictionaryGetValue(dict, kSCPropNetIPv4Router);
+ if (string)
{
- r->type = mDNSAddrType_IPv4;
- r->ip.v4 = zerov4Addr;
- CFStringRef string = CFDictionaryGetValue(dict, kSCPropNetIPv4Router);
- if (string)
+ if (!CFStringGetCString(string, buf, 256, kCFStringEncodingUTF8))
+ LogMsg("Could not convert router to CString");
+ else
{
- if (!CFStringGetCString(string, buf, 256, kCFStringEncodingUTF8))
- LogMsg("Could not convert router to CString");
- else
- {
- struct sockaddr_in saddr;
- saddr.sin_len = sizeof(saddr);
- saddr.sin_family = AF_INET;
- saddr.sin_port = 0;
- inet_aton(buf, &saddr.sin_addr);
-
- *(in_addr_t *)&r->ip.v4 = saddr.sin_addr.s_addr;
- }
+ struct sockaddr_in saddr;
+ saddr.sin_len = sizeof(saddr);
+ saddr.sin_family = AF_INET;
+ saddr.sin_port = 0;
+ inet_aton(buf, &saddr.sin_addr);
+ *(in_addr_t *)&r->ip.v4 = saddr.sin_addr.s_addr;
}
+ }
+ string = CFDictionaryGetValue(dict, kSCDynamicStorePropNetPrimaryInterface);
+ if (string)
+ {
+ mDNSBool HavePrimaryGlobalv6 = mDNSfalse; // does the primary interface have a global v6 address?
+ struct ifaddrs *ifa = myGetIfAddrs(1);
+ *v4 = *v6 = zeroAddr;
- string = CFDictionaryGetValue(dict, kSCDynamicStorePropNetPrimaryInterface);
- if (string)
+ if (!CFStringGetCString(string, buf, 256, kCFStringEncodingUTF8))
+ {
+ LogMsg("Could not convert router to CString");
+ goto exit;
+ }
+ // find primary interface in list
+ while (ifa && (mDNSIPv4AddressIsZero(v4->ip.v4) || mDNSv4AddressIsLinkLocal(&v4->ip.v4) || !HavePrimaryGlobalv6))
{
- mDNSBool HavePrimaryGlobalv6 = mDNSfalse; // does the primary interface have a global v6 address?
- struct ifaddrs *ifa = myGetIfAddrs(1);
-
- *v4 = *v6 = zeroAddr;
-
- if (!CFStringGetCString(string, buf, 256, kCFStringEncodingUTF8)) { LogMsg("Could not convert router to CString"); goto exit; }
-
- // find primary interface in list
- while (ifa && (mDNSIPv4AddressIsZero(v4->ip.v4) || mDNSv4AddressIsLinkLocal(&v4->ip.v4) || !HavePrimaryGlobalv6))
+ mDNSAddr tmp6 = zeroAddr;
+ if (!strcmp(buf, ifa->ifa_name))
{
- mDNSAddr tmp6 = zeroAddr;
- if (!strcmp(buf, ifa->ifa_name))
+ if (ifa->ifa_addr->sa_family == AF_INET)
{
- if (ifa->ifa_addr->sa_family == AF_INET)
- {
- if (mDNSIPv4AddressIsZero(v4->ip.v4) || mDNSv4AddressIsLinkLocal(&v4->ip.v4)) SetupAddr(v4, ifa->ifa_addr);
- }
- else if (ifa->ifa_addr->sa_family == AF_INET6)
- {
- SetupAddr(&tmp6, ifa->ifa_addr);
- if (tmp6.ip.v6.b[0] >> 5 == 1) // global prefix: 001
- { HavePrimaryGlobalv6 = mDNStrue; *v6 = tmp6; }
- }
+ if (mDNSIPv4AddressIsZero(v4->ip.v4) || mDNSv4AddressIsLinkLocal(&v4->ip.v4))
+ SetupAddr(v4, ifa->ifa_addr);
}
- else
+ else if (ifa->ifa_addr->sa_family == AF_INET6)
{
- // We'll take a V6 address from the non-primary interface if the primary interface doesn't have a global V6 address
- if (!HavePrimaryGlobalv6 && ifa->ifa_addr->sa_family == AF_INET6 && !v6->ip.v6.b[0])
- {
- SetupAddr(&tmp6, ifa->ifa_addr);
- if (tmp6.ip.v6.b[0] >> 5 == 1) *v6 = tmp6;
+ SetupAddr(&tmp6, ifa->ifa_addr);
+ if (tmp6.ip.v6.b[0] >> 5 == 1) // global prefix: 001
+ {
+ HavePrimaryGlobalv6 = mDNStrue;
+ *v6 = tmp6;
}
}
- ifa = ifa->ifa_next;
}
-
- // Note that while we advertise v6, we still require v4 (possibly NAT'd, but not link-local) because we must use
- // V4 to communicate w/ our DNS server
+ else
+ {
+ // We'll take a V6 address from the non-primary interface if the primary interface doesn't have a global V6 address
+ if (!HavePrimaryGlobalv6 && ifa->ifa_addr->sa_family == AF_INET6 && !v6->ip.v6.b[0])
+ {
+ SetupAddr(&tmp6, ifa->ifa_addr);
+ if (tmp6.ip.v6.b[0] >> 5 == 1)
+ *v6 = tmp6;
+ }
+ }
+ ifa = ifa->ifa_next;
}
+ // Note that while we advertise v6, we still require v4 (possibly NAT'd, but not link-local) because we must use
+ // V4 to communicate w/ our DNS server
+ }
exit:
- CFRelease(dict);
- }
- CFRelease(store);
+ CFRelease(dict);
}
return mStatus_NoError;
}
@@ -6941,57 +7152,20 @@ mDNSlocal void SetLocalDomains(void)
mDNSlocal void GetCurrentPMSetting(const CFStringRef name, mDNSs32 *val)
{
-#if USE_IOPMCOPYACTIVEPMPREFERENCES
- CFTypeRef blob = NULL;
- CFStringRef str = NULL;
- CFDictionaryRef odict = NULL;
- CFDictionaryRef idict = NULL;
- CFNumberRef number = NULL;
-
- blob = IOPSCopyPowerSourcesInfo();
- if (!blob) { LogMsg("GetCurrentPMSetting: IOPSCopyPowerSourcesInfo failed!"); goto end; }
-
- odict = IOPMCopyActivePMPreferences();
- if (!odict) { LogMsg("GetCurrentPMSetting: IOPMCopyActivePMPreferences failed!"); goto end; }
-
- str = IOPSGetProvidingPowerSourceType(blob);
- if (!str) { LogMsg("GetCurrentPMSetting: IOPSGetProvidingPowerSourceType failed!"); goto end; }
-
- idict = CFDictionaryGetValue(odict, str);
- if (!idict)
+
+ CFDictionaryRef dict = SCDynamicStoreCopyValue(NULL, NetworkChangedKey_PowerSettings);
+ if (!dict)
{
- char buf[256];
- if (!CFStringGetCString(str, buf, sizeof(buf), kCFStringEncodingUTF8)) buf[0] = 0;
- LogMsg("GetCurrentPMSetting: CFDictionaryGetValue (%s) failed!", buf);
- goto end;
+ LogSPS("GetCurrentPMSetting: Could not get IOPM CurrentSettings dict");
}
-
- number = CFDictionaryGetValue(idict, name);
- if (!number || CFGetTypeID(number) != CFNumberGetTypeID() || !CFNumberGetValue(number, kCFNumberSInt32Type, val))
- *val = 0;
-end:
- if (blob) CFRelease(blob);
- if (odict) CFRelease(odict);
-
-#else
-
- SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:GetCurrentPMSetting"), NULL, NULL);
- if (!store) LogMsg("GetCurrentPMSetting: SCDynamicStoreCreate failed: %s", SCErrorString(SCError()));
else
{
- CFDictionaryRef dict = SCDynamicStoreCopyValue(store, NetworkChangedKey_PowerSettings);
- if (!dict) LogSPS("GetCurrentPMSetting: Could not get IOPM CurrentSettings dict");
- else
- {
- CFNumberRef number = CFDictionaryGetValue(dict, name);
- if (!number || CFGetTypeID(number) != CFNumberGetTypeID() || !CFNumberGetValue(number, kCFNumberSInt32Type, val))
- *val = 0;
- CFRelease(dict);
- }
- CFRelease(store);
+ CFNumberRef number = CFDictionaryGetValue(dict, name);
+ if (!number || CFGetTypeID(number) != CFNumberGetTypeID() || !CFNumberGetValue(number, kCFNumberSInt32Type, val))
+ *val = 0;
+ CFRelease(dict);
}
-
-#endif
+
}
#if APPLE_OSX_mDNSResponder
@@ -7301,6 +7475,10 @@ mDNSlocal mDNSu32 CountProxyRecords(mDNS *const m, uint32_t *const numbytes, Net
// attempt to update the record again.
if (isKeepAliveRecord && (UpdateKeepaliveRData(m, rr, intf, mDNSfalse, mDNSNULL) != mStatus_NoError))
LogSPS("CountProxyRecords: Failed to update keepalive record - %s", ARDisplayString(m, rr));
+
+ // Offload only Valid Keepalive records
+ if (isKeepAliveRecord && !mDNSValidKeepAliveRecord(rr))
+ continue;
#else
(void) TCPKAOnly; // unused
(void) supportsTCPKA; // unused
@@ -7338,6 +7516,10 @@ mDNSlocal void GetProxyRecords(mDNS *const m, DNSMessage *const msg, uint32_t *c
// Skip over TCP KeepAlive records if the policy prohibits it or if the interface does not support TCP Keepalive
if ((TCPKAOnly && !isKeepAliveRecord) || (isKeepAliveRecord && !supportsTCPKA))
continue;
+
+ // Offload only Valid Keepalive records
+ if (isKeepAliveRecord && !mDNSValidKeepAliveRecord(rr))
+ continue;
#else
(void) TCPKAOnly; // unused
(void) supportsTCPKA; // unused
@@ -7360,29 +7542,6 @@ mDNSlocal void GetProxyRecords(mDNS *const m, DNSMessage *const msg, uint32_t *c
*numbytes = p - msg->data;
}
-// If compiling with old headers and libraries (pre 10.5) that don't include IOConnectCallStructMethod
-// then we declare a dummy version here so that the code at least compiles
-#ifndef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
-static kern_return_t
-IOConnectCallStructMethod(
- mach_port_t connection, // In
- uint32_t selector, // In
- const void *inputStruct, // In
- size_t inputStructCnt, // In
- void *outputStruct, // Out
- size_t *outputStructCnt) // In/Out
-{
- (void)connection;
- (void)selector;
- (void)inputStruct;
- (void)inputStructCnt;
- (void)outputStruct;
- (void)outputStructCnt;
- LogMsg("Compiled without IOConnectCallStructMethod");
- return(KERN_FAILURE);
-}
-#endif
-
mDNSexport mDNSBool SupportsInNICProxy(NetworkInterfaceInfo *const intf)
{
if(!UseInternalSleepProxy)
@@ -7393,12 +7552,12 @@ mDNSexport mDNSBool SupportsInNICProxy(NetworkInterfaceInfo *const intf)
return CheckInterfaceSupport(intf, mDNS_IOREG_KEY);
}
-mDNSexport mStatus ActivateLocalProxy(mDNS *const m, NetworkInterfaceInfo *const intf) // Called with the lock held
+mDNSexport mStatus ActivateLocalProxy(mDNS *const m, NetworkInterfaceInfo *const intf, mDNSBool *keepaliveOnly) // Called with the lock held
{
mStatus result = mStatus_UnknownErr;
mDNSBool TCPKAOnly = mDNSfalse;
mDNSBool supportsTCPKA = mDNSfalse;
- mDNSBool onbattery = mDNSfalse;
+ mDNSBool onbattery = mDNSfalse;
io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOBSDNameMatching(kIOMasterPortDefault, 0, intf->ifname));
#if APPLE_OSX_mDNSResponder && !TARGET_OS_EMBEDDED
@@ -7489,6 +7648,7 @@ mDNSexport mStatus ActivateLocalProxy(mDNS *const m, NetworkInterfaceInfo *const
IOObjectRelease(parent);
}
IOObjectRelease(service);
+ *keepaliveOnly = TCPKAOnly;
return result;
}
@@ -7638,18 +7798,10 @@ mDNSlocal mDNSv6Addr IPv6AddressFromString(char* buf)
mDNSlocal CFDictionaryRef CopyConnectivityBackToMyMacDict()
{
- SCDynamicStoreRef store = NULL;
CFDictionaryRef connd = NULL;
CFDictionaryRef BTMMDict = NULL;
- store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:CopyConnectivityBackToMyMacDict"), NULL, NULL);
- if (!store)
- {
- LogMsg("CopyConnectivityBackToMyMacDict: SCDynamicStoreCreate failed: %s", SCErrorString(SCError()));
- goto end;
- }
-
- connd = SCDynamicStoreCopyValue(store, NetworkChangedKey_BTMMConnectivity);
+ connd = SCDynamicStoreCopyValue(NULL, NetworkChangedKey_BTMMConnectivity);
if (!connd)
{
LogInfo("CopyConnectivityBackToMyMacDict: SCDynamicStoreCopyValue failed: %s", SCErrorString(SCError()));
@@ -7675,7 +7827,6 @@ mDNSlocal CFDictionaryRef CopyConnectivityBackToMyMacDict()
end:
if (connd) CFRelease(connd);
- if (store) CFRelease(store);
return BTMMDict;
}
@@ -7844,12 +7995,76 @@ mDNSlocal mDNSBool IsAppleNetwork(mDNS *const m)
return mDNSfalse;
}
+// Called with KQueueLock & mDNS lock
+// SetNetworkChanged is allowed to shorten (but not extend) the pause while we wait for configuration changes to settle
+mDNSlocal void SetNetworkChanged(mDNS *const m, mDNSs32 delay)
+{
+ mDNS_CheckLock(m);
+ if (!m->NetworkChanged || m->NetworkChanged - NonZeroTime(m->timenow + delay) > 0)
+ {
+ m->NetworkChanged = NonZeroTime(m->timenow + delay);
+ LogInfo("SetNetworkChanged: Scheduling in %d ticks", delay);
+ }
+ else
+ LogInfo("SetNetworkChanged: *NOT* increasing delay from %d to %d", m->NetworkChanged - m->timenow, delay);
+}
+
+// Called with KQueueLock & mDNS lock
+mDNSlocal void SetKeyChainTimer(mDNS *const m, mDNSs32 delay)
+{
+ // If it's not set or it needs to happen sooner than when it's currently set
+ if (!m->p->KeyChainTimer || m->p->KeyChainTimer - NonZeroTime(m->timenow + delay) > 0)
+ {
+ m->p->KeyChainTimer = NonZeroTime(m->timenow + delay);
+ LogInfo("SetKeyChainTimer: %d", delay);
+ }
+}
+
mDNSexport void mDNSMacOSXNetworkChanged(mDNS *const m)
{
- LogInfo("*** Network Configuration Change *** (%d)%s",
- m->p->NetworkChanged ? mDNS_TimeNow(m) - m->p->NetworkChanged : 0,
- m->p->NetworkChanged ? "" : " (no scheduled configuration change)");
- m->p->NetworkChanged = 0; // If we received a network change event and deferred processing, we're now dealing with it
+ LogInfo("*** Network Configuration Change *** %d ticks late%s",
+ m->NetworkChanged ? mDNS_TimeNow(m) - m->NetworkChanged : 0,
+ m->NetworkChanged ? "" : " (no scheduled configuration change)");
+ m->NetworkChanged = 0; // If we received a network change event and deferred processing, we're now dealing with it
+
+ // If we have any NOTREADY IPv6 addresses, wait until they've finished configuring
+ int InfoSocket = socket(AF_INET6, SOCK_DGRAM, 0);
+ if (InfoSocket > 0)
+ {
+ mDNSBool notready = mDNSfalse;
+ struct ifaddrs *ifa = myGetIfAddrs(1);
+ while (ifa)
+ {
+ if (ifa->ifa_addr->sa_family == AF_INET6)
+ {
+ struct in6_ifreq ifr6;
+ mDNSPlatformMemZero((char *)&ifr6, sizeof(ifr6));
+ strlcpy(ifr6.ifr_name, ifa->ifa_name, sizeof(ifr6.ifr_name));
+ ifr6.ifr_addr = *(struct sockaddr_in6 *)ifa->ifa_addr;
+ // We need to check for IN6_IFF_TENTATIVE here, not IN6_IFF_NOTREADY, because
+ // IN6_IFF_NOTREADY includes both IN6_IFF_TENTATIVE and IN6_IFF_DUPLICATED addresses.
+ // We can expect that an IN6_IFF_TENTATIVE address will shortly become ready,
+ // but an IN6_IFF_DUPLICATED address may not.
+ if (ioctl(InfoSocket, SIOCGIFAFLAG_IN6, &ifr6) != -1)
+ if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_TENTATIVE)
+ {
+ LogInfo("*** Network Configuration Change *** IPv6 address %.16a TENTATIVE, will retry", &ifr6.ifr_addr.sin6_addr);
+ notready = mDNStrue;
+ }
+ }
+ ifa = ifa->ifa_next;
+ }
+ close(InfoSocket);
+ if (notready)
+ {
+ mDNS_Lock(m);
+ SetNetworkChanged(m, mDNSPlatformOneSecond / 2);
+ mDNS_Unlock(m);
+ return;
+ }
+ LogInfo("*** Network Configuration Change *** No IPv6 address NOTREADY, will continue");
+ }
+
mDNSs32 utc = mDNSPlatformUTC();
m->SystemWakeOnLANEnabled = SystemWakeForNetworkAccess();
m->SystemSleepOnlyIfWakeOnLAN = SystemSleepOnlyIfWakeOnLAN();
@@ -7933,36 +8148,12 @@ mDNSexport void mDNSMacOSXNetworkChanged(mDNS *const m)
if (IsAppleNetwork(m) != mDNS_McastTracingEnabled)
{
mDNS_McastTracingEnabled = mDNS_McastTracingEnabled ? mDNSfalse : mDNStrue;
- LogMsg("mDNSMacOSXNetworkChanged: Multicast Tracing %s", mDNS_McastTracingEnabled ? "Enabled" : "Disabled");
+ LogInfo("mDNSMacOSXNetworkChanged: Multicast Tracing %s", mDNS_McastTracingEnabled ? "Enabled" : "Disabled");
UpdateDebugState();
}
}
-// Called with KQueueLock & mDNS lock
-// SetNetworkChanged is allowed to extend (but not reduce) the pause while we wait for configuration changes to settle
-mDNSlocal void SetNetworkChanged(mDNS *const m, mDNSs32 delay)
-{
- if (!m->p->NetworkChanged || m->p->NetworkChanged - NonZeroTime(m->timenow + delay) < 0)
- {
- m->p->NetworkChanged = NonZeroTime(m->timenow + delay);
- LogInfo("SetNetworkChanged: Scheduling in %d msec", delay);
- }
- else
- LogInfo("SetNetworkChanged: *NOT* reducing delay from %d to %d", m->p->NetworkChanged - m->timenow, delay);
-}
-
-// Called with KQueueLock & mDNS lock
-mDNSlocal void SetKeyChainTimer(mDNS *const m, mDNSs32 delay)
-{
- // If it's not set or it needs to happen sooner than when it's currently set
- if (!m->p->KeyChainTimer || m->p->KeyChainTimer - NonZeroTime(m->timenow + delay) > 0)
- {
- m->p->KeyChainTimer = NonZeroTime(m->timenow + delay);
- LogInfo("SetKeyChainTimer: %d", delay);
- }
-}
-
// Copy the fourth slash-delimited element from either:
// State:/Network/Interface/<bsdname>/IPv4
// or
@@ -7983,7 +8174,6 @@ mDNSlocal CFStringRef CopyNameFromKey(CFStringRef key)
// an IP service that is explicitly configured for IPv4 Link Local
mDNSlocal int ChangedKeysHaveIPv4LL(CFArrayRef inkeys)
{
- SCDynamicStoreRef store = NULL;
CFDictionaryRef dict = NULL;
CFMutableArrayRef a;
const void **keys = NULL, **vals = NULL;
@@ -7994,9 +8184,6 @@ mDNSlocal int ChangedKeysHaveIPv4LL(CFArrayRef inkeys)
jc = CFArrayGetCount(inkeys);
if (!jc) goto done;
- store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:ChangedKeysHaveIPv4LL"), NULL, NULL);
- if (store == NULL) goto done;
-
a = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
if (a == NULL) goto done;
@@ -8012,7 +8199,7 @@ mDNSlocal int ChangedKeysHaveIPv4LL(CFArrayRef inkeys)
CFArrayAppendValue(a, pattern);
CFRelease(pattern);
- dict = SCDynamicStoreCopyMultiple(store, NULL, a);
+ dict = SCDynamicStoreCopyMultiple(NULL, NULL, a);
CFRelease(a);
if (!dict)
@@ -8094,7 +8281,6 @@ done:
if (vals != NULL) mDNSPlatformMemFree(vals);
if (keys != NULL) mDNSPlatformMemFree(keys);
if (dict != NULL) CFRelease(dict);
- if (store != NULL) CFRelease(store);
return found;
}
@@ -8106,20 +8292,22 @@ mDNSlocal void NetworkChanged(SCDynamicStoreRef store, CFArrayRef changedKeys, v
KQueueLock(m);
mDNS_Lock(m);
- mDNSs32 delay = mDNSPlatformOneSecond * 2; // Start off assuming a two-second delay
+ //mDNSs32 delay = mDNSPlatformOneSecond * 2; // Start off assuming a two-second delay
+ const mDNSs32 delay = (mDNSPlatformOneSecond + 39) / 40; // 25 ms delay
int c = CFArrayGetCount(changedKeys); // Count changes
CFRange range = { 0, c };
- int c1 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Hostnames ) != 0);
- int c2 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Computername) != 0);
- int c3 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DNS ) != 0);
- int c4 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DynamicDNS ) != 0);
- int c5 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_BackToMyMac ) != 0);
- int c6 = ChangedKeysHaveIPv4LL(changedKeys);
- int c7 = 0;
-
+ int c_host = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Hostnames ) != 0);
+ int c_comp = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Computername) != 0);
+ int c_udns = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DNS ) != 0);
+ int c_ddns = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DynamicDNS ) != 0);
+ int c_btmm = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_BackToMyMac ) != 0);
+ int c_v4ll = ChangedKeysHaveIPv4LL(changedKeys);
+ int c_fast = 0;
+
// Do immediate network changed processing for "p2p*" interfaces and
- // for interfaces with the IFEF_DIRECTLINK flag set.
+ // for interfaces with the IFEF_DIRECTLINK flag set or association with a CarPlay
+ // hosted SSID.
{
CFArrayRef labels;
CFIndex n;
@@ -8149,10 +8337,10 @@ mDNSlocal void NetworkChanged(SCDynamicStoreRef store, CFArrayRef changedKeys, v
// The 4th label (index = 3) should be the interface name.
if (CFStringGetCString(CFArrayGetValueAtIndex(labels, 3), buf, sizeof(buf), kCFStringEncodingUTF8)
- && (strstr(buf, "p2p") || (getExtendedFlags(buf) & IFEF_DIRECTLINK)))
+ && (strstr(buf, "p2p") || (getExtendedFlags(buf) & IFEF_DIRECTLINK) || IsCarPlaySSID(buf)))
{
LogInfo("NetworkChanged: interface %s qualifies for reduced change handling delay", buf);
- c7++;
+ c_fast++;
CFRelease(labels);
break;
}
@@ -8161,22 +8349,8 @@ mDNSlocal void NetworkChanged(SCDynamicStoreRef store, CFArrayRef changedKeys, v
}
}
- if (c && c - c1 - c2 - c3 - c4 - c5 - c6 - c7 == 0)
- delay = mDNSPlatformOneSecond/10; // If these were the only changes, shorten delay
-
- // Immediately force a reconfig (esp. cache flush) if any of the following is true:
- // 1. DNS Settings changed.
- // 2 An interface changed that is explicitly IPv4 link local
- // 3. There are P2P/IFEF_DIRECTLINK/IsCarPlaySSID changes
- if (c3 || ChangedKeysHaveIPv4LL(changedKeys) || c7)
- {
- LogInfo("NetworkChanged: %s : Handling this change immediately",
- c3 ? "DNS Settings Changed" :
- c7 ? "P2P/IFEF_DIRECTLINK/IsCarPlaySSID Changed" :
- "An interface changed that is explicitly IPv4 link local");
- m->p->NetworkChanged = NonZeroTime(m->timenow);
- delay = 0; // for the logs below.
- }
+ //if (c && c - c_host - c_comp - c_udns - c_ddns - c_btmm - c_v4ll - c_fast == 0)
+ // delay = mDNSPlatformOneSecond/10; // If these were the only changes, shorten delay
if (mDNS_LoggingEnabled)
{
@@ -8185,19 +8359,19 @@ mDNSlocal void NetworkChanged(SCDynamicStoreRef store, CFArrayRef changedKeys, v
{
char buf[256];
if (!CFStringGetCString(CFArrayGetValueAtIndex(changedKeys, i), buf, sizeof(buf), kCFStringEncodingUTF8)) buf[0] = 0;
- LogInfo("*** NetworkChanged SC key: %s", buf);
+ LogInfo("*** Network Configuration Change *** SC key: %s", buf);
}
- LogInfo("*** NetworkChanged *** %d change%s %s%s%s%s%s%s%sdelay %d%s",
+ LogInfo("*** Network Configuration Change *** %d change%s %s%s%s%s%s%s%sdelay %d%s",
c, c>1 ? "s" : "",
- c1 ? "(Local Hostname) " : "",
- c2 ? "(Computer Name) " : "",
- c3 ? "(DNS) " : "",
- c4 ? "(DynamicDNS) " : "",
- c5 ? "(BTMM) " : "",
- c6 ? "(kSCValNetIPv4ConfigMethodLinkLocal) " : "",
- c7 ? "(P2P/IFEF_DIRECTLINK/IsCarPlaySSID) " : "",
+ c_host ? "(Local Hostname) " : "",
+ c_comp ? "(Computer Name) " : "",
+ c_udns ? "(DNS) " : "",
+ c_ddns ? "(DynamicDNS) " : "",
+ c_btmm ? "(BTMM) " : "",
+ c_v4ll ? "(kSCValNetIPv4ConfigMethodLinkLocal) " : "",
+ c_fast ? "(P2P/IFEF_DIRECTLINK/IsCarPlaySSID) " : "",
delay,
- (c4 || c5) ? " + SetKeyChainTimer" : "");
+ (c_ddns || c_btmm) ? " + SetKeyChainTimer" : "");
}
SetNetworkChanged(m, delay);
@@ -8207,11 +8381,12 @@ mDNSlocal void NetworkChanged(SCDynamicStoreRef store, CFArrayRef changedKeys, v
// setup the DomainAuthInfo before handing the network change.
// If we don't, then we will first try to register services in the clear, then later setup the
// DomainAuthInfo, which is incorrect.
- if (c4 || c5)
+ if (c_ddns || c_btmm)
SetKeyChainTimer(m, delay);
- mDNS_Unlock(m);
+ // Don't try to call mDNSMacOSXNetworkChanged() here -- we're running on the wrong thread
+ mDNS_Unlock(m);
KQueueUnlock(m, "NetworkChanged");
}
@@ -8285,7 +8460,7 @@ mDNSlocal mStatus WatchForNetworkChanges(mDNS *const m)
CFArrayAppendValue(keys, NetworkChangedKey_DNS);
CFArrayAppendValue(keys, NetworkChangedKey_DynamicDNS);
CFArrayAppendValue(keys, NetworkChangedKey_BackToMyMac);
- CFArrayAppendValue(keys, NetworkChangedKey_PowerSettings); // should remove as part of <rdar://problem/6751656>
+ CFArrayAppendValue(keys, NetworkChangedKey_PowerSettings);
CFArrayAppendValue(keys, NetworkChangedKey_BTMMConnectivity);
CFArrayAppendValue(patterns, pattern1);
CFArrayAppendValue(patterns, pattern2);
@@ -8318,33 +8493,6 @@ exit:
return(err);
}
-#if 0 // <rdar://problem/6751656>
-mDNSlocal void PMChanged(void *context)
-{
- mDNS *const m = (mDNS *const)context;
-
- KQueueLock(m);
- mDNS_Lock(m);
-
- LogSPS("PMChanged");
-
- SetNetworkChanged(m, mDNSPlatformOneSecond * 2);
-
- mDNS_Unlock(m);
- KQueueUnlock(m, "PMChanged");
-}
-
-mDNSlocal mStatus WatchForPMChanges(mDNS *const m)
-{
- m->p->PMRLS = IOPMPrefsNotificationCreateRunLoopSource(PMChanged, m);
- if (!m->p->PMRLS) { LogMsg("IOPMPrefsNotificationCreateRunLoopSource failed!"); return mStatus_UnknownErr; }
-
- CFRunLoopAddSource(CFRunLoopGetCurrent(), m->p->PMRLS, kCFRunLoopDefaultMode);
-
- return mStatus_NoError;
-}
-#endif
-
#if !TARGET_OS_EMBEDDED // don't setup packet filter rules on embedded
mDNSlocal void mDNSSetPacketFilterRules(mDNS *const m, char * ifname, const ResourceRecord *const excludeRecord)
@@ -8450,12 +8598,9 @@ mDNSlocal void newMasterElected(mDNS *const m, struct net_event_data * ptr)
LogInfo("newMasterElected: ifname = %s, interfaceIndex = %d", ifname, interfaceIndex);
infoOSX = IfindexToInterfaceInfoOSX(m, (mDNSInterfaceID)(uintptr_t)interfaceIndex);
-
- // Can get an KEV_DL_MASTER_ELECTED event prior to the interface existing
- // when it is first brought up.
if (!infoOSX)
{
- LogInfo("newMasterElected: interface not yet active");
+ LogInfo("newMasterElected: interface %s not yet active", ifname);
return;
}
InterfaceID = infoOSX->ifinfo.InterfaceID;
@@ -8516,13 +8661,18 @@ mDNSlocal void removeCachedPeerRecords(mDNS *const m, mDNSu32 ifindex, mDNSAddr
mDNSu32 slot;
CacheGroup *cg;
CacheRecord *cr;
- mDNSInterfaceID InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(m, ifindex);
+ NetworkInterfaceInfoOSX *infoOSX;
+ mDNSInterfaceID InterfaceID;
- if (!InterfaceID)
+ // Using mDNSPlatformInterfaceIDfromInterfaceIndex() would lead to recursive
+ // locking issues, see: <rdar://problem/21332983>
+ infoOSX = IfindexToInterfaceInfoOSX(m, (mDNSInterfaceID)(uintptr_t)ifindex);
+ if (!infoOSX)
{
- LogInfo("removeCachedPeerRecords: Invalid ifindex: %d", ifindex);
+ LogInfo("removeCachedPeerRecords: interface %d not yet active", ifindex);
return;
}
+ InterfaceID = infoOSX->ifinfo.InterfaceID;
FORALL_CACHERECORDS(slot, cg, cr)
{
@@ -8771,6 +8921,12 @@ mDNSlocal OSStatus KeychainChanged(SecKeychainEvent keychainEvent, SecKeychainCa
mDNSlocal void PowerOn(mDNS *const m)
{
mDNSCoreMachineSleep(m, false); // Will set m->SleepState = SleepState_Awake;
+
+ // Hold on to a sleep assertion to allow mDNSResponder to perform its maintenance activities.
+ // This allows for the network link to come up, DHCP to get an address, mDNS to issue queries etc.
+ // We will clear this assertion as soon as we think the mainenance activities are done.
+ mDNSPlatformPreventSleep(m, DARK_WAKE_TIME, "mDNSResponder:maintenance");
+
if (m->p->WakeAtUTC)
{
long utc = mDNSPlatformUTC();
@@ -9526,7 +9682,7 @@ mDNSlocal mDNSBool EtcHostsDeleteOldEntries(mDNS *const m, AuthHash *newhosts, m
{
AuthGroup *ag;
mDNSu32 slot;
- AuthRecord *rr, *primary, *rrnext;
+ AuthRecord *rr, *rrnext;
for (slot = 0; slot < AUTH_HASH_SLOTS; slot++)
for (ag = m->rrauth.rrauth_hash[slot]; ag; ag = ag->next)
for (rr = ag->members; rr; rr = rrnext)
@@ -9539,7 +9695,7 @@ mDNSlocal mDNSBool EtcHostsDeleteOldEntries(mDNS *const m, AuthHash *newhosts, m
ag1 = AuthGroupForRecord(newhosts, slot, &rr->resrec);
if (ag1)
{
- primary = rr1 = ag1->members;
+ rr1 = ag1->members;
while (rr1)
{
if (IdenticalResourceRecord(&rr1->resrec, &rr->resrec))
@@ -9912,14 +10068,16 @@ mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
m->p->permanentsockets.sktv4 = -1;
m->p->permanentsockets.kqsv4.KQcallback = myKQSocketCallBack;
m->p->permanentsockets.kqsv4.KQcontext = &m->p->permanentsockets;
- m->p->permanentsockets.kqsv4.KQtask = "UDP packet reception";
+ m->p->permanentsockets.kqsv4.KQtask = "IPv4 UDP packet reception";
m->p->permanentsockets.sktv6 = -1;
m->p->permanentsockets.kqsv6.KQcallback = myKQSocketCallBack;
m->p->permanentsockets.kqsv6.KQcontext = &m->p->permanentsockets;
- m->p->permanentsockets.kqsv6.KQtask = "UDP packet reception";
+ m->p->permanentsockets.kqsv6.KQtask = "IPv6 UDP packet reception";
err = SetupSocket(&m->p->permanentsockets, MulticastDNSPort, AF_INET, mDNSNULL);
+ if (err) LogMsg("mDNSPlatformInit_setup: SetupSocket(AF_INET) failed error %d errno %d (%s)", err, errno, strerror(errno));
err = SetupSocket(&m->p->permanentsockets, MulticastDNSPort, AF_INET6, mDNSNULL);
+ if (err) LogMsg("mDNSPlatformInit_setup: SetupSocket(AF_INET6) failed error %d errno %d (%s)", err, errno, strerror(errno));
struct sockaddr_in s4;
socklen_t n4 = sizeof(s4);
@@ -9972,16 +10130,12 @@ mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
err = WatchForNetworkChanges(m);
if (err) { LogMsg("mDNSPlatformInit_setup: WatchForNetworkChanges failed %d", err); return(err); }
-#if 0 // <rdar://problem/6751656>
- err = WatchForPMChanges(m);
- if (err) { LogMsg("mDNSPlatformInit_setup: WatchForPMChanges failed %d", err); return(err); }
-#endif
-
err = WatchForSysEvents(m);
if (err) { LogMsg("mDNSPlatformInit_setup: WatchForSysEvents failed %d", err); return(err); }
mDNSs32 utc = mDNSPlatformUTC();
m->SystemWakeOnLANEnabled = SystemWakeForNetworkAccess();
+ myGetIfAddrs(1);
UpdateInterfaceList(m, utc);
SetupActiveInterfaces(m, utc);
@@ -10069,7 +10223,6 @@ mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
mDNSMacOSXUpdateEtcHosts(m);
SetupLocalHostRecords(m);
- CUPInit(m);
return(mStatus_NoError);
}
@@ -10303,6 +10456,42 @@ mDNSexport void mDNSPlatformSetAllowSleep(mDNS *const m, mDNSBool allowSleep, co
}
}
+mDNSexport void mDNSPlatformPreventSleep(mDNS *const m, mDNSu32 timeout, const char *reason)
+{
+ if (m->p->IOPMAssertion)
+ {
+ LogSPS("Sleep Assertion is already being held. Will not attempt to get it again for %d seconds for %s", timeout, reason);
+ return;
+ }
+#ifdef kIOPMAssertionTypeNoIdleSleep
+
+#if TARGET_OS_EMBEDDED
+ if (!IsAppleTV())
+ return; // No need for maintenance wakes on non-AppleTV embedded devices.
+#endif
+
+ double timeoutVal = (double)timeout;
+ CFStringRef str = CFStringCreateWithCString(NULL, reason, kCFStringEncodingUTF8);
+ CFNumberRef Timeout_num = CFNumberCreate(NULL, kCFNumberDoubleType, &timeoutVal);
+ CFMutableDictionaryRef assertionProperties = CFDictionaryCreateMutable(NULL, 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ if (IsAppleTV())
+ CFDictionarySetValue(assertionProperties, kIOPMAssertionTypeKey, kIOPMAssertPreventUserIdleSystemSleep);
+ else
+ CFDictionarySetValue(assertionProperties, kIOPMAssertionTypeKey, kIOPMAssertMaintenanceActivity);
+
+ CFDictionarySetValue(assertionProperties, kIOPMAssertionTimeoutKey, Timeout_num);
+ CFDictionarySetValue(assertionProperties, kIOPMAssertionNameKey, str);
+
+ IOPMAssertionCreateWithProperties(assertionProperties, (IOPMAssertionID *)&m->p->IOPMAssertion);
+ CFRelease(str);
+ CFRelease(Timeout_num);
+ CFRelease(assertionProperties);
+ LogSPS("Got an idle sleep assertion for %d seconds for %s", timeout, reason);
+#endif
+}
+
mDNSexport void mDNSPlatformSendWakeupPacket(mDNS *const m, mDNSInterfaceID InterfaceID, char *EthAddr, char *IPAddr, int iteration)
{
mDNSu32 ifindex;
@@ -10330,6 +10519,10 @@ mDNSexport mDNSBool mDNSPlatformInterfaceIsD2D(mDNSInterfaceID InterfaceID)
|| (InterfaceID == mDNSInterface_Unicast))
return mDNSfalse;
+ // Compare to cached AWDL interface ID.
+ if (AWDLInterfaceID && (InterfaceID == AWDLInterfaceID))
+ return mDNStrue;
+
info = IfindexToInterfaceInfoOSX(&mDNSStorage, InterfaceID);
if (info == NULL)
{
@@ -10458,25 +10651,24 @@ mDNSexport void mDNSPlatformDispatchAsync(mDNS *const m, void *context, AsyncDis
// definitions for device-info record construction
#define DEVINFO_MODEL "model="
-#define DEVINFO_MODEL_LEN strlen(DEVINFO_MODEL)
+#define DEVINFO_MODEL_LEN sizeof_string(DEVINFO_MODEL)
#define OSX_VER "osxvers="
-#define OSX_VER_LEN strlen(OSX_VER)
+#define OSX_VER_LEN sizeof_string(OSX_VER)
#define VER_NUM_LEN 2 // 2 digits of version number added to base string
#define MODEL_COLOR "ecolor="
-#define MODEL_COLOR_LEN strlen(MODEL_COLOR)
-#define MODEL_RGB_VALUE_LEN strlen("255,255,255") // 'r,g,b'
+#define MODEL_COLOR_LEN sizeof_string(MODEL_COLOR)
+#define MODEL_RGB_VALUE_LEN sizeof_string("255,255,255") // 'r,g,b'
-// Bytes available in TXT record for model name after subtracting space for other
+// Bytes available in TXT record for model name after subtracting space for other
// fixed size strings and their length bytes.
#define MAX_MODEL_NAME_LEN (256 - (DEVINFO_MODEL_LEN + 1) - (OSX_VER_LEN + VER_NUM_LEN + 1) - (MODEL_COLOR_LEN + MODEL_RGB_VALUE_LEN + 1))
-mDNSlocal mDNSBool getModelIconColors(char *color)
+mDNSlocal mDNSu8 getModelIconColors(char *color)
{
- mDNSBool hasColor = mDNSfalse;
mDNSPlatformMemZero(color, MODEL_RGB_VALUE_LEN + 1);
-
+
#if !TARGET_OS_EMBEDDED && defined(kIOPlatformDeviceEnclosureColorKey)
mDNSu8 red = 0;
mDNSu8 green = 0;
@@ -10487,12 +10679,11 @@ mDNSlocal mDNSBool getModelIconColors(char *color)
if (kIOReturnSuccess == rGetDeviceColor)
{
// IOKit was able to get enclosure color for the current device.
- hasColor = true;
- snprintf(color, MODEL_RGB_VALUE_LEN + 1, "%d,%d,%d", red, green, blue);
+ return snprintf(color, MODEL_RGB_VALUE_LEN + 1, "%d,%d,%d", red, green, blue);
}
#endif // !TARGET_OS_EMBEDDED && defined(kIOPlatformDeviceEnclosureColorKey)
-
- return hasColor;
+
+ return 0;
}
@@ -10518,20 +10709,21 @@ mDNSexport mDNSu32 initializeDeviceInfoTXT(mDNS *m, mDNSu8 *ptr)
mDNSPlatformMemCopy(ptr, OSX_VER, OSX_VER_LEN);
ptr += OSX_VER_LEN;
// convert version number to ASCII, add 1 for terminating null byte written by snprintf()
+ // WARNING: This code assumes that OSXVers is always exactly two digits
snprintf(ver_num, VER_NUM_LEN + 1, "%d", OSXVers);
mDNSPlatformMemCopy(ptr, ver_num, VER_NUM_LEN);
ptr += VER_NUM_LEN;
-
+
char rgb[MODEL_RGB_VALUE_LEN + 1]; // RGB value + null written by snprintf
- if (getModelIconColors(rgb))
+ len = getModelIconColors(rgb);
+ if (len)
{
- len = strlen(rgb);
*ptr = MODEL_COLOR_LEN + len; // length byte
ptr++;
-
+
mDNSPlatformMemCopy(ptr, MODEL_COLOR, MODEL_COLOR_LEN);
ptr += MODEL_COLOR_LEN;
-
+
mDNSPlatformMemCopy(ptr, rgb, len);
ptr += len;
}
diff --git a/mDNSResponder/mDNSMacOSX/mDNSMacOSX.h b/mDNSResponder/mDNSMacOSX/mDNSMacOSX.h
index eb1e1282..56c0902a 100644
--- a/mDNSResponder/mDNSMacOSX/mDNSMacOSX.h
+++ b/mDNSResponder/mDNSMacOSX/mDNSMacOSX.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,10 +51,6 @@ extern mDNSBool GetmDNSManagedPref(CFStringRef key);
#include <Security/Security.h>
#endif /* NO_SECURITYFRAMEWORK */
-#if TARGET_OS_IPHONE
-#include "cellular_usage_policy.h"
-#endif
-
#define kmDNSResponderServName "com.apple.mDNSResponder"
enum mDNSDynamicStoreSetConfigKey
@@ -141,8 +137,6 @@ struct NetworkInterfaceInfoOSX_struct
mDNSu8 Occulting; // Set if interface vanished for less than 60 seconds and then came back
mDNSu8 D2DInterface; // IFEF_LOCALNET_PRIVATE flag indicates we should call
// D2D plugin for operations over this interface
- mDNSu8 DirectLink; // IFEF_DIRECTLINK flag is set for interface
-
mDNSs32 AppearanceTime; // Time this interface appeared most recently in getifaddrs list
// i.e. the first time an interface is seen, AppearanceTime is set.
// If an interface goes away temporarily and then comes back then
@@ -169,7 +163,7 @@ struct mDNS_PlatformSupport_struct
{
NetworkInterfaceInfoOSX *InterfaceList;
KQSocketSet permanentsockets;
- int num_mcasts; // Number of multicasts received during this CPU scheduling period (used for CPU limiting)
+ int num_mcasts; // Number of multicasts received during this CPU scheduling period (used for CPU limiting)
domainlabel userhostlabel; // The hostlabel as it was set in System Preferences the last time we looked
domainlabel usernicelabel; // The nicelabel as it was set in System Preferences the last time we looked
// Following four variables are used for optimization where the helper is not
@@ -181,7 +175,6 @@ struct mDNS_PlatformSupport_struct
domainlabel prevnewnicelabel; // Previous m->nicelabel
mDNSs32 NotifyUser;
mDNSs32 HostNameConflict; // Time we experienced conflict on our link-local host name
- mDNSs32 NetworkChanged;
mDNSs32 KeyChainTimer;
CFRunLoopRef CFRunLoop;
@@ -216,9 +209,6 @@ struct mDNS_PlatformSupport_struct
TCPSocket TCPProxy;
ProxyCallback *UDPProxyCallback;
ProxyCallback *TCPProxyCallback;
-#if TARGET_OS_IPHONE
- cellular_usage_policy_client_t handle;
-#endif
};
extern int OfferSleepProxyService;
diff --git a/mDNSResponder/mDNSMacOSX/mDNSResponder-entitlements.plist b/mDNSResponder/mDNSMacOSX/mDNSResponder-entitlements.plist
index 21a343f8..8f7f77d9 100644
--- a/mDNSResponder/mDNSMacOSX/mDNSResponder-entitlements.plist
+++ b/mDNSResponder/mDNSMacOSX/mDNSResponder-entitlements.plist
@@ -8,8 +8,6 @@
<true/>
<key>com.apple.private.network.socket-delegate</key>
<true/>
- <key>com.apple.networkd.cellular_blocked.notify</key>
- <true/>
<key>com.apple.private.SCNetworkConnection-proxy-user</key>
<true/>
<key>com.apple.private.network.reserved-port</key>
@@ -18,8 +16,6 @@
<true/>
<key>com.apple.private.snhelper</key>
<true/>
- <key>com.apple.telephony.cupolicy-monitor-access</key>
- <true/>
<key>com.apple.private.necp.match</key>
<true/>
<key>com.apple.security.network.server</key>
diff --git a/mDNSResponder/mDNSMacOSX/mDNSResponder.pbproj/project.pbxproj b/mDNSResponder/mDNSMacOSX/mDNSResponder.pbproj/project.pbxproj
deleted file mode 100644
index 3e7df115..00000000
--- a/mDNSResponder/mDNSMacOSX/mDNSResponder.pbproj/project.pbxproj
+++ /dev/null
@@ -1,2338 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 38;
- objects = {
- 000753D303367C1C0CCA2C71 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = mDNSMacOSX.h;
- refType = 4;
- };
- 00AD62A3032D799A0CCA2C71 = {
- buildPhases = (
- FFF7174A07614A8600E10551,
- 00AD62A4032D799A0CCA2C71,
- 00AD62AC032D799A0CCA2C71,
- 00AD62B3032D799A0CCA2C71,
- 00AD62B7032D799A0CCA2C71,
- );
- buildSettings = {
- FRAMEWORK_SEARCH_PATHS = "";
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- HEADER_SEARCH_PATHS = "../mDNSShared \"${APPLE_INTERNAL_DEVELOPER_DIR}/Headers\" \"${CONFIGURATION_TEMP_DIR}\"";
- LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OPTIMIZATION_CFLAGS = "-O0";
- OTHER_CFLAGS = "-no-cpp-precomp -mdynamic-no-pic -DmDNSResponderVersion=${MVERS} -DAPPLE_OSX_mDNSResponder=1 -D_LEGACY_NAT_TRAVERSAL_ -DMDNS_DEBUGMSGS=1";
- OTHER_LDFLAGS = "-ldnsinfo";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = mDNSResponder.debug;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "-sectorder __TEXT __text mDNSResponder.order";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-W -Wall -Wmissing-prototypes -Wno-four-char-constants -Wno-unknown-pragmas";
- };
- dependencies = (
- );
- isa = PBXToolTarget;
- name = "mDNSResponder debug";
- productName = mDNSResponder;
- productReference = 00AD62B8032D799A0CCA2C71;
- };
- 00AD62A4032D799A0CCA2C71 = {
- buildActionMask = 2147483647;
- files = (
- 00AD62A5032D799A0CCA2C71,
- F5E11B5F04A28126019798ED,
- F515E29604A37BB701CA296C,
- F515E29704A37BB801CA296C,
- F515E29904A37BBB01CA296C,
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 00AD62A5032D799A0CCA2C71 = {
- fileRef = 6575FBFF022EAFBA00000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 00AD62AC032D799A0CCA2C71 = {
- buildActionMask = 2147483647;
- files = (
- 00AD62AD032D799A0CCA2C71,
- 00AD62AE032D799A0CCA2C71,
- 00AD62AF032D799A0CCA2C71,
- 7F18A9FB0587CEF6001880B3,
- 7F18A9FA0587CEF6001880B3,
- 7F461DB7062DBF2900672BF3,
- DBAAFE2E057E8F660085CAD0,
- DBAAFE2B057E8F4D0085CAD0,
- F525E72B04AA167A01F1CF4D,
- F5E11B5E04A28126019798ED,
- FFCB6D75075D595E00B8AF62,
- 00AD62B0032D799A0CCA2C71,
- 7FC8F9D606D14E66007E879D,
- 00AD62B1032D799A0CCA2C71,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 00AD62AD032D799A0CCA2C71 = {
- fileRef = 6575FC00022EAFBA00000109;
- isa = PBXBuildFile;
- settings = {
- ATTRIBUTES = (
- Client,
- );
- };
- };
- 00AD62AE032D799A0CCA2C71 = {
- fileRef = 6575FC01022EAFBA00000109;
- isa = PBXBuildFile;
- settings = {
- ATTRIBUTES = (
- Server,
- Client,
- );
- };
- };
- 00AD62AF032D799A0CCA2C71 = {
- fileRef = 6575FBE9022EAF5A00000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 00AD62B0032D799A0CCA2C71 = {
- fileRef = 6575FBEB022EAF7200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 00AD62B1032D799A0CCA2C71 = {
- fileRef = 6575FBEC022EAF7200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 00AD62B3032D799A0CCA2C71 = {
- buildActionMask = 2147483647;
- files = (
- 00AD62B4032D799A0CCA2C71,
- 00AD62B5032D799A0CCA2C71,
- 00AD62B6032D799A0CCA2C71,
- 7F869687066EE02400D2A2DC,
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 00AD62B4032D799A0CCA2C71 = {
- fileRef = 09AB6884FE841BABC02AAC07;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 00AD62B5032D799A0CCA2C71 = {
- fileRef = 65713D46025A293200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 00AD62B6032D799A0CCA2C71 = {
- fileRef = 00CA213D02786FC30CCA2C71;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 00AD62B7032D799A0CCA2C71 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 00AD62B8032D799A0CCA2C71 = {
- isa = PBXExecutableFileReference;
- path = mDNSResponder.debug;
- refType = 3;
- };
- 00AD62BB032D7A0C0CCA2C71 = {
- buildPhases = (
- );
- buildSettings = {
- OTHER_CFLAGS = "";
- OTHER_LDFLAGS = "";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = "Build All";
- SECTORDER_FLAGS = "";
- };
- dependencies = (
- FF25795106C9AB1D00376F7B,
- 00AD62BC032D7A160CCA2C71,
- 00AD62BD032D7A1B0CCA2C71,
- 00AD62BE032D7A1D0CCA2C71,
- FF16238F07023BD2001AB7D7,
- FFD41DDB0664169900F0C438,
- FFD41DDC0664169B00F0C438,
- FF2A870707B4481500B14068,
- );
- isa = PBXAggregateTarget;
- name = "Build All";
- productName = "Build All";
- };
- 00AD62BC032D7A160CCA2C71 = {
- isa = PBXTargetDependency;
- target = 08FB779FFE84155DC02AAC07;
- };
- 00AD62BD032D7A1B0CCA2C71 = {
- isa = PBXTargetDependency;
- target = 00AD62A3032D799A0CCA2C71;
- };
- 00AD62BE032D7A1D0CCA2C71 = {
- isa = PBXTargetDependency;
- target = 6575FC1C022EB76000000109;
- };
- 00B2AB0C032D7B220CCA2C71 = {
- buildRules = (
- );
- buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- MVERS = "\"mDNSResponder (Engineering Build)\"";
- };
- isa = PBXBuildStyle;
- name = Development;
- };
- 00CA213D02786FC30CCA2C71 = {
- isa = PBXFrameworkReference;
- name = IOKit.framework;
- path = /System/Library/Frameworks/IOKit.framework;
- refType = 0;
- };
-//000
-//001
-//002
-//003
-//004
-//030
-//031
-//032
-//033
-//034
- 034768E2FF38A6DC11DB9C8B = {
- isa = PBXExecutableFileReference;
- path = mDNSResponder;
- refType = 3;
- };
-//030
-//031
-//032
-//033
-//034
-//080
-//081
-//082
-//083
-//084
- 08FB7793FE84155DC02AAC07 = {
- buildStyles = (
- 00B2AB0C032D7B220CCA2C71,
- );
- hasScannedForEncodings = 1;
- isa = PBXProject;
- mainGroup = 08FB7794FE84155DC02AAC07;
- projectDirPath = "";
- targets = (
- 00AD62BB032D7A0C0CCA2C71,
- 08FB779FFE84155DC02AAC07,
- 00AD62A3032D799A0CCA2C71,
- 6575FC1C022EB76000000109,
- FF1C919207021C84001048AB,
- DB2CC4530662DD6800335AB3,
- DB2CC4660662DF5C00335AB3,
- FF25792906C9A70800376F7B,
- FFFB0DA907B43C9100B88D48,
- FF2609E107B440DD00CE10E5,
- );
- };
- 08FB7794FE84155DC02AAC07 = {
- children = (
- 08FB7795FE84155DC02AAC07,
- 6575FC1F022EB78C00000109,
- 6575FBFE022EAFA800000109,
- DB2CC4420662DCE500335AB3,
- FFFB0DA407B43BED00B88D48,
- 08FB779DFE84155DC02AAC07,
- 19C28FBDFE9D53C911CA2CBB,
- );
- isa = PBXGroup;
- name = mDNSResponder;
- refType = 4;
- };
- 08FB7795FE84155DC02AAC07 = {
- children = (
- 7FC8F9D406D14E66007E879D,
- 7F461DB5062DBF2900672BF3,
- F525E72804AA167501F1CF4D,
- F5E11B5A04A28126019798ED,
- F5E11B5B04A28126019798ED,
- 6575FBEC022EAF7200000109,
- 6575FBE9022EAF5A00000109,
- 6575FBEB022EAF7200000109,
- 654BE64F02B63B93000001D1,
- 654BE65002B63B93000001D1,
- DBAAFE29057E8F4D0085CAD0,
- 000753D303367C1C0CCA2C71,
- DBAAFE2C057E8F660085CAD0,
- FFCB6D73075D539900B8AF62,
- FF0E0B5D065ADC7600FE4D9C,
- FF1C919D07021D77001048AB,
- FF485D5105632E0000130380,
- FFF4F63A06CFE4DD00459EFD,
- 7F18A9F60587CEF6001880B3,
- 7F18A9F70587CEF6001880B3,
- FF25794606C9A8BF00376F7B,
- FF13FFEA0A5DA44A00897C81,
- FF13FFEC0A5DA45500897C81,
- );
- isa = PBXGroup;
- name = "mDNS Server Sources";
- path = "";
- refType = 4;
- };
- 08FB779DFE84155DC02AAC07 = {
- children = (
- 7F869685066EE02400D2A2DC,
- FFFB0DB407B43D2700B88D48,
- 09AB6884FE841BABC02AAC07,
- 65713D46025A293200000109,
- 00CA213D02786FC30CCA2C71,
- DB2CC4680662DFF500335AB3,
- FF2609FA07B4433800CE10E5,
- FF260A1F07B4436900CE10E5,
- );
- isa = PBXGroup;
- name = "External Frameworks and Libraries";
- refType = 4;
- };
- 08FB779FFE84155DC02AAC07 = {
- buildPhases = (
- FF37BE9207614059003C0420,
- 08FB77A0FE84155DC02AAC07,
- 08FB77A1FE84155DC02AAC07,
- 08FB77A3FE84155DC02AAC07,
- 08FB77A5FE84155DC02AAC07,
- FF5A0AE705632EA600743C27,
- FF5585E507790732008D1C14,
- );
- buildSettings = {
- FRAMEWORK_SEARCH_PATHS = "";
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- HEADER_SEARCH_PATHS = "../mDNSShared \"${APPLE_INTERNAL_DEVELOPER_DIR}/Headers\" \"${CONFIGURATION_TEMP_DIR}\"";
- INSTALL_PATH = /usr/sbin;
- LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OTHER_CFLAGS = "-no-cpp-precomp -mdynamic-no-pic -DmDNSResponderVersion=${MVERS} -DAPPLE_OSX_mDNSResponder=1 -D_LEGACY_NAT_TRAVERSAL_ -D__MigTypeCheck=1";
- OTHER_LDFLAGS = "-ldnsinfo";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = mDNSResponder;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "-sectorder __TEXT __text mDNSResponder.order";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-W -Wall -Wmissing-prototypes -Wno-four-char-constants -Wno-unknown-pragmas";
- };
- dependencies = (
- );
- isa = PBXToolTarget;
- name = mDNSResponder;
- productInstallPath = "${HOME}/bin";
- productName = mDNSResponder;
- productReference = 034768E2FF38A6DC11DB9C8B;
- };
- 08FB77A0FE84155DC02AAC07 = {
- buildActionMask = 2147483647;
- files = (
- 6575FC02022EAFBA00000109,
- F5E11B5D04A28126019798ED,
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 08FB77A1FE84155DC02AAC07 = {
- buildActionMask = 2147483647;
- files = (
- 6575FC0D022EB18700000109,
- 6575FC0E022EB18700000109,
- 6575FBEA022EAF5A00000109,
- 7F18A9F90587CEF6001880B3,
- 7F18A9F80587CEF6001880B3,
- 7F461DB6062DBF2900672BF3,
- DBAAFE2D057E8F660085CAD0,
- DBAAFE2A057E8F4D0085CAD0,
- F525E72904AA167501F1CF4D,
- F5E11B5C04A28126019798ED,
- FFCB6D74075D539900B8AF62,
- 6575FBED022EAF7200000109,
- 7FC8F9D506D14E66007E879D,
- 6575FBEE022EAF7200000109,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 08FB77A3FE84155DC02AAC07 = {
- buildActionMask = 2147483647;
- files = (
- 09AB6885FE841BABC02AAC07,
- 65713D66025A293200000109,
- 6585DD640279A3B7000001D1,
- 7F869686066EE02400D2A2DC,
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 08FB77A5FE84155DC02AAC07 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
-//080
-//081
-//082
-//083
-//084
-//090
-//091
-//092
-//093
-//094
- 09AB6884FE841BABC02AAC07 = {
- isa = PBXFrameworkReference;
- name = CoreFoundation.framework;
- path = /System/Library/Frameworks/CoreFoundation.framework;
- refType = 0;
- };
- 09AB6885FE841BABC02AAC07 = {
- fileRef = 09AB6884FE841BABC02AAC07;
- isa = PBXBuildFile;
- settings = {
- };
- };
-//090
-//091
-//092
-//093
-//094
-//190
-//191
-//192
-//193
-//194
- 19C28FBDFE9D53C911CA2CBB = {
- children = (
- 034768E2FF38A6DC11DB9C8B,
- 6575FC1D022EB76000000109,
- 00AD62B8032D799A0CCA2C71,
- DB2CC4670662DF5C00335AB3,
- FFD41DDA0664157900F0C438,
- FF25794406C9A70800376F7B,
- FF1C919B07021C84001048AB,
- FFFB0DAA07B43C9100B88D48,
- FF2609E207B440DD00CE10E5,
- );
- isa = PBXGroup;
- name = Products;
- refType = 4;
- };
-//190
-//191
-//192
-//193
-//194
-//650
-//651
-//652
-//653
-//654
- 654BE64F02B63B93000001D1 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = mDNSEmbeddedAPI.h;
- path = ../mDNSCore/mDNSEmbeddedAPI.h;
- refType = 4;
- };
- 654BE65002B63B93000001D1 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = mDNSDebug.h;
- path = ../mDNSCore/mDNSDebug.h;
- refType = 4;
- };
- 65713D46025A293200000109 = {
- isa = PBXFrameworkReference;
- name = SystemConfiguration.framework;
- path = /System/Library/Frameworks/SystemConfiguration.framework;
- refType = 0;
- };
- 65713D66025A293200000109 = {
- fileRef = 65713D46025A293200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 6575FBE9022EAF5A00000109 = {
- fileEncoding = 4;
- indentWidth = 4;
- isa = PBXFileReference;
- name = mDNS.c;
- path = ../mDNSCore/mDNS.c;
- refType = 4;
- tabWidth = 4;
- usesTabs = 1;
- };
- 6575FBEA022EAF5A00000109 = {
- fileRef = 6575FBE9022EAF5A00000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 6575FBEB022EAF7200000109 = {
- fileEncoding = 4;
- indentWidth = 4;
- isa = PBXFileReference;
- path = mDNSMacOSX.c;
- refType = 4;
- tabWidth = 4;
- usesTabs = 1;
- };
- 6575FBEC022EAF7200000109 = {
- fileEncoding = 4;
- indentWidth = 4;
- isa = PBXFileReference;
- path = daemon.c;
- refType = 4;
- tabWidth = 4;
- usesTabs = 1;
- };
- 6575FBED022EAF7200000109 = {
- fileRef = 6575FBEB022EAF7200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 6575FBEE022EAF7200000109 = {
- fileRef = 6575FBEC022EAF7200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 6575FBFE022EAFA800000109 = {
- children = (
- 6575FBFF022EAFBA00000109,
- 6575FC00022EAFBA00000109,
- 6575FC01022EAFBA00000109,
- );
- isa = PBXGroup;
- name = "DNS Service Discovery MIG files";
- refType = 4;
- };
- 6575FBFF022EAFBA00000109 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = DNSServiceDiscoveryDefines.h;
- refType = 4;
- };
- 6575FC00022EAFBA00000109 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = DNSServiceDiscoveryReply.defs;
- refType = 4;
- };
- 6575FC01022EAFBA00000109 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = DNSServiceDiscoveryRequest.defs;
- refType = 4;
- };
- 6575FC02022EAFBA00000109 = {
- fileRef = 6575FBFF022EAFBA00000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 6575FC0D022EB18700000109 = {
- fileRef = 6575FC00022EAFBA00000109;
- isa = PBXBuildFile;
- settings = {
- ATTRIBUTES = (
- Client,
- );
- };
- };
- 6575FC0E022EB18700000109 = {
- fileRef = 6575FC01022EAFBA00000109;
- isa = PBXBuildFile;
- settings = {
- ATTRIBUTES = (
- Server,
- Client,
- );
- };
- };
- 6575FC18022EB76000000109 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 6575FC19022EB76000000109 = {
- buildActionMask = 2147483647;
- files = (
- 6575FC21022EB7AA00000109,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 6575FC1A022EB76000000109 = {
- buildActionMask = 2147483647;
- files = (
- 6575FC24022EBA5D00000109,
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 6575FC1B022EB76000000109 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 6575FC1C022EB76000000109 = {
- buildPhases = (
- 6575FC18022EB76000000109,
- 6575FC19022EB76000000109,
- 6575FC1A022EB76000000109,
- 6575FC1B022EB76000000109,
- FFF4F63C06CFE53300459EFD,
- );
- buildSettings = {
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- INSTALL_PATH = /usr/bin;
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OTHER_CFLAGS = "-no-cpp-precomp -mdynamic-no-pic";
- OTHER_LDFLAGS = "";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = mDNS;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-W -Wall -Wmissing-prototypes -Wno-four-char-constants -Wno-unknown-pragmas";
- };
- dependencies = (
- );
- isa = PBXToolTarget;
- name = "mDNS command-line tool";
- productInstallPath = /usr/bin;
- productName = "mDNS command-line tool";
- productReference = 6575FC1D022EB76000000109;
- };
- 6575FC1D022EB76000000109 = {
- isa = PBXExecutableFileReference;
- path = mDNS;
- refType = 3;
- };
- 6575FC1F022EB78C00000109 = {
- children = (
- 6575FC20022EB7AA00000109,
- FF1C919F07021E3F001048AB,
- );
- isa = PBXGroup;
- name = "Command-Line Clients";
- refType = 4;
- };
- 6575FC20022EB7AA00000109 = {
- fileEncoding = 4;
- indentWidth = 4;
- isa = PBXFileReference;
- path = SamplemDNSClient.c;
- refType = 2;
- tabWidth = 4;
- usesTabs = 0;
- };
- 6575FC21022EB7AA00000109 = {
- fileRef = 6575FC20022EB7AA00000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 6575FC24022EBA5D00000109 = {
- fileRef = 09AB6884FE841BABC02AAC07;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 6585DD640279A3B7000001D1 = {
- fileRef = 00CA213D02786FC30CCA2C71;
- isa = PBXBuildFile;
- settings = {
- };
- };
-//650
-//651
-//652
-//653
-//654
-//7F0
-//7F1
-//7F2
-//7F3
-//7F4
- 7F18A9F60587CEF6001880B3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSCommon.c;
- path = ../mDNSCore/DNSCommon.c;
- refType = 2;
- };
- 7F18A9F70587CEF6001880B3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = uDNS.c;
- path = ../mDNSCore/uDNS.c;
- refType = 2;
- };
- 7F18A9F80587CEF6001880B3 = {
- fileRef = 7F18A9F60587CEF6001880B3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7F18A9F90587CEF6001880B3 = {
- fileRef = 7F18A9F70587CEF6001880B3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7F18A9FA0587CEF6001880B3 = {
- fileRef = 7F18A9F60587CEF6001880B3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7F18A9FB0587CEF6001880B3 = {
- fileRef = 7F18A9F70587CEF6001880B3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7F461DB5062DBF2900672BF3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSDigest.c;
- path = ../mDNSCore/DNSDigest.c;
- refType = 2;
- };
- 7F461DB6062DBF2900672BF3 = {
- fileRef = 7F461DB5062DBF2900672BF3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7F461DB7062DBF2900672BF3 = {
- fileRef = 7F461DB5062DBF2900672BF3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7F869685066EE02400D2A2DC = {
- isa = PBXFrameworkReference;
- name = Security.framework;
- path = /System/Library/Frameworks/Security.framework;
- refType = 0;
- };
- 7F869686066EE02400D2A2DC = {
- fileRef = 7F869685066EE02400D2A2DC;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7F869687066EE02400D2A2DC = {
- fileRef = 7F869685066EE02400D2A2DC;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7FC8F9D406D14E66007E879D = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = LegacyNATTraversal.c;
- refType = 2;
- };
- 7FC8F9D506D14E66007E879D = {
- fileRef = 7FC8F9D406D14E66007E879D;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 7FC8F9D606D14E66007E879D = {
- fileRef = 7FC8F9D406D14E66007E879D;
- isa = PBXBuildFile;
- settings = {
- };
- };
-//7F0
-//7F1
-//7F2
-//7F3
-//7F4
-//DB0
-//DB1
-//DB2
-//DB3
-//DB4
- DB2CC4420662DCE500335AB3 = {
- children = (
- DB2CC4430662DD1100335AB3,
- DB2CC4440662DD1100335AB3,
- DB2CC4450662DD1100335AB3,
- DB2CC4460662DD1100335AB3,
- DB2CC4470662DD1100335AB3,
- DB2CC4480662DD1100335AB3,
- DB2CC4490662DD1100335AB3,
- DB2CC44A0662DD1100335AB3,
- DB2CC44B0662DD1100335AB3,
- DB2CC44C0662DD1100335AB3,
- DB2CC44D0662DD1100335AB3,
- DB2CC44E0662DD1100335AB3,
- DB2CC44F0662DD1100335AB3,
- FF2C5FB00A48B8680066DA11,
- FF2C5FB20A48B86E0066DA11,
- );
- isa = PBXGroup;
- name = "Java Support";
- refType = 4;
- };
- DB2CC4430662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = BaseListener.java;
- path = ../mDNSShared/Java/BaseListener.java;
- refType = 2;
- };
- DB2CC4440662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = BrowseListener.java;
- path = ../mDNSShared/Java/BrowseListener.java;
- refType = 2;
- };
- DB2CC4450662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSRecord.java;
- path = ../mDNSShared/Java/DNSRecord.java;
- refType = 2;
- };
- DB2CC4460662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSSD.java;
- path = ../mDNSShared/Java/DNSSD.java;
- refType = 2;
- };
- DB2CC4470662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSSDException.java;
- path = ../mDNSShared/Java/DNSSDException.java;
- refType = 2;
- };
- DB2CC4480662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSSDRegistration.java;
- path = ../mDNSShared/Java/DNSSDRegistration.java;
- refType = 2;
- };
- DB2CC4490662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSSDService.java;
- path = ../mDNSShared/Java/DNSSDService.java;
- refType = 2;
- };
- DB2CC44A0662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DomainListener.java;
- path = ../mDNSShared/Java/DomainListener.java;
- refType = 2;
- };
- DB2CC44B0662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = JNISupport.c;
- path = ../mDNSShared/Java/JNISupport.c;
- refType = 2;
- };
- DB2CC44C0662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = QueryListener.java;
- path = ../mDNSShared/Java/QueryListener.java;
- refType = 2;
- };
- DB2CC44D0662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = RegisterListener.java;
- path = ../mDNSShared/Java/RegisterListener.java;
- refType = 2;
- };
- DB2CC44E0662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = ResolveListener.java;
- path = ../mDNSShared/Java/ResolveListener.java;
- refType = 2;
- };
- DB2CC44F0662DD1100335AB3 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = TXTRecord.java;
- path = ../mDNSShared/Java/TXTRecord.java;
- refType = 2;
- };
- DB2CC4500662DD6800335AB3 = {
- buildActionMask = 2147483647;
- files = (
- DB2CC4560662DE4500335AB3,
- DB2CC4570662DE4600335AB3,
- DB2CC4580662DE4700335AB3,
- DB2CC4590662DE4700335AB3,
- DB2CC45A0662DE4800335AB3,
- DB2CC45B0662DE4900335AB3,
- DB2CC45C0662DE4900335AB3,
- DB2CC45D0662DE4A00335AB3,
- DB2CC45E0662DE4B00335AB3,
- DB2CC45F0662DE4C00335AB3,
- DB2CC4600662DE4C00335AB3,
- DB2CC4610662DE4D00335AB3,
- FF2C5FB10A48B8680066DA11,
- FF2C5FB30A48B86E0066DA11,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- DB2CC4510662DD6800335AB3 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXJavaArchiveBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- DB2CC4520662DD6800335AB3 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- DB2CC4530662DD6800335AB3 = {
- buildPhases = (
- DB2CC4500662DD6800335AB3,
- DB2CC4510662DD6800335AB3,
- DB2CC4520662DD6800335AB3,
- DB2CC4550662DE1700335AB3,
- FFD41DDD06641B4200F0C438,
- );
- buildSettings = {
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- INSTALL_PATH = "${SYSTEM_LIBRARY_DIR}/Java/Extensions";
- JAVA_ARCHIVE_CLASSES = YES;
- JAVA_ARCHIVE_COMPRESSION = YES;
- JAVA_ARCHIVE_TYPE = JAR;
- JAVA_COMPILER_DEBUGGING_SYMBOLS = NO;
- JAVA_COMPILER_SOURCE_VERSION = 1.4;
- JAVA_COMPILER_TARGET_VM_VERSION = 1.4;
- JAVA_SOURCE_SUBDIR = .;
- LIBRARY_STYLE = STATIC;
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OTHER_CFLAGS = "";
- OTHER_LDFLAGS = "";
- OTHER_LIBTOOL_FLAGS = "";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = dns_sd;
- PURE_JAVA = YES;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
- };
- comments = "Multiplatform .jar file that implements Java interface to DNS-SD";
- dependencies = (
- );
- isa = PBXLibraryTarget;
- name = dns_sd.jar;
- productInstallPath = /System/Library/Java/Extensions;
- productName = dns_sd.jar;
- productReference = FFD41DDA0664157900F0C438;
- };
- DB2CC4550662DE1700335AB3 = {
- buildActionMask = 12;
- files = (
- );
- generatedFileNames = (
- );
- isa = PBXShellScriptBuildPhase;
- neededFileNames = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "javah -force -J-Xbootclasspath/p:${CONFIGURATION_TEMP_DIR}/dns_sd.jar.build/JavaClasses -o ${CONFIGURATION_TEMP_DIR}/dns_sd.jar.build/DNSSD.java.h com.apple.dnssd.AppleDNSSD com.apple.dnssd.AppleBrowser com.apple.dnssd.AppleResolver com.apple.dnssd.AppleRegistration com.apple.dnssd.AppleQuery com.apple.dnssd.AppleDomainEnum com.apple.dnssd.AppleService";
- };
- DB2CC4560662DE4500335AB3 = {
- fileRef = DB2CC4430662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC4570662DE4600335AB3 = {
- fileRef = DB2CC4440662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC4580662DE4700335AB3 = {
- fileRef = DB2CC4450662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC4590662DE4700335AB3 = {
- fileRef = DB2CC4460662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC45A0662DE4800335AB3 = {
- fileRef = DB2CC4470662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC45B0662DE4900335AB3 = {
- fileRef = DB2CC4480662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC45C0662DE4900335AB3 = {
- fileRef = DB2CC4490662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC45D0662DE4A00335AB3 = {
- fileRef = DB2CC44A0662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC45E0662DE4B00335AB3 = {
- fileRef = DB2CC44C0662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC45F0662DE4C00335AB3 = {
- fileRef = DB2CC44D0662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC4600662DE4C00335AB3 = {
- fileRef = DB2CC44E0662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC4610662DE4D00335AB3 = {
- fileRef = DB2CC44F0662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC4620662DF5C00335AB3 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- DB2CC4630662DF5C00335AB3 = {
- buildActionMask = 2147483647;
- files = (
- DB2CC46A0662E00700335AB3,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- DB2CC4640662DF5C00335AB3 = {
- buildActionMask = 2147483647;
- files = (
- DB2CC4690662DFF500335AB3,
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- DB2CC4650662DF5C00335AB3 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- DB2CC4660662DF5C00335AB3 = {
- buildPhases = (
- DB2CC4620662DF5C00335AB3,
- DB2CC4630662DF5C00335AB3,
- DB2CC4640662DF5C00335AB3,
- DB2CC4650662DF5C00335AB3,
- );
- buildSettings = {
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- HEADER_SEARCH_PATHS = "../mDNSShared \"${SYSTEM_LIBRARY_DIR}/Frameworks/JavaVM.framework/Versions/A/Headers\" \"${SYSTEM_LIBRARY_DIR}/Frameworks/JavaVM.framework/Versions/1.3.1/Headers\" \"${CONFIGURATION_TEMP_DIR}/dns_sd.jar.build\"";
- INSTALL_PATH = /usr/lib/java;
- LIBRARY_STYLE = DYNAMIC;
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OTHER_CFLAGS = "";
- OTHER_LIBTOOL_FLAGS = "";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = libjdns_sd.jnilib;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
- };
- comments = "Platform-specific JNI library that bridges dns_sd.jar to <dns_sd.h>.";
- dependencies = (
- FFD41DDF06641BBB00F0C438,
- );
- isa = PBXLibraryTarget;
- name = libjdns_sd.jnilib;
- productInstallPath = /usr/lib/java;
- productName = libjdns_sd.jnilib;
- productReference = DB2CC4670662DF5C00335AB3;
- };
- DB2CC4670662DF5C00335AB3 = {
- isa = PBXLibraryReference;
- path = libjdns_sd.jnilib;
- refType = 3;
- };
- DB2CC4680662DFF500335AB3 = {
- isa = PBXFrameworkReference;
- name = JavaVM.framework;
- path = /System/Library/Frameworks/JavaVM.framework;
- refType = 0;
- };
- DB2CC4690662DFF500335AB3 = {
- fileRef = DB2CC4680662DFF500335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DB2CC46A0662E00700335AB3 = {
- fileRef = DB2CC44B0662DD1100335AB3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DBAAFE29057E8F4D0085CAD0 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = mDNSDebug.c;
- path = ../mDNSShared/mDNSDebug.c;
- refType = 2;
- };
- DBAAFE2A057E8F4D0085CAD0 = {
- fileRef = DBAAFE29057E8F4D0085CAD0;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DBAAFE2B057E8F4D0085CAD0 = {
- fileRef = DBAAFE29057E8F4D0085CAD0;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DBAAFE2C057E8F660085CAD0 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = GenLinkedList.c;
- path = ../mDNSShared/GenLinkedList.c;
- refType = 2;
- };
- DBAAFE2D057E8F660085CAD0 = {
- fileRef = DBAAFE2C057E8F660085CAD0;
- isa = PBXBuildFile;
- settings = {
- };
- };
- DBAAFE2E057E8F660085CAD0 = {
- fileRef = DBAAFE2C057E8F660085CAD0;
- isa = PBXBuildFile;
- settings = {
- };
- };
-//DB0
-//DB1
-//DB2
-//DB3
-//DB4
-//F50
-//F51
-//F52
-//F53
-//F54
- F515E29604A37BB701CA296C = {
- fileRef = 654BE64F02B63B93000001D1;
- isa = PBXBuildFile;
- settings = {
- };
- };
- F515E29704A37BB801CA296C = {
- fileRef = 654BE65002B63B93000001D1;
- isa = PBXBuildFile;
- settings = {
- };
- };
- F515E29904A37BBB01CA296C = {
- fileRef = 000753D303367C1C0CCA2C71;
- isa = PBXBuildFile;
- settings = {
- };
- };
- F525E72804AA167501F1CF4D = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = uds_daemon.c;
- path = ../mDNSShared/uds_daemon.c;
- refType = 2;
- };
- F525E72904AA167501F1CF4D = {
- fileRef = F525E72804AA167501F1CF4D;
- isa = PBXBuildFile;
- settings = {
- };
- };
- F525E72B04AA167A01F1CF4D = {
- fileRef = F525E72804AA167501F1CF4D;
- isa = PBXBuildFile;
- settings = {
- };
- };
- F5E11B5A04A28126019798ED = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = dnssd_ipc.c;
- path = ../mDNSShared/dnssd_ipc.c;
- refType = 2;
- };
- F5E11B5B04A28126019798ED = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = dnssd_ipc.h;
- path = ../mDNSShared/dnssd_ipc.h;
- refType = 2;
- };
- F5E11B5C04A28126019798ED = {
- fileRef = F5E11B5A04A28126019798ED;
- isa = PBXBuildFile;
- settings = {
- };
- };
- F5E11B5D04A28126019798ED = {
- fileRef = F5E11B5B04A28126019798ED;
- isa = PBXBuildFile;
- settings = {
- };
- };
- F5E11B5E04A28126019798ED = {
- fileRef = F5E11B5A04A28126019798ED;
- isa = PBXBuildFile;
- settings = {
- };
- };
- F5E11B5F04A28126019798ED = {
- fileRef = F5E11B5B04A28126019798ED;
- isa = PBXBuildFile;
- settings = {
- };
- };
-//F50
-//F51
-//F52
-//F53
-//F54
-//FF0
-//FF1
-//FF2
-//FF3
-//FF4
- FF08480607CEB8E800AE6769 = {
- isa = PBXFileReference;
- name = inprogress.tiff;
- path = PreferencePane/Artwork/inprogress.tiff;
- refType = 2;
- };
- FF08480707CEB8E800AE6769 = {
- fileRef = FF08480607CEB8E800AE6769;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF0E0B5D065ADC7600FE4D9C = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = mDNS.1;
- path = ../mDNSShared/mDNS.1;
- refType = 2;
- };
- FF13FFE90A5DA40200897C81 = {
- fileRef = 6575FBEB022EAF7200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF13FFEA0A5DA44A00897C81 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = dnsextd_lexer.l;
- path = ../mDNSShared/dnsextd_lexer.l;
- refType = 2;
- };
- FF13FFEB0A5DA44A00897C81 = {
- fileRef = FF13FFEA0A5DA44A00897C81;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF13FFEC0A5DA45500897C81 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = dnsextd_parser.y;
- path = ../mDNSShared/dnsextd_parser.y;
- refType = 2;
- };
- FF13FFED0A5DA45500897C81 = {
- fileRef = FF13FFEC0A5DA45500897C81;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF13FFEE0A5DA52700897C81 = {
- isa = PBXTargetDependency;
- target = 08FB779FFE84155DC02AAC07;
- };
- FF13FFEF0A5DA6FD00897C81 = {
- fileRef = FFCB6D73075D539900B8AF62;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF16238F07023BD2001AB7D7 = {
- isa = PBXTargetDependency;
- target = FF1C919207021C84001048AB;
- };
- FF1C919207021C84001048AB = {
- buildPhases = (
- FF1C919307021C84001048AB,
- FF1C919407021C84001048AB,
- FF1C919607021C84001048AB,
- FF1C919807021C84001048AB,
- FF1C919907021C84001048AB,
- );
- buildSettings = {
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- INSTALL_PATH = /usr/bin;
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OTHER_CFLAGS = "-no-cpp-precomp -mdynamic-no-pic -I../mDNSShared";
- OTHER_LDFLAGS = "";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = "dns-sd";
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-W -Wall -Wmissing-prototypes -Wno-four-char-constants -Wno-unknown-pragmas";
- };
- dependencies = (
- );
- isa = PBXToolTarget;
- name = "dns-sd command-line tool";
- productInstallPath = /usr/bin;
- productName = "dns-sd command-line tool";
- productReference = FF1C919B07021C84001048AB;
- };
- FF1C919307021C84001048AB = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF1C919407021C84001048AB = {
- buildActionMask = 2147483647;
- files = (
- FF1C91A007021E40001048AB,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF1C919607021C84001048AB = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF1C919807021C84001048AB = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF1C919907021C84001048AB = {
- buildActionMask = 8;
- dstPath = /usr/share/man/man1;
- dstSubfolderSpec = 0;
- files = (
- FF1C919E07021D78001048AB,
- );
- isa = PBXCopyFilesBuildPhase;
- runOnlyForDeploymentPostprocessing = 1;
- };
- FF1C919B07021C84001048AB = {
- isa = PBXExecutableFileReference;
- path = "dns-sd";
- refType = 3;
- };
- FF1C919D07021D77001048AB = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = "dns-sd.1";
- path = "../mDNSShared/dns-sd.1";
- refType = 2;
- };
- FF1C919E07021D78001048AB = {
- fileRef = FF1C919D07021D77001048AB;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF1C919F07021E3F001048AB = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = "dns-sd.c";
- path = "../Clients/dns-sd.c";
- refType = 2;
- };
- FF1C91A007021E40001048AB = {
- fileRef = FF1C919F07021E3F001048AB;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25792906C9A70800376F7B = {
- buildPhases = (
- FF25792A06C9A70800376F7B,
- FF25792D06C9A70800376F7B,
- FF25793A06C9A70800376F7B,
- FF25793F06C9A70800376F7B,
- FF25794006C9A70800376F7B,
- );
- buildSettings = {
- FRAMEWORK_SEARCH_PATHS = "";
- GCC_TREAT_WARNINGS_AS_ERRORS = YES;
- HEADER_SEARCH_PATHS = "\"${APPLE_INTERNAL_DEVELOPER_DIR}/Headers\" \"${CONFIGURATION_TEMP_DIR}\"";
- INSTALL_PATH = /usr/sbin;
- LEX = /usr/bin/flex;
- LEXFLAGS = "-i";
- LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OTHER_CFLAGS = "-no-cpp-precomp -mdynamic-no-pic";
- OTHER_LDFLAGS = "-ldnsinfo";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = dnsextd;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-W -Wall -Wmissing-prototypes -Wno-four-char-constants -Wno-unknown-pragmas";
- YACC = "/usr/bin/bison -y";
- };
- dependencies = (
- FF13FFEE0A5DA52700897C81,
- );
- isa = PBXToolTarget;
- name = dnsextd;
- productInstallPath = /usr/sbin;
- productName = mDNSResponder;
- productReference = FF25794406C9A70800376F7B;
- };
- FF25792A06C9A70800376F7B = {
- buildActionMask = 2147483647;
- files = (
- FF25792B06C9A70800376F7B,
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF25792B06C9A70800376F7B = {
- fileRef = 6575FBFF022EAFBA00000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25792D06C9A70800376F7B = {
- buildActionMask = 2147483647;
- files = (
- FF25793606C9A70800376F7B,
- FF25793806C9A70800376F7B,
- FF25794706C9A8BF00376F7B,
- FF25794A06C9A98700376F7B,
- FF25794E06C9AA3000376F7B,
- FF13FFE90A5DA40200897C81,
- FF13FFEB0A5DA44A00897C81,
- FF13FFED0A5DA45500897C81,
- FF13FFEF0A5DA6FD00897C81,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF25793606C9A70800376F7B = {
- fileRef = 7F18A9F60587CEF6001880B3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25793806C9A70800376F7B = {
- fileRef = 7F461DB5062DBF2900672BF3;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25793A06C9A70800376F7B = {
- buildActionMask = 2147483647;
- files = (
- FF25793B06C9A70800376F7B,
- FF25793C06C9A70800376F7B,
- FF25793D06C9A70800376F7B,
- FF25793E06C9A70800376F7B,
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF25793B06C9A70800376F7B = {
- fileRef = 09AB6884FE841BABC02AAC07;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25793C06C9A70800376F7B = {
- fileRef = 65713D46025A293200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25793D06C9A70800376F7B = {
- fileRef = 00CA213D02786FC30CCA2C71;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25793E06C9A70800376F7B = {
- fileRef = 7F869685066EE02400D2A2DC;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25793F06C9A70800376F7B = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF25794006C9A70800376F7B = {
- buildActionMask = 8;
- dstPath = /usr/share/man/man8;
- dstSubfolderSpec = 0;
- files = (
- FFF4F63B06CFE4DD00459EFD,
- );
- isa = PBXCopyFilesBuildPhase;
- runOnlyForDeploymentPostprocessing = 1;
- };
- FF25794406C9A70800376F7B = {
- isa = PBXExecutableFileReference;
- path = dnsextd;
- refType = 3;
- };
- FF25794606C9A8BF00376F7B = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = dnsextd.c;
- path = ../mDNSShared/dnsextd.c;
- refType = 2;
- };
- FF25794706C9A8BF00376F7B = {
- fileRef = FF25794606C9A8BF00376F7B;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25794A06C9A98700376F7B = {
- fileRef = DBAAFE29057E8F4D0085CAD0;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25794E06C9AA3000376F7B = {
- fileRef = DBAAFE2C057E8F660085CAD0;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF25795106C9AB1D00376F7B = {
- isa = PBXTargetDependency;
- target = FF25792906C9A70800376F7B;
- };
- FF2609DC07B440DD00CE10E5 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF2609DD07B440DD00CE10E5 = {
- buildActionMask = 2147483647;
- files = (
- FF260A2B07B4464B00CE10E5,
- FF260A2C07B4464B00CE10E5,
- FF260A2D07B4464B00CE10E5,
- FF260A2E07B4464B00CE10E5,
- FF260A2F07B4464B00CE10E5,
- FF260A3007B4464B00CE10E5,
- FF260A3107B4464B00CE10E5,
- FF260A3407B4466900CE10E5,
- FF260A3507B4466900CE10E5,
- FF260A4A07B4475600CE10E5,
- FF260A4D07B4477F00CE10E5,
- FF2A870607B447EF00B14068,
- FF08480707CEB8E800AE6769,
- FF354EB208516C63007C00E1,
- );
- isa = PBXResourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF2609DE07B440DD00CE10E5 = {
- buildActionMask = 2147483647;
- files = (
- FF2609E407B441D400CE10E5,
- FF2609E507B441D700CE10E5,
- FF2609E607B441DB00CE10E5,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF2609DF07B440DD00CE10E5 = {
- buildActionMask = 2147483647;
- files = (
- FF2609F607B442BA00CE10E5,
- FF2609F707B442C000CE10E5,
- FF2609FB07B4433800CE10E5,
- FF260A2007B4436900CE10E5,
- FF260A2107B443B500CE10E5,
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF2609E007B440DD00CE10E5 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FF2609E107B440DD00CE10E5 = {
- buildPhases = (
- FF2609DC07B440DD00CE10E5,
- FF2609DD07B440DD00CE10E5,
- FF2609DE07B440DD00CE10E5,
- FF2609DF07B440DD00CE10E5,
- FF2609E007B440DD00CE10E5,
- );
- buildSettings = {
- EXPORTED_SYMBOLS_FILE = "";
- INSTALL_PATH = "${SYSTEM_LIBRARY_DIR}/PreferencePanes";
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OTHER_CFLAGS = "";
- OTHER_LDFLAGS = "-twolevel_namespace";
- OTHER_REZFLAGS = "";
- PREBINDING = NO;
- PRODUCT_NAME = Bonjour;
- SECTORDER_FLAGS = "";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
- WRAPPER_EXTENSION = prefPane;
- };
- dependencies = (
- FF2609E307B440EC00CE10E5,
- );
- isa = PBXBundleTarget;
- name = PreferencePane;
- productInstallPath = "${SYSTEM_LIBRARY_DIR}/PreferencePanes";
- productName = PreferencePane;
- productReference = FF2609E207B440DD00CE10E5;
- productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
-<plist version=\"1.0\">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>Bonjour</string>
- <key>CFBundleGetInfoString</key>
- <string></string>
- <key>CFBundleIconFile</key>
- <string>BonjourPref</string>
- <key>CFBundleIdentifier</key>
- <string>com.apple.preference.bonjour</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string></string>
- <key>CFBundlePackageType</key>
- <string>BNDL</string>
- <key>CFBundleShortVersionString</key>
- <string></string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>NSMainNibFile</key>
- <string>DNSServiceDiscoveryPref</string>
- <key>NSPrefPaneIconFile</key>
- <string>BonjourPref.tiff</string>
- <key>NSPrefPaneIconLabel</key>
- <string>Bonjour</string>
- <key>NSPrincipalClass</key>
- <string>DNSServiceDiscoveryPref</string>
-</dict>
-</plist>
-";
- };
- FF2609E207B440DD00CE10E5 = {
- isa = PBXBundleReference;
- path = Bonjour.prefPane;
- refType = 3;
- };
- FF2609E307B440EC00CE10E5 = {
- isa = PBXTargetDependency;
- target = FFFB0DA907B43C9100B88D48;
- };
- FF2609E407B441D400CE10E5 = {
- fileRef = FFFB0DAC07B43CBA00B88D48;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF2609E507B441D700CE10E5 = {
- fileRef = FFFB0DAD07B43CBA00B88D48;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF2609E607B441DB00CE10E5 = {
- fileRef = FFFB0DAE07B43CBA00B88D48;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF2609F607B442BA00CE10E5 = {
- fileRef = 65713D46025A293200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF2609F707B442C000CE10E5 = {
- fileRef = 7F869685066EE02400D2A2DC;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF2609FA07B4433800CE10E5 = {
- isa = PBXFrameworkReference;
- name = Cocoa.framework;
- path = /System/Library/Frameworks/Cocoa.framework;
- refType = 0;
- };
- FF2609FB07B4433800CE10E5 = {
- fileRef = FF2609FA07B4433800CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A1F07B4436900CE10E5 = {
- isa = PBXFrameworkReference;
- name = PreferencePanes.framework;
- path = /System/Library/Frameworks/PreferencePanes.framework;
- refType = 0;
- };
- FF260A2007B4436900CE10E5 = {
- fileRef = FF260A1F07B4436900CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A2107B443B500CE10E5 = {
- fileRef = 09AB6884FE841BABC02AAC07;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A2207B443C500CE10E5 = {
- fileRef = 09AB6884FE841BABC02AAC07;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A2307B4463400CE10E5 = {
- children = (
- FF260A2407B4464B00CE10E5,
- FF260A2507B4464B00CE10E5,
- FF260A2607B4464B00CE10E5,
- FF260A2707B4464B00CE10E5,
- FF260A2907B4464B00CE10E5,
- FF260A2807B4464B00CE10E5,
- FF08480607CEB8E800AE6769,
- FF260A2A07B4464B00CE10E5,
- FF260A3207B4466900CE10E5,
- FF260A3307B4466900CE10E5,
- FF354EB108516C63007C00E1,
- FF260A4807B4475600CE10E5,
- FF260A4B07B4477F00CE10E5,
- );
- isa = PBXGroup;
- name = Resources;
- refType = 4;
- };
- FF260A2407B4464B00CE10E5 = {
- isa = PBXFileReference;
- name = remove_idle.tiff;
- path = PreferencePane/Artwork/remove_idle.tiff;
- refType = 2;
- };
- FF260A2507B4464B00CE10E5 = {
- isa = PBXFileReference;
- name = add_pressed.tiff;
- path = PreferencePane/Artwork/add_pressed.tiff;
- refType = 2;
- };
- FF260A2607B4464B00CE10E5 = {
- isa = PBXFileReference;
- name = remove_disabled.tiff;
- path = PreferencePane/Artwork/remove_disabled.tiff;
- refType = 2;
- };
- FF260A2707B4464B00CE10E5 = {
- isa = PBXFileReference;
- name = add_idle.tiff;
- path = PreferencePane/Artwork/add_idle.tiff;
- refType = 2;
- };
- FF260A2807B4464B00CE10E5 = {
- isa = PBXFileReference;
- name = success.tiff;
- path = PreferencePane/Artwork/success.tiff;
- refType = 2;
- };
- FF260A2907B4464B00CE10E5 = {
- isa = PBXFileReference;
- name = remove_pressed.tiff;
- path = PreferencePane/Artwork/remove_pressed.tiff;
- refType = 2;
- };
- FF260A2A07B4464B00CE10E5 = {
- isa = PBXFileReference;
- name = failure.tiff;
- path = PreferencePane/Artwork/failure.tiff;
- refType = 2;
- };
- FF260A2B07B4464B00CE10E5 = {
- fileRef = FF260A2407B4464B00CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A2C07B4464B00CE10E5 = {
- fileRef = FF260A2507B4464B00CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A2D07B4464B00CE10E5 = {
- fileRef = FF260A2607B4464B00CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A2E07B4464B00CE10E5 = {
- fileRef = FF260A2707B4464B00CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A2F07B4464B00CE10E5 = {
- fileRef = FF260A2807B4464B00CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A3007B4464B00CE10E5 = {
- fileRef = FF260A2907B4464B00CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A3107B4464B00CE10E5 = {
- fileRef = FF260A2A07B4464B00CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A3207B4466900CE10E5 = {
- isa = PBXFileReference;
- name = BonjourPref.icns;
- path = PreferencePane/BonjourPref.icns;
- refType = 2;
- };
- FF260A3307B4466900CE10E5 = {
- isa = PBXFileReference;
- name = BonjourPref.tiff;
- path = PreferencePane/BonjourPref.tiff;
- refType = 2;
- };
- FF260A3407B4466900CE10E5 = {
- fileRef = FF260A3207B4466900CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A3507B4466900CE10E5 = {
- fileRef = FF260A3307B4466900CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A4807B4475600CE10E5 = {
- children = (
- FF260A4907B4475600CE10E5,
- );
- isa = PBXVariantGroup;
- name = DNSServiceDiscoveryPref.nib;
- path = PreferencePane;
- refType = 2;
- };
- FF260A4907B4475600CE10E5 = {
- isa = PBXFileReference;
- name = English;
- path = PreferencePane/English.lproj/DNSServiceDiscoveryPref.nib;
- refType = 2;
- };
- FF260A4A07B4475600CE10E5 = {
- fileRef = FF260A4807B4475600CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF260A4B07B4477F00CE10E5 = {
- children = (
- FF260A4C07B4477F00CE10E5,
- );
- isa = PBXVariantGroup;
- name = InfoPlist.strings;
- path = PreferencePane;
- refType = 2;
- };
- FF260A4C07B4477F00CE10E5 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = English;
- path = PreferencePane/English.lproj/InfoPlist.strings;
- refType = 2;
- };
- FF260A4D07B4477F00CE10E5 = {
- fileRef = FF260A4B07B4477F00CE10E5;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF2A870607B447EF00B14068 = {
- fileRef = FFFB0DAA07B43C9100B88D48;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF2A870707B4481500B14068 = {
- isa = PBXTargetDependency;
- target = FF2609E107B440DD00CE10E5;
- };
- FF2C5FB00A48B8680066DA11 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSSDRecordRegistrar.java;
- path = ../mDNSShared/Java/DNSSDRecordRegistrar.java;
- refType = 2;
- };
- FF2C5FB10A48B8680066DA11 = {
- fileRef = FF2C5FB00A48B8680066DA11;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF2C5FB20A48B86E0066DA11 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = RegisterRecordListener.java;
- path = ../mDNSShared/Java/RegisterRecordListener.java;
- refType = 2;
- };
- FF2C5FB30A48B86E0066DA11 = {
- fileRef = FF2C5FB20A48B86E0066DA11;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF354EB108516C63007C00E1 = {
- fileEncoding = 4;
- isa = PBXExecutableFileReference;
- name = installtool;
- path = PreferencePane/installtool;
- refType = 2;
- };
- FF354EB208516C63007C00E1 = {
- fileRef = FF354EB108516C63007C00E1;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FF37BE9207614059003C0420 = {
- buildActionMask = 2147483647;
- files = (
- );
- generatedFileNames = (
- );
- isa = PBXShellScriptBuildPhase;
- neededFileNames = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "if [ -e /usr/local/include/dnsinfo.h ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/dnsinfo.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${CONFIGURATION_TEMP_DIR}/dnsinfo.h\ntouch ${CONFIGURATION_TEMP_DIR}/empty.c\ncc ${CONFIGURATION_TEMP_DIR}/empty.c -c -o \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nrm -f ${CONFIGURATION_TEMP_DIR}/empty.c\nfi";
- };
- FF485D5105632E0000130380 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = mDNSResponder.8;
- path = ../mDNSShared/mDNSResponder.8;
- refType = 2;
- };
- FF5585E507790732008D1C14 = {
- buildActionMask = 8;
- files = (
- );
- generatedFileNames = (
- );
- isa = PBXShellScriptBuildPhase;
- neededFileNames = (
- );
- runOnlyForDeploymentPostprocessing = 1;
- shellPath = /bin/tcsh;
- shellScript = "# Install plist to tell launchd to start mDNSResponder\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons\ncp ${SRCROOT}/LaunchDaemonInfo.plist ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponder.plist\n\n# Install mDNSResponder.bundle containing language localizations\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices\ncp -R ${SRCROOT}/mDNSResponder-bundle ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle\n\n# Remove unwanted CVS directories\nfind ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -depth -name CVS -exec rm -rf {} \\;\n\n# Expand UTF-8 files to UTF-16 (not necessary, but required by B&I policy)\nforeach file (`find ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -name Localizable.strings`)\niconv -f utf-8 -t utf-16 ${file} > ${file}.new\nmv -f ${file}.new ${file}\nend\n\n# Remove French localization (not wanted for Apple B&I builds)\nrm -rf ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle/Resources/French.lproj\n";
- };
- FF5A0AE705632EA600743C27 = {
- buildActionMask = 8;
- dstPath = /usr/share/man/man8;
- dstSubfolderSpec = 0;
- files = (
- FF5A0AE805632EAE00743C27,
- );
- isa = PBXCopyFilesBuildPhase;
- runOnlyForDeploymentPostprocessing = 1;
- };
- FF5A0AE805632EAE00743C27 = {
- fileRef = FF485D5105632E0000130380;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FFCB6D73075D539900B8AF62 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = PlatformCommon.c;
- path = ../mDNSShared/PlatformCommon.c;
- refType = 2;
- };
- FFCB6D74075D539900B8AF62 = {
- fileRef = FFCB6D73075D539900B8AF62;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FFCB6D75075D595E00B8AF62 = {
- fileRef = FFCB6D73075D539900B8AF62;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FFD41DDA0664157900F0C438 = {
- includeInIndex = 0;
- isa = PBXZipArchiveReference;
- path = dns_sd.jar;
- refType = 3;
- };
- FFD41DDB0664169900F0C438 = {
- isa = PBXTargetDependency;
- target = DB2CC4530662DD6800335AB3;
- };
- FFD41DDC0664169B00F0C438 = {
- isa = PBXTargetDependency;
- target = DB2CC4660662DF5C00335AB3;
- };
- FFD41DDD06641B4200F0C438 = {
- buildActionMask = 2147483647;
- files = (
- );
- generatedFileNames = (
- );
- isa = PBXShellScriptBuildPhase;
- neededFileNames = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "rm -f ${CONFIGURATION_BUILD_DIR}/dns_sd";
- };
- FFD41DDF06641BBB00F0C438 = {
- isa = PBXTargetDependency;
- target = DB2CC4530662DD6800335AB3;
- };
- FFE6935007C2CA7F00283007 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = ConfigurationAuthority.h;
- path = PreferencePane/ConfigurationAuthority.h;
- refType = 2;
- };
- FFE6935207C2CAA400283007 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = DNSServiceDiscoveryPref.h;
- path = PreferencePane/DNSServiceDiscoveryPref.h;
- refType = 2;
- };
- FFE6935407C2CABD00283007 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = PrivilegedOperations.h;
- path = PreferencePane/PrivilegedOperations.h;
- refType = 2;
- };
- FFF4F63A06CFE4DD00459EFD = {
- fileEncoding = 4;
- isa = PBXFileReference;
- name = dnsextd.8;
- path = ../mDNSShared/dnsextd.8;
- refType = 2;
- };
- FFF4F63B06CFE4DD00459EFD = {
- fileRef = FFF4F63A06CFE4DD00459EFD;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FFF4F63C06CFE53300459EFD = {
- buildActionMask = 8;
- dstPath = /usr/share/man/man1;
- dstSubfolderSpec = 0;
- files = (
- FFF4F63D06CFE54300459EFD,
- );
- isa = PBXCopyFilesBuildPhase;
- runOnlyForDeploymentPostprocessing = 1;
- };
- FFF4F63D06CFE54300459EFD = {
- fileRef = FF0E0B5D065ADC7600FE4D9C;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FFF7174A07614A8600E10551 = {
- buildActionMask = 2147483647;
- files = (
- );
- generatedFileNames = (
- );
- isa = PBXShellScriptBuildPhase;
- neededFileNames = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "if [ -e /usr/local/include/dnsinfo.h ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/dnsinfo.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${CONFIGURATION_TEMP_DIR}/dnsinfo.h\ntouch ${CONFIGURATION_TEMP_DIR}/empty.c\ncc ${CONFIGURATION_TEMP_DIR}/empty.c -c -o \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nrm -f ${CONFIGURATION_TEMP_DIR}/empty.c\nfi";
- };
- FFFB0DA407B43BED00B88D48 = {
- children = (
- FFE6935007C2CA7F00283007,
- FFFB0DAE07B43CBA00B88D48,
- FFE6935207C2CAA400283007,
- FFFB0DAC07B43CBA00B88D48,
- FFE6935407C2CABD00283007,
- FFFB0DAD07B43CBA00B88D48,
- FFFB0DAF07B43CBA00B88D48,
- FF260A2307B4463400CE10E5,
- );
- isa = PBXGroup;
- path = PreferencePane;
- refType = 2;
- };
- FFFB0DA507B43C9100B88D48 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FFFB0DA607B43C9100B88D48 = {
- buildActionMask = 2147483647;
- files = (
- FFFB0DB307B43CBA00B88D48,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FFFB0DA707B43C9100B88D48 = {
- buildActionMask = 2147483647;
- files = (
- FFFB0DB507B43D2700B88D48,
- FFFB0DB907B43D5F00B88D48,
- FFFB0DBD07B43D7400B88D48,
- FF260A2207B443C500CE10E5,
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FFFB0DA807B43C9100B88D48 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- FFFB0DA907B43C9100B88D48 = {
- buildPhases = (
- FFFB0DA507B43C9100B88D48,
- FFFB0DA607B43C9100B88D48,
- FFFB0DA707B43C9100B88D48,
- FFFB0DA807B43C9100B88D48,
- );
- buildSettings = {
- INSTALL_PATH = "/Library/Application Support/Bonjour";
- MACOSX_DEPLOYMENT_TARGET = 10.2;
- OTHER_CFLAGS = "";
- OTHER_LDFLAGS = "";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = ddnswriteconfig;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "";
- STRIPFLAGS = "-S";
- WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
- };
- dependencies = (
- );
- isa = PBXToolTarget;
- name = ddnswriteconfig;
- productInstallPath = "/Library/Application Support/Bonjour";
- productName = ddnswriteconfig;
- productReference = FFFB0DAA07B43C9100B88D48;
- };
- FFFB0DAA07B43C9100B88D48 = {
- isa = PBXExecutableFileReference;
- path = ddnswriteconfig;
- refType = 3;
- };
- FFFB0DAC07B43CBA00B88D48 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = DNSServiceDiscoveryPref.m;
- refType = 4;
- };
- FFFB0DAD07B43CBA00B88D48 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = PrivilegedOperations.c;
- refType = 4;
- };
- FFFB0DAE07B43CBA00B88D48 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = ConfigurationAuthority.c;
- refType = 4;
- };
- FFFB0DAF07B43CBA00B88D48 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- path = ddnswriteconfig.m;
- refType = 4;
- };
- FFFB0DB307B43CBA00B88D48 = {
- fileRef = FFFB0DAF07B43CBA00B88D48;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FFFB0DB407B43D2700B88D48 = {
- isa = PBXFrameworkReference;
- name = Foundation.framework;
- path = /System/Library/Frameworks/Foundation.framework;
- refType = 0;
- };
- FFFB0DB507B43D2700B88D48 = {
- fileRef = FFFB0DB407B43D2700B88D48;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FFFB0DB907B43D5F00B88D48 = {
- fileRef = 7F869685066EE02400D2A2DC;
- isa = PBXBuildFile;
- settings = {
- };
- };
- FFFB0DBD07B43D7400B88D48 = {
- fileRef = 65713D46025A293200000109;
- isa = PBXBuildFile;
- settings = {
- };
- };
- };
- rootObject = 08FB7793FE84155DC02AAC07;
-}
diff --git a/mDNSResponder/mDNSMacOSX/mDNSResponder.sb b/mDNSResponder/mDNSMacOSX/mDNSResponder.sb
index f267f324..5c8eedd7 100644
--- a/mDNSResponder/mDNSMacOSX/mDNSResponder.sb
+++ b/mDNSResponder/mDNSMacOSX/mDNSResponder.sb
@@ -1,6 +1,6 @@
; -*- Mode: Scheme; tab-width: 4 -*-
;
-; Copyright (c) 2012 Apple Inc. All rights reserved.
+; Copyright (c) 2012-2015 Apple Inc. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
@@ -10,7 +10,7 @@
; 2. Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation
; and/or other materials provided with the distribution.
-; 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
+; 3. Neither the name of Apple Inc. ("Apple") nor the names of its
; contributors may be used to endorse or promote products derived from this
; software without specific prior written permission.
;
@@ -45,9 +45,12 @@
; Mach communications
; These are needed for things like getpwnam, hostname changes, & keychain
(allow mach-lookup
+ (global-name "com.apple.awdd")
(global-name "com.apple.bsd.dirhelper")
(global-name "com.apple.CoreServices.coreservicesd")
+ (global-name "com.apple.coreservices.quarantine-resolver")
(global-name "com.apple.distributed_notifications.2")
+ (global-name "com.apple.lsd.mapdb")
(global-name "com.apple.ocspd")
(global-name "com.apple.PowerManagement.control")
(global-name "com.apple.mDNSResponderHelper")
@@ -58,13 +61,13 @@
(global-name "com.apple.SystemConfiguration.NetworkInformation")
(global-name "com.apple.system.notification_center")
(global-name "com.apple.system.logger")
+ (global-name "com.apple.usymptomsd")
(global-name "com.apple.webcontentfilter.dns")
(global-name "com.apple.server.bluetooth")
(global-name "com.apple.awacs")
(global-name "com.apple.networkd")
(global-name "com.apple.securityd")
(global-name "com.apple.wifi.manager")
- (global-name "com.apple.commcenter.cupolicy.xpc")
(global-name "com.apple.blued")
(global-name "com.apple.mobilegestalt.xpc")
(global-name "com.apple.snhelper"))
@@ -99,6 +102,7 @@
(literal "/usr/sbin")
(literal "/usr/sbin/mDNSResponder")
+ (literal "/Library/Preferences/com.apple.mDNSResponder.plist")
(literal "/Library/Preferences/SystemConfiguration/preferences.plist")
(literal "/Library/Preferences/SystemConfiguration/com.apple.nat.plist")
(regex #"^/Library/Preferences/(ByHost/)?\.GlobalPreferences\.")
@@ -136,10 +140,7 @@
(regex #"^/private/var/folders/[^/]+/[^/]+/C/mds(/|$)")
; Required on 10.5 and 10.6
- (regex #"^/private/var/folders/[^/]+/[^/]+/-Caches-/mds(/|$)")
-
- ; Required on 10.10.4
- (regex #"^/private/var/folders/[^/]+/[^/]+/[0-9]+(/|$)"))
+ (regex #"^/private/var/folders/[^/]+/[^/]+/-Caches-/mds(/|$)"))
; CRL Cache for SSL/TLS connections
(allow file-read-data (literal "/private/var/db/crls/crlcache.db"))
diff --git a/mDNSResponder/mDNSMacOSX/mDNSResponder.xcodeproj/project.pbxproj b/mDNSResponder/mDNSMacOSX/mDNSResponder.xcodeproj/project.pbxproj
index 39d8a451..ef2fecbd 100644
--- a/mDNSResponder/mDNSMacOSX/mDNSResponder.xcodeproj/project.pbxproj
+++ b/mDNSResponder/mDNSMacOSX/mDNSResponder.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 45;
+ objectVersion = 46;
objects = {
/* Begin PBXAggregateTarget section */
@@ -25,16 +25,14 @@
isa = PBXAggregateTarget;
buildConfigurationList = 03067D730C83A3CB0022BE1F /* Build configuration list for PBXAggregateTarget "Build Some" */;
buildPhases = (
- FF045B6A0C7E4AA600448140 /* ShellScript */,
);
dependencies = (
- 217A4C49138EE14C000A5BA8 /* PBXTargetDependency */,
03067D680C83A3830022BE1F /* PBXTargetDependency */,
- 03067D6A0C83A3890022BE1F /* PBXTargetDependency */,
- 03067D6C0C83A3920022BE1F /* PBXTargetDependency */,
03067D6E0C83A39C0022BE1F /* PBXTargetDependency */,
- 84C5B3411665544B00C324A8 /* PBXTargetDependency */,
+ 03067D6C0C83A3920022BE1F /* PBXTargetDependency */,
BD7833F01ABA5E3500EC51ED /* PBXTargetDependency */,
+ 84C5B3411665544B00C324A8 /* PBXTargetDependency */,
+ 217A4C49138EE14C000A5BA8 /* PBXTargetDependency */,
);
name = "Build Some";
productName = "Build Some";
@@ -57,9 +55,9 @@
buildPhases = (
);
dependencies = (
+ 215FFB19124002C100470DE1 /* PBXTargetDependency */,
215FFB1D124002CC00470DE1 /* PBXTargetDependency */,
215FFB1B124002C700470DE1 /* PBXTargetDependency */,
- 215FFB19124002C100470DE1 /* PBXTargetDependency */,
);
name = SystemLibrariesStatic;
productName = SystemLibrariesStatic;
@@ -93,23 +91,13 @@
/* Begin PBXBuildFile section */
21070E5F16486B9000A69507 /* DNSSECSupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 21070E5D16486B9000A69507 /* DNSSECSupport.c */; };
- 21070E6016486B9000A69507 /* DNSSECSupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 21070E5D16486B9000A69507 /* DNSSECSupport.c */; };
21070E6116486B9000A69507 /* DNSSECSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 21070E5E16486B9000A69507 /* DNSSECSupport.h */; };
- 21070E6216486B9000A69507 /* DNSSECSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 21070E5E16486B9000A69507 /* DNSSECSupport.h */; };
- 2120ABD516B71614007089B6 /* CUPolicy.c in Sources */ = {isa = PBXBuildFile; fileRef = 2120ABD416B71614007089B6 /* CUPolicy.c */; };
- 2120ABD616B71614007089B6 /* CUPolicy.c in Sources */ = {isa = PBXBuildFile; fileRef = 2120ABD416B71614007089B6 /* CUPolicy.c */; };
2124FA2C1471E98C0021D7BB /* nsec.h in Headers */ = {isa = PBXBuildFile; fileRef = 2124FA2B1471E98C0021D7BB /* nsec.h */; };
- 2124FA2D1471E98C0021D7BB /* nsec.h in Headers */ = {isa = PBXBuildFile; fileRef = 2124FA2B1471E98C0021D7BB /* nsec.h */; };
2124FA301471E9B50021D7BB /* dnssec.h in Headers */ = {isa = PBXBuildFile; fileRef = 2124FA2F1471E9B50021D7BB /* dnssec.h */; };
- 2124FA311471E9B50021D7BB /* dnssec.h in Headers */ = {isa = PBXBuildFile; fileRef = 2124FA2F1471E9B50021D7BB /* dnssec.h */; };
2124FA331471E9DE0021D7BB /* nsec.c in Sources */ = {isa = PBXBuildFile; fileRef = 2124FA321471E9DE0021D7BB /* nsec.c */; };
- 2124FA341471E9DE0021D7BB /* nsec.c in Sources */ = {isa = PBXBuildFile; fileRef = 2124FA321471E9DE0021D7BB /* nsec.c */; };
2127A47715C3C7B900A857FC /* nsec3.c in Sources */ = {isa = PBXBuildFile; fileRef = 2127A47515C3C7B900A857FC /* nsec3.c */; };
- 2127A47815C3C7B900A857FC /* nsec3.c in Sources */ = {isa = PBXBuildFile; fileRef = 2127A47515C3C7B900A857FC /* nsec3.c */; };
2127A47915C3C7B900A857FC /* nsec3.h in Headers */ = {isa = PBXBuildFile; fileRef = 2127A47615C3C7B900A857FC /* nsec3.h */; };
- 2127A47A15C3C7B900A857FC /* nsec3.h in Headers */ = {isa = PBXBuildFile; fileRef = 2127A47615C3C7B900A857FC /* nsec3.h */; };
213BDC6D147319F400000896 /* dnssec.c in Sources */ = {isa = PBXBuildFile; fileRef = 213BDC6C147319F400000896 /* dnssec.c */; };
- 213BDC6E147319F400000896 /* dnssec.c in Sources */ = {isa = PBXBuildFile; fileRef = 213BDC6C147319F400000896 /* dnssec.c */; };
213FB23C12028C4A002B3A08 /* BonjourEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = 213FB22C12028B53002B3A08 /* BonjourEvents.c */; };
213FB23D12028C5A002B3A08 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09AB6884FE841BABC02AAC07 /* CoreFoundation.framework */; };
215FFAEE124000F900470DE1 /* dnssd_ipc.c in Sources */ = {isa = PBXBuildFile; fileRef = F5E11B5A04A28126019798ED /* dnssd_ipc.c */; };
@@ -130,39 +118,28 @@
215FFAFD1240013400470DE1 /* DNSServiceDiscovery.c in Sources */ = {isa = PBXBuildFile; fileRef = FFA572480AF18FCC0055A0F1 /* DNSServiceDiscovery.c */; };
215FFAFE1240013400470DE1 /* DNSServiceDiscoveryRequest.defs in Sources */ = {isa = PBXBuildFile; fileRef = 6575FC01022EAFBA00000109 /* DNSServiceDiscoveryRequest.defs */; };
215FFAFF1240013400470DE1 /* DNSServiceDiscoveryReply.defs in Sources */ = {isa = PBXBuildFile; fileRef = 6575FC00022EAFBA00000109 /* DNSServiceDiscoveryReply.defs */; settings = {ATTRIBUTES = (Server, ); }; };
- 216D9ACE1720C9F5008066E1 /* VPNService.c in Sources */ = {isa = PBXBuildFile; fileRef = 216D9ACD1720C9F5008066E1 /* VPNService.c */; };
- 216D9ACF1720C9F5008066E1 /* VPNService.c in Sources */ = {isa = PBXBuildFile; fileRef = 216D9ACD1720C9F5008066E1 /* VPNService.c */; };
+ 216D9ACE1720C9F5008066E1 /* uDNSPathEvalulation.c in Sources */ = {isa = PBXBuildFile; fileRef = 216D9ACD1720C9F5008066E1 /* uDNSPathEvalulation.c */; };
218E8E51156D8C0300720DA0 /* dnsproxy.c in Sources */ = {isa = PBXBuildFile; fileRef = 218E8E4F156D8C0300720DA0 /* dnsproxy.c */; };
- 218E8E52156D8C0300720DA0 /* dnsproxy.c in Sources */ = {isa = PBXBuildFile; fileRef = 218E8E4F156D8C0300720DA0 /* dnsproxy.c */; };
218E8E53156D8C0300720DA0 /* dnsproxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 218E8E50156D8C0300720DA0 /* dnsproxy.h */; };
- 218E8E54156D8C0300720DA0 /* dnsproxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 218E8E50156D8C0300720DA0 /* dnsproxy.h */; };
- 219D5542149ED645004464AE /* libxml2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 219D5541149ED645004464AE /* libxml2.2.dylib */; };
- 219D5543149ED645004464AE /* libxml2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 219D5541149ED645004464AE /* libxml2.2.dylib */; };
+ 219D5542149ED645004464AE /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 219D5541149ED645004464AE /* libxml2.dylib */; };
21A57F4C145B2AE100939099 /* CryptoAlg.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A57F4A145B2AE100939099 /* CryptoAlg.c */; };
- 21A57F4D145B2AE100939099 /* CryptoAlg.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A57F4A145B2AE100939099 /* CryptoAlg.c */; };
21A57F4E145B2AE100939099 /* CryptoAlg.h in Headers */ = {isa = PBXBuildFile; fileRef = 21A57F4B145B2AE100939099 /* CryptoAlg.h */; };
- 21A57F4F145B2AE100939099 /* CryptoAlg.h in Headers */ = {isa = PBXBuildFile; fileRef = 21A57F4B145B2AE100939099 /* CryptoAlg.h */; };
21A57F53145B2B1400939099 /* CryptoSupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A57F51145B2B1400939099 /* CryptoSupport.c */; };
- 21A57F54145B2B1400939099 /* CryptoSupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A57F51145B2B1400939099 /* CryptoSupport.c */; };
21A57F55145B2B1400939099 /* CryptoSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 21A57F52145B2B1400939099 /* CryptoSupport.h */; };
- 21A57F56145B2B1400939099 /* CryptoSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 21A57F52145B2B1400939099 /* CryptoSupport.h */; };
21DCD05C1461B23700702FC8 /* CryptoAlg.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A57F4A145B2AE100939099 /* CryptoAlg.c */; };
- 21DCD05D1461B23700702FC8 /* CryptoAlg.h in Sources */ = {isa = PBXBuildFile; fileRef = 21A57F4B145B2AE100939099 /* CryptoAlg.h */; };
21DD8FBF161E9A250033C8F8 /* anonymous.c in Sources */ = {isa = PBXBuildFile; fileRef = 21DD8FBD161E9A250033C8F8 /* anonymous.c */; };
- 21DD8FC0161E9A250033C8F8 /* anonymous.c in Sources */ = {isa = PBXBuildFile; fileRef = 21DD8FBD161E9A250033C8F8 /* anonymous.c */; };
21DD8FC1161E9A250033C8F8 /* anonymous.h in Headers */ = {isa = PBXBuildFile; fileRef = 21DD8FBE161E9A250033C8F8 /* anonymous.h */; };
- 21DD8FC2161E9A250033C8F8 /* anonymous.h in Headers */ = {isa = PBXBuildFile; fileRef = 21DD8FBE161E9A250033C8F8 /* anonymous.h */; };
21DED43515702C0F0060B6B9 /* DNSProxySupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 21DED43415702C0F0060B6B9 /* DNSProxySupport.c */; };
- 21DED43615702C0F0060B6B9 /* DNSProxySupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 21DED43415702C0F0060B6B9 /* DNSProxySupport.c */; };
+ 21F51DC11B3541940070B05C /* com.apple.mDNSResponder.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 21F51DBF1B35412D0070B05C /* com.apple.mDNSResponder.plist */; };
+ 21F51DC31B3541F50070B05C /* com.apple.mDNSResponderHelper.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 21F51DBE1B3541030070B05C /* com.apple.mDNSResponderHelper.plist */; };
+ 21F51DC51B3542210070B05C /* com.apple.dnsextd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 21F51DBD1B3540DB0070B05C /* com.apple.dnsextd.plist */; };
2E0405F50C3195F700F13B59 /* helper.c in Sources */ = {isa = PBXBuildFile; fileRef = 2E0405F40C3195F700F13B59 /* helper.c */; };
2E0405F60C31961100F13B59 /* helpermsg.defs in Sources */ = {isa = PBXBuildFile; fileRef = 2E0405EB0C3190DC00F13B59 /* helpermsg.defs */; settings = {ATTRIBUTES = (Client, Server, ); COMPILER_FLAGS = "-Wno-error"; }; };
2E0406150C3197CB00F13B59 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E0406140C3197CB00F13B59 /* libbsm.dylib */; };
2E04061F0C3198B700F13B59 /* helpermsg.defs in Sources */ = {isa = PBXBuildFile; fileRef = 2E0405EB0C3190DC00F13B59 /* helpermsg.defs */; };
- 2E0406200C3198B700F13B59 /* helpermsg.defs in Sources */ = {isa = PBXBuildFile; fileRef = 2E0405EB0C3190DC00F13B59 /* helpermsg.defs */; };
2E04070A0C31EEEC00F13B59 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09AB6884FE841BABC02AAC07 /* CoreFoundation.framework */; };
2E04070B0C31EEEC00F13B59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65713D46025A293200000109 /* SystemConfiguration.framework */; };
2E3552900C3A95C100CA1CB7 /* helper-error.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E35528F0C3A95C100CA1CB7 /* helper-error.h */; };
- 2E3552910C3A95C100CA1CB7 /* helper-error.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E35528F0C3A95C100CA1CB7 /* helper-error.h */; };
2E3552920C3A95C100CA1CB7 /* helper-error.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E35528F0C3A95C100CA1CB7 /* helper-error.h */; };
2E35529D0C3A9E7600CA1CB7 /* helper-error.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E35528F0C3A95C100CA1CB7 /* helper-error.h */; };
2E35529E0C3A9E7600CA1CB7 /* helper-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = 2E96A52D0C39C1A50087C4D2 /* helper-stubs.c */; };
@@ -174,18 +151,13 @@
2E8165F90C59838100485EB2 /* libipsec.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E8165F60C59835F00485EB2 /* libipsec.dylib */; };
2E96A51D0C39BDAC0087C4D2 /* helper-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 2E0406CA0C31E9AD00F13B59 /* helper-main.c */; };
2E96A5260C39BE480087C4D2 /* helper.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E96A5250C39BE480087C4D2 /* helper.h */; };
- 2E96A5270C39BE480087C4D2 /* helper.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E96A5250C39BE480087C4D2 /* helper.h */; };
- 2E96A5300C39C1A50087C4D2 /* helper-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = 2E96A52D0C39C1A50087C4D2 /* helper-stubs.c */; };
2E96A5320C39C1A50087C4D2 /* helper-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = 2E96A52D0C39C1A50087C4D2 /* helper-stubs.c */; };
2EAE955A0C31F4D30021F738 /* helpermsg.defs in Sources */ = {isa = PBXBuildFile; fileRef = 2E0405EB0C3190DC00F13B59 /* helpermsg.defs */; };
2EC8F8EC0C39CCAC003C9C48 /* helper.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E96A5250C39BE480087C4D2 /* helper.h */; };
2ECC11A60C4FEC3800CB1885 /* helpermsg-types.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECC11A50C4FEC3800CB1885 /* helpermsg-types.h */; };
- 2ECC11A70C4FEC3800CB1885 /* helpermsg-types.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECC11A50C4FEC3800CB1885 /* helpermsg-types.h */; };
2ECC11A80C4FEC3800CB1885 /* helpermsg-types.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECC11A50C4FEC3800CB1885 /* helpermsg-types.h */; };
2EDC5E730C39EA640092701B /* helper-server.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDC5E720C39EA640092701B /* helper-server.h */; };
- 2EDC5E740C39EA640092701B /* helper-server.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDC5E720C39EA640092701B /* helper-server.h */; };
2EDC5E750C39EA640092701B /* helper-server.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDC5E720C39EA640092701B /* helper-server.h */; };
- 3F347CF6185D57CD00367B40 /* base.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 3F347CF5185D57CD00367B40 /* base.xcconfig */; };
4A7B9E8014FDA25000B84CC1 /* mDNSResponder.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A7B9E7E14FDA1BB00B84CC1 /* mDNSResponder.plist */; };
4A7B9E8214FDA26C00B84CC1 /* mDNSResponder.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A7B9E7C14FDA19F00B84CC1 /* mDNSResponder.txt */; };
4AAE0C9A0C68EA81003882A5 /* mDNSResponderHelper.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4AAE0C7A0C68E97F003882A5 /* mDNSResponderHelper.8 */; };
@@ -195,13 +167,16 @@
8415A6571897109000BDBA26 /* libdns_services.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8415A6561897109000BDBA26 /* libdns_services.dylib */; };
8418673E15AB8C2D00BB7F70 /* com.apple.networking.mDNSResponder in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8418673A15AB8B6900BB7F70 /* com.apple.networking.mDNSResponder */; };
848DA5C7165477E000D2E8B4 /* xpc_services.c in Sources */ = {isa = PBXBuildFile; fileRef = 848DA5C6165477E000D2E8B4 /* xpc_services.c */; };
- 848DA5C8165477E000D2E8B4 /* xpc_services.c in Sources */ = {isa = PBXBuildFile; fileRef = 848DA5C6165477E000D2E8B4 /* xpc_services.c */; };
848DA5CA165477EB00D2E8B4 /* xpc_services.h in Headers */ = {isa = PBXBuildFile; fileRef = 848DA5C9165477EB00D2E8B4 /* xpc_services.h */; };
- 848DA5CB165477EB00D2E8B4 /* xpc_services.h in Headers */ = {isa = PBXBuildFile; fileRef = 848DA5C9165477EB00D2E8B4 /* xpc_services.h */; };
848DA5D616547F7200D2E8B4 /* dns_xpc.h in Headers */ = {isa = PBXBuildFile; fileRef = 848DA5D516547F7200D2E8B4 /* dns_xpc.h */; };
- 848DA5D716547F7200D2E8B4 /* dns_xpc.h in Headers */ = {isa = PBXBuildFile; fileRef = 848DA5D516547F7200D2E8B4 /* dns_xpc.h */; };
84C5B33C166553F100C324A8 /* dns_services.c in Sources */ = {isa = PBXBuildFile; fileRef = 84C5B339166553AF00C324A8 /* dns_services.c */; };
84F4C090188F050200D1E1DE /* dns_services.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F4C08F188F04CF00D1E1DE /* dns_services.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BD03E88D1AD31278005E8A81 /* SymptomReporter.c in Sources */ = {isa = PBXBuildFile; fileRef = BD03E88C1AD31278005E8A81 /* SymptomReporter.c */; };
+ BD2806081C40775600455151 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BD2806071C40775600455151 /* Foundation.framework */; };
+ BD64FE9C1C40762F0040EAB3 /* Metrics.h in Headers */ = {isa = PBXBuildFile; fileRef = BD64FE9A1C40762F0040EAB3 /* Metrics.h */; };
+ BD64FE9D1C40762F0040EAB3 /* Metrics.m in Sources */ = {isa = PBXBuildFile; fileRef = BD64FE9B1C40762F0040EAB3 /* Metrics.m */; };
+ BDA9A7881B3A924C00523835 /* dns_sd_private.h in Headers */ = {isa = PBXBuildFile; fileRef = BDA9A7871B3A923600523835 /* dns_sd_private.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BDA9A7891B3A92A500523835 /* dns_sd_private.h in Headers */ = {isa = PBXBuildFile; fileRef = BDA9A7871B3A923600523835 /* dns_sd_private.h */; settings = {ATTRIBUTES = (Private, ); }; };
D284BE530ADD80740027CCDF /* DNSServiceDiscoveryDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 6575FBFF022EAFBA00000109 /* DNSServiceDiscoveryDefines.h */; };
D284BE540ADD80740027CCDF /* dnssd_ipc.h in Headers */ = {isa = PBXBuildFile; fileRef = F5E11B5B04A28126019798ED /* dnssd_ipc.h */; };
D284BE560ADD80740027CCDF /* DNSServiceDiscoveryReply.defs in Sources */ = {isa = PBXBuildFile; fileRef = 6575FC00022EAFBA00000109 /* DNSServiceDiscoveryReply.defs */; settings = {ATTRIBUTES = (Client, ); }; };
@@ -222,28 +197,6 @@
D284BE670ADD80740027CCDF /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CA213D02786FC30CCA2C71 /* IOKit.framework */; };
D284BE680ADD80740027CCDF /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F869685066EE02400D2A2DC /* Security.framework */; };
D284BE6B0ADD80740027CCDF /* mDNSResponder.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = FF485D5105632E0000130380 /* mDNSResponder.8 */; };
- D284BE780ADD80800027CCDF /* DNSServiceDiscoveryDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 6575FBFF022EAFBA00000109 /* DNSServiceDiscoveryDefines.h */; };
- D284BE790ADD80800027CCDF /* dnssd_ipc.h in Headers */ = {isa = PBXBuildFile; fileRef = F5E11B5B04A28126019798ED /* dnssd_ipc.h */; };
- D284BE7A0ADD80800027CCDF /* mDNSEmbeddedAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 654BE64F02B63B93000001D1 /* mDNSEmbeddedAPI.h */; };
- D284BE7B0ADD80800027CCDF /* mDNSDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 654BE65002B63B93000001D1 /* mDNSDebug.h */; };
- D284BE7C0ADD80800027CCDF /* mDNSMacOSX.h in Headers */ = {isa = PBXBuildFile; fileRef = 000753D303367C1C0CCA2C71 /* mDNSMacOSX.h */; };
- D284BE7E0ADD80800027CCDF /* DNSServiceDiscoveryReply.defs in Sources */ = {isa = PBXBuildFile; fileRef = 6575FC00022EAFBA00000109 /* DNSServiceDiscoveryReply.defs */; settings = {ATTRIBUTES = (Client, ); }; };
- D284BE7F0ADD80800027CCDF /* DNSServiceDiscoveryRequest.defs in Sources */ = {isa = PBXBuildFile; fileRef = 6575FC01022EAFBA00000109 /* DNSServiceDiscoveryRequest.defs */; settings = {ATTRIBUTES = (Server, ); }; };
- D284BE800ADD80800027CCDF /* mDNS.c in Sources */ = {isa = PBXBuildFile; fileRef = 6575FBE9022EAF5A00000109 /* mDNS.c */; };
- D284BE810ADD80800027CCDF /* uDNS.c in Sources */ = {isa = PBXBuildFile; fileRef = 7F18A9F70587CEF6001880B3 /* uDNS.c */; };
- D284BE820ADD80800027CCDF /* DNSCommon.c in Sources */ = {isa = PBXBuildFile; fileRef = 7F18A9F60587CEF6001880B3 /* DNSCommon.c */; };
- D284BE830ADD80800027CCDF /* DNSDigest.c in Sources */ = {isa = PBXBuildFile; fileRef = 7F461DB5062DBF2900672BF3 /* DNSDigest.c */; };
- D284BE850ADD80800027CCDF /* mDNSDebug.c in Sources */ = {isa = PBXBuildFile; fileRef = DBAAFE29057E8F4D0085CAD0 /* mDNSDebug.c */; };
- D284BE860ADD80800027CCDF /* uds_daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = F525E72804AA167501F1CF4D /* uds_daemon.c */; };
- D284BE870ADD80800027CCDF /* dnssd_ipc.c in Sources */ = {isa = PBXBuildFile; fileRef = F5E11B5A04A28126019798ED /* dnssd_ipc.c */; };
- D284BE880ADD80800027CCDF /* PlatformCommon.c in Sources */ = {isa = PBXBuildFile; fileRef = FFCB6D73075D539900B8AF62 /* PlatformCommon.c */; };
- D284BE890ADD80800027CCDF /* mDNSMacOSX.c in Sources */ = {isa = PBXBuildFile; fileRef = 6575FBEB022EAF7200000109 /* mDNSMacOSX.c */; };
- D284BE8A0ADD80800027CCDF /* LegacyNATTraversal.c in Sources */ = {isa = PBXBuildFile; fileRef = 7FC8F9D406D14E66007E879D /* LegacyNATTraversal.c */; };
- D284BE8B0ADD80800027CCDF /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = 6575FBEC022EAF7200000109 /* daemon.c */; };
- D284BE8D0ADD80800027CCDF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09AB6884FE841BABC02AAC07 /* CoreFoundation.framework */; };
- D284BE8E0ADD80800027CCDF /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65713D46025A293200000109 /* SystemConfiguration.framework */; };
- D284BE8F0ADD80800027CCDF /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CA213D02786FC30CCA2C71 /* IOKit.framework */; };
- D284BE900ADD80800027CCDF /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F869685066EE02400D2A2DC /* Security.framework */; };
D284BEA80ADD80920027CCDF /* dns-sd.c in Sources */ = {isa = PBXBuildFile; fileRef = FF1C919F07021E3F001048AB /* dns-sd.c */; };
D284BEAC0ADD80920027CCDF /* dns-sd.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = FF1C919D07021D77001048AB /* dns-sd.1 */; };
D284BEB70ADD809A0027CCDF /* JNISupport.c in Sources */ = {isa = PBXBuildFile; fileRef = DB2CC44B0662DD1100335AB3 /* JNISupport.c */; };
@@ -305,6 +258,7 @@
FFC22AA50B00F43000BAB070 /* DNSServiceDiscoveryReply.defs in Sources */ = {isa = PBXBuildFile; fileRef = 6575FC00022EAFBA00000109 /* DNSServiceDiscoveryReply.defs */; settings = {ATTRIBUTES = (Server, ); }; };
FFC22AA60B00F43100BAB070 /* DNSServiceDiscoveryReply.defs in Sources */ = {isa = PBXBuildFile; fileRef = 6575FC00022EAFBA00000109 /* DNSServiceDiscoveryReply.defs */; settings = {ATTRIBUTES = (Server, ); }; };
FFC22AA70B00F43100BAB070 /* DNSServiceDiscoveryReply.defs in Sources */ = {isa = PBXBuildFile; fileRef = 6575FC00022EAFBA00000109 /* DNSServiceDiscoveryReply.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+ FFD52A9E1AF858DD00CAD3EC /* CryptoAlg.h in Headers */ = {isa = PBXBuildFile; fileRef = 21A57F4B145B2AE100939099 /* CryptoAlg.h */; };
FFF589B70E37F66800EF515C /* ClientCommon.c in Sources */ = {isa = PBXBuildFile; fileRef = FF5852100DD27BD300862BDF /* ClientCommon.c */; };
FFF589C10E37F67E00EF515C /* ClientCommon.c in Sources */ = {isa = PBXBuildFile; fileRef = FF5852100DD27BD300862BDF /* ClientCommon.c */; };
FFFA38630AEEDB090065B80A /* dnssd_clientlib.c in Sources */ = {isa = PBXBuildFile; fileRef = FFFA38620AEEDB090065B80A /* dnssd_clientlib.c */; };
@@ -345,13 +299,6 @@
remoteGlobalIDString = D284BE500ADD80740027CCDF;
remoteInfo = mDNSResponder;
};
- 03067D690C83A3890022BE1F /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = D284BE750ADD80800027CCDF;
- remoteInfo = "mDNSResponder debug";
- };
03067D6B0C83A3920022BE1F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
@@ -373,6 +320,13 @@
remoteGlobalIDString = 03067D640C83A3700022BE1F;
remoteInfo = "Build Some";
};
+ 0C2AAB311B6929F300113637 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 84C5B3341665529800C324A8;
+ remoteInfo = dns_services;
+ };
2130257012400E9300AC839F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
@@ -502,6 +456,36 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
+ 21F51DC01B35418C0070B05C /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /System/Library/LaunchDaemons;
+ dstSubfolderSpec = 0;
+ files = (
+ 21F51DC11B3541940070B05C /* com.apple.mDNSResponder.plist in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 21F51DC21B3541F30070B05C /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /System/Library/LaunchDaemons;
+ dstSubfolderSpec = 0;
+ files = (
+ 21F51DC31B3541F50070B05C /* com.apple.mDNSResponderHelper.plist in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 21F51DC41B35421A0070B05C /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /System/Library/LaunchDaemons;
+ dstSubfolderSpec = 0;
+ files = (
+ 21F51DC51B3542210070B05C /* com.apple.dnsextd.plist in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
4A7B9E7F14FDA21B00B84CC1 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
@@ -599,7 +583,6 @@
09AB6884FE841BABC02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
21070E5D16486B9000A69507 /* DNSSECSupport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DNSSECSupport.c; sourceTree = "<group>"; };
21070E5E16486B9000A69507 /* DNSSECSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNSSECSupport.h; sourceTree = "<group>"; };
- 2120ABD416B71614007089B6 /* CUPolicy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CUPolicy.c; sourceTree = "<group>"; };
2124FA2B1471E98C0021D7BB /* nsec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nsec.h; path = ../mDNSCore/nsec.h; sourceTree = "<group>"; };
2124FA2F1471E9B50021D7BB /* dnssec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dnssec.h; path = ../mDNSCore/dnssec.h; sourceTree = "<group>"; };
2124FA321471E9DE0021D7BB /* nsec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nsec.c; path = ../mDNSCore/nsec.c; sourceTree = "<group>"; };
@@ -612,10 +595,10 @@
2141DD1D123FFCDB0086D23E /* libdns_sd.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdns_sd.a; sourceTree = BUILT_PRODUCTS_DIR; };
2141DD24123FFD0F0086D23E /* libdns_sd_debug.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdns_sd_debug.a; sourceTree = BUILT_PRODUCTS_DIR; };
2141DD2A123FFD2C0086D23E /* libdns_sd_profile.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdns_sd_profile.a; sourceTree = BUILT_PRODUCTS_DIR; };
- 216D9ACD1720C9F5008066E1 /* VPNService.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = VPNService.c; sourceTree = "<group>"; };
+ 216D9ACD1720C9F5008066E1 /* uDNSPathEvalulation.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uDNSPathEvalulation.c; sourceTree = "<group>"; };
218E8E4F156D8C0300720DA0 /* dnsproxy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dnsproxy.c; path = ../mDNSCore/dnsproxy.c; sourceTree = "<group>"; };
218E8E50156D8C0300720DA0 /* dnsproxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dnsproxy.h; path = ../mDNSCore/dnsproxy.h; sourceTree = "<group>"; };
- 219D5541149ED645004464AE /* libxml2.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.2.dylib; path = SDKs/MacOSX10.8.sdk/usr/lib/libxml2.2.dylib; sourceTree = DEVELOPER_DIR; };
+ 219D5541149ED645004464AE /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = "<absolute>"; };
21A57F4A145B2AE100939099 /* CryptoAlg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = CryptoAlg.c; path = ../mDNSCore/CryptoAlg.c; sourceTree = "<group>"; };
21A57F4B145B2AE100939099 /* CryptoAlg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptoAlg.h; path = ../mDNSCore/CryptoAlg.h; sourceTree = "<group>"; };
21A57F51145B2B1400939099 /* CryptoSupport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CryptoSupport.c; sourceTree = "<group>"; };
@@ -624,6 +607,9 @@
21DD8FBE161E9A250033C8F8 /* anonymous.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = anonymous.h; path = ../mDNSCore/anonymous.h; sourceTree = "<group>"; };
21DED43415702C0F0060B6B9 /* DNSProxySupport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DNSProxySupport.c; sourceTree = "<group>"; };
21F432971134AA6800581B69 /* WebFilterDNS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebFilterDNS.framework; path = /System/Library/PrivateFrameworks/WebFilterDNS.framework; sourceTree = "<absolute>"; };
+ 21F51DBD1B3540DB0070B05C /* com.apple.dnsextd.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.dnsextd.plist; sourceTree = "<group>"; };
+ 21F51DBE1B3541030070B05C /* com.apple.mDNSResponderHelper.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.mDNSResponderHelper.plist; sourceTree = "<group>"; };
+ 21F51DBF1B35412D0070B05C /* com.apple.mDNSResponder.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.mDNSResponder.plist; sourceTree = "<group>"; };
2E0405EB0C3190DC00F13B59 /* helpermsg.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; path = helpermsg.defs; sourceTree = "<group>"; };
2E0405F00C31955500F13B59 /* mDNSResponderHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mDNSResponderHelper; sourceTree = BUILT_PRODUCTS_DIR; };
2E0405F40C3195F700F13B59 /* helper.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = helper.c; sourceTree = "<group>"; };
@@ -635,7 +621,6 @@
2E96A52D0C39C1A50087C4D2 /* helper-stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "helper-stubs.c"; sourceTree = "<group>"; };
2ECC11A50C4FEC3800CB1885 /* helpermsg-types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "helpermsg-types.h"; sourceTree = "<group>"; };
2EDC5E720C39EA640092701B /* helper-server.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "helper-server.h"; sourceTree = "<group>"; };
- 3F347CF5185D57CD00367B40 /* base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = base.xcconfig; sourceTree = "<group>"; };
4A2E69DD0F5475A3004A87B0 /* uds_daemon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = uds_daemon.h; path = ../mDNSShared/uds_daemon.h; sourceTree = SOURCE_ROOT; };
4A3600DF0F34F8CD00453EFB /* DeviceToDeviceManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DeviceToDeviceManager.framework; path = /System/Library/PrivateFrameworks/DeviceToDeviceManager.framework; sourceTree = "<absolute>"; };
4A7B9E7C14FDA19F00B84CC1 /* mDNSResponder.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = mDNSResponder.txt; sourceTree = "<group>"; };
@@ -656,7 +641,6 @@
6575FBFF022EAFBA00000109 /* DNSServiceDiscoveryDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNSServiceDiscoveryDefines.h; sourceTree = "<group>"; };
6575FC00022EAFBA00000109 /* DNSServiceDiscoveryReply.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; path = DNSServiceDiscoveryReply.defs; sourceTree = "<group>"; };
6575FC01022EAFBA00000109 /* DNSServiceDiscoveryRequest.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; path = DNSServiceDiscoveryRequest.defs; sourceTree = "<group>"; };
- 6575FC20022EB7AA00000109 /* SamplemDNSClient.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = SamplemDNSClient.c; sourceTree = SOURCE_ROOT; tabWidth = 4; usesTabs = 0; };
72FB545A166D5F960090B2D9 /* dnsctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = dnsctl.c; path = ../Clients/dnsctl.c; sourceTree = "<group>"; };
72FB545F166D5FB00090B2D9 /* dnsctl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dnsctl; sourceTree = BUILT_PRODUCTS_DIR; };
7F18A9F60587CEF6001880B3 /* DNSCommon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DNSCommon.c; path = ../mDNSCore/DNSCommon.c; sourceTree = SOURCE_ROOT; };
@@ -664,7 +648,7 @@
7F461DB5062DBF2900672BF3 /* DNSDigest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DNSDigest.c; path = ../mDNSCore/DNSDigest.c; sourceTree = SOURCE_ROOT; };
7F869685066EE02400D2A2DC /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
7FC8F9D406D14E66007E879D /* LegacyNATTraversal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = LegacyNATTraversal.c; sourceTree = SOURCE_ROOT; };
- 8415A6561897109000BDBA26 /* libdns_services.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libdns_services.dylib; path = ../../../../../../../usr/lib/libdns_services.dylib; sourceTree = "<group>"; };
+ 8415A6561897109000BDBA26 /* libdns_services.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libdns_services.dylib; path = /usr/lib/libdns_services.dylib; sourceTree = "<absolute>"; };
8418673A15AB8B6900BB7F70 /* com.apple.networking.mDNSResponder */ = {isa = PBXFileReference; lastKnownFileType = text; path = com.apple.networking.mDNSResponder; sourceTree = "<group>"; };
8418673C15AB8B8000BB7F70 /* mDNSResponderLogging.mobileconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = mDNSResponderLogging.mobileconfig; sourceTree = "<group>"; };
848DA5C6165477E000D2E8B4 /* xpc_services.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xpc_services.c; path = Private/xpc_services.c; sourceTree = "<group>"; };
@@ -673,14 +657,18 @@
84C5B3351665529800C324A8 /* libdns_services.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdns_services.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
84C5B339166553AF00C324A8 /* dns_services.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = dns_services.c; path = Private/dns_services.c; sourceTree = "<group>"; };
84F4C08F188F04CF00D1E1DE /* dns_services.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dns_services.h; path = Private/dns_services.h; sourceTree = "<group>"; };
+ BD03E88C1AD31278005E8A81 /* SymptomReporter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SymptomReporter.c; sourceTree = "<group>"; };
+ BD2806071C40775600455151 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ BD64FE9A1C40762F0040EAB3 /* Metrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Metrics.h; sourceTree = "<group>"; };
+ BD64FE9B1C40762F0040EAB3 /* Metrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Metrics.m; sourceTree = "<group>"; };
+ BD64FE9E1C4076B40040EAB3 /* WirelessDiagnostics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WirelessDiagnostics.framework; path = System/Library/PrivateFrameworks/WirelessDiagnostics.framework; sourceTree = SDKROOT; };
+ BDA9A7871B3A923600523835 /* dns_sd_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dns_sd_private.h; path = Private/dns_sd_private.h; sourceTree = "<group>"; };
D284BE730ADD80740027CCDF /* mDNSResponder */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mDNSResponder; sourceTree = BUILT_PRODUCTS_DIR; };
- D284BE950ADD80800027CCDF /* mDNSResponder.debug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mDNSResponder.debug; sourceTree = BUILT_PRODUCTS_DIR; };
D284BEB00ADD80920027CCDF /* dns-sd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "dns-sd"; sourceTree = BUILT_PRODUCTS_DIR; };
D284BEBE0ADD809A0027CCDF /* libjdns_sd.jnilib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libjdns_sd.jnilib; sourceTree = BUILT_PRODUCTS_DIR; };
D284BED90ADD80A20027CCDF /* dnsextd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dnsextd; sourceTree = BUILT_PRODUCTS_DIR; };
D284BEE80ADD80A70027CCDF /* ddnswriteconfig */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ddnswriteconfig; sourceTree = BUILT_PRODUCTS_DIR; };
D284BF0C0ADD80B00027CCDF /* Bonjour.prefPane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Bonjour.prefPane; sourceTree = BUILT_PRODUCTS_DIR; };
- D284C04D0ADD95D30027CCDF /* Info-PreferencePane.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Info-PreferencePane.plist"; path = "PreferencePane/Info-PreferencePane.plist"; sourceTree = "<group>"; };
DB2CC4430662DD1100335AB3 /* BaseListener.java */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.java; name = BaseListener.java; path = ../mDNSShared/Java/BaseListener.java; sourceTree = SOURCE_ROOT; };
DB2CC4440662DD1100335AB3 /* BrowseListener.java */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.java; name = BrowseListener.java; path = ../mDNSShared/Java/BrowseListener.java; sourceTree = SOURCE_ROOT; };
DB2CC4450662DD1100335AB3 /* DNSRecord.java */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.java; name = DNSRecord.java; path = ../mDNSShared/Java/DNSRecord.java; sourceTree = SOURCE_ROOT; };
@@ -808,22 +796,11 @@
buildActionMask = 2147483647;
files = (
D284BE650ADD80740027CCDF /* CoreFoundation.framework in Frameworks */,
- D284BE660ADD80740027CCDF /* SystemConfiguration.framework in Frameworks */,
+ BD2806081C40775600455151 /* Foundation.framework in Frameworks */,
D284BE670ADD80740027CCDF /* IOKit.framework in Frameworks */,
D284BE680ADD80740027CCDF /* Security.framework in Frameworks */,
- 219D5542149ED645004464AE /* libxml2.2.dylib in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D284BE8C0ADD80800027CCDF /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- D284BE8D0ADD80800027CCDF /* CoreFoundation.framework in Frameworks */,
- D284BE8E0ADD80800027CCDF /* SystemConfiguration.framework in Frameworks */,
- D284BE8F0ADD80800027CCDF /* IOKit.framework in Frameworks */,
- D284BE900ADD80800027CCDF /* Security.framework in Frameworks */,
- 219D5543149ED645004464AE /* libxml2.2.dylib in Frameworks */,
+ D284BE660ADD80740027CCDF /* SystemConfiguration.framework in Frameworks */,
+ 219D5542149ED645004464AE /* libxml2.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -904,8 +881,6 @@
08FB7794FE84155DC02AAC07 /* mDNSResponder */ = {
isa = PBXGroup;
children = (
- 8415A6561897109000BDBA26 /* libdns_services.dylib */,
- 3F347CF5185D57CD00367B40 /* base.xcconfig */,
08FB7795FE84155DC02AAC07 /* mDNS Server Sources */,
6575FC1F022EB78C00000109 /* Command-Line Clients */,
213FB20912028902002B3A08 /* Bonjour Events Plugin */,
@@ -921,79 +896,83 @@
08FB7795FE84155DC02AAC07 /* mDNS Server Sources */ = {
isa = PBXGroup;
children = (
- 84F4C08F188F04CF00D1E1DE /* dns_services.h */,
- 216D9ACD1720C9F5008066E1 /* VPNService.c */,
- 2120ABD416B71614007089B6 /* CUPolicy.c */,
- 72FB545A166D5F960090B2D9 /* dnsctl.c */,
- 84C5B339166553AF00C324A8 /* dns_services.c */,
- 848DA5D516547F7200D2E8B4 /* dns_xpc.h */,
- 848DA5C9165477EB00D2E8B4 /* xpc_services.h */,
- 848DA5C6165477E000D2E8B4 /* xpc_services.c */,
- 21070E5D16486B9000A69507 /* DNSSECSupport.c */,
- 21070E5E16486B9000A69507 /* DNSSECSupport.h */,
21DD8FBD161E9A250033C8F8 /* anonymous.c */,
21DD8FBE161E9A250033C8F8 /* anonymous.h */,
- 2127A47515C3C7B900A857FC /* nsec3.c */,
- 2127A47615C3C7B900A857FC /* nsec3.h */,
- 8418673C15AB8B8000BB7F70 /* mDNSResponderLogging.mobileconfig */,
+ 21F51DBD1B3540DB0070B05C /* com.apple.dnsextd.plist */,
+ 21F51DBF1B35412D0070B05C /* com.apple.mDNSResponder.plist */,
+ 21F51DBE1B3541030070B05C /* com.apple.mDNSResponderHelper.plist */,
8418673A15AB8B6900BB7F70 /* com.apple.networking.mDNSResponder */,
- 21DED43415702C0F0060B6B9 /* DNSProxySupport.c */,
+ 21A57F4A145B2AE100939099 /* CryptoAlg.c */,
+ 21A57F4B145B2AE100939099 /* CryptoAlg.h */,
+ 21A57F51145B2B1400939099 /* CryptoSupport.c */,
+ 21A57F52145B2B1400939099 /* CryptoSupport.h */,
+ 6575FBEC022EAF7200000109 /* daemon.c */,
+ FFA572630AF190C20055A0F1 /* dns_sd.h */,
+ BDA9A7871B3A923600523835 /* dns_sd_private.h */,
+ 84C5B339166553AF00C324A8 /* dns_services.c */,
+ 84F4C08F188F04CF00D1E1DE /* dns_services.h */,
+ 848DA5D516547F7200D2E8B4 /* dns_xpc.h */,
+ 7F18A9F60587CEF6001880B3 /* DNSCommon.c */,
+ 7F461DB5062DBF2900672BF3 /* DNSDigest.c */,
+ FF13FFEA0A5DA44A00897C81 /* dnsextd_lexer.l */,
+ FF13FFEC0A5DA45500897C81 /* dnsextd_parser.y */,
+ FFF4F63A06CFE4DD00459EFD /* dnsextd.8 */,
+ FF25794606C9A8BF00376F7B /* dnsextd.c */,
+ FFFF8F800C3307AC00722979 /* dnsextd.conf */,
218E8E4F156D8C0300720DA0 /* dnsproxy.c */,
218E8E50156D8C0300720DA0 /* dnsproxy.h */,
+ 21DED43415702C0F0060B6B9 /* DNSProxySupport.c */,
+ FFFA38620AEEDB090065B80A /* dnssd_clientlib.c */,
+ FFFA38640AEEDB130065B80A /* dnssd_clientstub.c */,
+ F5E11B5A04A28126019798ED /* dnssd_ipc.c */,
+ F5E11B5B04A28126019798ED /* dnssd_ipc.h */,
213BDC6C147319F400000896 /* dnssec.c */,
- 2124FA321471E9DE0021D7BB /* nsec.c */,
2124FA2F1471E9B50021D7BB /* dnssec.h */,
- 2124FA2B1471E98C0021D7BB /* nsec.h */,
- 21A57F51145B2B1400939099 /* CryptoSupport.c */,
- 21A57F52145B2B1400939099 /* CryptoSupport.h */,
- 21A57F4A145B2AE100939099 /* CryptoAlg.c */,
- 21A57F4B145B2AE100939099 /* CryptoAlg.h */,
+ 21070E5D16486B9000A69507 /* DNSSECSupport.c */,
+ 21070E5E16486B9000A69507 /* DNSSECSupport.h */,
+ FFA572480AF18FCC0055A0F1 /* DNSServiceDiscovery.c */,
+ FFA572600AF1908D0055A0F1 /* DNSServiceDiscovery.h */,
+ DBAAFE2C057E8F660085CAD0 /* GenLinkedList.c */,
4ADB5F230F6AB9F400B95BF3 /* helper-entitlements.plist */,
- 4A2E69DD0F5475A3004A87B0 /* uds_daemon.h */,
- 4AAE0C7A0C68E97F003882A5 /* mDNSResponderHelper.8 */,
- 2ECC11A50C4FEC3800CB1885 /* helpermsg-types.h */,
2E35528F0C3A95C100CA1CB7 /* helper-error.h */,
- 2E96A52D0C39C1A50087C4D2 /* helper-stubs.c */,
+ 2E0406CA0C31E9AD00F13B59 /* helper-main.c */,
2EDC5E720C39EA640092701B /* helper-server.h */,
- 2E96A5250C39BE480087C4D2 /* helper.h */,
+ 2E96A52D0C39C1A50087C4D2 /* helper-stubs.c */,
2E0405F40C3195F700F13B59 /* helper.c */,
- 2E0406CA0C31E9AD00F13B59 /* helper-main.c */,
+ 2E96A5250C39BE480087C4D2 /* helper.h */,
+ 2ECC11A50C4FEC3800CB1885 /* helpermsg-types.h */,
4A8202510C56C36500DDFD48 /* ipsec_strerror.h */,
- 4A8202520C56C36500DDFD48 /* libpfkey.h */,
- 4A8202530C56C36600DDFD48 /* pfkey.c */,
7FC8F9D406D14E66007E879D /* LegacyNATTraversal.c */,
- 7F461DB5062DBF2900672BF3 /* DNSDigest.c */,
- F525E72804AA167501F1CF4D /* uds_daemon.c */,
- F5E11B5A04A28126019798ED /* dnssd_ipc.c */,
- F5E11B5B04A28126019798ED /* dnssd_ipc.h */,
- 6575FBEC022EAF7200000109 /* daemon.c */,
+ 4A8202520C56C36500DDFD48 /* libpfkey.h */,
6575FBE9022EAF5A00000109 /* mDNS.c */,
- 6575FBEB022EAF7200000109 /* mDNSMacOSX.c */,
- 654BE64F02B63B93000001D1 /* mDNSEmbeddedAPI.h */,
- 654BE65002B63B93000001D1 /* mDNSDebug.h */,
DBAAFE29057E8F4D0085CAD0 /* mDNSDebug.c */,
+ 654BE65002B63B93000001D1 /* mDNSDebug.h */,
+ 654BE64F02B63B93000001D1 /* mDNSEmbeddedAPI.h */,
+ 6575FBEB022EAF7200000109 /* mDNSMacOSX.c */,
000753D303367C1C0CCA2C71 /* mDNSMacOSX.h */,
- DBAAFE2C057E8F660085CAD0 /* GenLinkedList.c */,
- FFCB6D73075D539900B8AF62 /* PlatformCommon.c */,
- FF1C919D07021D77001048AB /* dns-sd.1 */,
FF485D5105632E0000130380 /* mDNSResponder.8 */,
- FFF4F63A06CFE4DD00459EFD /* dnsextd.8 */,
- FFFF8F800C3307AC00722979 /* dnsextd.conf */,
+ 4A7B9E7E14FDA1BB00B84CC1 /* mDNSResponder.plist */,
FF85880B0BD599F40080D89F /* mDNSResponder.sb */,
4A7B9E7C14FDA19F00B84CC1 /* mDNSResponder.txt */,
- 4A7B9E7E14FDA1BB00B84CC1 /* mDNSResponder.plist */,
- 7F18A9F60587CEF6001880B3 /* DNSCommon.c */,
- 7F18A9F70587CEF6001880B3 /* uDNS.c */,
- FF25794606C9A8BF00376F7B /* dnsextd.c */,
- FF13FFEA0A5DA44A00897C81 /* dnsextd_lexer.l */,
- FF13FFEC0A5DA45500897C81 /* dnsextd_parser.y */,
- FFFA38620AEEDB090065B80A /* dnssd_clientlib.c */,
- FFFA38640AEEDB130065B80A /* dnssd_clientstub.c */,
- FFA572600AF1908D0055A0F1 /* DNSServiceDiscovery.h */,
- FFA572480AF18FCC0055A0F1 /* DNSServiceDiscovery.c */,
- FFA572630AF190C20055A0F1 /* dns_sd.h */,
+ 4AAE0C7A0C68E97F003882A5 /* mDNSResponderHelper.8 */,
+ 8418673C15AB8B8000BB7F70 /* mDNSResponderLogging.mobileconfig */,
+ BD64FE9A1C40762F0040EAB3 /* Metrics.h */,
+ BD64FE9B1C40762F0040EAB3 /* Metrics.m */,
+ 2124FA321471E9DE0021D7BB /* nsec.c */,
+ 2124FA2B1471E98C0021D7BB /* nsec.h */,
+ 2127A47515C3C7B900A857FC /* nsec3.c */,
+ 2127A47615C3C7B900A857FC /* nsec3.h */,
4BD2B638134FE09F002B96D5 /* P2PPacketFilter.c */,
4BD2B639134FE09F002B96D5 /* P2PPacketFilter.h */,
+ 4A8202530C56C36600DDFD48 /* pfkey.c */,
+ FFCB6D73075D539900B8AF62 /* PlatformCommon.c */,
+ BD03E88C1AD31278005E8A81 /* SymptomReporter.c */,
+ 7F18A9F70587CEF6001880B3 /* uDNS.c */,
+ 216D9ACD1720C9F5008066E1 /* uDNSPathEvalulation.c */,
+ F525E72804AA167501F1CF4D /* uds_daemon.c */,
+ 4A2E69DD0F5475A3004A87B0 /* uds_daemon.h */,
+ 848DA5C6165477E000D2E8B4 /* xpc_services.c */,
+ 848DA5C9165477EB00D2E8B4 /* xpc_services.h */,
);
name = "mDNS Server Sources";
sourceTree = "<group>";
@@ -1001,19 +980,22 @@
08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
- 219D5541149ED645004464AE /* libxml2.2.dylib */,
+ FF2609FA07B4433800CE10E5 /* Cocoa.framework */,
+ 09AB6884FE841BABC02AAC07 /* CoreFoundation.framework */,
4A3600DF0F34F8CD00453EFB /* DeviceToDeviceManager.framework */,
- 2E8165F60C59835F00485EB2 /* libipsec.dylib */,
- 65713D46025A293200000109 /* SystemConfiguration.framework */,
- 2E0406140C3197CB00F13B59 /* libbsm.dylib */,
- 7F869685066EE02400D2A2DC /* Security.framework */,
FFFB0DB407B43D2700B88D48 /* Foundation.framework */,
- 09AB6884FE841BABC02AAC07 /* CoreFoundation.framework */,
+ BD2806071C40775600455151 /* Foundation.framework */,
00CA213D02786FC30CCA2C71 /* IOKit.framework */,
DB2CC4680662DFF500335AB3 /* JavaVM.framework */,
- FF2609FA07B4433800CE10E5 /* Cocoa.framework */,
+ 2E0406140C3197CB00F13B59 /* libbsm.dylib */,
+ 8415A6561897109000BDBA26 /* libdns_services.dylib */,
+ 2E8165F60C59835F00485EB2 /* libipsec.dylib */,
+ 219D5541149ED645004464AE /* libxml2.dylib */,
FF260A1F07B4436900CE10E5 /* PreferencePanes.framework */,
+ 7F869685066EE02400D2A2DC /* Security.framework */,
+ 65713D46025A293200000109 /* SystemConfiguration.framework */,
21F432971134AA6800581B69 /* WebFilterDNS.framework */,
+ BD64FE9E1C4076B40040EAB3 /* WirelessDiagnostics.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
@@ -1021,24 +1003,22 @@
19C28FBDFE9D53C911CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
- D284C04D0ADD95D30027CCDF /* Info-PreferencePane.plist */,
- D284BE730ADD80740027CCDF /* mDNSResponder */,
- D284BE950ADD80800027CCDF /* mDNSResponder.debug */,
- D284BEB00ADD80920027CCDF /* dns-sd */,
- D284BEBE0ADD809A0027CCDF /* libjdns_sd.jnilib */,
- D284BED90ADD80A20027CCDF /* dnsextd */,
- D284BEE80ADD80A70027CCDF /* ddnswriteconfig */,
D284BF0C0ADD80B00027CCDF /* Bonjour.prefPane */,
- FFB765840AEED9C700583A2C /* libsystem_dnssd.dylib */,
- FFA572390AF18F1C0055A0F1 /* libsystem_dnssd_debug.dylib */,
- FFA572450AF18F450055A0F1 /* libsystem_dnssd_profile.dylib */,
- 2E0405F00C31955500F13B59 /* mDNSResponderHelper */,
213FB21812028A7A002B3A08 /* BonjourEvents.plugin */,
+ D284BEE80ADD80A70027CCDF /* ddnswriteconfig */,
+ D284BEB00ADD80920027CCDF /* dns-sd */,
+ 72FB545F166D5FB00090B2D9 /* dnsctl */,
+ D284BED90ADD80A20027CCDF /* dnsextd */,
2141DD1D123FFCDB0086D23E /* libdns_sd.a */,
2141DD24123FFD0F0086D23E /* libdns_sd_debug.a */,
2141DD2A123FFD2C0086D23E /* libdns_sd_profile.a */,
84C5B3351665529800C324A8 /* libdns_services.dylib */,
- 72FB545F166D5FB00090B2D9 /* dnsctl */,
+ D284BEBE0ADD809A0027CCDF /* libjdns_sd.jnilib */,
+ FFB765840AEED9C700583A2C /* libsystem_dnssd.dylib */,
+ FFA572390AF18F1C0055A0F1 /* libsystem_dnssd_debug.dylib */,
+ FFA572450AF18F450055A0F1 /* libsystem_dnssd_profile.dylib */,
+ D284BE730ADD80740027CCDF /* mDNSResponder */,
+ 2E0405F00C31955500F13B59 /* mDNSResponderHelper */,
);
name = Products;
sourceTree = "<group>";
@@ -1066,8 +1046,9 @@
6575FC1F022EB78C00000109 /* Command-Line Clients */ = {
isa = PBXGroup;
children = (
- 6575FC20022EB7AA00000109 /* SamplemDNSClient.c */,
+ FF1C919D07021D77001048AB /* dns-sd.1 */,
FF1C919F07021E3F001048AB /* dns-sd.c */,
+ 72FB545A166D5F960090B2D9 /* dnsctl.c */,
FF5852100DD27BD300862BDF /* ClientCommon.c */,
);
name = "Command-Line Clients";
@@ -1137,6 +1118,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ BDA9A7891B3A92A500523835 /* dns_sd_private.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1180,6 +1162,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ BD64FE9C1C40762F0040EAB3 /* Metrics.h in Headers */,
D284BE530ADD80740027CCDF /* DNSServiceDiscoveryDefines.h in Headers */,
D284BE540ADD80740027CCDF /* dnssd_ipc.h in Headers */,
2E96A5260C39BE480087C4D2 /* helper.h in Headers */,
@@ -1199,32 +1182,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- D284BE770ADD80800027CCDF /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- D284BE780ADD80800027CCDF /* DNSServiceDiscoveryDefines.h in Headers */,
- D284BE790ADD80800027CCDF /* dnssd_ipc.h in Headers */,
- D284BE7A0ADD80800027CCDF /* mDNSEmbeddedAPI.h in Headers */,
- D284BE7B0ADD80800027CCDF /* mDNSDebug.h in Headers */,
- D284BE7C0ADD80800027CCDF /* mDNSMacOSX.h in Headers */,
- 2E96A5270C39BE480087C4D2 /* helper.h in Headers */,
- 2EDC5E740C39EA640092701B /* helper-server.h in Headers */,
- 2E3552910C3A95C100CA1CB7 /* helper-error.h in Headers */,
- 2ECC11A70C4FEC3800CB1885 /* helpermsg-types.h in Headers */,
- 21A57F4F145B2AE100939099 /* CryptoAlg.h in Headers */,
- 21A57F56145B2B1400939099 /* CryptoSupport.h in Headers */,
- 2124FA2D1471E98C0021D7BB /* nsec.h in Headers */,
- 2124FA311471E9B50021D7BB /* dnssec.h in Headers */,
- 218E8E54156D8C0300720DA0 /* dnsproxy.h in Headers */,
- 2127A47A15C3C7B900A857FC /* nsec3.h in Headers */,
- 21DD8FC2161E9A250033C8F8 /* anonymous.h in Headers */,
- 21070E6216486B9000A69507 /* DNSSECSupport.h in Headers */,
- 848DA5CB165477EB00D2E8B4 /* xpc_services.h in Headers */,
- 848DA5D716547F7200D2E8B4 /* dns_xpc.h in Headers */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
D284BEA60ADD80920027CCDF /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
@@ -1245,6 +1202,7 @@
files = (
2E35529D0C3A9E7600CA1CB7 /* helper-error.h in Headers */,
2E35529F0C3A9E7600CA1CB7 /* helper.h in Headers */,
+ FFD52A9E1AF858DD00CAD3EC /* CryptoAlg.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1280,6 +1238,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ BDA9A7881B3A924C00523835 /* dns_sd_private.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1382,6 +1341,7 @@
2E0405ED0C31955500F13B59 /* Sources */,
2E0405EE0C31955500F13B59 /* Frameworks */,
4AAE0C5A0C68E6EC003882A5 /* CopyFiles */,
+ 21F51DC21B3541F30070B05C /* CopyFiles */,
);
buildRules = (
);
@@ -1403,6 +1363,7 @@
buildRules = (
);
dependencies = (
+ 0C2AAB321B6929F300113637 /* PBXTargetDependency */,
);
name = dnsctl;
productName = dnsctl;
@@ -1434,12 +1395,12 @@
D284BE520ADD80740027CCDF /* Headers */,
D284BE550ADD80740027CCDF /* Sources */,
D284BE640ADD80740027CCDF /* Frameworks */,
- D284BE690ADD80740027CCDF /* Rez */,
D284BE6A0ADD80740027CCDF /* CopyFiles */,
4A7B9E7F14FDA21B00B84CC1 /* CopyFiles */,
4A7B9E8114FDA25500B84CC1 /* CopyFiles */,
- D284BE6C0ADD80740027CCDF /* ShellScript */,
+ D284BE6C0ADD80740027CCDF /* Run Script */,
8418673D15AB8BFF00BB7F70 /* CopyFiles */,
+ 21F51DC01B35418C0070B05C /* CopyFiles */,
);
buildRules = (
);
@@ -1451,25 +1412,6 @@
productReference = D284BE730ADD80740027CCDF /* mDNSResponder */;
productType = "com.apple.product-type.tool";
};
- D284BE750ADD80800027CCDF /* mDNSResponder debug */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = D284BE920ADD80800027CCDF /* Build configuration list for PBXNativeTarget "mDNSResponder debug" */;
- buildPhases = (
- D284BE760ADD80800027CCDF /* ShellScript */,
- D284BE770ADD80800027CCDF /* Headers */,
- D284BE7D0ADD80800027CCDF /* Sources */,
- D284BE8C0ADD80800027CCDF /* Frameworks */,
- D284BE910ADD80800027CCDF /* Rez */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = "mDNSResponder debug";
- productName = mDNSResponder;
- productReference = D284BE950ADD80800027CCDF /* mDNSResponder.debug */;
- productType = "com.apple.product-type.tool";
- };
D284BEA50ADD80920027CCDF /* dns-sd tool */ = {
isa = PBXNativeTarget;
buildConfigurationList = D284BEAD0ADD80920027CCDF /* Build configuration list for PBXNativeTarget "dns-sd tool" */;
@@ -1477,7 +1419,6 @@
D284BEA60ADD80920027CCDF /* Headers */,
D284BEA70ADD80920027CCDF /* Sources */,
D284BEA90ADD80920027CCDF /* Frameworks */,
- D284BEAA0ADD80920027CCDF /* Rez */,
D284BEAB0ADD80920027CCDF /* CopyFiles */,
);
buildRules = (
@@ -1497,7 +1438,6 @@
D284BEB50ADD809A0027CCDF /* Headers */,
D284BEB60ADD809A0027CCDF /* Sources */,
D284BEB80ADD809A0027CCDF /* Frameworks */,
- D284BEBA0ADD809A0027CCDF /* Rez */,
);
buildRules = (
);
@@ -1521,7 +1461,7 @@
D284BECE0ADD80A20027CCDF /* Frameworks */,
D284BED40ADD80A20027CCDF /* CopyFiles */,
FFFF8F770C32F0FD00722979 /* CopyFiles */,
- FF37FAAD0BC581780044A5CF /* ShellScript */,
+ 21F51DC41B35421A0070B05C /* CopyFiles */,
);
buildRules = (
D284BFB80ADD8E510027CCDF /* PBXBuildRule */,
@@ -1542,7 +1482,6 @@
D284BEDC0ADD80A70027CCDF /* Headers */,
D284BEDD0ADD80A70027CCDF /* Sources */,
D284BEDF0ADD80A70027CCDF /* Frameworks */,
- D284BEE40ADD80A70027CCDF /* Rez */,
);
buildRules = (
);
@@ -1562,7 +1501,6 @@
D284BEEE0ADD80B00027CCDF /* Resources */,
D284BEFD0ADD80B00027CCDF /* Sources */,
D284BF010ADD80B00027CCDF /* Frameworks */,
- D284BF070ADD80B00027CCDF /* Rez */,
);
buildRules = (
);
@@ -1633,9 +1571,10 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
+ LastUpgradeCheck = 0700;
};
buildConfigurationList = D284BE2B0ADD78180027CCDF /* Build configuration list for PBXProject "mDNSResponder" */;
- compatibilityVersion = "Xcode 3.1";
+ compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
@@ -1652,26 +1591,25 @@
03067D640C83A3700022BE1F /* Build Some */,
FFB7657B0AEED96B00583A2C /* Build All */,
D284BE500ADD80740027CCDF /* mDNSResponder */,
- D284BE750ADD80800027CCDF /* mDNSResponder debug */,
2E0405EF0C31955500F13B59 /* mDNSResponderHelper */,
D284BEA50ADD80920027CCDF /* dns-sd tool */,
- 4AE471670EAFF81900A6C5AD /* dns_sd.jar */,
- D284BEB20ADD809A0027CCDF /* libjdns_sd.jnilib */,
+ 72FB545E166D5FB00090B2D9 /* dnsctl */,
D284BEBF0ADD80A20027CCDF /* dnsextd */,
D284BEDB0ADD80A70027CCDF /* ddnswriteconfig */,
D284BEEA0ADD80B00027CCDF /* PreferencePane */,
- FFB765830AEED9C700583A2C /* libdns_sd_dynamic */,
- FFA572300AF18F1C0055A0F1 /* libdns_sd_debug_dynamic */,
- FFA5723C0AF18F450055A0F1 /* libdns_sd_profile_dynamic */,
- FFA572650AF190F10055A0F1 /* SystemLibrariesDynamic */,
213FB21712028A7A002B3A08 /* BonjourEvents */,
2141DCF8123FFB5D0086D23E /* SystemLibraries */,
2141DD0B123FFC7F0086D23E /* SystemLibrariesStatic */,
+ FFA572650AF190F10055A0F1 /* SystemLibrariesDynamic */,
2141DD1C123FFCDB0086D23E /* libdns_sd_static */,
2141DD23123FFD0F0086D23E /* libdns_sd_debug_static */,
2141DD29123FFD2C0086D23E /* libdns_sd_profile_static */,
+ FFB765830AEED9C700583A2C /* libdns_sd_dynamic */,
+ FFA572300AF18F1C0055A0F1 /* libdns_sd_debug_dynamic */,
+ FFA5723C0AF18F450055A0F1 /* libdns_sd_profile_dynamic */,
84C5B3341665529800C324A8 /* dns_services */,
- 72FB545E166D5FB00090B2D9 /* dnsctl */,
+ D284BEB20ADD809A0027CCDF /* libjdns_sd.jnilib */,
+ 4AE471670EAFF81900A6C5AD /* dns_sd.jar */,
);
};
/* End PBXProject section */
@@ -1688,7 +1626,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 3F347CF6185D57CD00367B40 /* base.xcconfig in Resources */,
D284BEEF0ADD80B00027CCDF /* remove_idle.tiff in Resources */,
D284BEF00ADD80B00027CCDF /* add_pressed.tiff in Resources */,
D284BEF10ADD80B00027CCDF /* remove_disabled.tiff in Resources */,
@@ -1708,51 +1645,6 @@
};
/* End PBXResourcesBuildPhase section */
-/* Begin PBXRezBuildPhase section */
- D284BE690ADD80740027CCDF /* Rez */ = {
- isa = PBXRezBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D284BE910ADD80800027CCDF /* Rez */ = {
- isa = PBXRezBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D284BEAA0ADD80920027CCDF /* Rez */ = {
- isa = PBXRezBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D284BEBA0ADD809A0027CCDF /* Rez */ = {
- isa = PBXRezBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D284BEE40ADD80A70027CCDF /* Rez */ = {
- isa = PBXRezBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D284BF070ADD80B00027CCDF /* Rez */ = {
- isa = PBXRezBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXRezBuildPhase section */
-
/* Begin PBXShellScriptBuildPhase section */
030BBED60CE11EEC00472F0C /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -1791,7 +1683,7 @@
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = "/bin/bash -e -x";
- shellScript = "DSTROOT=${DSTROOT}\nmkdir -p \"$DSTROOT/usr/include\"\nsed 's/\\(^#define _DNS_SD_LIBDISPATCH \\)0$/\\1 1/' \"$SRCROOT/../mDNSShared/dns_sd.h\" > \"$DSTROOT/usr/include/dns_sd.h\"\n\nif [[ \"${ACTION}\" == \"installhdrs\" ]]; then\n exit 0\nfi\n\nif [[ \"${PLATFORM_NAME}\" =~ \"simulator\" ]]; then\n ln -s libsystem_dnssd.dylib ${DSTROOT}${INSTALL_PATH}/libsystem_sim_dnssd.dylib\nfi\n";
+ shellScript = "DSTROOT=${DSTROOT}\nmkdir -p \"$DSTROOT/usr/include\"\nsed 's/\\(^#define _DNS_SD_LIBDISPATCH \\)0$/\\1 1/' \"$SRCROOT/../mDNSShared/dns_sd.h\" > \"$DSTROOT/usr/include/dns_sd.h\"\n\nif [[ \"${ACTION}\" == \"installhdrs\" ]]; then\n DSTROOT=${DSTROOT}\n mkdir -p \"$DSTROOT/usr/local/include\"\n sed 's/\\(^#define _DNS_SD_LIBDISPATCH \\)0$/\\1 1/' \"$SRCROOT/../mDNSMacOSX/Private/dns_services.h\" > \"$DSTROOT/usr/local/include/dns_services.h\"\n exit 0\nfi\n\nif [[ \"${PLATFORM_NAME}\" =~ \"simulator\" ]]; then\n ln -s libsystem_dnssd.dylib ${DSTROOT}${INSTALL_PATH}/libsystem_sim_dnssd.dylib\nfi\n";
};
4A4EE3A413CB8E82005C624B /* Build yacc file into derived source files */ = {
isa = PBXShellScriptBuildPhase;
@@ -1819,45 +1711,15 @@
shellPath = /bin/sh;
shellScript = "if [ -e \"${SDKROOT}/usr/local/include/dnsinfo.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/dnsinfo.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${CONFIGURATION_TEMP_DIR}/dnsinfo.h\ntouch \"${CONFIGURATION_TEMP_DIR}/empty.c\"\nfor i in ${ARCHS}\ndo\nccflags=\"-arch $i $ccflags\"\ndone\ncc ${ccflags} \"${CONFIGURATION_TEMP_DIR}/empty.c\" -c -o \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/empty.c\"\nfi\n\nif [ -e \"${SDKROOT}/usr/include/sandbox.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/sandbox.h\"\nelse\necho \"#define MDNS_NO_SANDBOX 1\" > \"${CONFIGURATION_TEMP_DIR}/sandbox.h\"\nfi\n\nif [ -e \"${SDKROOT}/usr/local/include/vproc.h\" -o -e \"${SDKROOT}/usr/include/vproc.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/vproc.h\"\nelse\ntouch \"${CONFIGURATION_TEMP_DIR}/vproc.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/Frameworks/IOKit.framework/PrivateHeaders/pwr_mgt/IOPMLibPrivate.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/IOKit\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/IOKit/pwr_mgt\"\ntouch \"${CONFIGURATION_TEMP_DIR}/IOKit/pwr_mgt/IOPMLibPrivate.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/PrivateFrameworks/DeviceToDeviceManager.framework/Headers/DeviceToDeviceManager.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager\"\necho \"#define NO_D2D 1\" > \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager/DeviceToDeviceManager.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/PrivateFrameworks/WebFilterDNS.framework/Headers/WebFilterDNS.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS\"\necho \"#define NO_WCF 1\" > \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS/WebFilterDNS.h\"\nfi\n\nif [ -e \"${SDKROOT}/usr/local/include/AWACS.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/AWACS.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libAWACS.a\"\nelse\necho \"#define NO_AWACS 1\" > \"${CONFIGURATION_TEMP_DIR}/AWACS.h\"\ntouch \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\"\nfor i in ${ARCHS}\ndo\nccflags=\"-arch $i $ccflags\"\ndone\ncc ${ccflags} \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\" -c -o \"${CONFIGURATION_TEMP_DIR}/libAWACS.a\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\"\nfi\n";
};
- D284BE6C0ADD80740027CCDF /* ShellScript */ = {
+ D284BE6C0ADD80740027CCDF /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 8;
files = (
);
+ name = "Run Script";
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/bash;
- shellScript = "# Install mDNSResponder.bundle containing language localizations\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices\ncp -R ${SRCROOT}/mDNSResponder-bundle ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle\n\n# Remove unwanted CVS directories\nfind ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -depth -name CVS -exec rm -rf {} \\;\n\n# Expand UTF-8 files to UTF-16 (at one time this appeared to be necessary, but it's not, so we don't do it any more)\n#foreach file (`find ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -name Localizable.strings`)\n#iconv -f utf-8 -t utf-16 ${file} > ${file}.new\n#mv -f ${file}.new ${file}\n#end\n\n# Remove French localization (not wanted for Apple B&I builds)\nrm -rf ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle/Resources/French.lproj\n\n# Copy Sandbox profile\nif [ -z \"${IPHONEOS_DEPLOYMENT_TARGET}\" -a -z \"${TVOS_DEPLOYMENT_TARGET}\" ] ; then\n SANDBOXDST=\"${DSTROOT}/usr/share/sandbox\"\nelse\n SANDBOXDST=\"${DSTROOT}/usr/local/share/sandbox/profiles/embedded/builtin\"\nfi\n(umask 022; mkdir -p -m 0755 \"$SANDBOXDST\")\ncp \"${SRCROOT}/mDNSResponder.sb\" \"${SANDBOXDST}/mDNSResponder.sb\"\n";
- };
- D284BE760ADD80800027CCDF /* ShellScript */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "if [ -e \"${SDKROOT}/usr/local/include/dnsinfo.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/dnsinfo.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${CONFIGURATION_TEMP_DIR}/dnsinfo.h\ntouch \"${CONFIGURATION_TEMP_DIR}/empty.c\"\nfor i in ${ARCHS}\ndo\nccflags=\"-arch $i $ccflags\"\ndone\ncc ${ccflags} \"${CONFIGURATION_TEMP_DIR}/empty.c\" -c -o \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/empty.c\"\nfi\n\nif [ -e \"${SDKROOT}/usr/include/sandbox.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/sandbox.h\"\nelse\necho \"#define MDNS_NO_SANDBOX 1\" > \"${CONFIGURATION_TEMP_DIR}/sandbox.h\"\nfi\n\nif [ -e \"${SDKROOT}/usr/local/include/vproc.h\" -o -e \"${SDKROOT}/usr/include/vproc.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/vproc.h\"\nelse\ntouch \"${CONFIGURATION_TEMP_DIR}/vproc.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/Frameworks/IOKit.framework/PrivateHeaders/pwr_mgt/IOPMLibPrivate.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/IOKit\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/IOKit/pwr_mgt\"\ntouch \"${CONFIGURATION_TEMP_DIR}/IOKit/pwr_mgt/IOPMLibPrivate.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/PrivateFrameworks/DeviceToDeviceManager.framework/Headers/DeviceToDeviceManager.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager\"\necho \"#define NO_D2D 1\" > \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager/DeviceToDeviceManager.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/PrivateFrameworks/WebFilterDNS.framework/Headers/WebFilterDNS.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS\"\necho \"#define NO_WCF 1\" > \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS/WebFilterDNS.h\"\nfi\n\nif [ -e \"${SDKROOT}/usr/local/include/AWACS.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/AWACS.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libAWACS.a\"\nelse\necho \"#define NO_AWACS 1\" > \"${CONFIGURATION_TEMP_DIR}/AWACS.h\"\ntouch \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\"\nfor i in ${ARCHS}\ndo\nccflags=\"-arch $i $ccflags\"\ndone\ncc ${ccflags} \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\" -c -o \"${CONFIGURATION_TEMP_DIR}/libAWACS.a\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\"\nfi";
- };
- FF045B6A0C7E4AA600448140 /* ShellScript */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 8;
- files = (
- );
- inputPaths = (
- );
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 1;
- shellPath = /bin/sh;
- shellScript = "# Install plists to tell launchd how to start mDNSResponder and mDNSResponderHelper\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons\n\nif [ \"${MACOSX_DEPLOYMENT_TARGET}\" == \"10.4\" ] ; then\ncp ${SRCROOT}/LaunchDaemonInfo-Tiger.plist ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponder.plist\ncp ${SRCROOT}/LaunchDaemonInfo-Tiger.helper.plist ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponderHelper.plist\nelse\ncp ${SRCROOT}/LaunchDaemonInfo.plist ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponder.plist\ncp ${SRCROOT}/LaunchDaemonInfo.helper.plist ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponderHelper.plist\nfi\n\nif [ ! -z \"${IPHONEOS_DEPLOYMENT_TARGET}\" ] ; then\nplutil -convert binary1 ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponder.plist\nplutil -convert binary1 ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponderHelper.plist\nfi\n";
- };
- FF37FAAD0BC581780044A5CF /* ShellScript */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 8;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 1;
- shellPath = /bin/tcsh;
- shellScript = "# Install plist to tell launchd how to start dnsextd\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons\ncp ${SRCROOT}/LaunchDaemonInfo.dnsextd.plist ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.dnsextd.plist\n";
+ shellScript = "# Install mDNSResponder.bundle containing language localizations\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices\ncp -R ${SRCROOT}/mDNSResponder-bundle ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle\n\n# Remove unwanted CVS directories\nfind ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -depth -name CVS -exec rm -rf {} \\;\n\n# Expand UTF-8 files to UTF-16 (at one time this appeared to be necessary, but it's not, so we don't do it any more)\n#foreach file (`find ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -name Localizable.strings`)\n#iconv -f utf-8 -t utf-16 ${file} > ${file}.new\n#mv -f ${file}.new ${file}\n#end\n\n# Remove French localization (not wanted for Apple B&I builds)\nrm -rf ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle/Resources/French.lproj\n\n# Copy Sandbox profile\nif [ -z \"${IPHONEOS_DEPLOYMENT_TARGET}\" -a -z \"${TVOS_DEPLOYMENT_TARGET}\" -a -z \"${WATCHOS_DEPLOYMENT_TARGET}\" ] ; then\n SANDBOXDST=\"${DSTROOT}/usr/share/sandbox\"\nelse\n SANDBOXDST=\"${DSTROOT}/usr/local/share/sandbox/profiles/embedded/builtin\"\nfi\n(umask 022; mkdir -p -m 0755 \"$SANDBOXDST\")\ncp \"${SRCROOT}/mDNSResponder.sb\" \"${SANDBOXDST}/mDNSResponder.sb\"\n";
};
/* End PBXShellScriptBuildPhase section */
@@ -1960,48 +1822,15 @@
21A57F53145B2B1400939099 /* CryptoSupport.c in Sources */,
2124FA331471E9DE0021D7BB /* nsec.c in Sources */,
213BDC6D147319F400000896 /* dnssec.c in Sources */,
+ BD64FE9D1C40762F0040EAB3 /* Metrics.m in Sources */,
218E8E51156D8C0300720DA0 /* dnsproxy.c in Sources */,
21DED43515702C0F0060B6B9 /* DNSProxySupport.c in Sources */,
- 216D9ACE1720C9F5008066E1 /* VPNService.c in Sources */,
+ 216D9ACE1720C9F5008066E1 /* uDNSPathEvalulation.c in Sources */,
+ BD03E88D1AD31278005E8A81 /* SymptomReporter.c in Sources */,
2127A47715C3C7B900A857FC /* nsec3.c in Sources */,
21DD8FBF161E9A250033C8F8 /* anonymous.c in Sources */,
21070E5F16486B9000A69507 /* DNSSECSupport.c in Sources */,
848DA5C7165477E000D2E8B4 /* xpc_services.c in Sources */,
- 2120ABD516B71614007089B6 /* CUPolicy.c in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D284BE7D0ADD80800027CCDF /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- D284BE7E0ADD80800027CCDF /* DNSServiceDiscoveryReply.defs in Sources */,
- D284BE7F0ADD80800027CCDF /* DNSServiceDiscoveryRequest.defs in Sources */,
- D284BE800ADD80800027CCDF /* mDNS.c in Sources */,
- D284BE810ADD80800027CCDF /* uDNS.c in Sources */,
- D284BE820ADD80800027CCDF /* DNSCommon.c in Sources */,
- D284BE830ADD80800027CCDF /* DNSDigest.c in Sources */,
- D284BE850ADD80800027CCDF /* mDNSDebug.c in Sources */,
- D284BE860ADD80800027CCDF /* uds_daemon.c in Sources */,
- D284BE870ADD80800027CCDF /* dnssd_ipc.c in Sources */,
- D284BE880ADD80800027CCDF /* PlatformCommon.c in Sources */,
- D284BE890ADD80800027CCDF /* mDNSMacOSX.c in Sources */,
- D284BE8A0ADD80800027CCDF /* LegacyNATTraversal.c in Sources */,
- D284BE8B0ADD80800027CCDF /* daemon.c in Sources */,
- 2E0406200C3198B700F13B59 /* helpermsg.defs in Sources */,
- 2E96A5300C39C1A50087C4D2 /* helper-stubs.c in Sources */,
- 21A57F4D145B2AE100939099 /* CryptoAlg.c in Sources */,
- 21A57F54145B2B1400939099 /* CryptoSupport.c in Sources */,
- 2124FA341471E9DE0021D7BB /* nsec.c in Sources */,
- 213BDC6E147319F400000896 /* dnssec.c in Sources */,
- 218E8E52156D8C0300720DA0 /* dnsproxy.c in Sources */,
- 21DED43615702C0F0060B6B9 /* DNSProxySupport.c in Sources */,
- 216D9ACF1720C9F5008066E1 /* VPNService.c in Sources */,
- 2127A47815C3C7B900A857FC /* nsec3.c in Sources */,
- 21DD8FC0161E9A250033C8F8 /* anonymous.c in Sources */,
- 21070E6016486B9000A69507 /* DNSSECSupport.c in Sources */,
- 848DA5C8165477E000D2E8B4 /* xpc_services.c in Sources */,
- 2120ABD616B71614007089B6 /* CUPolicy.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2027,7 +1856,6 @@
buildActionMask = 2147483647;
files = (
21DCD05C1461B23700702FC8 /* CryptoAlg.c in Sources */,
- 21DCD05D1461B23700702FC8 /* CryptoAlg.h in Sources */,
D284BEC50ADD80A20027CCDF /* DNSCommon.c in Sources */,
D284BEC60ADD80A20027CCDF /* DNSDigest.c in Sources */,
D284BEC70ADD80A20027CCDF /* dnsextd.c in Sources */,
@@ -2108,11 +1936,6 @@
target = D284BE500ADD80740027CCDF /* mDNSResponder */;
targetProxy = 03067D670C83A3830022BE1F /* PBXContainerItemProxy */;
};
- 03067D6A0C83A3890022BE1F /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = D284BE750ADD80800027CCDF /* mDNSResponder debug */;
- targetProxy = 03067D690C83A3890022BE1F /* PBXContainerItemProxy */;
- };
03067D6C0C83A3920022BE1F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D284BEA50ADD80920027CCDF /* dns-sd tool */;
@@ -2128,6 +1951,11 @@
target = 03067D640C83A3700022BE1F /* Build Some */;
targetProxy = 03067D850C849CC30022BE1F /* PBXContainerItemProxy */;
};
+ 0C2AAB321B6929F300113637 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 84C5B3341665529800C324A8 /* dns_services */;
+ targetProxy = 0C2AAB311B6929F300113637 /* PBXContainerItemProxy */;
+ };
2130257112400E9300AC839F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = FFA572650AF190F10055A0F1 /* SystemLibrariesDynamic */;
@@ -2245,9 +2073,6 @@
03067D740C83A3CB0022BE1F /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = s;
PRODUCT_NAME = "Build Some";
};
@@ -2259,12 +2084,8 @@
ALWAYS_SEARCH_USER_PATHS = NO;
BUNDLE_LOADER = /usr/libexec/UserEventAgent;
CODE_SIGN_IDENTITY = "-";
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_MODEL_TUNING = G5;
INFOPLIST_FILE = "BonjourEvents-Info.plist";
INSTALL_PATH = /System/Library/UserEventPlugins/;
- PREBINDING = NO;
PRODUCT_NAME = BonjourEvents;
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = plugin;
@@ -2274,8 +2095,6 @@
2141DCF9123FFB5D0086D23E /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = SystemLibraries;
};
@@ -2284,8 +2103,6 @@
2141DD0C123FFC7F0086D23E /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = s;
PRODUCT_NAME = SystemLibrariesStatic;
};
@@ -2294,11 +2111,6 @@
2141DD1E123FFCDB0086D23E /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"__DARWIN_NON_CANCELABLE=1",
@@ -2307,7 +2119,6 @@
INSTALLHDRS_COPY_PHASE = YES;
INSTALLHDRS_SCRIPT_PHASE = YES;
INSTALL_PATH = /usr/local/lib/system;
- PREBINDING = NO;
PRODUCT_NAME = dns_sd;
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
};
@@ -2316,18 +2127,12 @@
2141DD25123FFD100086D23E /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"__DARWIN_NON_CANCELABLE=1",
);
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALL_PATH = /usr/local/lib/system;
- PREBINDING = NO;
PRODUCT_NAME = dns_sd_debug;
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
};
@@ -2336,18 +2141,14 @@
2141DD2B123FFD2C0086D23E /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"__DARWIN_NON_CANCELABLE=1",
);
+ GENERATE_PROFILING_CODE = YES;
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALL_PATH = /usr/local/lib/system;
- PREBINDING = NO;
PRODUCT_NAME = dns_sd_profile;
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
};
@@ -2356,33 +2157,23 @@
2E0405F20C31955500F13B59 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ "APPLY_RULES_IN_COPY_FILES[sdk=appletvos*]" = YES;
+ "APPLY_RULES_IN_COPY_FILES[sdk=iphoneos*]" = YES;
+ "APPLY_RULES_IN_COPY_FILES[sdk=watchos*]" = YES;
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "helper-entitlements.plist";
CODE_SIGN_IDENTITY = "-";
- CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
- CONFIGURATION_TEMP_DIR = "$(PROJECT_TEMP_DIR)";
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_TREAT_WARNINGS_AS_ERRORS = NO;
- GCC_WARN_CHECK_SWITCH_STATEMENTS = NO;
HEADER_SEARCH_PATHS = (
"${CONFIGURATION_TEMP_DIR}",
"$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders",
"$(SDKROOT)/usr/local/include",
);
INSTALL_PATH = /usr/sbin;
- LD_MAP_FILE_PATH = "$(TARGET_TEMP_DIR)/$(PRODUCT_NAME)-LinkMap-$(CURRENT_VARIANT)-$(CURRENT_ARCH).txt";
LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
- MACOSX_DEPLOYMENT_TARGET = 10.5;
- "OTHER_CFLAGS[sdk=iphoneos*][arch=*]" = "$(inherited)";
- OTHER_LDFLAGS = (
- "$(inherited)",
- "-lipsec",
- );
- "OTHER_LDFLAGS[sdk=macosx*][arch=*]" = (
- "-lipsec",
- "-Wl,-pie",
- );
- PREBINDING = NO;
+ MACOSX_DEPLOYMENT_TARGET = 10.10;
+ OTHER_LDFLAGS = "-lipsec";
+ "PLIST_FILE_OUTPUT_FORMAT[sdk=appletvos*]" = binary;
+ "PLIST_FILE_OUTPUT_FORMAT[sdk=iphoneos*]" = binary;
+ "PLIST_FILE_OUTPUT_FORMAT[sdk=watchos*]" = binary;
PRODUCT_NAME = mDNSResponderHelper;
PROVISIONING_PROFILE = "";
};
@@ -2391,8 +2182,6 @@
4AE471680EAFF81900A6C5AD /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = dns_sd.jar;
};
@@ -2402,7 +2191,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
@@ -2411,11 +2199,9 @@
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "dnsctl-entitlements.plist";
+ CODE_SIGN_ENTITLEMENTS = "dnsctl-entitlements.plist";
CODE_SIGN_IDENTITY = "-";
- COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -2424,14 +2210,12 @@
);
GCC_STRICT_ALIASING = YES;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = /usr/local/bin;
MACOSX_DEPLOYMENT_TARGET = 10.9;
- ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SDKROOT = macosx;
@@ -2442,15 +2226,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
EXECUTABLE_PREFIX = lib;
GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -2458,7 +2239,6 @@
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
@@ -2474,23 +2254,16 @@
D284BE290ADD78180027CCDF /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- OTHER_CFLAGS = "";
- OTHER_LDFLAGS = "";
- OTHER_REZFLAGS = "";
PRODUCT_NAME = "Build All";
- SECTORDER_FLAGS = "";
};
name = Development;
};
D284BE2C0ADD78180027CCDF /* Development */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 3F347CF5185D57CD00367B40 /* base.xcconfig */;
buildSettings = {
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
+ CONFIGURATION_TEMP_DIR = "$(PROJECT_TEMP_DIR)";
+ COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"__APPLE_USE_RFC_3542=1",
@@ -2508,7 +2281,7 @@
"-DUSE_SYSTEMCONFIGURATION_PRIVATE_HEADERS",
"-fwrapv",
);
- PREBINDING = NO;
+ SDKROOT = macosx.internal;
STRIP_STYLE = debugging;
WARNING_CFLAGS = (
"-W",
@@ -2525,16 +2298,16 @@
D284BE6E0ADD80740027CCDF /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "mDNSResponder-entitlements.plist";
+ "APPLY_RULES_IN_COPY_FILES[sdk=appletvos*]" = YES;
+ "APPLY_RULES_IN_COPY_FILES[sdk=iphoneos*]" = YES;
+ "APPLY_RULES_IN_COPY_FILES[sdk=watchos*]" = YES;
+ CODE_SIGN_ENTITLEMENTS = "mDNSResponder-entitlements.plist";
CODE_SIGN_IDENTITY = "-";
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SDKROOT)/$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
+ "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
);
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
HEADER_SEARCH_PATHS = (
"$(SDKROOT)/$(SYSTEM_LIBRARY_DIR)/Frameworks/Security.framework/PrivateHeaders",
@@ -2547,129 +2320,48 @@
);
INSTALL_PATH = /usr/sbin;
LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
- MACOSX_DEPLOYMENT_TARGET = 10.5;
+ MACOSX_DEPLOYMENT_TARGET = 10.10;
ORDER_FILE = "${SRCROOT}/mDNSResponder.order";
- OTHER_CFLAGS = (
- "$(inherited)",
- "-no-cpp-precomp",
- );
- "OTHER_CFLAGS[sdk=iphoneos*][arch=*]" = "$(inherited)";
OTHER_LDFLAGS = "";
"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
- "-Wl,-pie",
"-weak_framework",
DeviceToDeviceManager,
"-lMobileGestalt",
- "-lcupolicy",
);
"OTHER_LDFLAGS[sdk=macosx*][arch=*]" = (
- "-Wl,-pie",
"-lAWACS",
"-weak_framework",
WebFilterDNS,
"-weak_framework",
DeviceToDeviceManager,
);
- "OTHER_LDFLAGS[sdk=macosx10.6][arch=*]" = "-lAWACS";
- OTHER_REZFLAGS = "";
+ "PLIST_FILE_OUTPUT_FORMAT[sdk=appletvos*]" = binary;
+ "PLIST_FILE_OUTPUT_FORMAT[sdk=iphoneos*]" = binary;
+ "PLIST_FILE_OUTPUT_FORMAT[sdk=watchos*]" = binary;
PRODUCT_NAME = mDNSResponder;
PROVISIONING_PROFILE = "";
- REZ_EXECUTABLE = YES;
- };
- name = Development;
- };
- D284BE930ADD80800027CCDF /* Development */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "$(SDKROOT)/$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
- );
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_OPTIMIZATION_LEVEL = s;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "$(inherited)",
- "MDNS_DEBUGMSGS=1",
- );
- HEADER_SEARCH_PATHS = (
- "$(SDKROOT)/$(SYSTEM_LIBRARY_DIR)/Frameworks/Security.framework/PrivateHeaders",
- ../mDNSShared,
- "${SYSTEM_LIBRARY_DIR}/Frameworks/System.framework/PrivateHeaders",
- "${APPLE_INTERNAL_DEVELOPER_DIR}/Headers",
- "${CONFIGURATION_TEMP_DIR}",
- "$(SDKROOT)/usr/include/libxml2",
- "$(SDKROOT)/usr/local/include",
- );
- LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
- MACOSX_DEPLOYMENT_TARGET = 10.5;
- OTHER_CFLAGS = (
- "$(inherited)",
- "-no-cpp-precomp",
- );
- OTHER_LDFLAGS = "";
- "OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
- "-Wl,-pie",
- "-weak_framework",
- DeviceToDeviceManager,
- "-lMobileGestalt",
- "-lcupolicy",
- );
- "OTHER_LDFLAGS[sdk=macosx*][arch=*]" = (
- "-Wl,-pie",
- "-lAWACS",
- "-weak_framework",
- WebFilterDNS,
- "-weak_framework",
- DeviceToDeviceManager,
- );
- "OTHER_LDFLAGS[sdk=macosx10.6][arch=*]" = "-lAWACS";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = mDNSResponder.debug;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = (
- "-sectorder",
- __TEXT,
- __text,
- mDNSResponder.order,
- );
- SKIP_INSTALL = YES;
+ SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
};
name = Development;
};
D284BEAE0ADD80920027CCDF /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
HEADER_SEARCH_PATHS = (
../mDNSShared,
"${SYSTEM_LIBRARY_DIR}/Frameworks/System.framework/PrivateHeaders",
);
INSTALL_PATH = /usr/bin;
- OTHER_CFLAGS = "-no-cpp-precomp";
- OTHER_LDFLAGS = "";
- OTHER_REZFLAGS = "";
PRODUCT_NAME = "dns-sd";
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "";
};
name = Development;
};
D284BEBC0ADD809A0027CCDF /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
EXECUTABLE_EXTENSION = jnilib;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
../mDNSShared,
@@ -2682,9 +2374,7 @@
MACH_O_TYPE = mh_dylib;
OTHER_CFLAGS = "";
OTHER_LIBTOOL_FLAGS = "";
- OTHER_REZFLAGS = "";
PRODUCT_NAME = libjdns_sd;
- REZ_EXECUTABLE = YES;
SECTORDER_FLAGS = "";
};
name = Development;
@@ -2692,11 +2382,6 @@
D284BED70ADD80A20027CCDF /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- FRAMEWORK_SEARCH_PATHS = "";
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
HEADER_SEARCH_PATHS = (
"${SYSTEM_LIBRARY_DIR}/Frameworks/System.framework/PrivateHeaders",
"${APPLE_INTERNAL_DEVELOPER_DIR}/Headers",
@@ -2705,57 +2390,32 @@
);
INSTALL_PATH = /usr/sbin;
LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
- MACOSX_DEPLOYMENT_TARGET = 10.5;
- OTHER_CFLAGS = (
- "-no-cpp-precomp",
- "-UAPPLE_OSX_mDNSResponder",
- );
- OTHER_LDFLAGS = "";
- "OTHER_LDFLAGS[sdk=macosx*][arch=*]" = "-Wl,-pie";
+ MACOSX_DEPLOYMENT_TARGET = 10.10;
+ OTHER_CFLAGS = "-UAPPLE_OSX_mDNSResponder";
PRODUCT_NAME = dnsextd;
- SECTORDER_FLAGS = "";
};
name = Development;
};
D284BEE60ADD80A70027CCDF /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
INSTALL_PATH = "/Library/Application Support/Bonjour";
- MACOSX_DEPLOYMENT_TARGET = 10.5;
- OTHER_CFLAGS = "";
- OTHER_LDFLAGS = "";
- "OTHER_LDFLAGS[sdk=macosx*]" = "-Wl,-pie";
- OTHER_REZFLAGS = "";
+ MACOSX_DEPLOYMENT_TARGET = 10.6;
+ OTHER_LDFLAGS = "-Wl,-pie";
PRODUCT_NAME = ddnswriteconfig;
- REZ_EXECUTABLE = YES;
- SECTORDER_FLAGS = "";
};
name = Development;
};
D284BF090ADD80B00027CCDF /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- EXPORTED_SYMBOLS_FILE = "";
- GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_GC = supported;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
INFOPLIST_FILE = "PreferencePane/Info-PreferencePane.plist";
INSTALL_PATH = /AppleInternal/Library/PreferencePanes;
- MACOSX_DEPLOYMENT_TARGET = 10.5;
- OTHER_CFLAGS = "";
+ MACOSX_DEPLOYMENT_TARGET = 10.6;
OTHER_LDFLAGS = "-twolevel_namespace";
- OTHER_REZFLAGS = "";
PRODUCT_NAME = Bonjour;
- SECTORDER_FLAGS = "";
WRAPPER_EXTENSION = prefPane;
};
name = Development;
@@ -2763,13 +2423,8 @@
FFA572380AF18F1C0055A0F1 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- COPY_PHASE_STRIP = NO;
DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
EXECUTABLE_EXTENSION = dylib;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"__DARWIN_NON_CANCELABLE=1",
@@ -2801,12 +2456,8 @@
FFA572440AF18F450055A0F1 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- COPY_PHASE_STRIP = NO;
DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
EXECUTABLE_EXTENSION = dylib;
- GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@@ -2840,9 +2491,6 @@
FFA5726F0AF191200055A0F1 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
PRODUCT_NAME = SystemLibrariesDynamic;
};
name = Development;
@@ -2850,11 +2498,6 @@
FFB7657F0AEED99D00583A2C /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
PRODUCT_NAME = "Build All";
};
name = Development;
@@ -2862,18 +2505,12 @@
FFB7658A0AEED9FB00583A2C /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CONFIGURATION_BUILD_DIR = "${BUILD_DIR}";
- CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
- COPY_PHASE_STRIP = NO;
DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
EXECUTABLE_EXTENSION = dylib;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"__DARWIN_NON_CANCELABLE=1",
);
- GCC_TREAT_WARNINGS_AS_ERRORS = NO;
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALLHDRS_COPY_PHASE = YES;
INSTALLHDRS_SCRIPT_PHASE = YES;
@@ -3015,14 +2652,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Development;
};
- D284BE920ADD80800027CCDF /* Build configuration list for PBXNativeTarget "mDNSResponder debug" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- D284BE930ADD80800027CCDF /* Development */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Development;
- };
D284BEAD0ADD80920027CCDF /* Build configuration list for PBXNativeTarget "dns-sd tool" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/mDNSResponder/mDNSMacOSX/mDNSResponderHelper.8 b/mDNSResponder/mDNSMacOSX/mDNSResponderHelper.8
index 6e959dbd..7f5836c7 100644
--- a/mDNSResponder/mDNSMacOSX/mDNSResponderHelper.8
+++ b/mDNSResponder/mDNSMacOSX/mDNSResponderHelper.8
@@ -1,6 +1,6 @@
.\" -*- tab-width: 4 -*-
.\"
-.\" Copyright (c) 2007 Apple Computer, Inc. All Rights Reserved.
+.\" Copyright (c) 2007-2009 Apple Inc. All Rights Reserved.
.\"
.\" Licensed under the Apache License, Version 2.0 (the "License");
.\" you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSMacOSX/pfkey.c b/mDNSResponder/mDNSMacOSX/pfkey.c
index 839c8d71..6e95a6b5 100644
--- a/mDNSResponder/mDNSMacOSX/pfkey.c
+++ b/mDNSResponder/mDNSMacOSX/pfkey.c
@@ -1,5 +1,6 @@
-/*
- * Copyright (c) 2003-2007 Apple Computer, Inc. All rights reserved.
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2003-2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/* $FreeBSD: src/lib/libipsec/pfkey.c,v 1.1.2.2 2001/07/03 11:01:14 ume Exp $ */
/* $KAME: pfkey.c,v 1.39 2001/03/05 18:22:17 thorpej Exp $ */
diff --git a/mDNSResponder/mDNSMacOSX/uDNSPathEvalulation.c b/mDNSResponder/mDNSMacOSX/uDNSPathEvalulation.c
new file mode 100644
index 00000000..1314584d
--- /dev/null
+++ b/mDNSResponder/mDNSMacOSX/uDNSPathEvalulation.c
@@ -0,0 +1,155 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2013, 2015 Apple Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mDNSMacOSX.h"
+#include <libproc.h>
+#include <network/private.h>
+
+//Gets the DNSPolicy from NW PATH EVALUATOR
+mDNSexport void mDNSPlatformGetDNSRoutePolicy(mDNS *const m, DNSQuestion *q, mDNSBool *isCellBlocked)
+{
+ (void) m;
+ q->ServiceID = -1; // initialize the ServiceID to default value of -1
+
+ // Return for non-unicast DNS queries, invalid pid, if NWPathEvaluation is already done by the client, or NWPathEvaluation not available on this OS
+ if (mDNSOpaque16IsZero(q->TargetQID) || (q->pid < 0) || (q->flags & kDNSServiceFlagsPathEvaluationDone) || !nw_endpoint_create_host)
+ {
+ *isCellBlocked = mDNSfalse;
+ return;
+ }
+
+ mDNSs32 service_id;
+ mDNSu32 client_ifindex, dnspol_ifindex;
+ int retval;
+ struct proc_uniqidentifierinfo info;
+ mDNSBool isUUIDSet;
+
+ char unenc_name[MAX_ESCAPED_DOMAIN_NAME];
+ ConvertDomainNameToCString(&q->qname, unenc_name);
+
+ nw_endpoint_t host = nw_endpoint_create_host(unenc_name, "0");
+ if (host == NULL)
+ LogMsg("mDNSPlatformGetDNSRoutePolicy: DNS Route Policy: Query for %##s (%s), PID[%d], EUID[%d], ServiceID[%d] nw_endpoint_t host is NULL", q->qname.c,
+ DNSTypeName(q->qtype), q->pid, q->euid, q->ServiceID);
+
+ nw_parameters_t parameters = nw_parameters_create();
+ if (parameters == NULL)
+ LogMsg("mDNSPlatformGetDNSRoutePolicy: DNS Route Policy: Query for %##s (%s), PID[%d], EUID[%d], ServiceID[%d] nw_endpoint_t parameters is NULL", q->qname.c,
+ DNSTypeName(q->qtype), q->pid, q->euid, q->ServiceID);
+
+ // Check for all the special (negative) internal value interface indices before initializing client_ifindex
+ if ( (q->InterfaceID == mDNSInterface_Any)
+ || (q->InterfaceID == mDNSInterface_Unicast)
+ || (q->InterfaceID == mDNSInterface_LocalOnly)
+ || (q->InterfaceID == mDNSInterfaceMark)
+ || (q->InterfaceID == mDNSInterface_P2P)
+ || (q->InterfaceID == uDNSInterfaceMark))
+ {
+ client_ifindex = 0;
+ }
+ else
+ {
+ client_ifindex = (mDNSu32)(uintptr_t)q->InterfaceID;
+ }
+
+
+ if (client_ifindex > 0)
+ {
+ nw_interface_t client_intf = nw_interface_create_with_index(client_ifindex);
+ nw_parameters_require_interface(parameters, client_intf);
+ if (client_intf != NULL)
+ network_release(client_intf);
+ else
+ LogInfo("mDNSPlatformGetDNSRoutePolicy: DNS Route Policy: client_intf returned by nw_interface_create_with_index() is NULL");
+ }
+
+ nw_parameters_set_uid(parameters,(uid_t)q->euid);
+
+ if (q->pid != 0)
+ {
+ nw_parameters_set_pid(parameters, q->pid);
+ retval = proc_pidinfo(q->pid, PROC_PIDUNIQIDENTIFIERINFO, 1, &info, sizeof(info));
+ if (retval == (int)sizeof(info))
+ {
+ nw_parameters_set_e_proc_uuid(parameters, info.p_uuid);
+ isUUIDSet = mDNStrue;
+ }
+ else
+ {
+ debugf("mDNSPlatformGetDNSRoutePolicy: proc_pidinfo returned %d", retval);
+ isUUIDSet = mDNSfalse;
+ }
+ }
+ else
+ {
+ nw_parameters_set_e_proc_uuid(parameters, q->uuid);
+ isUUIDSet = mDNStrue;
+ }
+
+ nw_path_evaluator_t evaluator = nw_path_create_evaluator_for_endpoint(host, parameters);
+ if (evaluator == NULL)
+ LogMsg("mDNSPlatformGetDNSRoutePolicy: DNS Route Policy: Query for %##s (%s), PID[%d], EUID[%d], ServiceID[%d] nw_path_evaluator_t evaluator is NULL", q->qname.c,
+ DNSTypeName(q->qtype), q->pid, q->euid, q->ServiceID);
+
+ if (host != NULL)
+ network_release(host);
+ if (parameters != NULL)
+ network_release(parameters);
+
+ nw_path_t path = nw_path_evaluator_copy_path(evaluator);
+ if (path == NULL)
+ LogMsg("mDNSPlatformGetDNSRoutePolicy: DNS Route Policy: Query for %##s (%s), PID[%d], EUID[%d], ServiceID[%d] nw_path_t path is NULL", q->qname.c,
+ DNSTypeName(q->qtype), q->pid, q->euid, q->ServiceID);
+
+ service_id = nw_path_get_flow_divert_unit(path);
+ if (service_id != 0)
+ {
+ q->ServiceID = service_id;
+ LogInfo("mDNSPlatformGetDNSRoutePolicy: DNS Route Policy: Query for %##s service ID is set ->service_ID:[%d] ", q->qname.c, service_id);
+ }
+ else
+ {
+ nw_interface_t nwpath_intf = nw_path_copy_scoped_interface(path);
+ if (nwpath_intf != NULL)
+ {
+ // Use the new scoped interface given by NW PATH EVALUATOR
+ dnspol_ifindex = nw_interface_get_index(nwpath_intf);
+ q->InterfaceID = (mDNSInterfaceID)(uintptr_t)dnspol_ifindex;
+
+ network_release(nwpath_intf);
+
+ if (dnspol_ifindex != client_ifindex)
+ LogInfo("mDNSPlatformGetDNSRoutePolicy: DNS Route Policy has changed the scoped ifindex from [%d] to [%d]",
+ client_ifindex, dnspol_ifindex);
+ }
+ else
+ {
+ debugf("mDNSPlatformGetDNSRoutePolicy: Query for %##s (%s), PID[%d], EUID[%d], ServiceID[%d] nw_interface_t nwpath_intf is NULL ", q->qname.c, DNSTypeName(q->qtype), q->pid, q->euid, q->ServiceID);
+ }
+ }
+
+ if (isUUIDSet && TARGET_OS_IPHONE && nw_path_get_status(path) == nw_path_status_unsatisfied && nw_path_get_reason(path) == nw_path_reason_policy_drop)
+ *isCellBlocked = mDNStrue;
+ else
+ *isCellBlocked = mDNSfalse;
+
+ if (path != NULL)
+ network_release(path);
+ if (evaluator != NULL)
+ network_release(evaluator);
+
+}
diff --git a/mDNSResponder/mDNSPosix/._ReadMe.txt b/mDNSResponder/mDNSPosix/._ReadMe.txt
new file mode 100755
index 00000000..cd621b2a
--- /dev/null
+++ b/mDNSResponder/mDNSPosix/._ReadMe.txt
Binary files differ
diff --git a/mDNSResponder/mDNSPosix/Identify.c b/mDNSResponder/mDNSPosix/Identify.c
index 003ac631..6a5d362b 100644
--- a/mDNSResponder/mDNSPosix/Identify.c
+++ b/mDNSResponder/mDNSPosix/Identify.c
@@ -330,8 +330,10 @@ mDNSexport int main(int argc, char **argv)
if (StopNow == 2) break;
}
#endif
- else {
- if (strlen(arg) >= sizeof(hostname)) {
+ else
+ {
+ if (strlen(arg) >= sizeof(hostname))
+ {
fprintf(stderr, "hostname must be < %d characters\n", (int)sizeof(hostname));
goto usage;
}
diff --git a/mDNSResponder/mDNSPosix/Makefile b/mDNSResponder/mDNSPosix/Makefile
index 817a3775..de8bd00c 100755
--- a/mDNSResponder/mDNSPosix/Makefile
+++ b/mDNSResponder/mDNSPosix/Makefile
@@ -153,6 +153,7 @@ LINKOPTS = -lSystem
LDSUFFIX = dylib
JDK = /System/Library/Frameworks/JavaVM.framework/Home
JAVACFLAGS_OS = -dynamiclib -I/System/Library/Frameworks/JavaVM.framework/Headers -framework JavaVM
+OPTIONALTARG = dnsextd
else
$(error ERROR: Must specify target OS on command-line, e.g. "make os=x [target]".\
@@ -215,7 +216,7 @@ CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUG)
#############################################################################
-all: setup Daemon libdns_sd Clients SAClient SAResponder SAProxyResponder Identify NetMonitor dnsextd $(OPTIONALTARG)
+all: setup Daemon libdns_sd Clients SAClient SAResponder SAProxyResponder Identify NetMonitor $(OPTIONALTARG)
install: setup InstalledDaemon InstalledStartup InstalledLib InstalledManPages InstalledClients $(OPTINSTALL)
diff --git a/mDNSResponder/mDNSPosix/ReadMe.txt b/mDNSResponder/mDNSPosix/ReadMe.txt
index c2f56412..a374ddf0 100755
--- a/mDNSResponder/mDNSPosix/ReadMe.txt
+++ b/mDNSResponder/mDNSPosix/ReadMe.txt
@@ -308,6 +308,20 @@ CVE-ID
CVE-2011-0220 : JaeSeung Song of the Department of Computing at Imperial
College London
+Impact:  A local application may be able to cause a denial of service
+Description:  A denial of service issue was addressed through
+improved memory handling.
+CVE-ID
+CVE-2015-7988 : Alexandre Helie
+
+Impact:  A remote attacker may be able to cause unexpected
+application termination or arbitrary code execution
+Description:  Multiple memory corruption issues existed in DNS
+data parsing. These issues were addressed through improved bounds
+checking.
+CVE-ID
+CVE-2015-7987 : Alexandre Helie
+
To Do List
----------
• port to a System V that's not Solaris
diff --git a/mDNSResponder/mDNSPosix/mDNSPosix.c b/mDNSResponder/mDNSPosix/mDNSPosix.c
index 1ff9837d..77b57149 100755
--- a/mDNSResponder/mDNSPosix/mDNSPosix.c
+++ b/mDNSResponder/mDNSPosix/mDNSPosix.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -525,6 +525,7 @@ mDNSexport int ParseDNSServers(mDNS *m, const char *filePath)
numOfServers++;
}
}
+ fclose(fp);
return (numOfServers > 0) ? 0 : -1;
}
@@ -648,10 +649,22 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf
// ... with a shared UDP port, if it's for multicast receiving
if (err == 0 && port.NotAnInteger)
{
- #if defined(SO_REUSEPORT)
- err = setsockopt(*sktPtr, SOL_SOCKET, SO_REUSEPORT, &kOn, sizeof(kOn));
- #elif defined(SO_REUSEADDR)
+ // <rdar://problem/20946253>
+ // We test for SO_REUSEADDR first, as suggested by Jonny Törnbom from Axis Communications
+ // Linux kernel versions 3.9 introduces support for socket option
+ // SO_REUSEPORT, however this is not implemented the same as on *BSD
+ // systems. Linux version implements a "port hijacking" prevention
+ // mechanism, limiting processes wanting to bind to an already existing
+ // addr:port to have the same effective UID as the first who bound it. What
+ // this meant for us was that the daemon ran as one user and when for
+ // instance mDNSClientPosix was executed by another user, it wasn't allowed
+ // to bind to the socket. Our suggestion was to switch the order in which
+ // SO_REUSEPORT and SO_REUSEADDR was tested so that SO_REUSEADDR stays on
+ // top and SO_REUSEPORT to be used only if SO_REUSEADDR doesn't exist.
+ #if defined(SO_REUSEADDR) && !defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
err = setsockopt(*sktPtr, SOL_SOCKET, SO_REUSEADDR, &kOn, sizeof(kOn));
+ #elif defined(SO_REUSEPORT)
+ err = setsockopt(*sktPtr, SOL_SOCKET, SO_REUSEPORT, &kOn, sizeof(kOn));
#else
#error This platform has no way to avoid address busy errors on multicast.
#endif
@@ -919,6 +932,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct
if (strcmp(intfName, STRINGIFY(DIRECTLINK_INTERFACE_NAME)) == 0)
intf->coreIntf.DirectLink = mDNStrue;
#endif
+ intf->coreIntf.SupportsUnicastMDNSResponse = mDNStrue;
// The interface is all ready to go, let's register it with the mDNS core.
if (err == 0)
@@ -1625,21 +1639,15 @@ mDNSexport mDNSBool mDNSPlatformInterfaceIsD2D(mDNSInterfaceID InterfaceID)
return mDNSfalse;
}
-mDNSexport mDNSBool mDNSPlatformAllowPID(mDNS *const m, DNSQuestion *q)
+mDNSexport void mDNSPlatformGetDNSRoutePolicy(mDNS *const m, DNSQuestion *q, mDNSBool *isCellBlocked)
{
(void) m;
- (void) q;
- return mDNStrue;
-}
-mDNSexport mDNSs32 mDNSPlatformGetServiceID(mDNS *const m, DNSQuestion *q)
-{
- (void) m;
- (void) q;
- return -1;
+ q->ServiceID = -1;
+ *isCellBlocked = mDNSfalse;
}
-mDNSexport void mDNSPlatformSetDelegatePID(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q)
+mDNSexport void mDNSPlatformSetuDNSSocktOpt(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q)
{
(void) src;
(void) dst;
diff --git a/mDNSResponder/mDNSPosix/mDNSUNP.c b/mDNSResponder/mDNSPosix/mDNSUNP.c
index 5c4d9fe1..3cfeac6e 100755
--- a/mDNSResponder/mDNSPosix/mDNSUNP.c
+++ b/mDNSResponder/mDNSPosix/mDNSUNP.c
@@ -83,14 +83,12 @@ void plen_to_mask(int plen, char *addr) {
struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
{
struct ifi_info *ifi, *ifihead, **ifipnext, *ifipold, **ifiptr;
- FILE *fp;
+ FILE *fp = NULL;
char addr[8][5];
int flags, myflags, index, plen, scope;
char ifname[9], lastname[IFNAMSIZ];
char addr6[32+7+1]; /* don't forget the seven ':' */
struct addrinfo hints, *res0;
- struct sockaddr_in6 *sin6;
- struct in6_addr *addrptr;
int err;
int sockfd = -1;
struct ifreq ifr;
@@ -150,18 +148,13 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
char ipv6addr[INET6_ADDRSTRLEN];
plen_to_mask(plen, ipv6addr);
ifi->ifi_netmask = calloc(1, sizeof(struct sockaddr_in6));
- if (ifi->ifi_addr == NULL) {
+ if (ifi->ifi_netmask == NULL) {
goto gotError;
}
- sin6=calloc(1, sizeof(struct sockaddr_in6));
- addrptr=calloc(1, sizeof(struct in6_addr));
- inet_pton(family, ipv6addr, addrptr);
- sin6->sin6_family=family;
- sin6->sin6_addr=*addrptr;
- sin6->sin6_scope_id=scope;
- memcpy(ifi->ifi_netmask, sin6, sizeof(struct sockaddr_in6));
- free(sin6);
+ ((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_family=family;
+ ((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_scope_id=scope;
+ inet_pton(family, ipv6addr, &((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_addr);
/* Add interface name */
memcpy(ifi->ifi_name, ifname, IFI_NAME);
@@ -179,6 +172,7 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
* EADDRNOTAVAIL for the main interface
*/
free(ifi->ifi_addr);
+ free(ifi->ifi_netmask);
free(ifi);
ifipnext = ifiptr;
*ifipnext = ifipold;
@@ -207,6 +201,9 @@ done:
if (sockfd != -1) {
assert(close(sockfd) == 0);
}
+ if (fp != NULL) {
+ fclose(fp);
+ }
return(ifihead); /* pointer to first structure in linked list */
}
#endif // defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
diff --git a/mDNSResponder/mDNSPosix/mdnsd.sh b/mDNSResponder/mDNSPosix/mdnsd.sh
index 14fef9b4..c43d9fcb 100644
--- a/mDNSResponder/mDNSPosix/mdnsd.sh
+++ b/mDNSResponder/mDNSPosix/mdnsd.sh
@@ -36,7 +36,7 @@ if [ -r /sbin/start-stop-daemon ]; then
# Suse Linux doesn't work with symbolic signal names, but we really don't need
# to specify "-s TERM" since SIGTERM (15) is the default stop signal anway
# STOP="start-stop-daemon --stop -s TERM --quiet --oknodo --exec"
- STOP="start-stop-daemon --stop --quiet --oknodo --exec"
+ STOP="start-stop-daemon --stop --quiet --oknodo --retry 2 --exec"
else
killmdnsd() {
kill -TERM `cat /var/run/mdnsd.pid`
diff --git a/mDNSResponder/mDNSPosix/nss_mdns.c b/mDNSResponder/mDNSPosix/nss_mdns.c
index afadb3c6..ade4d4d2 100755
--- a/mDNSResponder/mDNSPosix/nss_mdns.c
+++ b/mDNSResponder/mDNSPosix/nss_mdns.c
@@ -1088,7 +1088,6 @@ mdns_lookup_callback
ns_type_t expected_rr_type =
af_to_rr (result->hostent->h_addrtype);
- // Idiot check class
if (rrclass != C_IN)
{
syslog (LOG_WARNING,
@@ -1270,7 +1269,6 @@ add_address_to_buffer (result_map_t * result, const void * data, int len)
return NULL;
}
- // Idiot check
if (len != result->hostent->h_length)
{
syslog (LOG_WARNING,
@@ -1311,7 +1309,6 @@ contains_address (result_map_t * result, const void * data, int len)
{
int i;
- // Idiot check
if (len != result->hostent->h_length)
{
syslog (LOG_WARNING,
@@ -2473,7 +2470,6 @@ cmp_dns_suffix (const char * name, const char * domain)
const char * nametail;
const char * domaintail;
- // Idiot checks
if (*name == 0 || *name == k_dns_separator)
{
// Name can't be empty or start with separator
diff --git a/mDNSResponder/mDNSShared/CommonServices.h b/mDNSResponder/mDNSShared/CommonServices.h
index 342479b9..7fceac02 100644
--- a/mDNSResponder/mDNSShared/CommonServices.h
+++ b/mDNSResponder/mDNSShared/CommonServices.h
@@ -834,6 +834,12 @@ typedef unsigned long int uintptr_t;
#endif
#endif
+// Limits
+
+#if( !defined( UINT32_MAX ) )
+ #define UINT32_MAX UINT32_C( 4294967295 )
+#endif
+
#if 0
#pragma mark == bool ==
#endif
diff --git a/mDNSResponder/mDNSShared/DebugServices.c b/mDNSResponder/mDNSShared/DebugServices.c
index 98f876a4..44305a5c 100644
--- a/mDNSResponder/mDNSShared/DebugServices.c
+++ b/mDNSResponder/mDNSShared/DebugServices.c
@@ -1746,8 +1746,8 @@ DEBUG_EXPORT const char * DebugGetErrorString( int_least32_t inErrorCode, char
CaseErrorStringifyHardCode( -65548, mStatus_NameConflict );
CaseErrorStringifyHardCode( -65549, mStatus_Invalid );
CaseErrorStringifyHardCode( -65550, mStatus_GrowCache );
- CaseErrorStringifyHardCode( -65551, mStatus_BadInterfaceErr );
- CaseErrorStringifyHardCode( -65552, mStatus_Incompatible );
+ CaseErrorStringifyHardCode( -65551, mStatus_Incompatible );
+ CaseErrorStringifyHardCode( -65552, mStatus_BadInterfaceErr );
CaseErrorStringifyHardCode( -65791, mStatus_ConfigChanged );
CaseErrorStringifyHardCode( -65792, mStatus_MemFree );
diff --git a/mDNSResponder/mDNSShared/GenLinkedList.c b/mDNSResponder/mDNSShared/GenLinkedList.c
index 45dbb7cb..1c6cb5be 100644
--- a/mDNSResponder/mDNSShared/GenLinkedList.c
+++ b/mDNSResponder/mDNSShared/GenLinkedList.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,13 +13,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-
- File: GenLinkedList.c
-
- Contains: implementation of generic linked lists.
-
- Version: 1.0
- Tabs: 4 spaces
*/
#include "GenLinkedList.h"
diff --git a/mDNSResponder/mDNSShared/PlatformCommon.c b/mDNSResponder/mDNSShared/PlatformCommon.c
index d86a755a..4f844560 100644
--- a/mDNSResponder/mDNSShared/PlatformCommon.c
+++ b/mDNSResponder/mDNSShared/PlatformCommon.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -190,10 +190,13 @@ mDNSexport void mDNSPlatformWriteLogMsg(const char *ident, const char *buffer, m
if (ident && ident[0] && mDNSPlatformClockDivisor)
syslog(syslog_level, "%8d.%03d: %s", (int)(t/1000), ms, buffer);
else
-#elif APPLE_OSX_mDNSResponder
- mDNSPlatformLogToFile(syslog_level, buffer);
+#endif
+ {
+#if APPLE_OSX_mDNSResponder
+ mDNSPlatformLogToFile(syslog_level, buffer);
#else
- syslog(syslog_level, "%s", buffer);
+ syslog(syslog_level, "%s", buffer);
#endif
+ }
}
}
diff --git a/mDNSResponder/mDNSShared/dns-sd.1 b/mDNSResponder/mDNSShared/dns-sd.1
index 9d8323b9..d462ae20 100644
--- a/mDNSResponder/mDNSShared/dns-sd.1
+++ b/mDNSResponder/mDNSShared/dns-sd.1
@@ -1,6 +1,6 @@
.\" -*- tab-width: 4 -*-
.\"
-.\" Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
+.\" Copyright (c) 2004-2012 Apple Inc. All Rights Reserved.
.\"
.\" Licensed under the Apache License, Version 2.0 (the "License");
.\" you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSShared/dns_sd.h b/mDNSResponder/mDNSShared/dns_sd.h
index 38315273..cf32ea1e 100644
--- a/mDNSResponder/mDNSShared/dns_sd.h
+++ b/mDNSResponder/mDNSShared/dns_sd.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2003-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
@@ -66,7 +66,7 @@
*/
#ifndef _DNS_SD_H
-#define _DNS_SD_H 5763004
+#define _DNS_SD_H 6254102
#ifdef __cplusplus
extern "C" {
@@ -497,12 +497,18 @@ enum
* as the "serviceIndex".
*/
- kDNSServiceFlagsDenyExpensive = 0x20000000
+ kDNSServiceFlagsDenyExpensive = 0x20000000,
/*
* This flag is meaningful only for Unicast DNS queries. When set, the kernel will restrict
* DNS resolutions on interfaces defined as expensive for that request.
*/
+ kDNSServiceFlagsPathEvaluationDone = 0x40000000
+ /*
+ * This flag is meaningful for only Unicast DNS queries.
+ * When set, it indicates that Network PathEvaluation has already been performed.
+ */
+
};
#define kDNSServiceOutputFlags (kDNSServiceFlagsValidate | kDNSServiceFlagsValidateOptional | kDNSServiceFlagsMoreComing | kDNSServiceFlagsAdd | kDNSServiceFlagsDefault)
@@ -724,9 +730,8 @@ enum
* DNS server." Normally, most clients will use 0 for interface index to
* automatically get the default sensible behaviour.
*
- * If the client passes a positive interface index, then for multicast names that
- * indicates to do the operation only on that one interface. For unicast names the
- * interface index is ignored unless kDNSServiceFlagsForceMulticast is also set.
+ * If the client passes a positive interface index, then that indicates to do the
+ * operation only on that one specified interface.
*
* If the client passes kDNSServiceInterfaceIndexLocalOnly when registering
* a service, then that service will be found *only* by other local clients
@@ -2606,34 +2611,6 @@ DNSServiceErrorType DNSSD_API DNSServiceSleepKeepalive
);
#endif
-#ifdef APPLE_OSX_mDNSResponder
-/* DNSServiceCreateDelegateConnection()
- *
- * Create a delegate connection to the daemon allowing efficient registration of
- * multiple individual records.
- *
- * Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. Deallocating
- * the reference (via DNSServiceRefDeallocate()) severs the
- * connection and deregisters all records registered on this connection.
- *
- * pid : Process ID of the delegate
- *
- * uuid: UUID of the delegate
- *
- * Note that only one of the two arguments (pid or uuid) can be specified. If pid
- * is zero, uuid will be assumed to be a valid value; otherwise pid will be used.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns
- * an error code indicating the specific failure that occurred (in which
- * case the DNSServiceRef is not initialized). kDNSServiceErr_NotAuth is
- * returned to indicate that the calling process does not have entitlements
- * to use this API.
- */
-DNSServiceErrorType DNSSD_API DNSServiceCreateDelegateConnection(DNSServiceRef *sdRef, int32_t pid, uuid_t uuid);
-#endif
-
#ifdef __APPLE_API_PRIVATE
#define kDNSServiceCompPrivateDNS "PrivateDNS"
diff --git a/mDNSResponder/mDNSShared/dnsextd.8 b/mDNSResponder/mDNSShared/dnsextd.8
index 796caaba..6611c823 100644
--- a/mDNSResponder/mDNSShared/dnsextd.8
+++ b/mDNSResponder/mDNSShared/dnsextd.8
@@ -1,6 +1,6 @@
.\" -*- tab-width: 4 -*-
.\"
-.\" Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
+.\" Copyright (c) 2004, 2006, 2009 Apple Inc. All Rights Reserved.
.\"
.\" Licensed under the Apache License, Version 2.0 (the "License");
.\" you may not use this file except in compliance with the License.
diff --git a/mDNSResponder/mDNSShared/dnsextd.c b/mDNSResponder/mDNSShared/dnsextd.c
index aa06650a..7b8e67e6 100644
--- a/mDNSResponder/mDNSShared/dnsextd.c
+++ b/mDNSResponder/mDNSShared/dnsextd.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -560,6 +560,7 @@ mDNSlocal mDNSBool IsLLQRequest(PktMsg *pkt)
ptr = LocateAdditionals(&pkt->msg, end);
if (!ptr) goto end;
+ bzero(&lcr, sizeof(lcr));
// find last Additional info.
for (i = 0; i < pkt->msg.h.numAdditionals; i++)
{
@@ -628,7 +629,6 @@ SetZone
)
{
domainname zname;
- mDNSu8 QR_OP;
const mDNSu8 * ptr = pkt->msg.data;
mDNSBool exception = mDNSfalse;
@@ -640,15 +640,13 @@ SetZone
// Figure out what type of packet this is
- QR_OP = ( mDNSu8 ) ( pkt->msg.h.flags.b[0] & kDNSFlag0_QROP_Mask );
-
if ( IsQuery( pkt ) )
{
DNSQuestion question;
// It's a query
- ptr = getQuestion( &pkt->msg, ptr, ( ( mDNSu8* ) &pkt->msg ) + pkt->len, NULL, &question );
+ getQuestion( &pkt->msg, ptr, ( ( mDNSu8* ) &pkt->msg ) + pkt->len, NULL, &question );
AppendDomainName( &zname, &question.qname );
@@ -661,7 +659,7 @@ SetZone
// It's an update. The format of the zone section is the same as the format for the question section
// according to RFC 2136, so we'll just treat this as a question so we can get at the zone.
- ptr = getQuestion( &pkt->msg, ptr, ( ( mDNSu8* ) &pkt->msg ) + pkt->len, NULL, &question );
+ getQuestion( &pkt->msg, ptr, ( ( mDNSu8* ) &pkt->msg ) + pkt->len, NULL, &question );
AppendDomainName( &zname, &question.qname );
@@ -1373,8 +1371,7 @@ mDNSlocal void DeleteRecords(DaemonInfo *d, mDNSBool DeleteAll)
// Add, delete, or refresh records in table based on contents of a successfully completed dynamic update
mDNSlocal void UpdateLeaseTable(PktMsg *pkt, DaemonInfo *d, mDNSs32 lease)
{
- RRTableElem **rptr, *tmp;
- int i, allocsize, bucket;
+ int i, allocsize;
LargeCacheRecord lcr;
ResourceRecord *rr = &lcr.r.resrec;
const mDNSu8 *ptr, *end;
@@ -1397,8 +1394,8 @@ mDNSlocal void UpdateLeaseTable(PktMsg *pkt, DaemonInfo *d, mDNSs32 lease)
ptr = GetLargeResourceRecord(NULL, &pkt->msg, ptr, end, 0, kDNSRecordTypePacketAns, &lcr);
if (!ptr || lcr.r.resrec.RecordType == kDNSRecordTypePacketNegative) { Log("UpdateLeaseTable: GetLargeResourceRecord failed"); goto cleanup; }
- bucket = rr->namehash % d->nbuckets;
- rptr = &d->table[bucket];
+ int bucket = rr->namehash % d->nbuckets;
+ RRTableElem *tmp, **rptr = &d->table[bucket];
// handle deletions
if (rr->rrtype == kDNSQType_ANY && !rr->rroriginalttl && rr->rrclass == kDNSQClass_ANY && !rr->rdlength)
@@ -1444,7 +1441,6 @@ mDNSlocal void UpdateLeaseTable(PktMsg *pkt, DaemonInfo *d, mDNSs32 lease)
{
RehashTable(d);
bucket = rr->namehash % d->nbuckets;
- rptr = &d->table[bucket];
}
if (gettimeofday(&tv, NULL)) { LogErr("UpdateLeaseTable", "gettimeofday"); goto cleanup; }
allocsize = sizeof(RRTableElem);
@@ -1475,12 +1471,11 @@ cleanup:
// Replies are currently not signed !!!KRS change this
mDNSlocal PktMsg *FormatLeaseReply(DaemonInfo *d, PktMsg *orig, mDNSu32 lease)
{
- PktMsg *reply;
- mDNSu8 *ptr, *end;
+ PktMsg *const reply = malloc(sizeof(*reply));
+ mDNSu8 *ptr;
mDNSOpaque16 flags;
-
(void)d; //unused
- reply = malloc(sizeof(*reply));
+
if (!reply) { LogErr("FormatLeaseReply", "malloc"); return NULL; }
flags.b[0] = kDNSFlag0_QR_Response | kDNSFlag0_OP_Update;
flags.b[1] = 0;
@@ -1488,9 +1483,7 @@ mDNSlocal PktMsg *FormatLeaseReply(DaemonInfo *d, PktMsg *orig, mDNSu32 lease)
InitializeDNSMessage(&reply->msg.h, orig->msg.h.id, flags);
reply->src.sin_addr.s_addr = zerov4Addr.NotAnInteger; // unused except for log messages
reply->src.sin_family = AF_INET;
- ptr = reply->msg.data;
- end = (mDNSu8 *)&reply->msg + sizeof(DNSMessage);
- ptr = putUpdateLease(&reply->msg, ptr, lease);
+ ptr = putUpdateLease(&reply->msg, reply->msg.data, lease);
if (!ptr) { Log("FormatLeaseReply: putUpdateLease failed"); free(reply); return NULL; }
reply->len = ptr - (mDNSu8 *)&reply->msg;
HdrHToN(reply);
@@ -2401,6 +2394,7 @@ mDNSlocal mDNSBool IsAuthorized( DaemonInfo * d, PktMsg * pkt, DomainAuthInfo **
HdrNToH(pkt);
*key = NULL;
+ bzero(&lcr, sizeof(lcr));
if ( pkt->msg.h.numAdditionals )
{
diff --git a/mDNSResponder/mDNSShared/dnsextd_lexer.l b/mDNSResponder/mDNSShared/dnsextd_lexer.l
index 5cac1060..75df9697 100644
--- a/mDNSResponder/mDNSShared/dnsextd_lexer.l
+++ b/mDNSResponder/mDNSShared/dnsextd_lexer.l
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2006-2011 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006-2011 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,11 +23,6 @@
extern YYSTYPE yylval;
-/* Mac OS X 10.4 has flex version 2.5.4, which doesn't define yylineno for us */
-/* Mac OS X 10.5 has flex version 2.5.33, which does define yylineno */
-#if YY_FLEX_MAJOR_VERSION <= 2 && YY_FLEX_MINOR_VERSION <= 5 && YY_FLEX_SUBMINOR_VERSION <= 4
-int yylineno = 1;
-#endif
#define YY_NO_INPUT 1
int yylex(void);
diff --git a/mDNSResponder/mDNSShared/dnsextd_parser.y b/mDNSResponder/mDNSShared/dnsextd_parser.y
index 18c5990f..24d62696 100644
--- a/mDNSResponder/mDNSShared/dnsextd_parser.y
+++ b/mDNSResponder/mDNSShared/dnsextd_parser.y
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006-2010 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,6 +76,7 @@ typedef struct ZoneSpec
static StringListElem * g_stringList = NULL;
+static StringListElem * g_addrList = NULL;
static KeySpec * g_keys;
static ZoneSpec * g_zones;
static ZoneSpec g_zoneSpec;
@@ -173,6 +174,22 @@ optionsstatement:
|
LISTEN_ON PORT NUMBER addresscontent
{
+ mDNSIPPort listen_port = mDNSOpaque16fromIntVal( $3 );
+ DaemonInfo* d = ( DaemonInfo* ) context;
+ d->addr.sin_port = ( listen_port.NotAnInteger) ? listen_port.NotAnInteger : UnicastDNSPort.NotAnInteger;
+ StringListElem* addr = g_addrList;
+ while (addr != NULL)
+ {
+ StringListElem* next;
+ // The first ipv4 address in {,} is used; the rest are ignored.
+ if (inet_pton( AF_INET, addr->string, &d->addr.sin_addr ) == 0) {
+ inet_pton( AF_INET, "127.0.0.1", &d->ns_addr.sin_addr );
+ LogMsg("LISTEN_ON: An invalid ipv4 address, %s, detected.", addr->string);
+ }
+ next = addr->next;
+ free(addr);
+ addr = next;
+ }
}
|
NAMESERVER ADDRESS networkaddress
@@ -308,6 +325,20 @@ addressstatements:
addressstatement:
DOTTED_DECIMAL_ADDRESS
{
+ StringListElem * elem;
+
+ elem = ( StringListElem* ) malloc( sizeof( StringListElem ) );
+
+ if ( !elem )
+ {
+ LogMsg("ERROR: memory allocation failure");
+ YYABORT;
+ }
+
+ elem->string = $1;
+
+ elem->next = g_addrList;
+ g_addrList = elem;
}
;
diff --git a/mDNSResponder/mDNSShared/dnssd_clientlib.c b/mDNSResponder/mDNSShared/dnssd_clientlib.c
index cca58853..cfc1d424 100644
--- a/mDNSResponder/mDNSShared/dnssd_clientlib.c
+++ b/mDNSResponder/mDNSShared/dnssd_clientlib.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2004, Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
diff --git a/mDNSResponder/mDNSShared/dnssd_clientstub.c b/mDNSResponder/mDNSShared/dnssd_clientstub.c
index 5c1d02c4..5e151d08 100644
--- a/mDNSResponder/mDNSShared/dnssd_clientstub.c
+++ b/mDNSResponder/mDNSShared/dnssd_clientstub.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
@@ -29,14 +29,15 @@
#include <errno.h>
#include <stdlib.h>
+#include "dnssd_ipc.h"
+
#if APPLE_OSX_mDNSResponder
#include <mach-o/dyld.h>
#include <uuid/uuid.h>
#include <TargetConditionals.h>
+#include "dns_sd_private.h"
#endif
-#include "dnssd_ipc.h"
-
#if defined(_WIN32)
#define _SSIZE_T
@@ -74,7 +75,7 @@ static void syslog( int priority, const char * message, ...)
va_start( args, message );
len = _vscprintf( message, args ) + 1;
buffer = malloc( len * sizeof(char) );
- if ( buffer ) { vsprintf( buffer, message, args ); OutputDebugString( buffer ); free( buffer ); }
+ if ( buffer ) { vsnprintf( buffer, len, message, args ); OutputDebugString( buffer ); free( buffer ); }
WSASetLastError( err );
}
#else
@@ -284,7 +285,7 @@ static int more_bytes(dnssd_sock_t sd)
// two ints and not just one.
int nfdbits = sizeof (int) * 8;
int nints = (sd/nfdbits) + 1;
- fs = (fd_set *)calloc(nints, sizeof(int));
+ fs = (fd_set *)calloc(nints, (size_t)sizeof(int));
if (fs == NULL)
{
syslog(LOG_WARNING, "dnssd_clientstub more_bytes: malloc failed");
@@ -355,7 +356,7 @@ static ipc_msg_hdr *create_hdr(uint32_t op, size_t *len, char **data_start, int
struct timeval tv;
if (gettimeofday(&tv, NULL) < 0)
{ syslog(LOG_WARNING, "dnssd_clientstub create_hdr: gettimeofday failed %d %s", dnssd_errno, dnssd_strerror(dnssd_errno)); return NULL; }
- sprintf(ctrl_path, "%s%d-%.3lx-%.6lu", CTL_PATH_PREFIX, (int)getpid(),
+ snprintf(ctrl_path, sizeof(ctrl_path), "%s%d-%.3lx-%.6lu", CTL_PATH_PREFIX, (int)getpid(),
(unsigned long)(tv.tv_sec & 0xFFF), (unsigned long)(tv.tv_usec));
*len += strlen(ctrl_path) + 1;
#else
@@ -405,7 +406,11 @@ static void FreeDNSServiceOp(DNSServiceOp *x)
// We don't use our DNSServiceRefValid macro here because if we're cleaning up after a socket() call failed
// then sockfd could legitimately contain a failing value (e.g. dnssd_InvalidSocket)
if ((x->sockfd ^ x->validator) != ValidatorBits)
+ {
+ static DNSServiceOp *op_were_not_going_to_free_but_we_need_to_fool_the_analyzer;
syslog(LOG_WARNING, "dnssd_clientstub attempt to dispose invalid DNSServiceRef %p %08X %08X", x, x->sockfd, x->validator);
+ op_were_not_going_to_free_but_we_need_to_fool_the_analyzer = x;
+ }
else
{
x->next = NULL;
@@ -530,6 +535,11 @@ static DNSServiceErrorType ConnectToServer(DNSServiceRef *ref, DNSServiceFlags f
char* uds_serverpath = getenv(MDNS_UDS_SERVERPATH_ENVVAR);
if (uds_serverpath == NULL)
uds_serverpath = MDNS_UDS_SERVERPATH;
+ else if (strlen(uds_serverpath) >= MAX_CTLPATH)
+ {
+ uds_serverpath = MDNS_UDS_SERVERPATH;
+ syslog(LOG_WARNING, "dnssd_clientstub ConnectToServer: using default path since env len is invalid");
+ }
#endif
*ref = NULL;
sdr->sockfd = socket(AF_DNSSD, SOCK_STREAM, 0);
@@ -578,8 +588,10 @@ static DNSServiceErrorType ConnectToServer(DNSServiceRef *ref, DNSServiceFlags f
}
else
{
+ #if !defined(USE_TCP_LOOPBACK)
syslog(LOG_WARNING, "dnssd_clientstub ConnectToServer: connect() failed path:%s Socket:%d Err:%d Errno:%d %s",
uds_serverpath, sdr->sockfd, err, dnssd_errno, dnssd_strerror(dnssd_errno));
+ #endif
dnssd_close(sdr->sockfd);
FreeDNSServiceOp(sdr);
return kDNSServiceErr_ServiceNotRunning;
@@ -597,21 +609,25 @@ static DNSServiceErrorType ConnectToServer(DNSServiceRef *ref, DNSServiceFlags f
static DNSServiceErrorType deliver_request(ipc_msg_hdr *hdr, DNSServiceOp *sdr)
{
+ if (!hdr)
+ {
+ syslog(LOG_WARNING, "dnssd_clientstub deliver_request: !hdr");
+ return kDNSServiceErr_Unknown;
+ }
+
uint32_t datalen = hdr->datalen; // We take a copy here because we're going to convert hdr->datalen to network byte order
#if defined(USE_TCP_LOOPBACK) || defined(USE_NAMED_ERROR_RETURN_SOCKET)
char *const data = (char *)hdr + sizeof(ipc_msg_hdr);
#endif
dnssd_sock_t listenfd = dnssd_InvalidSocket, errsd = dnssd_InvalidSocket;
DNSServiceErrorType err = kDNSServiceErr_Unknown; // Default for the "goto cleanup" cases
- int MakeSeparateReturnSocket = 0;
// Note: need to check hdr->op, not sdr->op.
// hdr->op contains the code for the specific operation we're currently doing, whereas sdr->op
// contains the original parent DNSServiceOp (e.g. for an add_record_request, hdr->op will be
// add_record_request but the parent sdr->op will be connection_request or reg_service_request)
- if (sdr->primary ||
- hdr->op == reg_record_request || hdr->op == add_record_request || hdr->op == update_record_request || hdr->op == remove_record_request)
- MakeSeparateReturnSocket = 1;
+ const int MakeSeparateReturnSocket = (sdr->primary ||
+ hdr->op == reg_record_request || hdr->op == add_record_request || hdr->op == update_record_request || hdr->op == remove_record_request);
if (!DNSServiceRefValid(sdr))
{
@@ -621,12 +637,6 @@ static DNSServiceErrorType deliver_request(ipc_msg_hdr *hdr, DNSServiceOp *sdr)
return kDNSServiceErr_BadReference;
}
- if (!hdr)
- {
- syslog(LOG_WARNING, "dnssd_clientstub deliver_request: !hdr");
- return kDNSServiceErr_Unknown;
- }
-
if (MakeSeparateReturnSocket)
{
#if defined(USE_TCP_LOOPBACK)
@@ -1158,6 +1168,8 @@ DNSServiceErrorType DNSSD_API DNSServiceGetProperty(const char *property, void *
put_string(property, &ptr);
err = deliver_request(hdr, tmp); // Will free hdr for us
+ if (err) { DNSServiceRefDeallocate(tmp); return err; }
+
if (read_all(tmp->sockfd, (char*)&actualsize, (int)sizeof(actualsize)) < 0)
{ DNSServiceRefDeallocate(tmp); return kDNSServiceErr_ServiceNotRunning; }
@@ -1182,24 +1194,17 @@ DNSServiceErrorType DNSSD_API DNSServiceGetPID(const uint16_t srcport, int32_t *
size_t len = sizeof(int32_t);
DNSServiceErrorType err = ConnectToServer(&tmp, 0, getpid_request, NULL, NULL, NULL);
- if (err)
- return err;
+ if (err) return err;
hdr = create_hdr(getpid_request, &len, &ptr, 0, tmp);
- if (!hdr)
- {
- DNSServiceRefDeallocate(tmp);
- return kDNSServiceErr_NoMemory;
- }
+ if (!hdr) { DNSServiceRefDeallocate(tmp); return kDNSServiceErr_NoMemory; }
put_uint16(srcport, &ptr);
err = deliver_request(hdr, tmp); // Will free hdr for us
+ if (err) { DNSServiceRefDeallocate(tmp); return err; }
if (read_all(tmp->sockfd, (char*)pid, sizeof(int32_t)) < 0)
- {
- DNSServiceRefDeallocate(tmp);
- return kDNSServiceErr_ServiceNotRunning;
- }
+ { DNSServiceRefDeallocate(tmp); return kDNSServiceErr_ServiceNotRunning; }
DNSServiceRefDeallocate(tmp);
return kDNSServiceErr_NoError;
@@ -1391,6 +1396,7 @@ static void handle_addrinfo_response(DNSServiceOp *const sdr, const CallbackHead
rdlen = get_uint16(&data, end);
rdata = get_rdata (&data, end, rdlen);
ttl = get_uint32(&data, end);
+ (void)rrclass; // Unused
// We only generate client callbacks for A and AAAA results (including NXDOMAIN results for
// those types, if the client has requested those with the kDNSServiceFlagsReturnIntermediates).
@@ -1613,13 +1619,7 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister
hdr = create_hdr(reg_service_request, &len, &ptr, (*sdRef)->primary ? 1 : 0, *sdRef);
if (!hdr) { DNSServiceRefDeallocate(*sdRef); *sdRef = NULL; return kDNSServiceErr_NoMemory; }
-
- // If it is going over a shared connection, then don't set the IPC_FLAGS_NOREPLY
- // as it affects all the operations over the shared connection. This is not
- // a normal case and hence receiving the response back from the daemon and
- // discarding it in ConnectionResponse is okay.
-
- if (!(flags & kDNSServiceFlagsShareConnection) && !callBack) hdr->ipc_flags |= IPC_FLAGS_NOREPLY;
+ if (!callBack) hdr->ipc_flags |= IPC_FLAGS_NOREPLY;
put_flags(flags, &ptr);
put_uint32(interfaceIndex, &ptr);
diff --git a/mDNSResponder/mDNSShared/dnssd_ipc.c b/mDNSResponder/mDNSShared/dnssd_ipc.c
index 6059eb39..0fd75824 100644
--- a/mDNSResponder/mDNSShared/dnssd_ipc.c
+++ b/mDNSResponder/mDNSShared/dnssd_ipc.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
diff --git a/mDNSResponder/mDNSShared/dnssd_ipc.h b/mDNSResponder/mDNSShared/dnssd_ipc.h
index 609fa640..7dc64c5f 100644
--- a/mDNSResponder/mDNSShared/dnssd_ipc.h
+++ b/mDNSResponder/mDNSShared/dnssd_ipc.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
@@ -88,7 +88,7 @@ extern char *win32_strerror(int inErrorCode);
# define MDNS_UDS_SERVERPATH_ENVVAR "DNSSD_UDS_PATH"
# define LISTENQ 100
// longest legal control path length
-# define MAX_CTLPATH 256
+# define MAX_CTLPATH (sizeof(((struct sockaddr_un*)0)->sun_path))
# define dnssd_sockaddr_t struct sockaddr_un
#endif
diff --git a/mDNSResponder/mDNSShared/mDNSDebug.c b/mDNSResponder/mDNSShared/mDNSDebug.c
index 4f575c06..6c0781c3 100644
--- a/mDNSResponder/mDNSShared/mDNSDebug.c
+++ b/mDNSResponder/mDNSShared/mDNSDebug.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,13 +13,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-
- File: mDNSDebug.c
-
- Contains: Implementation of debugging utilities. Requires a POSIX environment.
-
- Version: 1.0
-
*/
#include "mDNSDebug.h"
diff --git a/mDNSResponder/mDNSShared/mDNSResponder.8 b/mDNSResponder/mDNSShared/mDNSResponder.8
index 48c1cf65..e9bd8e9b 100644
--- a/mDNSResponder/mDNSShared/mDNSResponder.8
+++ b/mDNSResponder/mDNSShared/mDNSResponder.8
@@ -1,6 +1,6 @@
.\" -*- tab-width: 4 -*-
.\"
-.\" Copyright (c) 2003-2004 Apple Computer, Inc. All Rights Reserved.
+.\" Copyright (c) 2003-2012 Apple Inc. All Rights Reserved.
.\"
.\" Licensed under the Apache License, Version 2.0 (the "License");
.\" you may not use this file except in compliance with the License.
@@ -80,9 +80,28 @@ A SIGINFO signal will dump a snapshot summary of the internal state to
.Pa /var/log/system.log Ns :
.Pp
.Dl % sudo killall -INFO mDNSResponder
+.Sh OPTIONAL ARGUMENTS
+.Nm
+accepts the following optional arguments:
+.Bl -tag -width "AlwaysAppendSearchDomains"
+.It Fl AlwaysAppendSearchDomains
+Append search domains for multi-labeled Partially Qualified Domain Name as well as single-labeled Partially Qualified Domain Name.
+This argument is not recommended because of the extra DNS traffic it generates and its adverse effect on battery life.
+.It Fl NoMulticastAdvertisements
+Prevent the system from advertising Bonjour services via Multicast DNS.
+.El
+.Pp
+To cause
+.Nm
+to run with these optional arguments when it launches on OS X 10.11 (El Capitan) and later, set the
+.Sy AlwaysAppendSearchDomains
+or
+.Sy NoMulticastAdvertisements
+boolean keys to true in /Library/Preferences/com.apple.mDNSResponder.plist and reboot.
+.Pp
.Sh FILES
-.Pa /usr/sbin/mDNSResponder \" Pathname
-.\"
+.Pa /usr/sbin/mDNSResponder
+.Pa /Library/Preferences/com.apple.mDNSResponder.plist
.Pp
.Sh INFO
.Pp
@@ -112,5 +131,5 @@ daemon first appeared in Mac OS X 10.2 (Jaguar).
Also available from the Darwin open source repository
(though not officially supported by Apple) are
.Nm
-daemons for other platforms, including Mac OS 9, Microsoft Windows,
+daemons for other platforms, including Microsoft Windows,
Linux, FreeBSD, NetBSD, Solaris, and other POSIX systems.
diff --git a/mDNSResponder/mDNSShared/uds_daemon.c b/mDNSResponder/mDNSShared/uds_daemon.c
index 310df527..be89f319 100644
--- a/mDNSResponder/mDNSShared/uds_daemon.c
+++ b/mDNSResponder/mDNSShared/uds_daemon.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2003-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -171,6 +171,7 @@ struct request_state
struct reply_state *replies; // corresponding (active) reply list
req_termination_fn terminate;
DNSServiceFlags flags;
+ mDNSu32 interfaceIndex;
union
{
@@ -317,10 +318,8 @@ mDNSlocal char *AnonDataToString(const mDNSu8 *ad, int adlen, char *adstr, int a
mDNSlocal void FatalError(char *errmsg)
{
- char* ptr = NULL;
LogMsg("%s: %s", errmsg, dnssd_strerror(dnssd_errno));
- *ptr = 0; // On OS X abort() doesn't generate a crash log, but writing to zero does
- abort(); // On platforms where writing to zero doesn't generate an exception, abort instead
+ abort();
}
mDNSlocal mDNSu32 dnssd_htonl(mDNSu32 l)
@@ -546,10 +545,20 @@ mDNSlocal reply_state *create_reply(const reply_op_t op, const size_t datalen, r
// Append a reply to the list in a request object
// If our request is sharing a connection, then we append our reply_state onto the primary's list
+// If the request does not want asynchronous replies, then the reply is freed instead of being appended to any list.
mDNSlocal void append_reply(request_state *req, reply_state *rep)
{
- request_state *r = req->primary ? req->primary : req;
- reply_state **ptr = &r->replies;
+ request_state *r;
+ reply_state **ptr;
+
+ if (req->no_reply)
+ {
+ freeL("reply_state/append_reply", rep);
+ return;
+ }
+
+ r = req->primary ? req->primary : req;
+ ptr = &r->replies;
while (*ptr) ptr = &(*ptr)->next;
*ptr = rep;
rep->next = NULL;
@@ -662,6 +671,7 @@ mDNSlocal AuthRecord *read_rr_from_ipc_msg(request_state *request, int GetTTL, i
AuthRecType artype;
request->flags = flags;
+ request->interfaceIndex = interfaceIndex;
if (str_err) { LogMsg("ERROR: read_rr_from_ipc_msg - get_string"); return NULL; }
@@ -1066,7 +1076,7 @@ mDNSlocal void regrecord_callback(mDNS *const m, AuthRecord *rr, mStatus result)
if (result != mStatus_MemFree) LogMsg("regrecord_callback: error %d received after parent termination", result);
// We come here when the record is being deregistered either from DNSServiceRemoveRecord or connection_termination.
- // If the record has been updated, we need to free the rdata. Everytime we call mDNS_Update, it calls update_callback
+ // If the record has been updated, we need to free the rdata. Every time we call mDNS_Update, it calls update_callback
// with the old rdata (so that we can free it) and stores the new rdata in "rr->resrec.rdata". This means, we need
// to free the latest rdata for which the update_callback was never called with.
if (rr->resrec.rdata != &rr->rdatastorage) freeL("RData/regrecord_callback", rr->resrec.rdata);
@@ -1149,11 +1159,12 @@ mDNSlocal void set_peer_pid(request_state *request)
return;
mDNSPlatformStrCopy(request->pid_name, proc.pbsi_comm);
request->process_id = p;
+ debugf("set_peer_pid: Client PEERPID is %d %s", p, request->pid_name);
#else // !LOCAL_PEERPID
len = 0;
+ LogInfo("set_peer_pid: Not Supported on this version of OS");
if (request->sd < 0)
return;
- LogInfo("set_peer_pid: Not Supported on this version of OS");
#endif // LOCAL_PEERPID
}
@@ -1975,7 +1986,6 @@ mDNSlocal mDNSBool PreDefinedInterfaceIndex(mDNSu32 interfaceIndex)
case kDNSServiceInterfaceIndexUnicast:
case kDNSServiceInterfaceIndexP2P:
return mDNStrue;
- break;
default:
return mDNSfalse;
}
@@ -1989,6 +1999,7 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
domainname d, srv;
mStatus err;
char *AnonData = mDNSNULL;
+ const char *msgTXTData;
DNSServiceFlags flags = get_flags(&request->msgptr, request->msgend);
mDNSu32 interfaceIndex = get_uint32(&request->msgptr, request->msgend);
@@ -2012,7 +2023,7 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
// If it's one of the specially defined inteface index values, just return an error.
if (PreDefinedInterfaceIndex(interfaceIndex))
{
- LogMsg("ERROR: handle_regservice_request: bad interfaceIndex %d", interfaceIndex);
+ LogInfo("handle_regservice_request: bad interfaceIndex %d", interfaceIndex);
return(mStatus_BadParamErr);
}
@@ -2029,6 +2040,7 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
{ LogMsg("ERROR: handle_regservice_request - Couldn't read name/regtype/domain"); return(mStatus_BadParamErr); }
request->flags = flags;
+ request->interfaceIndex = interfaceIndex;
request->u.servicereg.InterfaceID = InterfaceID;
request->u.servicereg.instances = NULL;
request->u.servicereg.txtlen = 0;
@@ -2043,21 +2055,23 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
}
request->u.servicereg.txtlen = get_uint16(&request->msgptr, request->msgend);
+ msgTXTData = get_rdata(&request->msgptr, request->msgend, request->u.servicereg.txtlen);
+
+ if (!request->msgptr) { LogMsg("%3d: DNSServiceRegister(unreadable parameters)", request->sd); return(mStatus_BadParamErr); }
+
if (request->u.servicereg.txtlen)
{
request->u.servicereg.txtdata = mallocL("service_info txtdata", request->u.servicereg.txtlen);
if (!request->u.servicereg.txtdata) FatalError("ERROR: handle_regservice_request - malloc");
- mDNSPlatformMemCopy(request->u.servicereg.txtdata, get_rdata(&request->msgptr, request->msgend, request->u.servicereg.txtlen), request->u.servicereg.txtlen);
+ mDNSPlatformMemCopy(request->u.servicereg.txtdata, msgTXTData, request->u.servicereg.txtlen);
}
- if (!request->msgptr) { LogMsg("%3d: DNSServiceRegister(unreadable parameters)", request->sd); return(mStatus_BadParamErr); }
-
// Check for sub-types after the service type
request->u.servicereg.num_subtypes = ChopSubTypes(request->u.servicereg.type_as_string, &AnonData); // Note: Modifies regtype string to remove trailing subtypes
if (request->u.servicereg.num_subtypes < 0)
{
LogMsg("ERROR: handle_regservice_request - ChopSubTypes failed %s", request->u.servicereg.type_as_string);
- return(mStatus_BadParamErr);
+ goto bad_param;
}
if (AnonData)
{
@@ -2065,7 +2079,7 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
if (AnonDataLen > MAX_ANONYMOUS_DATA)
{
LogMsg("ERROR: handle_regservice_request: AnonDataLen %d", AnonDataLen);
- return(mStatus_BadParamErr);
+ goto bad_param;
}
request->u.servicereg.AnonData = mDNStrue;
}
@@ -2076,7 +2090,7 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
// Don't try to construct "domainname t" until *after* ChopSubTypes has worked its magic
if (!*request->u.servicereg.type_as_string || !MakeDomainNameFromDNSNameString(&request->u.servicereg.type, request->u.servicereg.type_as_string))
- { LogMsg("ERROR: handle_regservice_request - type_as_string bad %s", request->u.servicereg.type_as_string); return(mStatus_BadParamErr); }
+ { LogMsg("ERROR: handle_regservice_request - type_as_string bad %s", request->u.servicereg.type_as_string); goto bad_param; }
if (!name[0])
{
@@ -2092,7 +2106,7 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
name[newlen] = 0;
}
if (!MakeDomainLabelFromLiteralString(&request->u.servicereg.name, name))
- { LogMsg("ERROR: handle_regservice_request - name bad %s", name); return(mStatus_BadParamErr); }
+ { LogMsg("ERROR: handle_regservice_request - name bad %s", name); goto bad_param; }
request->u.servicereg.autoname = mDNSfalse;
}
@@ -2100,7 +2114,7 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
{
request->u.servicereg.default_domain = mDNSfalse;
if (!MakeDomainNameFromDNSNameString(&d, domain))
- { LogMsg("ERROR: handle_regservice_request - domain bad %s", domain); return(mStatus_BadParamErr); }
+ { LogMsg("ERROR: handle_regservice_request - domain bad %s", domain); goto bad_param; }
}
else
{
@@ -2109,19 +2123,16 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
}
// We don't allow the anonymous and the regular ones to coexist
- if (!CheckForMixedRegistrations(&request->u.servicereg.type, &d, request->u.servicereg.AnonData))
- {
- return(mStatus_BadParamErr);
- }
+ if (!CheckForMixedRegistrations(&request->u.servicereg.type, &d, request->u.servicereg.AnonData)) { goto bad_param; }
if (!ConstructServiceName(&srv, &request->u.servicereg.name, &request->u.servicereg.type, &d))
{
LogMsg("ERROR: handle_regservice_request - Couldn't ConstructServiceName from, “%#s” “%##s” “%##s”",
- request->u.servicereg.name.c, request->u.servicereg.type.c, d.c); return(mStatus_BadParamErr);
+ request->u.servicereg.name.c, request->u.servicereg.type.c, d.c); goto bad_param;
}
if (!MakeDomainNameFromDNSNameString(&request->u.servicereg.host, host))
- { LogMsg("ERROR: handle_regservice_request - host bad %s", host); return(mStatus_BadParamErr); }
+ { LogMsg("ERROR: handle_regservice_request - host bad %s", host); goto bad_param; }
request->u.servicereg.autorename = (flags & kDNSServiceFlagsNoAutoRename ) == 0;
request->u.servicereg.allowremotequery = (flags & kDNSServiceFlagsAllowRemoteQuery) != 0;
@@ -2168,6 +2179,11 @@ mDNSlocal mStatus handle_regservice_request(request_state *request)
}
return(err);
+
+bad_param:
+ freeL("handle_regservice_request (txtdata)", request->u.servicereg.txtdata);
+ request->u.servicereg.txtdata = NULL;
+ return mStatus_BadParamErr;
}
// ***************************************************************************
@@ -2455,9 +2471,13 @@ mDNSlocal void UpdateDeviceInfoRecord(mDNS *const m)
{
int num_autoname = 0;
request_state *req;
+
+ // Don't need to register the device info record for kDNSServiceInterfaceIndexLocalOnly registrations.
for (req = all_requests; req; req = req->next)
- if (req->terminate == regservice_termination_callback && req->u.servicereg.autoname)
+ {
+ if (req->terminate == regservice_termination_callback && req->u.servicereg.autoname && req->interfaceIndex != kDNSServiceInterfaceIndexLocalOnly)
num_autoname++;
+ }
// If DeviceInfo record is currently registered, see if we need to deregister it
if (m->DeviceInfo.resrec.RecordType != kDNSRecordTypeUnregistered)
@@ -2602,7 +2622,7 @@ mDNSlocal mStatus handle_browse_request(request_state *request)
// If it's one of the specially defined inteface index values, just return an error.
if (PreDefinedInterfaceIndex(interfaceIndex))
{
- LogMsg("ERROR: handle_browse_request: bad interfaceIndex %d", interfaceIndex);
+ LogInfo("handle_browse_request: bad interfaceIndex %d", interfaceIndex);
return(mStatus_BadParamErr);
}
@@ -2618,6 +2638,7 @@ mDNSlocal mStatus handle_browse_request(request_state *request)
if (!request->msgptr) { LogMsg("%3d: DNSServiceBrowse(unreadable parameters)", request->sd); return(mStatus_BadParamErr); }
request->flags = flags;
+ request->interfaceIndex = interfaceIndex;
typedn.c[0] = 0;
NumSubTypes = ChopSubTypes(regtype, &AnonData); // Note: Modifies regtype string to remove trailing subtypes
if (NumSubTypes < 0 || NumSubTypes > 1)
@@ -2800,7 +2821,7 @@ mDNSlocal mStatus handle_resolve_request(request_state *request)
// If it's one of the specially defined inteface index values, just return an error.
if (PreDefinedInterfaceIndex(interfaceIndex))
{
- LogMsg("ERROR: handle_resolve_request: bad interfaceIndex %d", interfaceIndex);
+ LogInfo("handle_resolve_request: bad interfaceIndex %d", interfaceIndex);
return(mStatus_BadParamErr);
}
@@ -2823,6 +2844,7 @@ mDNSlocal mStatus handle_resolve_request(request_state *request)
mDNSPlatformMemZero(&request->u.resolve, sizeof(request->u.resolve));
request->flags = flags;
+ request->interfaceIndex = interfaceIndex;
// format questions
request->u.resolve.qsrv.InterfaceID = InterfaceID;
@@ -2850,6 +2872,7 @@ mDNSlocal mStatus handle_resolve_request(request_state *request)
request->u.resolve.qsrv.qnameOrig = mDNSNULL;
request->u.resolve.qsrv.AnonInfo = mDNSNULL;
request->u.resolve.qsrv.pid = request->process_id;
+ request->u.resolve.qsrv.euid = request->uid;
request->u.resolve.qsrv.QuestionCallback = resolve_result_callback;
request->u.resolve.qsrv.QuestionContext = request;
@@ -2878,6 +2901,7 @@ mDNSlocal mStatus handle_resolve_request(request_state *request)
request->u.resolve.qtxt.qnameOrig = mDNSNULL;
request->u.resolve.qtxt.AnonInfo = mDNSNULL;
request->u.resolve.qtxt.pid = request->process_id;
+ request->u.resolve.qtxt.euid = request->uid;
request->u.resolve.qtxt.QuestionCallback = resolve_result_callback;
request->u.resolve.qtxt.QuestionContext = request;
@@ -3163,6 +3187,7 @@ mDNSlocal mStatus SendAdditionalQuery(DNSQuestion *q, request_state *request, mS
q2->TimeoutQuestion = 0;
q2->AnonInfo = mDNSNULL;
q2->pid = request->process_id;
+ q2->euid = request->uid;
}
LogOperation("%3d: DNSServiceQueryRecord(%##s, %s) unicast", request->sd, q2->qname.c, DNSTypeName(q2->qtype));
err = mDNS_StartQuery(&mDNSStorage, q2);
@@ -3342,15 +3367,16 @@ mDNSlocal void queryrecord_result_reply(mDNS *const m, request_state *req, DNSQu
(x.cr_version == XUCRED_VERSION))
{
struct sockaddr_storage addr;
- const RDataBody2 *const rdb = (RDataBody2 *)answer->rdata->u.data;
addr.ss_len = 0;
if (answer->rrtype == kDNSType_A || answer->rrtype == kDNSType_AAAA)
{
if (answer->rrtype == kDNSType_A)
{
- struct sockaddr_in *sin = (struct sockaddr_in *)&addr;
+ struct sockaddr_in *const sin = (struct sockaddr_in *)&addr;
sin->sin_port = 0;
- if (!putRData(mDNSNULL, (mDNSu8 *)&sin->sin_addr, (mDNSu8 *)(&sin->sin_addr + sizeof(rdb->ipv4)), answer))
+ // Instead of this stupid call to putRData it would be much simpler to just assign the value in the sensible way, like this:
+ // sin->sin_addr.s_addr = answer->rdata->u.ipv4.NotAnInteger;
+ if (!putRData(mDNSNULL, (mDNSu8 *)&sin->sin_addr, (mDNSu8 *)(&sin->sin_addr + sizeof(mDNSv4Addr)), answer))
LogMsg("queryrecord_result_reply: WCF AF_INET putRData failed");
else
{
@@ -3360,9 +3386,14 @@ mDNSlocal void queryrecord_result_reply(mDNS *const m, request_state *req, DNSQu
}
else if (answer->rrtype == kDNSType_AAAA)
{
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&addr;
+ struct sockaddr_in6 *const sin6 = (struct sockaddr_in6 *)&addr;
sin6->sin6_port = 0;
- if (!putRData(mDNSNULL, (mDNSu8 *)&sin6->sin6_addr, (mDNSu8 *)(&sin6->sin6_addr + sizeof(rdb->ipv6)), answer))
+ // Instead of this stupid call to putRData it would be much simpler to just assign the value in the sensible way, like this:
+ // sin6->sin6_addr.__u6_addr.__u6_addr32[0] = answer->rdata->u.ipv6.l[0];
+ // sin6->sin6_addr.__u6_addr.__u6_addr32[1] = answer->rdata->u.ipv6.l[1];
+ // sin6->sin6_addr.__u6_addr.__u6_addr32[2] = answer->rdata->u.ipv6.l[2];
+ // sin6->sin6_addr.__u6_addr.__u6_addr32[3] = answer->rdata->u.ipv6.l[3];
+ if (!putRData(mDNSNULL, (mDNSu8 *)&sin6->sin6_addr, (mDNSu8 *)(&sin6->sin6_addr + sizeof(mDNSv6Addr)), answer))
LogMsg("queryrecord_result_reply: WCF AF_INET6 putRData failed");
else
{
@@ -3658,7 +3689,7 @@ mDNSlocal void queryrecord_termination_callback(request_state *request)
mDNSlocal void SetQuestionPolicy(DNSQuestion *q, request_state *req)
{
int i;
-
+ q->euid = req->uid;
// The policy is either based on pid or UUID. Pass a zero pid
// to the "core" if the UUID is valid. If we always pass the pid,
// then the "core" needs to determine whether the uuid is valid
@@ -3681,6 +3712,8 @@ mDNSlocal void SetQuestionPolicy(DNSQuestion *q, request_state *req)
{
q->pid = req->process_id;
}
+
+ //debugf("SetQuestionPolicy: q->euid[%d] q->pid[%d] uuid is valid : %s", q->euid, q->pid, req->validUUID ? "true" : "false");
}
mDNSlocal mStatus handle_queryrecord_request(request_state *request)
@@ -3699,9 +3732,11 @@ mDNSlocal mStatus handle_queryrecord_request(request_state *request)
if (interfaceIndex && !InterfaceID)
{
// If it's one of the specially defined inteface index values, just return an error.
- if (PreDefinedInterfaceIndex(interfaceIndex))
+ // Also, caller should return an error immediately if lo0 (index 1) is not configured
+ // into the current active interfaces. See background in Radar 21967160.
+ if (PreDefinedInterfaceIndex(interfaceIndex) || interfaceIndex == 1)
{
- LogMsg("ERROR: handle_queryrecord_request: bad interfaceIndex %d", interfaceIndex);
+ LogInfo("handle_queryrecord_request: bad interfaceIndex %d", interfaceIndex);
return(mStatus_BadParamErr);
}
@@ -3719,6 +3754,7 @@ mDNSlocal mStatus handle_queryrecord_request(request_state *request)
{ LogMsg("%3d: DNSServiceQueryRecord(unreadable parameters)", request->sd); return(mStatus_BadParamErr); }
request->flags = flags;
+ request->interfaceIndex = interfaceIndex;
mDNSPlatformMemZero(&request->u.queryrecord, sizeof(request->u.queryrecord));
q->InterfaceID = InterfaceID;
@@ -3788,12 +3824,14 @@ mDNSlocal mStatus handle_queryrecord_request(request_state *request)
q->qnameOrig = mDNSNULL;
SetQuestionPolicy(q, request);
- LogOperation("%3d: DNSServiceQueryRecord(%X, %d, %##s, %s) START PID[%d](%s)",
+ LogOperation("%3d: DNSServiceQueryRecord(%X, %d, %##s, %s) START PID[%d](%s)",
request->sd, flags, interfaceIndex, q->qname.c, DNSTypeName(q->qtype), request->process_id, request->pid_name);
err = mDNS_StartQuery(&mDNSStorage, q);
- if (err)
+ if (err)
+ {
LogMsg("%3d: ERROR: DNSServiceQueryRecord %##s %s mDNS_StartQuery: %d", request->sd, q->qname.c, DNSTypeName(q->qtype), (int)err);
+ }
else
{
request->terminate = queryrecord_termination_callback;
@@ -3907,6 +3945,9 @@ mDNSlocal mStatus handle_enum_request(request_state *request)
if (!request->msgptr)
{ LogMsg("%3d: DNSServiceEnumerateDomains(unreadable parameters)", request->sd); return(mStatus_BadParamErr); }
+ request->flags = flags;
+ request->interfaceIndex = interfaceIndex;
+
// mark which kind of enumeration we're doing so that we know what domain enumeration queries to stop
request->u.enumeration.flags = reg;
@@ -4080,7 +4121,7 @@ mDNSlocal void handle_connection_delegate_request(request_state *request)
if (proc_pidinfo(request->process_id, PROC_PIDT_SHORTBSDINFO, 1, &proc, PROC_PIDT_SHORTBSDINFO_SIZE) == 0)
return;
mDNSPlatformStrCopy(request->pid_name, proc.pbsi_comm);
- //LogMsg("handle_connection_delegate_request: process id %d, name %s", request->process_id, request->pid_name);
+ debugf("handle_connection_delegate_request: process id %d, name %s", request->process_id, request->pid_name);
}
#endif
#ifdef LOCAL_PEEREUUID
@@ -4114,7 +4155,7 @@ mDNSlocal void handle_getpid_request(request_state *request)
const DNSQuestion *q = NULL;
PIDInfo pi;
- LogOperation("%3d: DNSServiceGetPID START", request->sd);
+ LogMsg("%3d: DNSServiceGetPID START", request->sd);
for (req = all_requests; req; req=req->next)
{
@@ -4131,7 +4172,7 @@ mDNSlocal void handle_getpid_request(request_state *request)
if (port == srcport)
{
pid = req->process_id;
- LogInfo("DNSServiceGetPID: srcport %d, pid %d [%s] question %##s", htons(srcport), pid, req->pid_name, q->qname.c);
+ LogMsg("DNSServiceGetPID: srcport %d, pid %d [%s] question %##s", htons(srcport), pid, req->pid_name, q->qname.c);
break;
}
}
@@ -4150,7 +4191,7 @@ mDNSlocal void handle_getpid_request(request_state *request)
#if APPLE_OSX_mDNSResponder
pid = getpid();
#endif // APPLE_OSX_mDNSResponder
- LogInfo("DNSServiceGetPID: srcport %d, pid %d [%s], question %##s", htons(srcport), pid, "_mDNSResponder", q->qname.c);
+ LogMsg("DNSServiceGetPID: srcport %d, pid %d [%s], question %##s", htons(srcport), pid, "_mDNSResponder", q->qname.c);
break;
}
}
@@ -4160,7 +4201,7 @@ mDNSlocal void handle_getpid_request(request_state *request)
pi.err = 0;
pi.pid = pid;
send_all(request->sd, (const char *)&pi, sizeof(PIDInfo));
- LogOperation("%3d: DNSServiceGetPID STOP", request->sd);
+ LogMsg("%3d: DNSServiceGetPID STOP", request->sd);
}
// ***************************************************************************
@@ -4258,6 +4299,8 @@ mDNSlocal mStatus handle_port_mapping_request(request_state *request)
if (!(protocol & (kDNSServiceProtocol_UDP | kDNSServiceProtocol_TCP))) return(mStatus_BadParamErr);
}
+ request->flags = flags;
+ request->interfaceIndex = interfaceIndex;
request->u.pm.NATinfo.Protocol = !protocol ? NATOp_AddrRequest : (protocol == kDNSServiceProtocol_UDP) ? NATOp_MapUDP : NATOp_MapTCP;
// u.pm.NATinfo.IntPort = already set above
request->u.pm.NATinfo.RequestedPort = request->u.pm.ReqExt;
@@ -4381,6 +4424,7 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
domainname d;
mStatus err = 0;
mDNSs32 serviceIndex = -1; // default unscoped value for ServiceID is -1
+ mDNSInterfaceID InterfaceID;
DNSServiceFlags flags = get_flags(&request->msgptr, request->msgend);
@@ -4398,7 +4442,7 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
mDNSPlatformMemZero(&request->u.addrinfo, sizeof(request->u.addrinfo));
- mDNSInterfaceID InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(&mDNSStorage, interfaceIndex);
+ InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(&mDNSStorage, interfaceIndex);
// The request is scoped to a specific interface index, but the
// interface is not currently in our list.
@@ -4407,7 +4451,7 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
// If it's one of the specially defined inteface index values, just return an error.
if (PreDefinedInterfaceIndex(interfaceIndex))
{
- LogMsg("ERROR: handle_addrinfo_request: bad interfaceIndex %d", interfaceIndex);
+ LogInfo("handle_addrinfo_request: bad interfaceIndex %d", interfaceIndex);
return(mStatus_BadParamErr);
}
@@ -4416,6 +4460,9 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
InterfaceID = (mDNSInterfaceID)(uintptr_t)interfaceIndex;
LogInfo("handle_addrinfo_request: query pending for interface index %d", interfaceIndex);
}
+
+ request->flags = flags;
+ request->interfaceIndex = interfaceIndex;
request->u.addrinfo.interface_id = InterfaceID;
request->u.addrinfo.flags = flags;
request->u.addrinfo.protocol = get_uint32(&request->msgptr, request->msgend);
@@ -4554,8 +4601,7 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
}
}
- LogOperation("%3d: DNSServiceGetAddrInfo(%X, %d, %d, %##s) START PID[%d](%s)", request->sd, flags, interfaceIndex,
- request->u.addrinfo.protocol, d.c, request->process_id, request->pid_name);
+ LogOperation("%3d: DNSServiceGetAddrInfo(%X, %d, %d, %##s) START PID[%d](%s)", request->sd, flags, interfaceIndex, request->u.addrinfo.protocol, d.c, request->process_id, request->pid_name);
return(err);
}
@@ -4660,12 +4706,10 @@ mDNSlocal void read_msg(request_state *req)
#if !defined(_WIN32)
cmsg = CMSG_FIRSTHDR(&msg);
#if DEBUG_64BIT_SCM_RIGHTS
- LogMsg("%3d: Expecting %d %d %d %d", req->sd, sizeof(cbuf), sizeof(cbuf), SOL_SOCKET, SCM_RIGHTS);
- LogMsg("%3d: Got %d %d %d %d", req->sd, msg.msg_controllen, cmsg->cmsg_len, cmsg->cmsg_level, cmsg->cmsg_type);
+ LogMsg("%3d: Expecting %d %d %d %d", req->sd, sizeof(cbuf), sizeof(cbuf), SOL_SOCKET, SCM_RIGHTS);
+ LogMsg("%3d: Got %d %d %d %d", req->sd, msg.msg_controllen, cmsg ? cmsg->cmsg_len : -1, cmsg ? cmsg->cmsg_level : -1, cmsg ? cmsg->cmsg_type : -1);
#endif // DEBUG_64BIT_SCM_RIGHTS
- if (msg.msg_controllen != 0 &&
- cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_RIGHTS)
+ if (cmsg && cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS)
{
#if APPLE_OSX_mDNSResponder
// Strictly speaking BPF_fd belongs solely in the platform support layer, but because
@@ -4685,7 +4729,7 @@ mDNSlocal void read_msg(request_state *req)
#endif // DEBUG_64BIT_SCM_RIGHTS
if (req->data_bytes < req->hdr.datalen)
{
- LogMsg("%3d: Client(PID [%d](%s)) sent error socket %d via SCM_RIGHTS with req->data_bytes %d < req->hdr.datalen %d",
+ LogMsg("%3d: Client(PID [%d](%s)) sent result code socket %d via SCM_RIGHTS with req->data_bytes %d < req->hdr.datalen %d",
req->sd, req->process_id, req->pid_name, req->errsd, req->data_bytes, req->hdr.datalen);
req->ts = t_error;
return;
@@ -4752,7 +4796,7 @@ mDNSlocal void read_msg(request_state *req)
#if !defined(USE_TCP_LOOPBACK)
got_errfd:
#endif
- LogOperation("%3d: Error socket %d created %08X %08X", req->sd, req->errsd, req->hdr.client_context.u32[1], req->hdr.client_context.u32[0]);
+ LogOperation("%3d: Result code socket %d created %08X %08X", req->sd, req->errsd, req->hdr.client_context.u32[1], req->hdr.client_context.u32[0]);
#if defined(_WIN32)
if (ioctlsocket(req->errsd, FIONBIO, &opt) != 0)
#else
@@ -4857,9 +4901,6 @@ mDNSlocal void request_callback(int fd, short filter, void *info)
return;
}
- // check if client wants silent operation
- if (req->hdr.ipc_flags & IPC_FLAGS_NOREPLY) req->no_reply = 1;
-
// If req->terminate is already set, this means this operation is sharing an existing connection
if (req->terminate && !LightweightOp(req->hdr.op))
{
@@ -4897,6 +4938,9 @@ mDNSlocal void request_callback(int fd, short filter, void *info)
req = newreq;
}
+ // Check if the request wants no asynchronous replies.
+ if (req->hdr.ipc_flags & IPC_FLAGS_NOREPLY) req->no_reply = 1;
+
// If we're shutting down, don't allow new client requests
// We do allow "cancel" and "getproperty" during shutdown
if (mDNSStorage.ShutdownTime && req->hdr.op != cancel_request && req->hdr.op != getproperty_request)
@@ -4954,7 +4998,7 @@ mDNSlocal void request_callback(int fd, short filter, void *info)
send_all(req->errsd, (const char *)&err_netorder, sizeof(err_netorder));
if (req->errsd != req->sd)
{
- LogOperation("%3d: Error socket %d closed %08X %08X (%d)",
+ LogOperation("%3d: Result code socket %d closed %08X %08X (%d)",
req->sd, req->errsd, req->hdr.client_context.u32[1], req->hdr.client_context.u32[0], err);
dnssd_close(req->errsd);
req->errsd = req->sd;
@@ -5019,11 +5063,14 @@ mDNSlocal void connect_callback(int fd, short filter, void *info)
#if APPLE_OSX_mDNSResponder
struct xucred x;
socklen_t xucredlen = sizeof(x);
- if (getsockopt(sd, 0, LOCAL_PEERCRED, &x, &xucredlen) >= 0 && x.cr_version == XUCRED_VERSION) request->uid = x.cr_uid;
- else my_perror("ERROR: getsockopt, LOCAL_PEERCRED");
+ if (getsockopt(sd, 0, LOCAL_PEERCRED, &x, &xucredlen) >= 0 && x.cr_version == XUCRED_VERSION)
+ request->uid = x.cr_uid; // save the effective userid of the client
+ else
+ my_perror("ERROR: getsockopt, LOCAL_PEERCRED");
+
debugf("LOCAL_PEERCRED %d %u %u %d", xucredlen, x.cr_version, x.cr_uid, x.cr_ngroups);
#endif // APPLE_OSX_mDNSResponder
- LogOperation("%3d: Adding FD for uid %u", request->sd, request->uid);
+ LogOperation("%3d: connect_callback: Adding FD for uid %u", request->sd, request->uid);
udsSupportAddFDToEventLoop(sd, request_callback, request, &request->platform_data);
}
}
@@ -5064,7 +5111,7 @@ mDNSlocal mDNSBool uds_socket_setup(dnssd_sock_t skt)
}
else
{
- LogMsg("%3d: Listening for incoming Unix Domain Socket client requests", skt);
+ LogOperation("%3d: Listening for incoming Unix Domain Socket client requests", skt);
mDNSStorage.uds_listener_skt = skt;
}
return mDNStrue;
@@ -5244,8 +5291,8 @@ mDNSlocal void LogClientInfo(mDNS *const m, request_state *req)
prefix, num_records, num_records != 1 ? "s" : "", num_ops, num_ops != 1 ? "s" : "",
req->process_id, req->pid_name);
for (p = req->u.reg_recs; p; p=p->next)
- LogMsgNoIdent(" -> DNSServiceRegisterRecord %3d %s PID[%d](%s)", p->key, ARDisplayString(m, p->rr),
- req->process_id, req->pid_name);
+ LogMsgNoIdent(" -> DNSServiceRegisterRecord 0x%08X %2d %3d %s PID[%d](%s)",
+ req->flags, req->interfaceIndex, p->key, ARDisplayString(m, p->rr), req->process_id, req->pid_name);
for (r = req->next; r; r=r->next) if (r->primary == req) LogClientInfo(m, r);
}
else if (req->terminate == regservice_termination_callback)
@@ -5253,32 +5300,34 @@ mDNSlocal void LogClientInfo(mDNS *const m, request_state *req)
service_instance *ptr;
char anonstr[256];
for (ptr = req->u.servicereg.instances; ptr; ptr = ptr->next)
- LogMsgNoIdent("%s DNSServiceRegister %##s%s %u/%u PID[%d](%s)",
- (ptr == req->u.servicereg.instances) ? prefix : " ", ptr->srs.RR_SRV.resrec.name->c,
- AnonDataToString(ptr->srs.AnonData, 0, anonstr, sizeof(anonstr)), mDNSVal16(req->u.servicereg.port),
- SRS_PORT(&ptr->srs), req->process_id, req->pid_name);
+ LogMsgNoIdent("%s DNSServiceRegister 0x%08X %2d %##s%s %u/%u PID[%d](%s)",
+ (ptr == req->u.servicereg.instances) ? prefix : " ", req->flags, req->interfaceIndex, ptr->srs.RR_SRV.resrec.name->c,
+ AnonDataToString(ptr->srs.AnonData, 0, anonstr, sizeof(anonstr)), mDNSVal16(req->u.servicereg.port),
+ SRS_PORT(&ptr->srs), req->process_id, req->pid_name);
}
else if (req->terminate == browse_termination_callback)
{
browser_t *blist;
char anonstr[256];
for (blist = req->u.browser.browsers; blist; blist = blist->next)
- LogMsgNoIdent("%s DNSServiceBrowse %##s%s PID[%d](%s)",
- (blist == req->u.browser.browsers) ? prefix : " ",blist->q.qname.c,
- AnonDataToString(req->u.browser.AnonData, 0, anonstr, sizeof(anonstr)), req->process_id, req->pid_name);
+ LogMsgNoIdent("%s DNSServiceBrowse 0x%08X %2d %##s%s PID[%d](%s)",
+ (blist == req->u.browser.browsers) ? prefix : " ", req->flags, req->interfaceIndex, blist->q.qname.c,
+ AnonDataToString(req->u.browser.AnonData, 0, anonstr, sizeof(anonstr)), req->process_id, req->pid_name);
}
else if (req->terminate == resolve_termination_callback)
- LogMsgNoIdent("%s DNSServiceResolve %##s PID[%d](%s)",
- prefix, req->u.resolve.qsrv.qname.c, req->process_id, req->pid_name);
+ LogMsgNoIdent("%s DNSServiceResolve 0x%08X %2d %##s PID[%d](%s)",
+ prefix, req->flags, req->interfaceIndex, req->u.resolve.qsrv.qname.c, req->process_id, req->pid_name);
else if (req->terminate == queryrecord_termination_callback)
- LogMsgNoIdent("%s DNSServiceQueryRecord %##s (%s) PID[%d](%s)",
- prefix, req->u.queryrecord.q.qname.c, DNSTypeName(req->u.queryrecord.q.qtype), req->process_id, req->pid_name);
+ LogMsgNoIdent("%s DNSServiceQueryRecord 0x%08X %2d %##s (%s) PID[%d](%s)",
+ prefix, req->flags, req->interfaceIndex, req->u.queryrecord.q.qname.c, DNSTypeName(req->u.queryrecord.q.qtype), req->process_id, req->pid_name);
else if (req->terminate == enum_termination_callback)
- LogMsgNoIdent("%s DNSServiceEnumerateDomains %##s PID[%d](%s)", prefix, req->u.enumeration.q_all.qname.c,
- req->process_id, req->pid_name);
+ LogMsgNoIdent("%s DNSServiceEnumerateDomains 0x%08X %2d %##s PID[%d](%s)",
+ prefix, req->flags, req->interfaceIndex, req->u.enumeration.q_all.qname.c, req->process_id, req->pid_name);
else if (req->terminate == port_mapping_termination_callback)
- LogMsgNoIdent("%s DNSServiceNATPortMapping %s%s Int %5d Req %5d Ext %.4a:%5d Req TTL %5d Granted TTL %5d PID[%d](%s)",
+ LogMsgNoIdent("%s DNSServiceNATPortMapping 0x%08X %2d %s%s Int %5d Req %5d Ext %.4a:%5d Req TTL %5d Granted TTL %5d PID[%d](%s)",
prefix,
+ req->flags,
+ req->interfaceIndex,
req->u.pm.NATinfo.Protocol & NATOp_MapTCP ? "TCP" : " ",
req->u.pm.NATinfo.Protocol & NATOp_MapUDP ? "UDP" : " ",
mDNSVal16(req->u.pm.NATinfo.IntPort),
@@ -5289,7 +5338,8 @@ mDNSlocal void LogClientInfo(mDNS *const m, request_state *req)
req->u.pm.NATinfo.Lifetime,
req->process_id, req->pid_name);
else if (req->terminate == addrinfo_termination_callback)
- LogMsgNoIdent("%s DNSServiceGetAddrInfo %s%s %##s PID[%d](%s)", prefix,
+ LogMsgNoIdent("%s DNSServiceGetAddrInfo 0x%08X %2d %s%s %##s PID[%d](%s)",
+ prefix, req->flags, req->interfaceIndex,
req->u.addrinfo.protocol & kDNSServiceProtocol_IPv4 ? "v4" : " ",
req->u.addrinfo.protocol & kDNSServiceProtocol_IPv6 ? "v6" : " ",
req->u.addrinfo.q4.qname.c, req->process_id, req->pid_name);
@@ -5523,19 +5573,22 @@ mDNSlocal void LogOneAuthRecord(mDNS *const m, const AuthRecord *ar, mDNSs32 now
char anstr[256];
if (AuthRecord_uDNS(ar))
{
- LogMsgNoIdent("%7d %7d %7d %7d %s",
+ LogMsgNoIdent("%7d %7d %7d %7d %s %s",
ar->ThisAPInterval / mDNSPlatformOneSecond,
(ar->LastAPTime + ar->ThisAPInterval - now) / mDNSPlatformOneSecond,
ar->expire ? (ar->expire - now) / mDNSPlatformOneSecond : 0,
- ar->state, ARDisplayString(m, ar));
+ ar->state,
+ ar->AllowRemoteQuery ? "☠" : " ",
+ ARDisplayString(m, ar));
}
else
{
- LogMsgNoIdent("%7d %7d %7d %7s %s%s",
+ LogMsgNoIdent("%7d %7d %7d %7s %s %s%s",
ar->ThisAPInterval / mDNSPlatformOneSecond,
ar->AnnounceCount ? (ar->LastAPTime + ar->ThisAPInterval - now) / mDNSPlatformOneSecond : 0,
ar->TimeExpire ? (ar->TimeExpire - now) / mDNSPlatformOneSecond : 0,
ifname ? ifname : "ALL",
+ ar->AllowRemoteQuery ? "☠" : " ",
ARDisplayString(m, ar), AnonInfoToString(ar->resrec.AnonInfo, anstr, sizeof(anstr)));
}
}
@@ -5988,11 +6041,8 @@ foundparent:;
LogMsgNoIdent("m->WABBrowseQueriesCount %d", m->WABBrowseQueriesCount);
LogMsgNoIdent("m->WABLBrowseQueriesCount %d", m->WABLBrowseQueriesCount);
LogMsgNoIdent("m->WABRegQueriesCount %d", m->WABRegQueriesCount);
- LogMsgNoIdent("m->mDNSOppCaching %d", m->mDNSOppCaching);
LogMsgNoIdent("m->AutoTargetServices %d", m->AutoTargetServices);
-#define LogTimer(MSG,T) LogMsgNoIdent( MSG " %08X %11d %08X %11d", (T), (T), (T)-now, (T)-now)
-
LogMsgNoIdent(" ABS (hex) ABS (dec) REL (hex) REL (dec)");
LogMsgNoIdent("m->timenow %08X %11d", now, now);
LogMsgNoIdent("m->timenow_adjust %08X %11d", m->timenow_adjust, m->timenow_adjust);
@@ -6097,7 +6147,6 @@ mDNSlocal int send_msg(request_state *const req)
{
reply_state *const rep = req->replies; // Send the first waiting reply
ssize_t nwriten;
- if (req->no_reply) return(t_complete);
ConvertHeaderBytes(rep->mhdr);
nwriten = send(req->sd, (char *)&rep->mhdr + rep->nwriten, rep->totallen - rep->nwriten, 0);
@@ -6159,7 +6208,7 @@ mDNSexport mDNSs32 udsserver_idle(mDNSs32 nextevent)
}
else if (result == t_terminated || result == t_error)
{
- LogMsg("%3d: Could not write data to clientPID[%d](%s) because of error - aborting connection", r->sd, r->process_id, r->pid_name);
+ LogMsg("%3d: Could not write data to client PID[%d](%s) because of error - aborting connection", r->sd, r->process_id, r->pid_name);
LogClientInfo(&mDNSStorage, r);
abort_request(r);
}
@@ -6215,7 +6264,7 @@ struct CompileTimeAssertionChecks_uds_daemon
char sizecheck_request_state [(sizeof(request_state) <= 2000) ? 1 : -1];
char sizecheck_registered_record_entry[(sizeof(registered_record_entry) <= 60) ? 1 : -1];
char sizecheck_service_instance [(sizeof(service_instance) <= 6552) ? 1 : -1];
- char sizecheck_browser_t [(sizeof(browser_t) <= 1096) ? 1 : -1];
+ char sizecheck_browser_t [(sizeof(browser_t) <= 1128) ? 1 : -1];
char sizecheck_reply_hdr [(sizeof(reply_hdr) <= 12) ? 1 : -1];
char sizecheck_reply_state [(sizeof(reply_state) <= 64) ? 1 : -1];
};
diff --git a/mDNSResponder/mDNSShared/uds_daemon.h b/mDNSResponder/mDNSShared/uds_daemon.h
index ca361172..6cc9197d 100644
--- a/mDNSResponder/mDNSShared/uds_daemon.h
+++ b/mDNSResponder/mDNSShared/uds_daemon.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2013 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,13 +13,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-
- File: uds_daemon.h
-
- Contains: Interfaces necessary to talk to uds_daemon.c.
-
- Version: 1.0
-
*/
#include "mDNSEmbeddedAPI.h"
@@ -29,6 +22,8 @@
#define SRS_PORT(S) mDNSVal16((S)->RR_SRV.resrec.rdata->u.srv.port)
+#define LogTimer(MSG,T) LogMsgNoIdent( MSG " %08X %11d %08X %11d", (T), (T), (T)-now, (T)-now)
+
extern int udsserver_init(dnssd_sock_t skts[], mDNSu32 count);
extern mDNSs32 udsserver_idle(mDNSs32 nextevent);
extern void udsserver_info(mDNS *const m); // print out info about current state
diff --git a/mDNSResponder/mDNSWindows/mDNSWin32.c b/mDNSResponder/mDNSWindows/mDNSWin32.c
index fd11c58a..0789cf4d 100755
--- a/mDNSResponder/mDNSWindows/mDNSWin32.c
+++ b/mDNSResponder/mDNSWindows/mDNSWin32.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4 -*-
*
- * Copyright (c) 2002-2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2013, 2015 Apple Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -2145,7 +2145,7 @@ exit:
}
mDNSexport void mDNSPlatformSendKeepalive(mDNSAddr *sadd, mDNSAddr *dadd, mDNSIPPort *lport, mDNSIPPort *rport, mDNSu32 seq, mDNSu32 ack, mDNSu16 win)
- {
+{
(void) sadd; // Unused
(void) dadd; // Unused
(void) lport; // Unused
@@ -2153,49 +2153,50 @@ mDNSexport void mDNSPlatformSendKeepalive(mDNSAddr *sadd, mDNSAddr *dadd, mDNSIP
(void) seq; // Unused
(void) ack; // Unused
(void) win; // Unused
- }
+}
-mDNSexport mStatus mDNSPlatformGetRemoteMacAddr(mDNSAddr *raddr, char *eth)
- {
- (void) raddr; // Unused
- (void) eth; // Unused
- }
+mDNSexport mStatus mDNSPlatformGetRemoteMacAddr(mDNS *const m, mDNSAddr *raddr)
+{
+ (void) m; // Unused
+ (void) raddr; // Unused
+
+ return mStatus_UnsupportedErr;
+}
mDNSexport mStatus mDNSPlatformStoreSPSMACAddr(mDNSAddr *spsaddr, char *ifname)
- {
+{
(void) spsaddr; // Unused
(void) ifname; // Unused
- }
+
+ return mStatus_UnsupportedErr;
+}
mDNSexport mStatus mDNSPlatformClearSPSMACAddr(void)
- {
- }
+{
+ return mStatus_UnsupportedErr;
+}
mDNSexport mStatus mDNSPlatformRetrieveTCPInfo(mDNS *const m, mDNSAddr *laddr, mDNSIPPort *lport, mDNSAddr *raddr, mDNSIPPort *rport, mDNSTCPInfo *mti)
- {
+{
(void) m; // Unused
(void) laddr; // Unused
(void) raddr; // Unused
(void) lport; // Unused
(void) rport; // Unused
(void) mti; // Unused
- }
-mDNSexport mDNSBool mDNSPlatformAllowPID(mDNS *const m, DNSQuestion *q)
- {
- (void) m;
- (void) q;
- return mDNStrue;
- }
+ return mStatus_UnsupportedErr;
+}
-mDNSexport mDNSs32 mDNSPlatformGetServiceID(mDNS *const m, DNSQuestion *q)
- {
+mDNSexport void mDNSPlatformGetDNSRoutePolicy(mDNS *const m, DNSQuestion *q, mDNSBool *isCellBlocked)
+{
(void) m;
- (void) q;
- return -1;
- }
-mDNSexport void mDNSPlatformSetDelegatePID(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q)
+ q->ServiceID = -1;
+ *isCellBlocked = mDNSfalse;
+}
+
+mDNSexport void mDNSPlatformSetuDNSSocktOpt(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q)
{
(void) src;
(void) dst;
@@ -2886,6 +2887,7 @@ mDNSlocal mStatus SetupInterface( mDNS * const inMDNS, const struct ifaddrs *inI
// If interface is a direct link, address record will be marked as kDNSRecordTypeKnownUnique
// and skip the probe phase of the probe/announce packet sequence.
ifd->interfaceInfo.DirectLink = mDNSfalse;
+ ifd->interfaceInfo.SupportsUnicastMDNSResponse = mDNStrue;
err = mDNS_RegisterInterface( inMDNS, &ifd->interfaceInfo, mDNSfalse );
require_noerr( err, exit );