mDNSResponder: Update to v567

The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-567.tar.gz

Update #3522.
This commit is contained in:
Sebastian Huber 2018-09-19 08:49:34 +02:00
parent 111789e4af
commit e36ca10181
24 changed files with 308 additions and 171 deletions

BIN
mDNSResponder/.DS_Store vendored Normal file

Binary file not shown.

BIN
mDNSResponder/._.DS_Store Normal file

Binary file not shown.

BIN
mDNSResponder/Clients/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
# -*- tab-width: 4 -*-
#
# Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
# Copyright (c) 2002-2004, 2015 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.
@ -20,6 +20,10 @@
# $+ means "The names of all the prerequisites, with spaces between them, exactly as given"
# For more magic automatic variables, see
# <http://www.gnu.org/software/make/manual/html_chapter/make_10.html#SEC111>
#
# This makefile uses $(CC) for compilation and linking, which is
# an automatic implicit gcc variable that defaults to "cc"
# <https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html>
#############################################################################
@ -42,10 +46,10 @@ build:
mkdir build
build/dns-sd: build dns-sd.c ClientCommon.c
cc $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@
$(CC) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@
build/dns-sd64: build dns-sd.c ClientCommon.c
cc $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ -m64
$(CC) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ -m64
# Note, we can make a 'fat' version of dns-sd using 'lipo', as shown below, but we
# don't, because we don't want or need a 'fat' version of dns-sd, because it will

View File

@ -1617,7 +1617,6 @@ int main(int argc, char **argv)
err = RegisterService(&client, argv[opi+0], typ, dom, NULL, argv[opi+3], argc-(opi+4), argv+(opi+4), flags);
break;
case 'P': if (argc < opi+6) goto Fail;
err = DNSServiceCreateConnection(&client_pa);
if (err) { fprintf(stderr, "DNSServiceCreateConnection returned %d\n", err); return(err); }
@ -1781,7 +1780,12 @@ int main(int argc, char **argv)
default: goto Fail;
}
if (!client || err != kDNSServiceErr_NoError) { fprintf(stderr, "DNSService call failed %ld\n", (long int)err); return (-1); }
if (!client || err != kDNSServiceErr_NoError)
{
fprintf(stderr, "DNSService call failed %ld%s\n", (long int)err,
(err == kDNSServiceErr_ServiceNotRunning) ? " (Service Not Running)" : "");
return (-1);
}
printtimestamp();
printf("...STARTING...\n");
HandleEvents();

View File

@ -16,7 +16,7 @@
include $(MAKEFILEPATH)/pb_makefiles/platform.make
MVERS = "mDNSResponder-561.1.1"
MVERS = "mDNSResponder-567"
DDNSWRITECONFIG = "$(DSTROOT)/Library/Application Support/Bonjour/ddnswriteconfig"
VER =

View File

@ -370,7 +370,7 @@ mDNSexport char *GetRRDisplayString_rdb(const ResourceRecord *const rr, const RD
char *ptr = buffer;
mDNSu32 length = mDNS_snprintf(buffer, MaxMsg-1, "%4d %##s %s ", rr->rdlength, rr->name->c, DNSTypeName(rr->rrtype));
if (rr->RecordType == kDNSRecordTypePacketNegative) return(buffer);
if (!rr->rdlength) { mDNS_snprintf(buffer+length, RemSpc, "<< ZERO RDATA LENGTH >>"); return(buffer); }
if (!rr->rdlength && rr->rrtype != kDNSType_OPT) { mDNS_snprintf(buffer+length, RemSpc, "<< ZERO RDATA LENGTH >>"); return(buffer); }
switch (rr->rrtype)
{
@ -408,6 +408,7 @@ mDNSexport char *GetRRDisplayString_rdb(const ResourceRecord *const rr, const RD
switch(opt->opt)
{
case kDNSOpt_LLQ:
length += mDNS_snprintf(buffer+length, RemSpc, " LLQ");
length += mDNS_snprintf(buffer+length, RemSpc, " Vers %d", opt->u.llq.vers);
length += mDNS_snprintf(buffer+length, RemSpc, " Op %d", opt->u.llq.llqOp);
length += mDNS_snprintf(buffer+length, RemSpc, " Err/Port %d", opt->u.llq.err);
@ -418,6 +419,7 @@ mDNSexport char *GetRRDisplayString_rdb(const ResourceRecord *const rr, const RD
length += mDNS_snprintf(buffer+length, RemSpc, " Lease %d", opt->u.updatelease);
break;
case kDNSOpt_Owner:
length += mDNS_snprintf(buffer+length, RemSpc, " Owner");
length += mDNS_snprintf(buffer+length, RemSpc, " Vers %d", opt->u.owner.vers);
length += mDNS_snprintf(buffer+length, RemSpc, " Seq %3d", (mDNSu8)opt->u.owner.seq); // Display as unsigned
length += mDNS_snprintf(buffer+length, RemSpc, " MAC %.6a", opt->u.owner.HMAC.b);
@ -429,6 +431,7 @@ mDNSexport char *GetRRDisplayString_rdb(const ResourceRecord *const rr, const RD
}
break;
case kDNSOpt_Trace:
length += mDNS_snprintf(buffer+length, RemSpc, " Trace");
length += mDNS_snprintf(buffer+length, RemSpc, " Platform %d", opt->u.tracer.platf);
length += mDNS_snprintf(buffer+length, RemSpc, " mDNSVers %d", opt->u.tracer.mDNSv);
break;
@ -3201,6 +3204,12 @@ mDNSexport mDNSBool SetRData(const DNSMessage *const msg, const mDNSu8 *ptr, con
opt->u.tracer.mDNSv = (mDNSu32) ((mDNSu32)ptr[1] << 24 | (mDNSu32)ptr[2] << 16 | (mDNSu32)ptr[3] << 8 | ptr[4]);
opt++;
}
else
{
opt->u.tracer.platf = 0xFF;
opt->u.tracer.mDNSv = 0xFFFFFFFF;
opt++;
}
break;
}
ptr += currentopt->optlen;

View File

@ -23,7 +23,7 @@
* routines, or types (which may or may not be present on any given platform).
*/
#include "DNSCommon.h" // Defines general DNS untility routines
#include "DNSCommon.h" // Defines general DNS utility routines
#include "uDNS.h" // Defines entry points into unicast-specific routines
#include "nsec.h"
#include "dnssec.h"
@ -11170,7 +11170,7 @@ mDNSlocal mDNSBool CacheRecordRmvEventsForQuestion(mDNS *const m, DNSQuestion *q
mDNSlocal void SuppressStatusChanged(mDNS *const m, DNSQuestion *q, DNSQuestion **restart)
{
// NOTE: CacheRecordRmvEventsForQuestion will not generate RMV events for queries that have non-zero
// LOddressAnswers. Hence it is important that we call CacheRecordRmvEventsForQuestion before
// LOAddressAnswers. Hence it is important that we call CacheRecordRmvEventsForQuestion before
// LocalRecordRmvEventsForQuestion (which decrements LOAddressAnswers)
if (q->SuppressQuery)
{

View File

@ -96,6 +96,9 @@ extern "C" {
#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!
// 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

View File

@ -1329,7 +1329,8 @@ mDNSlocal void tcpCallback(TCPSocket *sock, void *context, mDNSBool ConnectionEs
else
{
long n;
if (tcpInfo->nread < 2) // First read the two-byte length preceeding the DNS message
const mDNSBool Read_replylen = (tcpInfo->nread < 2); // Do we need to read the replylen field first?
if (Read_replylen) // First read the two-byte length preceeding the DNS message
{
mDNSu8 *lenptr = (mDNSu8 *)&tcpInfo->replylen;
n = mDNSPlatformReadTCP(sock, lenptr + tcpInfo->nread, 2 - tcpInfo->nread, &closed);
@ -1377,8 +1378,13 @@ mDNSlocal void tcpCallback(TCPSocket *sock, void *context, mDNSBool ConnectionEs
if (n < 0)
{
LogMsg("ERROR: tcpCallback - read returned %d", n);
err = mStatus_ConnFailed;
// If this is our only read for this invokation, and it fails, then that's bad.
// But if we did successfully read some or all of the replylen field this time through,
// and this is now our second read from the socket, then it's expected that sometimes
// there may be no more data present, and that's perfectly okay.
// Assuming failure of the second read is a problem is what caused this bug:
// <rdar://problem/15043194> mDNSResponder fails to read DNS over TCP packet correctly
if (!Read_replylen) { LogMsg("ERROR: tcpCallback - read returned %d", n); err = mStatus_ConnFailed; }
goto exit;
}
else if (closed)

View File

@ -1,8 +1,2 @@
#include "<DEVELOPER_DIR>/AppleInternal/XcodeConfig/SimulatorSupport.xcconfig"
// Set INSTALL_PATH[sdk=macosx*] when SimulatorSupport.xcconfig is unavailable
INSTALL_PATH[sdk=macosx*] = $(INSTALL_PATH_ACTUAL)
// Use $(INSTALL_PATH_PREFIX) instead of $(SDKROOT) as an unconditional prefix
PUBLIC_HEADERS_FOLDER_PATH = $(INSTALL_PATH_PREFIX)/usr/include
PRIVATE_HEADERS_FOLDER_PATH = $(INSTALL_PATH_PREFIX)/usr/local/include
PUBLIC_HEADERS_FOLDER_PATH = /usr/include
PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include

View File

@ -2593,6 +2593,14 @@ mDNSlocal void KQWokenFlushBytes(int fd, __unused short filter, __unused void *c
while (recv(fd, buffer, sizeof(buffer), MSG_DONTWAIT) > 0) continue;
}
mDNSlocal void SetLowWater(const KQSocketSet *const k, const int r)
{
if (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)
LogMsg("SO_RCVLOWAT IPv6 %d error %d errno %d (%s)", k->sktv6, r, errno, strerror(errno));
}
mDNSlocal void * KQueueLoop(void *m_param)
{
mDNS *m = m_param;
@ -2678,6 +2686,13 @@ mDNSlocal void * KQueueLoop(void *m_param)
// 3. The timeout expires
pthread_mutex_unlock(&PlatformStorage.BigMutex);
// If we woke up to receive a multicast, set low-water mark to dampen excessive wakeup rate
if (m->p->num_mcasts)
{
SetLowWater(&m->p->permanentsockets, 0x10000);
if (ticks > mDNSPlatformOneSecond / 8) ticks = mDNSPlatformOneSecond / 8;
}
#if USE_SELECT_WITH_KQUEUEFD
struct timeval timeout;
timeout.tv_sec = ticks / mDNSPlatformOneSecond;
@ -2705,6 +2720,13 @@ mDNSlocal void * KQueueLoop(void *m_param)
// makes the event no longer valid. Now we have the lock, we call kevent again
// and this time we can safely process the events it tells us about.
// If we changed UDP socket low-water mark, restore it, so we will be told about every packet
if (m->p->num_mcasts)
{
SetLowWater(&m->p->permanentsockets, 1);
m->p->num_mcasts = 0;
}
static const struct timespec zero_timeout = { 0, 0 };
int events_found;
while ((events_found = kevent(KQueueFD, NULL, 0, new_events, kEventsToReadAtOnce, &zero_timeout)) != 0)

View File

@ -615,7 +615,7 @@ do_mDNSPreferencesSetName(__unused mach_port_t port, int key, const char* old, c
}
// If we are not showing the dialogue, we need to remember the first "old" value so that
// we maintain the same through the lifetime of the dialogue. Subsequence conflicts don't
// we maintain the same through the lifetime of the dialogue. Subsequent conflicts don't
// update the "old" value.
if (!user[0])
{

View File

@ -2064,6 +2064,9 @@ mDNSexport void myKQSocketCallBack(int s1, short filter, void *context)
err = myrecvfrom(s1, &m->imsg, sizeof(m->imsg), (struct sockaddr *)&from, &fromlen, &destAddr, packetifname, &ttl);
if (err < 0) break;
if ((destAddr.type == mDNSAddrType_IPv4 && (destAddr.ip.v4.b[0] & 0xF0) == 0xE0) ||
(destAddr.type == mDNSAddrType_IPv6 && (destAddr.ip.v6.b[0] == 0xFF))) m->p->num_mcasts++;
count++;
if (from.ss_family == AF_INET)
{
@ -3010,8 +3013,11 @@ mDNSlocal mStatus SetupSocket(KQSocketSet *cp, const mDNSIPPort port, u_short sa
#endif // SO_RECV_ANYIF
// ... with a shared UDP port, if it's for multicast receiving
if (mDNSSameIPPort(port, MulticastDNSPort) || mDNSSameIPPort(port, NATPMPAnnouncementPort)) err = setsockopt(skt, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on));
if (err < 0) { errstr = "setsockopt - SO_REUSEPORT"; goto fail; }
if (mDNSSameIPPort(port, MulticastDNSPort) || mDNSSameIPPort(port, NATPMPAnnouncementPort))
{
err = setsockopt(skt, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on));
if (err < 0) { errstr = "setsockopt - SO_REUSEPORT"; goto fail; }
}
if (sa_family == AF_INET)
{
@ -6074,7 +6080,7 @@ mDNSlocal void SetupDDNSDomains(domainname *const fqdn, DNameListElem **RegDomai
char buf[MAX_ESCAPED_DOMAIN_NAME]; // Max legal C-string name, including terminating NUL
domainname d;
SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:mDNSPlatformSetDNSConfig"), NULL, NULL);
SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("mDNSResponder:SetupDDNSDomains"), NULL, NULL);
if (!store)
{
LogMsg("SetupDDNSDomains: SCDynamicStoreCreate failed: %s", SCErrorString(SCError()));
@ -6199,7 +6205,7 @@ mDNSexport mDNSBool mDNSPlatformSetDNSConfig(mDNS *const m, mDNSBool setservers,
static mDNSu16 resolverGroupID = 0;
// Need to set these here because we need to do this even if SCDynamicStoreCreate() or SCDynamicStoreCopyValue() below don't succeed
if (fqdn) fqdn->c[0] = 0;
if (fqdn ) fqdn->c[0] = 0;
if (RegDomains ) *RegDomains = NULL;
if (BrowseDomains) *BrowseDomains = NULL;
@ -6271,7 +6277,8 @@ mDNSexport mDNSBool mDNSPlatformSetDNSConfig(mDNS *const m, mDNSBool setservers,
else
{
LogInfo("mDNSPlatformSetDNSConfig: config->n_resolver = %d, generation %llu", config->n_resolver, config->generation);
if (m->p->LastConfigGeneration == config->generation)
// SameDomainName check below is to fix <rdar://problem/18059009> Dynamic DNS hostname changes not noticed
if (m->p->LastConfigGeneration == config->generation && (!fqdn || (SameDomainName(fqdn, &m->FQDN))))
{
LogInfo("mDNSPlatformSetDNSConfig: generation number %llu same, not processing", config->generation);
dns_configuration_free(config);

View File

@ -169,6 +169,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)
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

View File

@ -25,14 +25,10 @@
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 */,
);
name = "Build Some";
@ -63,6 +59,19 @@
name = SystemLibrariesStatic;
productName = SystemLibrariesStatic;
};
3F2EAA9F1A5B85FF007F5A52 /* Build Deprecated */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 3F2EAAA11A5B85FF007F5A52 /* Build configuration list for PBXAggregateTarget "Build Deprecated" */;
buildPhases = (
);
dependencies = (
3F2EAAA71A5B861D007F5A52 /* PBXTargetDependency */,
3F2EAAA51A5B861C007F5A52 /* PBXTargetDependency */,
3F2EAAA91A5B861E007F5A52 /* PBXTargetDependency */,
);
name = "Build Deprecated";
productName = "Build Deprecated";
};
FFA572650AF190F10055A0F1 /* SystemLibrariesDynamic */ = {
isa = PBXAggregateTarget;
buildConfigurationList = FFA5726E0AF191200055A0F1 /* Build configuration list for PBXAggregateTarget "SystemLibrariesDynamic" */;
@ -83,6 +92,7 @@
);
dependencies = (
FFB7657D0AEED97F00583A2C /* PBXTargetDependency */,
3F2EAAA31A5B8608007F5A52 /* PBXTargetDependency */,
2141DCFD123FFB7D0086D23E /* PBXTargetDependency */,
);
name = "Build All";
@ -337,20 +347,6 @@
/* End PBXBuildRule section */
/* Begin PBXContainerItemProxy section */
03067D670C83A3830022BE1F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1;
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 */;
@ -358,13 +354,6 @@
remoteGlobalIDString = D284BEA50ADD80920027CCDF;
remoteInfo = "dns-sd tool";
};
03067D6D0C83A39C0022BE1F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 2E0405EF0C31955500F13B59;
remoteInfo = mDNSResponderHelper;
};
03067D850C849CC30022BE1F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
@ -421,6 +410,34 @@
remoteGlobalIDString = 213FB21712028A7A002B3A08;
remoteInfo = BonjourEvents;
};
3F2EAAA21A5B8608007F5A52 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 3F2EAA9F1A5B85FF007F5A52;
remoteInfo = "Build Deprecated";
};
3F2EAAA41A5B861C007F5A52 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = D284BE750ADD80800027CCDF;
remoteInfo = "mDNSResponder debug";
};
3F2EAAA61A5B861D007F5A52 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = D284BE500ADD80740027CCDF;
remoteInfo = mDNSResponder;
};
3F2EAAA81A5B861E007F5A52 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 2E0405EF0C31955500F13B59;
remoteInfo = mDNSResponderHelper;
};
4AE471690EAFF83800A6C5AD /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
@ -1625,6 +1642,11 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
TargetAttributes = {
3F2EAA9F1A5B85FF007F5A52 = {
CreatedOnToolsVersion = 6.3;
};
};
};
buildConfigurationList = D284BE2B0ADD78180027CCDF /* Build configuration list for PBXProject "mDNSResponder" */;
compatibilityVersion = "Xcode 3.1";
@ -1642,6 +1664,7 @@
targets = (
00AD62BB032D7A0C0CCA2C71 /* Build More */,
03067D640C83A3700022BE1F /* Build Some */,
3F2EAA9F1A5B85FF007F5A52 /* Build Deprecated */,
FFB7657B0AEED96B00583A2C /* Build All */,
D284BE500ADD80740027CCDF /* mDNSResponder */,
D284BE750ADD80800027CCDF /* mDNSResponder debug */,
@ -1770,7 +1793,7 @@
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "DSTROOT=${DSTROOT}${INSTALL_PATH_PREFIX}\n\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\"";
shellScript = "DSTROOT=${DSTROOT}\n\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\"";
};
21DE714D115831CB00DD4BD1 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@ -1782,8 +1805,8 @@
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "DSTROOT=${DSTROOT}${INSTALL_PATH_PREFIX}\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\"";
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";
};
4A4EE3A413CB8E82005C624B /* Build yacc file into derived source files */ = {
isa = PBXShellScriptBuildPhase;
@ -1829,19 +1852,6 @@
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 [ ! -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;
@ -2095,26 +2105,11 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
03067D680C83A3830022BE1F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
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 */;
targetProxy = 03067D6B0C83A3920022BE1F /* PBXContainerItemProxy */;
};
03067D6E0C83A39C0022BE1F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 2E0405EF0C31955500F13B59 /* mDNSResponderHelper */;
targetProxy = 03067D6D0C83A39C0022BE1F /* PBXContainerItemProxy */;
};
03067D860C849CC30022BE1F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 03067D640C83A3700022BE1F /* Build Some */;
@ -2155,6 +2150,26 @@
target = 213FB21712028A7A002B3A08 /* BonjourEvents */;
targetProxy = 217A4C48138EE14C000A5BA8 /* PBXContainerItemProxy */;
};
3F2EAAA31A5B8608007F5A52 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 3F2EAA9F1A5B85FF007F5A52 /* Build Deprecated */;
targetProxy = 3F2EAAA21A5B8608007F5A52 /* PBXContainerItemProxy */;
};
3F2EAAA51A5B861C007F5A52 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D284BE750ADD80800027CCDF /* mDNSResponder debug */;
targetProxy = 3F2EAAA41A5B861C007F5A52 /* PBXContainerItemProxy */;
};
3F2EAAA71A5B861D007F5A52 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D284BE500ADD80740027CCDF /* mDNSResponder */;
targetProxy = 3F2EAAA61A5B861D007F5A52 /* PBXContainerItemProxy */;
};
3F2EAAA91A5B861E007F5A52 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 2E0405EF0C31955500F13B59 /* mDNSResponderHelper */;
targetProxy = 3F2EAAA81A5B861E007F5A52 /* PBXContainerItemProxy */;
};
4AE4716A0EAFF83800A6C5AD /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 4AE471670EAFF81900A6C5AD /* dns_sd.jar */;
@ -2250,7 +2265,7 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_MODEL_TUNING = G5;
INFOPLIST_FILE = "BonjourEvents-Info.plist";
INSTALL_PATH_ACTUAL = /System/Library/UserEventPlugins/;
INSTALL_PATH = /System/Library/UserEventPlugins/;
PREBINDING = NO;
PRODUCT_NAME = BonjourEvents;
PROVISIONING_PROFILE = "";
@ -2293,7 +2308,7 @@
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALLHDRS_COPY_PHASE = YES;
INSTALLHDRS_SCRIPT_PHASE = YES;
INSTALL_PATH_ACTUAL = /usr/local/lib/system;
INSTALL_PATH = /usr/local/lib/system;
PREBINDING = NO;
PRODUCT_NAME = dns_sd;
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
@ -2313,7 +2328,7 @@
"__DARWIN_NON_CANCELABLE=1",
);
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALL_PATH_ACTUAL = /usr/local/lib/system;
INSTALL_PATH = /usr/local/lib/system;
PREBINDING = NO;
PRODUCT_NAME = dns_sd_debug;
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
@ -2333,7 +2348,7 @@
"__DARWIN_NON_CANCELABLE=1",
);
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALL_PATH_ACTUAL = /usr/local/lib/system;
INSTALL_PATH = /usr/local/lib/system;
PREBINDING = NO;
PRODUCT_NAME = dns_sd_profile;
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
@ -2356,9 +2371,7 @@
"$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders",
"$(SDKROOT)/usr/local/include",
);
INSTALL_PATH = "";
"INSTALL_PATH[sdk=macosx*]" = "";
INSTALL_PATH_ACTUAL = /usr/sbin;
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;
@ -2377,6 +2390,13 @@
};
name = Development;
};
3F2EAAA01A5B85FF007F5A52 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Development;
};
4AE471680EAFF81900A6C5AD /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -2418,7 +2438,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH_ACTUAL = /usr/bin;
INSTALL_PATH = /usr/bin;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -2452,7 +2472,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH_ACTUAL = /usr/lib;
INSTALL_PATH = /usr/lib;
MACOSX_DEPLOYMENT_TARGET = 10.8;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "$(TARGET_NAME)_mdns";
@ -2497,7 +2517,6 @@
"-DUSE_SYSTEMCONFIGURATION_PRIVATE_HEADERS",
"-fwrapv",
);
"OTHER_LDFLAGS[sdk=macosx*]" = "";
PREBINDING = NO;
STRIP_STYLE = debugging;
WARNING_CFLAGS = (
@ -2535,9 +2554,7 @@
"$(SDKROOT)/usr/include/libxml2",
"$(SDKROOT)/usr/local/include/",
);
INSTALL_PATH = "";
"INSTALL_PATH[sdk=macosx*]" = "";
INSTALL_PATH_ACTUAL = /usr/sbin;
INSTALL_PATH = /usr/sbin;
LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
MACOSX_DEPLOYMENT_TARGET = 10.5;
ORDER_FILE = "${SRCROOT}/mDNSResponder.order";
@ -2642,7 +2659,7 @@
../mDNSShared,
"${SYSTEM_LIBRARY_DIR}/Frameworks/System.framework/PrivateHeaders",
);
INSTALL_PATH_ACTUAL = /usr/bin;
INSTALL_PATH = /usr/bin;
OTHER_CFLAGS = "-no-cpp-precomp";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
@ -2669,7 +2686,7 @@
"${SYSTEM_LIBRARY_DIR}/Frameworks/JavaVM.framework/Versions/1.3.1/Headers",
"${PROJECT_DERIVED_FILE_DIR}",
);
INSTALL_PATH_ACTUAL = /usr/lib/java;
INSTALL_PATH = /usr/lib/java;
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
OTHER_CFLAGS = "";
@ -2695,7 +2712,7 @@
"${CONFIGURATION_TEMP_DIR}",
/System/Library/Frameworks/System.Framework/PrivateHeaders,
);
INSTALL_PATH_ACTUAL = /usr/sbin;
INSTALL_PATH = /usr/sbin;
LIBRARY_SEARCH_PATHS = "\"${CONFIGURATION_TEMP_DIR}\"";
MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_CFLAGS = (
@ -2717,7 +2734,7 @@
CONFIGURATION_TEMP_DIR = "${BUILD_DIR}/mDNSResponder.build";
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
INSTALL_PATH_ACTUAL = "/Library/Application Support/Bonjour";
INSTALL_PATH = "/Library/Application Support/Bonjour";
MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
@ -2741,7 +2758,7 @@
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
INFOPLIST_FILE = "PreferencePane/Info-PreferencePane.plist";
INSTALL_PATH_ACTUAL = /AppleInternal/Library/PreferencePanes;
INSTALL_PATH = /AppleInternal/Library/PreferencePanes;
MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "-twolevel_namespace";
@ -2767,16 +2784,18 @@
"__DARWIN_NON_CANCELABLE=1",
);
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALL_PATH_ACTUAL = /usr/lib/system;
INSTALL_PATH = /usr/lib/system;
INTERPOSITION_SIM_SUFFIX = "";
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
LINK_WITH_STANDARD_LIBRARIES = NO;
OTHER_LDFLAGS = (
"-Wl,-umbrella,System",
"-L/usr/lib/system",
"-ldyld",
"-lcompiler_rt",
"-lsystem_kernel",
"-lsystem_platform",
"-lsystem_pthread",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_kernel",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_platform",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_pthread",
"-lsystem_malloc",
"-lsystem_c",
"-lsystem_blocks",
@ -2784,18 +2803,7 @@
"-llaunch",
"-lsystem_asl",
);
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
"-Wl,-umbrella,System",
"-L/usr/lib/system",
"-ldyld_sim",
"-lcompiler_rt_sim",
"-lsystem_sim_c",
"-lsystem_sim_blocks",
"-ldispatch",
"-Wl,-upward-lSystem",
);
PRODUCT_NAME = libsystem_dnssd_debug;
"PRODUCT_NAME[sdk=iphonesimulator*]" = libsystem_sim_dnssd_debug;
};
name = Development;
};
@ -2815,16 +2823,18 @@
);
GENERATE_PROFILING_CODE = YES;
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALL_PATH_ACTUAL = /usr/lib/system;
INSTALL_PATH = /usr/lib/system;
INTERPOSITION_SIM_SUFFIX = "";
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
LINK_WITH_STANDARD_LIBRARIES = NO;
OTHER_LDFLAGS = (
"-Wl,-umbrella,System",
"-L/usr/lib/system",
"-ldyld",
"-lcompiler_rt",
"-lsystem_kernel",
"-lsystem_platform",
"-lsystem_pthread",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_kernel",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_platform",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_pthread",
"-lsystem_malloc",
"-lsystem_c",
"-lsystem_blocks",
@ -2832,18 +2842,7 @@
"-llaunch",
"-lsystem_asl",
);
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
"-Wl,-umbrella,System",
"-L/usr/lib/system",
"-ldyld_sim",
"-lcompiler_rt_sim",
"-lsystem_sim_c",
"-lsystem_sim_blocks",
"-ldispatch",
"-Wl,-upward-lSystem",
);
PRODUCT_NAME = libsystem_dnssd_profile;
"PRODUCT_NAME[sdk=iphonesimulator*]" = libsystem_sim_dnssd_profile;
};
name = Development;
};
@ -2887,16 +2886,18 @@
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
INSTALLHDRS_COPY_PHASE = YES;
INSTALLHDRS_SCRIPT_PHASE = YES;
INSTALL_PATH_ACTUAL = /usr/lib/system;
INSTALL_PATH = /usr/lib/system;
INTERPOSITION_SIM_SUFFIX = "";
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
LINK_WITH_STANDARD_LIBRARIES = NO;
OTHER_LDFLAGS = (
"-Wl,-umbrella,System",
"-L/usr/lib/system",
"-ldyld",
"-lcompiler_rt",
"-lsystem_kernel",
"-lsystem_platform",
"-lsystem_pthread",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_kernel",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_platform",
"-lsystem$(INTERPOSITION_SIM_SUFFIX)_pthread",
"-lsystem_malloc",
"-lsystem_c",
"-lsystem_blocks",
@ -2904,18 +2905,7 @@
"-llaunch",
"-lsystem_asl",
);
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
"-Wl,-umbrella,System",
"-L/usr/lib/system",
"-ldyld_sim",
"-lcompiler_rt_sim",
"-lsystem_sim_c",
"-lsystem_sim_blocks",
"-ldispatch",
"-Wl,-upward-lSystem",
);
PRODUCT_NAME = libsystem_dnssd;
"PRODUCT_NAME[sdk=iphonesimulator*]" = libsystem_sim_dnssd;
};
name = Development;
};
@ -2986,6 +2976,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Development;
};
3F2EAAA11A5B85FF007F5A52 /* Build configuration list for PBXAggregateTarget "Build Deprecated" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3F2EAAA01A5B85FF007F5A52 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Development;
};
4AE471770EAFF84000A6C5AD /* Build configuration list for PBXLegacyTarget "dns_sd.jar" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -1,6 +1,6 @@
# -*- tab-width: 4 -*-
#
# Copyright (c) 2002-2004, Apple Computer, Inc. All rights reserved.
# Copyright (c) 2002-2004, 2015, Apple Computer, 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:
@ -30,8 +30,8 @@
# If "make os=xxx" gives lots of errors like "Missing dependency operator",
# then try typing "gmake os=xxx" instead.
#
# This Makefile builds an mDNSResponder daemon and a libdns_sd.so shared library
# for Linux. It also builds several example programs for embedded systems.
# This Makefile builds an mDNSResponder daemon and a libdns_sd.so shared library
# for Linux. It also builds several example programs for embedded systems.
#
# Make with no arguments to build all production targets.
# 'make DEBUG=1' to build debugging targets.
@ -57,6 +57,7 @@ JDK = /usr/jdk
CC = @cc
BISON = @bison
FLEX = @flex
ST = @strip
LD = ld -shared
CP = cp
RM = rm
@ -71,18 +72,18 @@ JAVACFLAGS_OS = -fPIC -shared -ldns_sd
# Set up diverging paths for debug vs. prod builds
DEBUG=0
ifeq ($(DEBUG),1)
CFLAGS_DEBUG = -g -DMDNS_DEBUGMSGS=2
CFLAGS_DEBUG = -g -DMDNS_DEBUGMSGS=2
OBJDIR = objects/debug
BUILDDIR = build/debug
STRIP = echo
STRIP = echo
else
# We use -Os for two reasons:
# 1. We want to make small binaries, suitable for putting into hardware devices
# 2. Some of the code analysis warnings only work when some form of optimization is enabled
CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
OBJDIR ?= objects/prod
BUILDDIR ?= build/prod
STRIP = strip -S
STRIP = $(ST) -S
endif
# Configure per-OS peculiarities
@ -95,14 +96,14 @@ LD = gcc -shared
LINKOPTS = -lsocket -lnsl -lresolv
JAVACFLAGS_OS += -I$(JDK)/include/solaris
ifneq ($(DEBUG),1)
STRIP = strip
STRIP = $(ST)
endif
else
# any target that contains the string "linux"
ifeq ($(findstring linux,$(os)),linux)
CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -fno-strict-aliasing
LD = gcc -shared
LD = $(CC) -shared
FLEXFLAGS_OS = -l
JAVACFLAGS_OS += -I$(JDK)/include/linux
@ -151,11 +152,11 @@ LD = $(CC) -dynamiclib
LINKOPTS = -lSystem
LDSUFFIX = dylib
JDK = /System/Library/Frameworks/JavaVM.framework/Home
JAVACFLAGS_OS = -dynamiclib -I/System/Library/Frameworks/JavaVM.framework/Headers -framework JavaVM
JAVACFLAGS_OS = -dynamiclib -I/System/Library/Frameworks/JavaVM.framework/Headers -framework JavaVM
else
$(error ERROR: Must specify target OS on command-line, e.g. "make os=x [target]".\
Supported operating systems include: x, linux, linux-uclibc, netbsd, freebsd, openbsd, solaris)
Supported operating systems include: x, linux, linux-uclibc, netbsd, freebsd, openbsd, solaris)
endif
endif
endif

View File

@ -120,6 +120,7 @@ struct timeval tv_start, tv_end, tv_interval;
static int FilterInterface = 0;
static FilterList *Filters;
#define ExactlyOneFilter (Filters && !Filters->next)
static mDNSBool AddressType = mDNSAddrType_IPv4;
static int NumPktQ, NumPktL, NumPktR, NumPktB; // Query/Legacy/Response/Bad
static int NumProbes, NumGoodbyes, NumQuestions, NumLegacy, NumAnswers, NumAdditionals;
@ -464,9 +465,9 @@ mDNSlocal const mDNSu8 *FindUpdate(mDNS *const m, const DNSMessage *const query,
mDNSlocal void DisplayPacketHeader(mDNS *const m, const DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *srcaddr, mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSInterfaceID InterfaceID)
{
const char *const ptype = (msg->h.flags.b[0] & kDNSFlag0_QR_Response) ? "-R- " :
const char *const ptype = (msg->h.flags.b[0] & kDNSFlag0_QR_Response) ? "-R- " :
(srcport.NotAnInteger == MulticastDNSPort.NotAnInteger) ? "-Q- " : "-LQ-";
const unsigned length = end - (mDNSu8 *)msg;
struct timeval tv;
struct tm tm;
const mDNSu32 index = mDNSPlatformInterfaceIndexfromInterfaceID(m, InterfaceID, mDNSfalse);
@ -477,7 +478,7 @@ mDNSlocal void DisplayPacketHeader(mDNS *const m, const DNSMessage *const msg, c
mprintf("\n%d:%02d:%02d.%06d Interface %d/%s\n", tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec, index, if_name);
mprintf("%#-16a %s Q:%3d Ans:%3d Auth:%3d Add:%3d Size:%5d bytes",
srcaddr, ptype, msg->h.numQuestions, msg->h.numAnswers, msg->h.numAuthorities, msg->h.numAdditionals, end - (mDNSu8 *)msg);
srcaddr, ptype, msg->h.numQuestions, msg->h.numAnswers, msg->h.numAuthorities, msg->h.numAdditionals, length);
if (msg->h.id.NotAnInteger) mprintf(" ID:%u", mDNSVal16(msg->h.id));
@ -488,7 +489,27 @@ mDNSlocal void DisplayPacketHeader(mDNS *const m, const DNSMessage *const msg, c
if (msg->h.flags.b[0] & kDNSFlag0_QR_Response) mprintf(" Truncated");
else mprintf(" Truncated (KA list continues in next packet)");
}
mprintf("\n");
if (length < sizeof(DNSMessageHeader) + NormalMaxDNSMessageData - 192)
if (msg->h.flags.b[0] & kDNSFlag0_TC)
mprintf("%#-16a **** WARNING: Packet suspiciously small. Payload size (excluding IP and UDP headers)\n"
"%#-16a **** should usually be closer to %d bytes before truncation becomes necessary.\n",
srcaddr, srcaddr, sizeof(DNSMessageHeader) + NormalMaxDNSMessageData);
}
mDNSlocal void DisplaySizeCheck(const DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *srcaddr, int num_opts)
{
const unsigned length = end - (mDNSu8 *)msg;
const int num_records = msg->h.numAnswers + msg->h.numAuthorities + msg->h.numAdditionals - num_opts;
if (length > sizeof(DNSMessageHeader) + NormalMaxDNSMessageData)
if (num_records > 1)
mprintf("%#-16a **** ERROR: Oversized packet with %d records.\n"
"%#-16a **** Many network devices cannot receive packets larger than %d bytes.\n"
"%#-16a **** To minimize interoperability failures, oversized packets MUST be limited to a single resource record.\n",
srcaddr, num_records, srcaddr, 40 + 8 + sizeof(DNSMessageHeader) + NormalMaxDNSMessageData, srcaddr);
}
mDNSlocal void DisplayResourceRecord(const mDNSAddr *const srcaddr, const char *const op, const ResourceRecord *const pktrr)
@ -594,7 +615,7 @@ mDNSlocal void HexDump(const mDNSu8 *ptr, const mDNSu8 *const end)
mDNSlocal void DisplayError(const mDNSAddr *srcaddr, const mDNSu8 *ptr, const mDNSu8 *const end, char *msg)
{
mprintf("%#-16a **** ERROR: FAILED TO READ %s **** \n", srcaddr, msg);
mprintf("%#-16a **** ERROR: FAILED TO READ %s ****\n", srcaddr, msg);
HexDump(ptr, end);
}
@ -602,6 +623,7 @@ mDNSlocal void DisplayQuery(mDNS *const m, const DNSMessage *const msg, const mD
const mDNSAddr *srcaddr, mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSInterfaceID InterfaceID)
{
int i;
int num_opts = 0;
const mDNSu8 *ptr = msg->data;
const mDNSu8 *auth = LocateAuthorities(msg, end);
mDNSBool MQ = (srcport.NotAnInteger == MulticastDNSPort.NotAnInteger);
@ -611,7 +633,7 @@ mDNSlocal void DisplayQuery(mDNS *const m, const DNSMessage *const msg, const mD
DisplayPacketHeader(m, msg, end, srcaddr, srcport, dstaddr, InterfaceID);
if (msg->h.id.NotAnInteger != 0xFFFF)
{
if (MQ) NumPktQ++;else NumPktL++;
if (MQ) NumPktQ++; else NumPktL++;
}
for (i=0; i<msg->h.numQuestions; i++)
@ -648,6 +670,8 @@ mDNSlocal void DisplayQuery(mDNS *const m, const DNSMessage *const msg, const mD
ptr = GetLargeResourceRecord(m, msg, ptr, end, InterfaceID, kDNSRecordTypePacketAns, &pkt);
if (!ptr) { DisplayError(srcaddr, ep, end, "KNOWN ANSWER"); return; }
DisplayResourceRecord(srcaddr, "(KA)", &pkt.r.resrec);
if (pkt.r.resrec.rrtype == kDNSType_OPT)
{ num_opts++; mprintf("%#-16a **** ERROR: OPT RECORD IN ANSWER SECTION ****\n", srcaddr); }
// In the case of queries with long multi-packet KA lists, we count each subsequent KA packet
// the same as a single query, to more accurately reflect the burden on the network
@ -664,6 +688,8 @@ mDNSlocal void DisplayQuery(mDNS *const m, const DNSMessage *const msg, const mD
// After we display an Update record with its matching question (above) we zero out its type and class
// If any remain that haven't been zero'd out, display them here
if (pkt.r.resrec.rrtype || pkt.r.resrec.rrclass) DisplayResourceRecord(srcaddr, "(AU)", &pkt.r.resrec);
if (pkt.r.resrec.rrtype == kDNSType_OPT)
{ num_opts++; mprintf("%#-16a **** ERROR: OPT RECORD IN AUTHORITY SECTION ****\n", srcaddr); }
}
for (i=0; i<msg->h.numAdditionals; i++)
@ -672,8 +698,15 @@ mDNSlocal void DisplayQuery(mDNS *const m, const DNSMessage *const msg, const mD
ptr = GetLargeResourceRecord(m, msg, ptr, end, InterfaceID, kDNSRecordTypePacketAdd, &pkt);
if (!ptr) { DisplayError(srcaddr, ep, end, "ADDITIONAL"); return; }
DisplayResourceRecord(srcaddr, pkt.r.resrec.rrtype == kDNSType_OPT ? "(OP)" : "(AD)", &pkt.r.resrec);
if (pkt.r.resrec.rrtype == kDNSType_OPT) num_opts++;
}
DisplaySizeCheck(msg, end, srcaddr, num_opts);
// We don't hexdump the DNSMessageHeader here because those six fields (id, flags, numQuestions, numAnswers, numAuthorities, numAdditionals)
// have already been swapped to host byte order and displayed, so including them in the hexdump is confusing
if (num_opts > 1) { mprintf("%#-16a **** ERROR: MULTIPLE OPT RECORDS ****\n", srcaddr); HexDump(msg->data, end); }
if (entry) AnalyseHost(m, entry, InterfaceID);
}
@ -681,6 +714,7 @@ mDNSlocal void DisplayResponse(mDNS *const m, const DNSMessage *const msg, const
const mDNSAddr *srcaddr, mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSInterfaceID InterfaceID)
{
int i;
int num_opts = 0;
const mDNSu8 *ptr = msg->data;
HostEntry *entry = GotPacketFromHost(srcaddr, HostPkt_R, msg->h.id);
LargeCacheRecord pkt;
@ -718,6 +752,8 @@ mDNSlocal void DisplayResponse(mDNS *const m, const DNSMessage *const msg, const
DisplayResourceRecord(srcaddr, "(DE)", &pkt.r.resrec);
recordstat(entry, pkt.r.resrec.name, OP_goodbye, pkt.r.resrec.rrtype);
}
if (pkt.r.resrec.rrtype == kDNSType_OPT)
{ num_opts++; mprintf("%#-16a **** ERROR: OPT RECORD IN ANSWER SECTION ****\n", srcaddr); }
}
for (i=0; i<msg->h.numAuthorities; i++)
@ -725,9 +761,12 @@ mDNSlocal void DisplayResponse(mDNS *const m, const DNSMessage *const msg, const
const mDNSu8 *ep = ptr;
ptr = GetLargeResourceRecord(m, msg, ptr, end, InterfaceID, kDNSRecordTypePacketAuth, &pkt);
if (!ptr) { DisplayError(srcaddr, ep, end, "AUTHORITY"); return; }
if (pkt.r.resrec.rrtype != kDNSType_NSEC3)
DisplayResourceRecord(srcaddr, "(AU)", &pkt.r.resrec);
if (pkt.r.resrec.rrtype == kDNSType_OPT)
{ num_opts++; mprintf("%#-16a **** ERROR: OPT RECORD IN AUTHORITY SECTION ****\n", srcaddr); }
else if (pkt.r.resrec.rrtype != kDNSType_NSEC3)
mprintf("%#-16a (?) **** ERROR: SHOULD NOT HAVE AUTHORITY IN mDNS RESPONSE **** %-5s %##s\n",
srcaddr, DNSTypeName(pkt.r.resrec.rrtype), pkt.r.resrec.name->c);
srcaddr, DNSTypeName(pkt.r.resrec.rrtype), pkt.r.resrec.name->c);
}
for (i=0; i<msg->h.numAdditionals; i++)
@ -736,12 +775,19 @@ mDNSlocal void DisplayResponse(mDNS *const m, const DNSMessage *const msg, const
ptr = GetLargeResourceRecord(m, msg, ptr, end, InterfaceID, kDNSRecordTypePacketAdd, &pkt);
if (!ptr) { DisplayError(srcaddr, ep, end, "ADDITIONAL"); return; }
NumAdditionals++;
if (pkt.r.resrec.rrtype == kDNSType_OPT) num_opts++;
DisplayResourceRecord(srcaddr,
pkt.r.resrec.rrtype == kDNSType_OPT ? "(OP)" : (pkt.r.resrec.RecordType & kDNSRecordTypePacketUniqueMask) ? "(AD)" : "(AD+)",
&pkt.r.resrec);
if (entry) RecordHostInfo(entry, &pkt.r.resrec);
}
DisplaySizeCheck(msg, end, srcaddr, num_opts);
// We don't hexdump the DNSMessageHeader here because those six fields (id, flags, numQuestions, numAnswers, numAuthorities, numAdditionals)
// have already been swapped to host byte order and displayed, so including them in the hexdump is confusing
if (num_opts > 1) { mprintf("%#-16a **** ERROR: MULTIPLE OPT RECORDS ****\n", srcaddr); HexDump(msg->data, end); }
if (entry) AnalyseHost(m, entry, InterfaceID);
}
@ -763,7 +809,7 @@ mDNSlocal void ProcessUnicastResponse(mDNS *const m, const DNSMessage *const msg
mDNSlocal mDNSBool AddressMatchesFilterList(const mDNSAddr *srcaddr)
{
FilterList *f;
if (!Filters) return(srcaddr->type == mDNSAddrType_IPv4);
if (!Filters) return(srcaddr->type == AddressType);
for (f=Filters; f; f=f->next) if (mDNSSameAddress(srcaddr, &f->FilterAddr)) return(mDNStrue);
return(mDNSfalse);
}
@ -930,9 +976,14 @@ mDNSexport int main(int argc, char **argv)
if (i+1 < argc && !strcmp(argv[i], "-i") && atoi(argv[i+1]))
{
FilterInterface = atoi(argv[i+1]);
i += 2;
i += 1;
printf("Monitoring interface %d\n", FilterInterface);
}
else if (!strcmp(argv[i], "-6"))
{
AddressType = mDNSAddrType_IPv6;
printf("Monitoring IPv6 traffic\n");
}
else
{
struct in_addr s4;

View File

@ -90,6 +90,8 @@ static GenLinkedList gEventSources; // linked list of PosixEventSour
static sigset_t gEventSignalSet; // Signals which event loop listens for
static sigset_t gEventSignals; // Signals which were received while inside loop
static PosixNetworkInterface *gRecentInterfaces;
// ***************************************************************************
// Globals (for debugging)
@ -574,6 +576,13 @@ mDNSexport mDNSu32 mDNSPlatformInterfaceIndexfromInterfaceID(mDNS *const m, mDNS
while ((intf != NULL) && (mDNSInterfaceID) intf != id)
intf = (PosixNetworkInterface *)(intf->coreIntf.next);
if (intf) return intf->index;
// If we didn't find the interface, check the RecentInterfaces list as well
intf = gRecentInterfaces;
while ((intf != NULL) && (mDNSInterfaceID) intf != id)
intf = (PosixNetworkInterface *)(intf->coreIntf.next);
return intf ? intf->index : 0;
}
@ -587,7 +596,11 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf)
#if HAVE_IPV6
if (intf->multicastSocket6 != -1) assert(close(intf->multicastSocket6) == 0);
#endif
free(intf);
// Move interface to the RecentInterfaces list for a minute
intf->LastSeen = mDNSPlatformUTC();
intf->coreIntf.next = &gRecentInterfaces->coreIntf;
gRecentInterfaces = intf;
}
// Grab the first interface, deregister it, free it, and repeat until done.
@ -643,6 +656,14 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf
#error This platform has no way to avoid address busy errors on multicast.
#endif
if (err < 0) { err = errno; perror("setsockopt - SO_REUSExxxx"); }
// Enable inbound packets on IFEF_AWDL interface.
// Only done for multicast sockets, since we don't expect unicast socket operations
// on the IFEF_AWDL interface. Operation is a no-op for other interface types.
#ifndef SO_RECV_ANYIF
#define SO_RECV_ANYIF 0x1104 /* unrestricted inbound processing */
#endif
if (setsockopt(*sktPtr, SOL_SOCKET, SO_RECV_ANYIF, &kOn, sizeof(kOn)) < 0) perror("setsockopt - SO_RECV_ANYIF");
}
// We want to receive destination addresses and interface identifiers.
@ -978,6 +999,17 @@ mDNSlocal int SetupInterfaceList(mDNS *const m)
// Clean up.
if (intfList != NULL) free_ifi_info(intfList);
// Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute
PosixNetworkInterface **ri = &gRecentInterfaces;
const mDNSs32 utc = mDNSPlatformUTC();
while (*ri)
{
PosixNetworkInterface *pi = *ri;
if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next;
else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; free(pi); }
}
return err;
}
@ -1318,9 +1350,15 @@ mDNSexport void mDNSPlatformClose(mDNS *const m)
#endif
}
// This is used internally by InterfaceChangeCallback.
// It's also exported so that the Standalone Responder (mDNSResponderPosix)
// can call it in response to a SIGHUP (mainly for debugging purposes).
mDNSexport mStatus mDNSPlatformPosixRefreshInterfaceList(mDNS *const m)
{
int err;
// This is a pretty heavyweight way to process interface changes --
// destroying the entire interface list and then making fresh one from scratch.
// We should make it like the OS X version, which leaves unchanged interfaces alone.
ClearInterfaceList(m);
err = SetupInterfaceList(m);
return PosixErrorToStatus(err);

View File

@ -38,7 +38,8 @@ typedef struct PosixNetworkInterface PosixNetworkInterface;
struct PosixNetworkInterface
{
NetworkInterfaceInfo coreIntf;
NetworkInterfaceInfo coreIntf; // MUST be the first element in this structure
mDNSs32 LastSeen;
const char * intfName;
PosixNetworkInterface * aliasIntf;
int index;

View File

@ -66,7 +66,7 @@
*/
#ifndef _DNS_SD_H
#define _DNS_SD_H 5610101
#define _DNS_SD_H 5670000
#ifdef __cplusplus
extern "C" {
@ -1961,7 +1961,6 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
const void *rdata
);
/*********************************************************************************************
*
* NAT Port Mapping

View File

@ -817,5 +817,4 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
return(kDNSServiceErr_Unsupported);
}
#endif // !MDNS_BUILDINGSTUBLIBRARY

View File

@ -1112,6 +1112,7 @@ void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdRef)
// callbacks when we return from this function. Setting ProcessReply to NULL
// provides extra protection.
sdRef->ProcessReply = NULL;
shutdown(sdRef->sockfd, SHUT_WR);
dispatch_source_cancel(sdRef->disp_source);
dispatch_release(sdRef->disp_source);
sdRef->disp_source = NULL;
@ -2092,7 +2093,6 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
return err;
}
static void handle_port_mapping_response(DNSServiceOp *const sdr, const CallbackHeader *const cbh, const char *data, const char *const end)
{
union { uint32_t l; u_char b[4]; } addr;