mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-14 02:30:28 +08:00
mDNSResponder: Update to v878.200.35
The sources can be obtained via: https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.200.35.tar.gz Update #4010.
This commit is contained in:
parent
0a1f82a346
commit
c6d65faa42
@ -174,10 +174,6 @@ static const char kFilePathSep = '/';
|
|||||||
#include "../mDNSShared/dnssd_clientstub.c"
|
#include "../mDNSShared/dnssd_clientstub.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _DNS_SD_LIBDISPATCH
|
|
||||||
#include <dispatch/private.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//*************************************************************************************************************
|
//*************************************************************************************************************
|
||||||
// Globals
|
// Globals
|
||||||
|
|
||||||
@ -416,46 +412,36 @@ static unsigned int keytag(unsigned char *key, unsigned int keysize)
|
|||||||
return ac & 0xFFFF;
|
return ac & 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void base64Encode(char *buffer, int buflen, void *rdata, unsigned int rdlen)
|
// Base 64 encoding according to <https://tools.ietf.org/html/rfc4648#section-4>.
|
||||||
|
#define kBase64EncodingTable "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||||
|
|
||||||
|
static void base64Encode(char *buffer, size_t buflen, void *rdata, size_t rdlen)
|
||||||
{
|
{
|
||||||
#if _DNS_SD_LIBDISPATCH
|
const uint8_t *src = (const uint8_t *)rdata;
|
||||||
const void *result = NULL;
|
const uint8_t *const end = &src[rdlen];
|
||||||
size_t size;
|
char *dst = buffer;
|
||||||
dispatch_data_t src_data = NULL, dest_data = NULL, null_str = NULL, data = NULL, map = NULL;
|
const char *lim;
|
||||||
|
|
||||||
src_data = dispatch_data_create(rdata, rdlen, dispatch_get_global_queue(0, 0), ^{});
|
if (buflen == 0) return;
|
||||||
if (!src_data)
|
lim = &buffer[buflen - 1];
|
||||||
goto done;
|
while ((src < end) && (dst < lim))
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
const size_t rem = (size_t)(end - src);
|
||||||
|
|
||||||
dest_data = dispatch_data_create_with_transform(src_data, DISPATCH_DATA_FORMAT_TYPE_NONE, DISPATCH_DATA_FORMAT_TYPE_BASE64);
|
// Form a 24-bit input group. If less than 24 bits remain, pad with zero bits.
|
||||||
if (!dest_data)
|
if ( rem >= 3) i = (src[0] << 16) | (src[1] << 8) | src[2]; // 24 bits are equal to 4 6-bit groups.
|
||||||
goto done;
|
else if (rem == 2) i = (src[0] << 16) | (src[1] << 8); // 16 bits are treated as 3 6-bit groups + 1 pad
|
||||||
|
else i = src[0] << 16; // 8 bits are treated as 2 6-bit groups + 2 pads
|
||||||
|
|
||||||
null_str = dispatch_data_create("", 1, dispatch_get_global_queue(0, 0), ^{});
|
// Encode each 6-bit group.
|
||||||
if (!null_str)
|
*dst++ = kBase64EncodingTable[(i >> 18) & 0x3F];
|
||||||
goto done;
|
if (dst < lim) *dst++ = kBase64EncodingTable[(i >> 12) & 0x3F];
|
||||||
|
if (dst < lim) *dst++ = (rem >= 2) ? kBase64EncodingTable[(i >> 6) & 0x3F] : '=';
|
||||||
data = dispatch_data_create_concat(dest_data, null_str);
|
if (dst < lim) *dst++ = (rem >= 3) ? kBase64EncodingTable[ i & 0x3F] : '=';
|
||||||
if (!data)
|
src += (rem > 3) ? 3 : rem;
|
||||||
goto done;
|
}
|
||||||
|
*dst = '\0';
|
||||||
map = dispatch_data_create_map(data, &result, &size);
|
|
||||||
if (!map)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
snprintf(buffer, buflen, " %s", (char *)result);
|
|
||||||
|
|
||||||
done:
|
|
||||||
if (src_data) dispatch_release(src_data);
|
|
||||||
if (dest_data) dispatch_release(dest_data);
|
|
||||||
if (data) dispatch_release(data);
|
|
||||||
if (null_str) dispatch_release(null_str);
|
|
||||||
if (map) dispatch_release(map);
|
|
||||||
return;
|
|
||||||
#else //_DNS_SD_LIBDISPATCH
|
|
||||||
snprintf(buffer, buflen, " %s", ".");
|
|
||||||
return;
|
|
||||||
#endif //_DNS_SD_LIBDISPATCH
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DNSServiceProtocol GetProtocol(const char *s)
|
static DNSServiceProtocol GetProtocol(const char *s)
|
||||||
@ -924,9 +910,9 @@ static int snprintd(char *p, int max, const unsigned char **rd)
|
|||||||
return(p-buf);
|
return(p-buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ParseDNSSECRecords(uint16_t rrtype, char *rdb, char *p, unsigned const char *rd, uint16_t rdlen)
|
static void ParseDNSSECRecords(uint16_t rrtype, char *rdb, size_t rdb_size, unsigned const char *rd, uint16_t rdlen)
|
||||||
{
|
{
|
||||||
int rdb_size = 1000;
|
char *p = rdb;
|
||||||
switch (rrtype)
|
switch (rrtype)
|
||||||
{
|
{
|
||||||
case kDNSServiceType_DS:
|
case kDNSServiceType_DS:
|
||||||
@ -945,7 +931,7 @@ static void ParseDNSSECRecords(uint16_t rrtype, char *rdb, char *p, unsigned con
|
|||||||
case kDNSServiceType_DNSKEY:
|
case kDNSServiceType_DNSKEY:
|
||||||
{
|
{
|
||||||
rdataDNSKey *rrkey = (rdataDNSKey *)rd;
|
rdataDNSKey *rrkey = (rdataDNSKey *)rd;
|
||||||
p += snprintf(p, rdb + rdb_size - p, "%d %d %d %u", swap16(rrkey->flags), rrkey->proto,
|
p += snprintf(p, rdb + rdb_size - p, "%d %d %d %u ", swap16(rrkey->flags), rrkey->proto,
|
||||||
rrkey->alg, (unsigned int)keytag((unsigned char *)rrkey, rdlen));
|
rrkey->alg, (unsigned int)keytag((unsigned char *)rrkey, rdlen));
|
||||||
base64Encode(p, rdb + rdb_size - p, (unsigned char *)(rd + DNSKEY_FIXED_SIZE), rdlen - DNSKEY_FIXED_SIZE);
|
base64Encode(p, rdb + rdb_size - p, (unsigned char *)(rd + DNSKEY_FIXED_SIZE), rdlen - DNSKEY_FIXED_SIZE);
|
||||||
break;
|
break;
|
||||||
@ -1027,6 +1013,11 @@ static void ParseDNSSECRecords(uint16_t rrtype, char *rdb, char *p, unsigned con
|
|||||||
p += snprintd(p, rdb + rdb_size - p, &q);
|
p += snprintd(p, rdb + rdb_size - p, &q);
|
||||||
len = p - k + 1;
|
len = p - k + 1;
|
||||||
|
|
||||||
|
if ((&rdb[rdb_size] - p) >= 2)
|
||||||
|
{
|
||||||
|
*p++ = ' ';
|
||||||
|
*p = '\0';
|
||||||
|
}
|
||||||
base64Encode(p, rdb + rdb_size - p, (unsigned char *)(rd + len + RRSIG_FIXED_SIZE), rdlen - (len + RRSIG_FIXED_SIZE));
|
base64Encode(p, rdb + rdb_size - p, (unsigned char *)(rd + len + RRSIG_FIXED_SIZE), rdlen - (len + RRSIG_FIXED_SIZE));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1115,7 +1106,7 @@ static void DNSSD_API qr_reply(DNSServiceRef sdref, const DNSServiceFlags flags,
|
|||||||
case kDNSServiceType_DNSKEY:
|
case kDNSServiceType_DNSKEY:
|
||||||
case kDNSServiceType_NSEC:
|
case kDNSServiceType_NSEC:
|
||||||
case kDNSServiceType_RRSIG:
|
case kDNSServiceType_RRSIG:
|
||||||
ParseDNSSECRecords(rrtype, rdb, p, rd, rdlen);
|
ParseDNSSECRecords(rrtype, rdb, sizeof(rdb), rd, rdlen);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1143,7 +1134,7 @@ static void DNSSD_API qr_reply(DNSServiceRef sdref, const DNSServiceFlags flags,
|
|||||||
if (operation == 'D')
|
if (operation == 'D')
|
||||||
printf("%s%3d %-30s%-6s%-7s%-18s %s", op, ifIndex, fullname, rr_type, rr_class, dnssec_status, rdb);
|
printf("%s%3d %-30s%-6s%-7s%-18s %s", op, ifIndex, fullname, rr_type, rr_class, dnssec_status, rdb);
|
||||||
else
|
else
|
||||||
printf("%s%6X%3d %-30s%-7s%-6s %s", op, flags, ifIndex, fullname, rr_type, rr_class, rdb);
|
printf("%s%9X%3d %-30s%-7s%-6s %s", op, flags, ifIndex, fullname, rr_type, rr_class, rdb);
|
||||||
if (unknowntype)
|
if (unknowntype)
|
||||||
{
|
{
|
||||||
while (rd < end)
|
while (rd < end)
|
||||||
@ -1248,7 +1239,7 @@ static void DNSSD_API addrinfo_reply(DNSServiceRef sdref, const DNSServiceFlags
|
|||||||
if (operation == 'g')
|
if (operation == 'g')
|
||||||
printf("%s%3d %-25s %-44s %-18s", op, interfaceIndex, hostname, addr, dnssec_status);
|
printf("%s%3d %-25s %-44s %-18s", op, interfaceIndex, hostname, addr, dnssec_status);
|
||||||
else
|
else
|
||||||
printf("%s%6X%3d %-38s %-44s %d", op, flags, interfaceIndex, hostname, addr, ttl);
|
printf("%s%9X%3d %-38s %-44s %d", op, flags, interfaceIndex, hostname, addr, ttl);
|
||||||
if (errorCode)
|
if (errorCode)
|
||||||
{
|
{
|
||||||
if (errorCode == kDNSServiceErr_NoSuchRecord)
|
if (errorCode == kDNSServiceErr_NoSuchRecord)
|
||||||
@ -1513,12 +1504,6 @@ static int API_string_limit_test()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// local prototypes for routines that don't have prototypes in dns_sd.h
|
|
||||||
#if APPLE_OSX_mDNSResponder
|
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser(DNSServiceFlags flags, const char *domain);
|
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceCreateDelegateConnection(DNSServiceRef *sdRef, int32_t pid, uuid_t uuid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int API_NULL_input_test()
|
static int API_NULL_input_test()
|
||||||
{
|
{
|
||||||
printf("Running basic API input range tests with various pointer parameters set to NULL:\n");
|
printf("Running basic API input range tests with various pointer parameters set to NULL:\n");
|
||||||
@ -1916,6 +1901,14 @@ int main(int argc, char **argv)
|
|||||||
opinterface = kDNSServiceInterfaceIndexBLE;
|
opinterface = kDNSServiceInterfaceIndexBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc > 1 && !strcasecmp(argv[1], "-allowexpired"))
|
||||||
|
{
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
flags |= kDNSServiceFlagsAllowExpiredAnswers;
|
||||||
|
printf("Setting kDNSServiceFlagsAllowExpiredAnswers\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (argc > 1 && !strcasecmp(argv[1], "-includep2p"))
|
if (argc > 1 && !strcasecmp(argv[1], "-includep2p"))
|
||||||
{
|
{
|
||||||
argc--;
|
argc--;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -11,12 +11,13 @@
|
|||||||
# install:
|
# install:
|
||||||
# installsrc:
|
# installsrc:
|
||||||
# installhdrs:
|
# installhdrs:
|
||||||
|
# installapi:
|
||||||
# clean:
|
# clean:
|
||||||
#
|
#
|
||||||
|
|
||||||
include $(MAKEFILEPATH)/pb_makefiles/platform.make
|
include $(MAKEFILEPATH)/pb_makefiles/platform.make
|
||||||
|
|
||||||
MVERS = "mDNSResponder-878.70.2"
|
MVERS = "mDNSResponder-878.200.35"
|
||||||
|
|
||||||
VER =
|
VER =
|
||||||
ifneq ($(strip $(GCC_VERSION)),)
|
ifneq ($(strip $(GCC_VERSION)),)
|
||||||
@ -44,6 +45,9 @@ installhdrs::
|
|||||||
cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild installhdrs OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target SystemLibraries $(VER)
|
cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild installhdrs OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target SystemLibraries $(VER)
|
||||||
cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild installhdrs OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target dns_services $(VER)
|
cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild installhdrs OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target dns_services $(VER)
|
||||||
|
|
||||||
|
installapi:
|
||||||
|
cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild installapi OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target SystemLibrariesDynamic $(VER)
|
||||||
|
|
||||||
java:
|
java:
|
||||||
cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild install OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target libjdns_sd.jnilib $(VER)
|
cd "$(SRCROOT)/mDNSMacOSX"; xcodebuild install OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) DSTROOT=$(DSTROOT) MVERS=$(MVERS) SDKROOT=$(SDKROOT) -target libjdns_sd.jnilib $(VER)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2015 Apple Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -3450,7 +3450,6 @@ mDNSexport const mDNSu8 *GetLargeResourceRecord(mDNS *const m, const DNSMessage
|
|||||||
rr->TimeRcvd = m ? m->timenow : 0;
|
rr->TimeRcvd = m ? m->timenow : 0;
|
||||||
rr->DelayDelivery = 0;
|
rr->DelayDelivery = 0;
|
||||||
rr->NextRequiredQuery = m ? m->timenow : 0; // Will be updated to the real value when we call SetNextCacheCheckTimeForRecord()
|
rr->NextRequiredQuery = m ? m->timenow : 0; // Will be updated to the real value when we call SetNextCacheCheckTimeForRecord()
|
||||||
rr->LastUsed = m ? m->timenow : 0;
|
|
||||||
rr->CRActiveQuestion = mDNSNULL;
|
rr->CRActiveQuestion = mDNSNULL;
|
||||||
rr->UnansweredQueries = 0;
|
rr->UnansweredQueries = 0;
|
||||||
rr->LastUnansweredTime= 0;
|
rr->LastUnansweredTime= 0;
|
||||||
@ -3630,25 +3629,6 @@ mDNSexport mDNSBool GetPktLease(mDNS *const m, const DNSMessage *const msg, cons
|
|||||||
return mDNSfalse;
|
return mDNSfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDNSlocal const mDNSu8 *DumpRecords(mDNS *const m, const DNSMessage *const msg, const mDNSu8 *ptr, const mDNSu8 *const end, int count, char *label)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
LogInfo("%2d %s", count, label);
|
|
||||||
for (i = 0; i < count && ptr; i++)
|
|
||||||
{
|
|
||||||
// This puts a LargeCacheRecord on the stack instead of using the shared m->rec storage,
|
|
||||||
// but since it's only used for debugging (and probably only on OS X, not on
|
|
||||||
// embedded systems) putting a 9kB object on the stack isn't a big problem.
|
|
||||||
LargeCacheRecord largecr;
|
|
||||||
ptr = GetLargeResourceRecord(m, msg, ptr, end, mDNSInterface_Any, kDNSRecordTypePacketAns, &largecr);
|
|
||||||
if (ptr)
|
|
||||||
LogInfo("%2d TTL%8d %s", i, largecr.r.resrec.rroriginalttl, CRDisplayString(m, &largecr.r));
|
|
||||||
}
|
|
||||||
if (!ptr)
|
|
||||||
LogInfo("DumpRecords: ERROR: Premature end of packet data");
|
|
||||||
return(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DNS_OP_Name(X) ( \
|
#define DNS_OP_Name(X) ( \
|
||||||
(X) == kDNSFlag0_OP_StdQuery ? "" : \
|
(X) == kDNSFlag0_OP_StdQuery ? "" : \
|
||||||
(X) == kDNSFlag0_OP_Iquery ? "Iquery " : \
|
(X) == kDNSFlag0_OP_Iquery ? "Iquery " : \
|
||||||
@ -3672,52 +3652,198 @@ mDNSlocal const mDNSu8 *DumpRecords(mDNS *const m, const DNSMessage *const msg,
|
|||||||
(X) == kDNSFlag1_RC_NotAuth ? "NotAuth" : \
|
(X) == kDNSFlag1_RC_NotAuth ? "NotAuth" : \
|
||||||
(X) == kDNSFlag1_RC_NotZone ? "NotZone" : "??" )
|
(X) == kDNSFlag1_RC_NotZone ? "NotZone" : "??" )
|
||||||
|
|
||||||
// Note: DumpPacket expects the packet header fields in host byte order, not network byte order
|
mDNSlocal void mDNS_snprintf_add(char **ptr, const char *lim, const char *fmt, ...)
|
||||||
mDNSexport void DumpPacket(mDNS *const m, mStatus status, mDNSBool sent, char *transport,
|
|
||||||
const mDNSAddr *srcaddr, mDNSIPPort srcport,
|
|
||||||
const mDNSAddr *dstaddr, mDNSIPPort dstport, const DNSMessage *const msg, const mDNSu8 *const end)
|
|
||||||
{
|
{
|
||||||
mDNSBool IsUpdate = ((msg->h.flags.b[0] & kDNSFlag0_OP_Mask) == kDNSFlag0_OP_Update);
|
va_list args;
|
||||||
const mDNSu8 *ptr = msg->data;
|
mDNSu32 buflen, n;
|
||||||
int i;
|
char *const dst = *ptr;
|
||||||
DNSQuestion q;
|
|
||||||
char tbuffer[64], sbuffer[64], dbuffer[64] = "";
|
|
||||||
if (!status) tbuffer[mDNS_snprintf(tbuffer, sizeof(tbuffer), sent ? "Sent" : "Received" )] = 0;
|
|
||||||
else tbuffer[mDNS_snprintf(tbuffer, sizeof(tbuffer), "ERROR %d %sing", status, sent ? "Send" : "Receive")] = 0;
|
|
||||||
if (sent) sbuffer[mDNS_snprintf(sbuffer, sizeof(sbuffer), "port " )] = 0;
|
|
||||||
else sbuffer[mDNS_snprintf(sbuffer, sizeof(sbuffer), "%#a:", srcaddr)] = 0;
|
|
||||||
if (dstaddr || !mDNSIPPortIsZero(dstport))
|
|
||||||
dbuffer[mDNS_snprintf(dbuffer, sizeof(dbuffer), " to %#a:%d", dstaddr, mDNSVal16(dstport))] = 0;
|
|
||||||
|
|
||||||
LogInfo("-- %s %s DNS %s%s (flags %02X%02X) RCODE: %s (%d) %s%s%s%s%s%sID: %d %d bytes from %s%d%s%s --",
|
buflen = (mDNSu32)(lim - dst);
|
||||||
tbuffer, transport,
|
if (buflen > 0)
|
||||||
|
{
|
||||||
|
va_start(args, fmt);
|
||||||
|
n = mDNS_vsnprintf(dst, buflen, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
*ptr = dst + n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DNSTypeString(X) (((X) == kDNSType_A) ? "A" : DNSTypeName(X))
|
||||||
|
|
||||||
|
#define ReadField16(PTR) ((mDNSu16)((((mDNSu16)((mDNSu8 *)(PTR))[0]) << 8) | ((mDNSu16)((mDNSu8 *)(PTR))[1])))
|
||||||
|
#define ReadField32(PTR) \
|
||||||
|
((mDNSu32)( \
|
||||||
|
(((mDNSu32)((mDNSu8 *)(PTR))[0]) << 24) | \
|
||||||
|
(((mDNSu32)((mDNSu8 *)(PTR))[1]) << 16) | \
|
||||||
|
(((mDNSu32)((mDNSu8 *)(PTR))[2]) << 8) | \
|
||||||
|
((mDNSu32)((mDNSu8 *)(PTR))[3])))
|
||||||
|
|
||||||
|
mDNSlocal void DNSMessageDump(const DNSMessage *const msg, const mDNSu8 *const end, char *buffer, mDNSu32 buflen)
|
||||||
|
{
|
||||||
|
domainname *name;
|
||||||
|
const mDNSu8 *ptr;
|
||||||
|
domainname nameStorage[2];
|
||||||
|
char *dst = buffer;
|
||||||
|
const char *const lim = &buffer[buflen];
|
||||||
|
mDNSu32 i;
|
||||||
|
const mDNSu32 rrcount = msg->h.numAnswers + msg->h.numAuthorities + msg->h.numAdditionals;
|
||||||
|
|
||||||
|
mDNS_snprintf_add(&dst, lim, "DNS %s%s (%lu) (flags %02X%02X) RCODE: %s (%d)%s%s%s%s%s%s ID: %u:",
|
||||||
DNS_OP_Name(msg->h.flags.b[0] & kDNSFlag0_OP_Mask),
|
DNS_OP_Name(msg->h.flags.b[0] & kDNSFlag0_OP_Mask),
|
||||||
msg->h.flags.b[0] & kDNSFlag0_QR_Response ? "Response" : "Query",
|
(msg->h.flags.b[0] & kDNSFlag0_QR_Response) ? "Response" : "Query",
|
||||||
|
(unsigned long)(end - (const mDNSu8 *)msg),
|
||||||
msg->h.flags.b[0], msg->h.flags.b[1],
|
msg->h.flags.b[0], msg->h.flags.b[1],
|
||||||
DNS_RC_Name(msg->h.flags.b[1] & kDNSFlag1_RC_Mask),
|
DNS_RC_Name(msg->h.flags.b[1] & kDNSFlag1_RC_Mask),
|
||||||
msg->h.flags.b[1] & kDNSFlag1_RC_Mask,
|
msg->h.flags.b[1] & kDNSFlag1_RC_Mask,
|
||||||
msg->h.flags.b[0] & kDNSFlag0_AA ? "AA " : "",
|
(msg->h.flags.b[0] & kDNSFlag0_AA) ? " AA" : "",
|
||||||
msg->h.flags.b[0] & kDNSFlag0_TC ? "TC " : "",
|
(msg->h.flags.b[0] & kDNSFlag0_TC) ? " TC" : "",
|
||||||
msg->h.flags.b[0] & kDNSFlag0_RD ? "RD " : "",
|
(msg->h.flags.b[0] & kDNSFlag0_RD) ? " RD" : "",
|
||||||
msg->h.flags.b[1] & kDNSFlag1_RA ? "RA " : "",
|
(msg->h.flags.b[1] & kDNSFlag1_RA) ? " RA" : "",
|
||||||
msg->h.flags.b[1] & kDNSFlag1_AD ? "AD " : "",
|
(msg->h.flags.b[1] & kDNSFlag1_AD) ? " AD" : "",
|
||||||
msg->h.flags.b[1] & kDNSFlag1_CD ? "CD " : "",
|
(msg->h.flags.b[1] & kDNSFlag1_CD) ? " CD" : "",
|
||||||
mDNSVal16(msg->h.id),
|
mDNSVal16(msg->h.id));
|
||||||
end - msg->data,
|
|
||||||
sbuffer, mDNSVal16(srcport), dbuffer,
|
|
||||||
(msg->h.flags.b[0] & kDNSFlag0_TC) ? " (truncated)" : ""
|
|
||||||
);
|
|
||||||
|
|
||||||
LogInfo("%2d %s", msg->h.numQuestions, IsUpdate ? "Zone" : "Questions");
|
name = mDNSNULL;
|
||||||
for (i = 0; i < msg->h.numQuestions && ptr; i++)
|
ptr = msg->data;
|
||||||
|
for (i = 0; i < msg->h.numQuestions; i++)
|
||||||
{
|
{
|
||||||
ptr = getQuestion(msg, ptr, end, mDNSInterface_Any, &q);
|
mDNSu16 qtype, qclass;
|
||||||
if (ptr) LogInfo("%2d %##s %s", i, q.qname.c, DNSTypeName(q.qtype));
|
|
||||||
|
name = &nameStorage[0];
|
||||||
|
ptr = getDomainName(msg, ptr, end, name);
|
||||||
|
if (!ptr) goto exit;
|
||||||
|
|
||||||
|
if ((end - ptr) < 4) goto exit;
|
||||||
|
qtype = ReadField16(&ptr[0]);
|
||||||
|
qclass = ReadField16(&ptr[2]);
|
||||||
|
ptr += 4;
|
||||||
|
|
||||||
|
mDNS_snprintf_add(&dst, lim, " %##s %s", name->c, DNSTypeString(qtype));
|
||||||
|
if (qclass != kDNSClass_IN) mDNS_snprintf_add(&dst, lim, "/%u", qclass);
|
||||||
|
mDNS_snprintf_add(&dst, lim, "?");
|
||||||
}
|
}
|
||||||
ptr = DumpRecords(m, msg, ptr, end, msg->h.numAnswers, IsUpdate ? "Prerequisites" : "Answers");
|
|
||||||
ptr = DumpRecords(m, msg, ptr, end, msg->h.numAuthorities, IsUpdate ? "Updates" : "Authorities");
|
mDNS_snprintf_add(&dst, lim, " %u/%u/%u", msg->h.numAnswers, msg->h.numAuthorities, msg->h.numAdditionals);
|
||||||
DumpRecords(m, msg, ptr, end, msg->h.numAdditionals, "Additionals");
|
for (i = 0; i < rrcount; i++)
|
||||||
LogInfo("--------------");
|
{
|
||||||
|
mDNSu16 rrtype, rrclass, rdlength;
|
||||||
|
mDNSu32 ttl;
|
||||||
|
int handled;
|
||||||
|
const mDNSu8 *rdata;
|
||||||
|
const domainname *const previousName = name;
|
||||||
|
|
||||||
|
name = &nameStorage[(name == &nameStorage[0]) ? 1 : 0];
|
||||||
|
ptr = getDomainName(msg, ptr, end, name);
|
||||||
|
if (!ptr) goto exit;
|
||||||
|
|
||||||
|
if ((end - ptr) < 10) goto exit;
|
||||||
|
rrtype = ReadField16(&ptr[0]);
|
||||||
|
rrclass = ReadField16(&ptr[2]);
|
||||||
|
ttl = ReadField32(&ptr[4]);
|
||||||
|
rdlength = ReadField16(&ptr[8]);
|
||||||
|
ptr += 10;
|
||||||
|
|
||||||
|
if ((end - ptr) < rdlength) goto exit;
|
||||||
|
rdata = ptr;
|
||||||
|
|
||||||
|
if (i > 0) mDNS_snprintf_add(&dst, lim, ",");
|
||||||
|
if (!previousName || !SameDomainName(name, previousName)) mDNS_snprintf_add(&dst, lim, " %##s", name);
|
||||||
|
|
||||||
|
mDNS_snprintf_add(&dst, lim, " %s", DNSTypeString(rrtype));
|
||||||
|
if (rrclass != kDNSClass_IN) mDNS_snprintf_add(&dst, lim, "/%u", rrclass);
|
||||||
|
mDNS_snprintf_add(&dst, lim, " ");
|
||||||
|
|
||||||
|
handled = mDNSfalse;
|
||||||
|
switch (rrtype)
|
||||||
|
{
|
||||||
|
case kDNSType_A:
|
||||||
|
if (rdlength == 4)
|
||||||
|
{
|
||||||
|
mDNS_snprintf_add(&dst, lim, "%.4a", rdata);
|
||||||
|
handled = mDNStrue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kDNSType_AAAA:
|
||||||
|
if (rdlength == 16)
|
||||||
|
{
|
||||||
|
mDNS_snprintf_add(&dst, lim, "%.16a", rdata);
|
||||||
|
handled = mDNStrue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kDNSType_CNAME:
|
||||||
|
ptr = getDomainName(msg, rdata, end, name);
|
||||||
|
if (!ptr) goto exit;
|
||||||
|
|
||||||
|
mDNS_snprintf_add(&dst, lim, "%##s", name);
|
||||||
|
handled = mDNStrue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kDNSType_SOA:
|
||||||
|
{
|
||||||
|
mDNSu32 serial, refresh, retry, expire, minimum;
|
||||||
|
domainname *const mname = &nameStorage[0];
|
||||||
|
domainname *const rname = &nameStorage[1];
|
||||||
|
name = mDNSNULL;
|
||||||
|
|
||||||
|
ptr = getDomainName(msg, rdata, end, mname);
|
||||||
|
if (!ptr) goto exit;
|
||||||
|
|
||||||
|
ptr = getDomainName(msg, ptr, end, rname);
|
||||||
|
if (!ptr) goto exit;
|
||||||
|
|
||||||
|
if ((end - ptr) < 20) goto exit;
|
||||||
|
serial = ReadField32(&ptr[0]);
|
||||||
|
refresh = ReadField32(&ptr[4]);
|
||||||
|
retry = ReadField32(&ptr[8]);
|
||||||
|
expire = ReadField32(&ptr[12]);
|
||||||
|
minimum = ReadField32(&ptr[16]);
|
||||||
|
|
||||||
|
mDNS_snprintf_add(&dst, lim, "%##s %##s %lu %lu %lu %lu %lu", mname, rname, (unsigned long)serial,
|
||||||
|
(unsigned long)refresh, (unsigned long)retry, (unsigned long)expire, (unsigned long)minimum);
|
||||||
|
|
||||||
|
handled = mDNStrue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!handled) mDNS_snprintf_add(&dst, lim, "RDATA[%u]: %.*H", rdlength, rdlength, rdata);
|
||||||
|
mDNS_snprintf_add(&dst, lim, " (%lu)", (unsigned long)ttl);
|
||||||
|
ptr = rdata + rdlength;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: DumpPacket expects the packet header fields in host byte order, not network byte order
|
||||||
|
mDNSexport void DumpPacket(mStatus status, mDNSBool sent, char *transport,
|
||||||
|
const mDNSAddr *srcaddr, mDNSIPPort srcport,
|
||||||
|
const mDNSAddr *dstaddr, mDNSIPPort dstport, const DNSMessage *const msg, const mDNSu8 *const end)
|
||||||
|
{
|
||||||
|
char buffer[512];
|
||||||
|
char *dst = buffer;
|
||||||
|
const char *const lim = &buffer[512];
|
||||||
|
|
||||||
|
buffer[0] = '\0';
|
||||||
|
if (!status) mDNS_snprintf_add(&dst, lim, sent ? "Sent" : "Received");
|
||||||
|
else mDNS_snprintf_add(&dst, lim, "ERROR %d %sing", status, sent ? "Send" : "Receiv");
|
||||||
|
|
||||||
|
mDNS_snprintf_add(&dst, lim, " %s DNS Message %u bytes from ", transport, (unsigned long)(end - (const mDNSu8 *)msg));
|
||||||
|
|
||||||
|
if (sent) mDNS_snprintf_add(&dst, lim, "port %d", mDNSVal16(srcport));
|
||||||
|
else mDNS_snprintf_add(&dst, lim, "%#a:%d", srcaddr, mDNSVal16(srcport));
|
||||||
|
|
||||||
|
if (dstaddr || !mDNSIPPortIsZero(dstport)) mDNS_snprintf_add(&dst, lim, " to %#a:%d", dstaddr, mDNSVal16(dstport));
|
||||||
|
|
||||||
|
LogInfo("%s", buffer);
|
||||||
|
|
||||||
|
buffer[0] = '\0';
|
||||||
|
DNSMessageDump(msg, end, buffer, (mDNSu32)sizeof(buffer));
|
||||||
|
LogInfo("%s", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
@ -3824,7 +3950,7 @@ mDNSexport mStatus mDNSSendDNSMessage(mDNS *const m, DNSMessage *const msg, mDNS
|
|||||||
|
|
||||||
// Dump the packet with the HINFO and TSIG
|
// Dump the packet with the HINFO and TSIG
|
||||||
if (mDNS_PacketLoggingEnabled && !mDNSOpaque16IsZero(msg->h.id))
|
if (mDNS_PacketLoggingEnabled && !mDNSOpaque16IsZero(msg->h.id))
|
||||||
DumpPacket(m, status, mDNStrue, sock && (sock->flags & kTCPSocketFlags_UseTLS) ? "TLS" : sock ? "TCP" : "UDP", mDNSNULL, src ? src->port : MulticastDNSPort, dst, dstport, msg, end);
|
DumpPacket(status, mDNStrue, sock && (sock->flags & kTCPSocketFlags_UseTLS) ? "TLS" : sock ? "TCP" : "UDP", mDNSNULL, src ? src->port : MulticastDNSPort, dst, dstport, msg, end);
|
||||||
|
|
||||||
// put the number of additionals back the way it was
|
// put the number of additionals back the way it was
|
||||||
msg->h.numAdditionals = numAdditionals;
|
msg->h.numAdditionals = numAdditionals;
|
||||||
@ -4053,6 +4179,9 @@ static const struct mDNSprintf_format
|
|||||||
unsigned int precision;
|
unsigned int precision;
|
||||||
} mDNSprintf_format_default = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
} mDNSprintf_format_default = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
#define kHexDigitsLowercase "0123456789abcdef"
|
||||||
|
#define kHexDigitsUppercase "0123456789ABCDEF";
|
||||||
|
|
||||||
mDNSexport mDNSu32 mDNS_vsnprintf(char *sbuffer, mDNSu32 buflen, const char *fmt, va_list arg)
|
mDNSexport mDNSu32 mDNS_vsnprintf(char *sbuffer, mDNSu32 buflen, const char *fmt, va_list arg)
|
||||||
{
|
{
|
||||||
mDNSu32 nwritten = 0;
|
mDNSu32 nwritten = 0;
|
||||||
@ -4064,6 +4193,7 @@ mDNSexport mDNSu32 mDNS_vsnprintf(char *sbuffer, mDNSu32 buflen, const char *fmt
|
|||||||
for (c = *fmt; c != 0; c = *++fmt)
|
for (c = *fmt; c != 0; c = *++fmt)
|
||||||
{
|
{
|
||||||
unsigned long n;
|
unsigned long n;
|
||||||
|
int hexdump = mDNSfalse;
|
||||||
if (c != '%')
|
if (c != '%')
|
||||||
{
|
{
|
||||||
*sbuffer++ = (char)c;
|
*sbuffer++ = (char)c;
|
||||||
@ -4190,10 +4320,63 @@ decimal: if (!F.havePrecision)
|
|||||||
a[0], a[1], a[2], a[3]); break;
|
a[0], a[1], a[2], a[3]); break;
|
||||||
case 6: i = mDNS_snprintf(mDNS_VACB, sizeof(mDNS_VACB), "%02X:%02X:%02X:%02X:%02X:%02X",
|
case 6: i = mDNS_snprintf(mDNS_VACB, sizeof(mDNS_VACB), "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
a[0], a[1], a[2], a[3], a[4], a[5]); break;
|
a[0], a[1], a[2], a[3], a[4], a[5]); break;
|
||||||
case 16: i = mDNS_snprintf(mDNS_VACB, sizeof(mDNS_VACB),
|
case 16: {
|
||||||
"%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X",
|
// Print IPv6 addresses according to RFC 5952, A Recommendation for IPv6 Address Text
|
||||||
a[0x0], a[0x1], a[0x2], a[0x3], a[0x4], a[0x5], a[0x6], a[0x7],
|
// Representation. See <https://tools.ietf.org/html/rfc5952>.
|
||||||
a[0x8], a[0x9], a[0xA], a[0xB], a[0xC], a[0xD], a[0xE], a[0xF]); break;
|
|
||||||
|
int idx, runLen = 0, runStart = 0, maxRunLen = 0, maxRunStart = 0, maxRunEnd;
|
||||||
|
|
||||||
|
// Find the leftmost longest run of consecutive zero hextets.
|
||||||
|
for (idx = 0; idx < 8; ++idx)
|
||||||
|
{
|
||||||
|
const unsigned int hextet = (a[idx * 2] << 8) | a[(idx * 2) + 1];
|
||||||
|
if (hextet == 0)
|
||||||
|
{
|
||||||
|
if (runLen++ == 0) runStart = idx;
|
||||||
|
if (runLen > maxRunLen)
|
||||||
|
{
|
||||||
|
maxRunStart = runStart;
|
||||||
|
maxRunLen = runLen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If the number of remaining hextets is less than or equal to the length of the longest
|
||||||
|
// run so far, then we've found the leftmost longest run.
|
||||||
|
if ((8 - (idx + 1)) <= maxRunLen) break;
|
||||||
|
runLen = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compress the leftmost longest run of two or more consecutive zero hextets as "::".
|
||||||
|
// For each reminaing hextet, suppress zeros leading up to the least-significant nibble, which
|
||||||
|
// is always written, even if it's zero. Because of this requirement, it's easier to write the
|
||||||
|
// IPv6 address in reverse. Also, write a colon separator before each hextet except for the
|
||||||
|
// first one.
|
||||||
|
s = mDNS_VACB_Lim;
|
||||||
|
maxRunEnd = (maxRunLen >= 2) ? (maxRunStart + maxRunLen - 1) : -1;
|
||||||
|
for (idx = 7; idx >= 0; --idx)
|
||||||
|
{
|
||||||
|
if (idx == maxRunEnd)
|
||||||
|
{
|
||||||
|
if (idx == 7) *--s = ':';
|
||||||
|
idx = maxRunStart;
|
||||||
|
*--s = ':';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned int hextet = (a[idx * 2] << 8) | a[(idx * 2) + 1];
|
||||||
|
do {
|
||||||
|
*--s = kHexDigitsLowercase[hextet % 16];
|
||||||
|
hextet /= 16;
|
||||||
|
} while (hextet);
|
||||||
|
if (idx > 0) *--s = ':';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i = (unsigned int)(mDNS_VACB_Lim - s);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default: i = mDNS_snprintf(mDNS_VACB, sizeof(mDNS_VACB), "%s", "<< ERROR: Must specify"
|
default: i = mDNS_snprintf(mDNS_VACB, sizeof(mDNS_VACB), "%s", "<< ERROR: Must specify"
|
||||||
" address size (i.e. %.4a=IPv4, %.6a=Ethernet, %.16a=IPv6) >>"); break;
|
" address size (i.e. %.4a=IPv4, %.6a=Ethernet, %.16a=IPv6) >>"); break;
|
||||||
}
|
}
|
||||||
@ -4203,9 +4386,9 @@ decimal: if (!F.havePrecision)
|
|||||||
|
|
||||||
case 'p': F.havePrecision = F.lSize = 1;
|
case 'p': F.havePrecision = F.lSize = 1;
|
||||||
F.precision = sizeof(void*) * 2; // 8 characters on 32-bit; 16 characters on 64-bit
|
F.precision = sizeof(void*) * 2; // 8 characters on 32-bit; 16 characters on 64-bit
|
||||||
case 'X': digits = "0123456789ABCDEF";
|
case 'X': digits = kHexDigitsUppercase;
|
||||||
goto hexadecimal;
|
goto hexadecimal;
|
||||||
case 'x': digits = "0123456789abcdef";
|
case 'x': digits = kHexDigitsLowercase;
|
||||||
hexadecimal: if (F.lSize) n = va_arg(arg, unsigned long);
|
hexadecimal: if (F.lSize) n = va_arg(arg, unsigned long);
|
||||||
else n = va_arg(arg, unsigned int);
|
else n = va_arg(arg, unsigned int);
|
||||||
if (F.hSize) n = (unsigned short) n;
|
if (F.hSize) n = (unsigned short) n;
|
||||||
@ -4288,6 +4471,12 @@ hexadecimal: if (F.lSize) n = va_arg(arg, unsigned long);
|
|||||||
{ i = F.precision; while (i>0 && (s[i] & 0xC0) == 0x80) i--;}
|
{ i = F.precision; while (i>0 && (s[i] & 0xC0) == 0x80) i--;}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'H': {
|
||||||
|
s = va_arg(arg, char *);
|
||||||
|
hexdump = mDNStrue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'n': s = va_arg(arg, char *);
|
case 'n': s = va_arg(arg, char *);
|
||||||
if (F.hSize) *(short *) s = (short)nwritten;
|
if (F.hSize) *(short *) s = (short)nwritten;
|
||||||
else if (F.lSize) *(long *) s = (long)nwritten;
|
else if (F.lSize) *(long *) s = (long)nwritten;
|
||||||
@ -4308,6 +4497,25 @@ hexadecimal: if (F.lSize) n = va_arg(arg, unsigned long);
|
|||||||
if (++nwritten >= buflen) goto exit;
|
if (++nwritten >= buflen) goto exit;
|
||||||
} while (i < --F.fieldWidth);
|
} while (i < --F.fieldWidth);
|
||||||
|
|
||||||
|
if (hexdump)
|
||||||
|
{
|
||||||
|
char *dst = sbuffer;
|
||||||
|
const char *const lim = &sbuffer[buflen - nwritten];
|
||||||
|
if (F.havePrecision)
|
||||||
|
{
|
||||||
|
for (i = 0; (i < F.precision) && (dst < lim); i++)
|
||||||
|
{
|
||||||
|
const unsigned int b = (unsigned int) *s++;
|
||||||
|
if (i > 0) *dst++ = ' ';
|
||||||
|
if (dst < lim) *dst++ = kHexDigitsLowercase[(b >> 4) & 0xF];
|
||||||
|
if (dst < lim) *dst++ = kHexDigitsLowercase[ b & 0xF];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i = (unsigned int)(dst - sbuffer);
|
||||||
|
sbuffer = dst;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Make sure we don't truncate in the middle of a UTF-8 character.
|
// Make sure we don't truncate in the middle of a UTF-8 character.
|
||||||
// Note: s[i] is the first eliminated character; i.e. the next character *after* the last character of the
|
// Note: s[i] is the first eliminated character; i.e. the next character *after* the last character of the
|
||||||
// allowed output. If s[i] is a UTF-8 continuation character, then we've cut a unicode character in half,
|
// allowed output. If s[i] is a UTF-8 continuation character, then we've cut a unicode character in half,
|
||||||
@ -4316,6 +4524,7 @@ hexadecimal: if (F.lSize) n = va_arg(arg, unsigned long);
|
|||||||
if (i > buflen - nwritten)
|
if (i > buflen - nwritten)
|
||||||
{ i = buflen - nwritten; while (i>0 && (s[i] & 0xC0) == 0x80) i--;}
|
{ i = buflen - nwritten; while (i>0 && (s[i] & 0xC0) == 0x80) i--;}
|
||||||
for (j=0; j<i; j++) *sbuffer++ = *s++; // Write the converted result
|
for (j=0; j<i; j++) *sbuffer++ = *s++; // Write the converted result
|
||||||
|
}
|
||||||
nwritten += i;
|
nwritten += i;
|
||||||
if (nwritten >= buflen) goto exit;
|
if (nwritten >= buflen) goto exit;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -260,7 +260,7 @@ extern const mDNSu8 *LocateAdditionals(const DNSMessage *const msg, const mDNSu8
|
|||||||
extern const mDNSu8 *LocateOptRR(const DNSMessage *const msg, const mDNSu8 *const end, int minsize);
|
extern const mDNSu8 *LocateOptRR(const DNSMessage *const msg, const mDNSu8 *const end, int minsize);
|
||||||
extern const rdataOPT *GetLLQOptData(mDNS *const m, const DNSMessage *const msg, const mDNSu8 *const end);
|
extern const rdataOPT *GetLLQOptData(mDNS *const m, const DNSMessage *const msg, const mDNSu8 *const end);
|
||||||
extern mDNSBool GetPktLease(mDNS *const m, const DNSMessage *const msg, const mDNSu8 *const end, mDNSu32 *const lease);
|
extern mDNSBool GetPktLease(mDNS *const m, const DNSMessage *const msg, const mDNSu8 *const end, mDNSu32 *const lease);
|
||||||
extern void DumpPacket(mDNS *const m, mStatus status, mDNSBool sent, char *transport,
|
extern void DumpPacket(mStatus status, mDNSBool sent, char *transport,
|
||||||
const mDNSAddr *srcaddr, mDNSIPPort srcport,
|
const mDNSAddr *srcaddr, mDNSIPPort srcport,
|
||||||
const mDNSAddr *dstaddr, mDNSIPPort dstport, const DNSMessage *const msg, const mDNSu8 *const end);
|
const mDNSAddr *dstaddr, mDNSIPPort dstport, const DNSMessage *const msg, const mDNSu8 *const end);
|
||||||
extern mDNSBool RRAssertsNonexistence(const ResourceRecord *const rr, mDNSu16 type);
|
extern mDNSBool RRAssertsNonexistence(const ResourceRecord *const rr, mDNSu16 type);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2017 Apple Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -548,6 +548,7 @@ mDNSexport void AnswerQuestionByFollowingCNAME(mDNS *const m, DNSQuestion *q, Re
|
|||||||
// because mDNS_StartQuery_internal re-initializes CNAMEReferrals to zero
|
// because mDNS_StartQuery_internal re-initializes CNAMEReferrals to zero
|
||||||
q->CNAMEReferrals = c;
|
q->CNAMEReferrals = c;
|
||||||
#if AWD_METRICS
|
#if AWD_METRICS
|
||||||
|
metrics.expiredAnswerState = q->metrics.expiredAnswerState; // We want the newly initialized state for this value
|
||||||
q->metrics = metrics;
|
q->metrics = metrics;
|
||||||
#endif
|
#endif
|
||||||
if (sock)
|
if (sock)
|
||||||
@ -785,6 +786,7 @@ mDNSlocal void AnswerAllLocalQuestionsWithLocalAuthRecord(mDNS *const m, AuthRec
|
|||||||
#define GoodbyeCount ((mDNSu8)3)
|
#define GoodbyeCount ((mDNSu8)3)
|
||||||
#define WakeupCount ((mDNSu8)18)
|
#define WakeupCount ((mDNSu8)18)
|
||||||
#define MAX_PROBE_RESTARTS ((mDNSu8)20)
|
#define MAX_PROBE_RESTARTS ((mDNSu8)20)
|
||||||
|
#define MAX_GHOST_TIME ((mDNSs32)((60*60*24*7)*mDNSPlatformOneSecond)) // One week
|
||||||
|
|
||||||
// Number of wakeups we send if WakeOnResolve is set in the question
|
// Number of wakeups we send if WakeOnResolve is set in the question
|
||||||
#define InitialWakeOnResolveCount ((mDNSu8)3)
|
#define InitialWakeOnResolveCount ((mDNSu8)3)
|
||||||
@ -3220,21 +3222,25 @@ mDNSlocal mDNSBool BuildQuestion(mDNS *const m, const NetworkInterfaceInfo *intf
|
|||||||
// Depth 3: PTR "_services._dns-sd._udp.local." refers to "_example._tcp.local."; may be stale
|
// Depth 3: PTR "_services._dns-sd._udp.local." refers to "_example._tcp.local."; may be stale
|
||||||
// Currently depths 4 and 5 are not expected to occur; if we did get to depth 5 we'd reconfim any records we
|
// Currently depths 4 and 5 are not expected to occur; if we did get to depth 5 we'd reconfim any records we
|
||||||
// found referring to the given name, but not recursively descend any further reconfirm *their* antecedents.
|
// found referring to the given name, but not recursively descend any further reconfirm *their* antecedents.
|
||||||
mDNSlocal void ReconfirmAntecedents(mDNS *const m, const domainname *const name, const mDNSu32 namehash, const int depth)
|
mDNSlocal void ReconfirmAntecedents(mDNS *const m, const domainname *const name, const mDNSu32 namehash, const mDNSInterfaceID InterfaceID, const int depth)
|
||||||
{
|
{
|
||||||
mDNSu32 slot;
|
mDNSu32 slot;
|
||||||
CacheGroup *cg;
|
const CacheGroup *cg;
|
||||||
CacheRecord *cr;
|
CacheRecord *cr;
|
||||||
debugf("ReconfirmAntecedents (depth=%d) for %##s", depth, name->c);
|
debugf("ReconfirmAntecedents (depth=%d) for %##s", depth, name->c);
|
||||||
|
if (!InterfaceID) return; // mDNS records have a non-zero InterfaceID. If InterfaceID is 0, then there's nothing to do.
|
||||||
FORALL_CACHERECORDS(slot, cg, cr)
|
FORALL_CACHERECORDS(slot, cg, cr)
|
||||||
{
|
{
|
||||||
domainname *crtarget = GetRRDomainNameTarget(&cr->resrec);
|
const domainname *crtarget;
|
||||||
if (crtarget && cr->resrec.rdatahash == namehash && SameDomainName(crtarget, name))
|
if (cr->resrec.InterfaceID != InterfaceID) continue; // Skip non-mDNS records and mDNS records from other interfaces.
|
||||||
|
if (cr->resrec.rdatahash != namehash) continue; // Skip records whose rdata hash doesn't match the name hash.
|
||||||
|
crtarget = GetRRDomainNameTarget(&cr->resrec);
|
||||||
|
if (crtarget && SameDomainName(crtarget, name))
|
||||||
{
|
{
|
||||||
LogInfo("ReconfirmAntecedents: Reconfirming (depth=%d) %s", depth, CRDisplayString(m, cr));
|
LogInfo("ReconfirmAntecedents: Reconfirming (depth=%d, InterfaceID=%p) %s", depth, InterfaceID, CRDisplayString(m, cr));
|
||||||
mDNS_Reconfirm_internal(m, cr, kDefaultReconfirmTimeForNoAnswer);
|
mDNS_Reconfirm_internal(m, cr, kDefaultReconfirmTimeForNoAnswer);
|
||||||
if (depth < 5)
|
if (depth < 5)
|
||||||
ReconfirmAntecedents(m, cr->resrec.name, cr->resrec.namehash, depth+1);
|
ReconfirmAntecedents(m, cr->resrec.name, cr->resrec.namehash, InterfaceID, depth+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3612,7 +3618,8 @@ mDNSlocal void SendQueries(mDNS *const m)
|
|||||||
{
|
{
|
||||||
q->ThisQInterval = MaxQuestionInterval;
|
q->ThisQInterval = MaxQuestionInterval;
|
||||||
}
|
}
|
||||||
else if (q->CurrentAnswers == 0 && q->ThisQInterval == InitialQuestionInterval * QuestionIntervalStep3 && !q->RequestUnicast &&
|
else if (mDNSOpaque16IsZero(q->TargetQID) && q->InterfaceID &&
|
||||||
|
q->CurrentAnswers == 0 && q->ThisQInterval == InitialQuestionInterval * QuestionIntervalStep3 && !q->RequestUnicast &&
|
||||||
!(RRTypeIsAddressType(q->qtype) && CacheHasAddressTypeForName(m, &q->qname, q->qnamehash)))
|
!(RRTypeIsAddressType(q->qtype) && CacheHasAddressTypeForName(m, &q->qname, q->qnamehash)))
|
||||||
{
|
{
|
||||||
// Generally don't need to log this.
|
// Generally don't need to log this.
|
||||||
@ -3623,7 +3630,7 @@ mDNSlocal void SendQueries(mDNS *const m)
|
|||||||
debugf("SendQueries: Zero current answers for %##s (%s); will reconfirm antecedents",
|
debugf("SendQueries: Zero current answers for %##s (%s); will reconfirm antecedents",
|
||||||
q->qname.c, DNSTypeName(q->qtype));
|
q->qname.c, DNSTypeName(q->qtype));
|
||||||
// Sending third query, and no answers yet; time to begin doubting the source
|
// Sending third query, and no answers yet; time to begin doubting the source
|
||||||
ReconfirmAntecedents(m, &q->qname, q->qnamehash, 0);
|
ReconfirmAntecedents(m, &q->qname, q->qnamehash, q->InterfaceID, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4107,8 +4114,9 @@ mDNSexport void AnswerCurrentQuestionWithResourceRecord(mDNS *const m, CacheReco
|
|||||||
DNSQuestion *const q = m->CurrentQuestion;
|
DNSQuestion *const q = m->CurrentQuestion;
|
||||||
const mDNSBool followcname = FollowCNAME(q, &rr->resrec, AddRecord);
|
const mDNSBool followcname = FollowCNAME(q, &rr->resrec, AddRecord);
|
||||||
|
|
||||||
verbosedebugf("AnswerCurrentQuestionWithResourceRecord:%4lu %s TTL %d %s",
|
verbosedebugf("AnswerCurrentQuestionWithResourceRecord:%4lu %s (%s) TTL %d %s",
|
||||||
q->CurrentAnswers, AddRecord ? "Add" : "Rmv", rr->resrec.rroriginalttl, CRDisplayString(m, rr));
|
q->CurrentAnswers, AddRecord ? "Add" : "Rmv", MortalityDisplayString(rr->resrec.mortality),
|
||||||
|
rr->resrec.rroriginalttl, CRDisplayString(m, rr));
|
||||||
|
|
||||||
// When the response for the question was validated, the entire rrset was validated. If we deliver
|
// When the response for the question was validated, the entire rrset was validated. If we deliver
|
||||||
// a RMV for a single record in the rrset, we invalidate the response. If we deliver another add
|
// a RMV for a single record in the rrset, we invalidate the response. If we deliver another add
|
||||||
@ -4150,6 +4158,10 @@ mDNSexport void AnswerCurrentQuestionWithResourceRecord(mDNS *const m, CacheReco
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the record to immortal if appropriate
|
||||||
|
if (AddRecord == QC_add && Question_uDNS(q) && rr->resrec.RecordType != kDNSRecordTypePacketNegative &&
|
||||||
|
q->allowExpired != AllowExpired_None && rr->resrec.mortality == Mortality_Mortal ) rr->resrec.mortality = Mortality_Immortal; // Update a non-expired cache record to immortal if appropriate
|
||||||
|
|
||||||
#if AWD_METRICS
|
#if AWD_METRICS
|
||||||
if ((AddRecord == QC_add) && Question_uDNS(q) && !followcname)
|
if ((AddRecord == QC_add) && Question_uDNS(q) && !followcname)
|
||||||
{
|
{
|
||||||
@ -4170,7 +4182,7 @@ mDNSexport void AnswerCurrentQuestionWithResourceRecord(mDNS *const m, CacheReco
|
|||||||
responseLatencyMs = 0;
|
responseLatencyMs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetricsUpdateDNSQueryStats(queryName, q->qtype, &rr->resrec, q->metrics.querySendCount, responseLatencyMs, isForCellular);
|
MetricsUpdateDNSQueryStats(queryName, q->qtype, &rr->resrec, q->metrics.querySendCount, q->metrics.expiredAnswerState, responseLatencyMs, isForCellular);
|
||||||
q->metrics.answered = mDNStrue;
|
q->metrics.answered = mDNStrue;
|
||||||
}
|
}
|
||||||
if (q->metrics.querySendCount > 0)
|
if (q->metrics.querySendCount > 0)
|
||||||
@ -4183,8 +4195,7 @@ mDNSexport void AnswerCurrentQuestionWithResourceRecord(mDNS *const m, CacheReco
|
|||||||
// may be called twice, once when the record is received, and again when it's time to notify local clients.
|
// 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.
|
// If any counters or similar are added here, care must be taken to ensure that they are not double-incremented by this.
|
||||||
|
|
||||||
rr->LastUsed = m->timenow;
|
if (AddRecord == QC_add && !q->DuplicateOf && rr->CRActiveQuestion != q && rr->resrec.mortality != Mortality_Ghost)
|
||||||
if (AddRecord == QC_add && !q->DuplicateOf && rr->CRActiveQuestion != q)
|
|
||||||
{
|
{
|
||||||
if (!rr->CRActiveQuestion) m->rrcache_active++; // If not previously active, increment rrcache_active count
|
if (!rr->CRActiveQuestion) m->rrcache_active++; // If not previously active, increment rrcache_active count
|
||||||
debugf("AnswerCurrentQuestionWithResourceRecord: Updating CRActiveQuestion from %p to %p for cache record %s, CurrentAnswer %d",
|
debugf("AnswerCurrentQuestionWithResourceRecord: Updating CRActiveQuestion from %p to %p for cache record %s, CurrentAnswer %d",
|
||||||
@ -4293,14 +4304,21 @@ mDNSexport void AnswerCurrentQuestionWithResourceRecord(mDNS *const m, CacheReco
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: Proceed with caution here because client callback function is allowed to do anything,
|
if ((m->CurrentQuestion == q) && !ValidatingQuestion(q))
|
||||||
// including starting/stopping queries, registering/deregistering records, etc.
|
{
|
||||||
//
|
|
||||||
// If we get a CNAME back while we are validating the response (i.e., CNAME for DS, DNSKEY, RRSIG),
|
// If we get a CNAME back while we are validating the response (i.e., CNAME for DS, DNSKEY, RRSIG),
|
||||||
// don't follow them. If it is a ValidationRequired question, wait for the CNAME to be validated
|
// don't follow them. If it is a ValidationRequired question, wait for the CNAME to be validated
|
||||||
// first before following it
|
// first before following it
|
||||||
if ((m->CurrentQuestion == q) && followcname && !ValidatingQuestion(q))
|
if (followcname) AnswerQuestionByFollowingCNAME(m, q, &rr->resrec);
|
||||||
AnswerQuestionByFollowingCNAME(m, q, &rr->resrec);
|
|
||||||
|
// If we are returning expired RRs, then remember the first expired qname we we can start the query again
|
||||||
|
if (rr->resrec.mortality == Mortality_Ghost && !q->firstExpiredQname.c[0] && (q->allowExpired == AllowExpired_AllowExpiredAnswers) && rr->resrec.RecordType != kDNSRecordTypePacketNegative)
|
||||||
|
{
|
||||||
|
debugf("AnswerCurrentQuestionWithResourceRecord: Keeping track of domain for expired RR %s for question %p", CRDisplayString(m,rr), q);
|
||||||
|
// Note: question->qname is already changed at this point if following a CNAME
|
||||||
|
AssignDomainName(&q->firstExpiredQname, rr->resrec.name); // Update firstExpiredQname
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mDNSlocal void CacheRecordDeferredAdd(mDNS *const m, CacheRecord *rr)
|
mDNSlocal void CacheRecordDeferredAdd(mDNS *const m, CacheRecord *rr)
|
||||||
@ -4474,7 +4492,8 @@ mDNSlocal void CacheRecordRmv(mDNS *const m, CacheRecord *rr)
|
|||||||
// response. A cache may be present that answers this question e.g., cache entry generated
|
// response. A cache may be present that answers this question e.g., cache entry generated
|
||||||
// before the question became suppressed. We need to skip the suppressed questions here as
|
// before the question became suppressed. We need to skip the suppressed questions here as
|
||||||
// the RMV event has already been generated.
|
// the RMV event has already been generated.
|
||||||
if (!QuerySuppressed(q) && ResourceRecordAnswersQuestion(&rr->resrec, q))
|
if (!QuerySuppressed(q) && ResourceRecordAnswersQuestion(&rr->resrec, q) &&
|
||||||
|
(q->allowExpired == AllowExpired_None || rr->resrec.mortality == Mortality_Mortal))
|
||||||
{
|
{
|
||||||
verbosedebugf("CacheRecordRmv %p %s", rr, CRDisplayString(m, rr));
|
verbosedebugf("CacheRecordRmv %p %s", rr, CRDisplayString(m, rr));
|
||||||
q->FlappingInterface1 = mDNSNULL;
|
q->FlappingInterface1 = mDNSNULL;
|
||||||
@ -4503,11 +4522,11 @@ mDNSlocal void CacheRecordRmv(mDNS *const m, CacheRecord *rr)
|
|||||||
}
|
}
|
||||||
if (rr->resrec.rdata->MaxRDLength) // Never generate "remove" events for negative results
|
if (rr->resrec.rdata->MaxRDLength) // Never generate "remove" events for negative results
|
||||||
{
|
{
|
||||||
if (q->CurrentAnswers == 0)
|
if ((q->CurrentAnswers == 0) && mDNSOpaque16IsZero(q->TargetQID))
|
||||||
{
|
{
|
||||||
LogInfo("CacheRecordRmv: Last answer for %##s (%s) expired from cache; will reconfirm antecedents",
|
LogInfo("CacheRecordRmv: Last answer for %##s (%s) expired from cache; will reconfirm antecedents",
|
||||||
q->qname.c, DNSTypeName(q->qtype));
|
q->qname.c, DNSTypeName(q->qtype));
|
||||||
ReconfirmAntecedents(m, &q->qname, q->qnamehash, 0);
|
ReconfirmAntecedents(m, &q->qname, q->qnamehash, rr->resrec.InterfaceID, 0);
|
||||||
}
|
}
|
||||||
AnswerCurrentQuestionWithResourceRecord(m, rr, QC_rmv);
|
AnswerCurrentQuestionWithResourceRecord(m, rr, QC_rmv);
|
||||||
}
|
}
|
||||||
@ -4631,16 +4650,15 @@ mDNSlocal void CheckCacheExpiration(mDNS *const m, const mDNSu32 slot, CacheGrou
|
|||||||
while (*rp)
|
while (*rp)
|
||||||
{
|
{
|
||||||
CacheRecord *const rr = *rp;
|
CacheRecord *const rr = *rp;
|
||||||
|
mDNSBool recordReleased = mDNSfalse;
|
||||||
mDNSs32 event = RRExpireTime(rr);
|
mDNSs32 event = RRExpireTime(rr);
|
||||||
if (m->timenow - event >= 0) // If expired, delete it
|
if (m->timenow - event >= 0) // If expired, delete it
|
||||||
{
|
{
|
||||||
*rp = rr->next; // Cut it from the list
|
|
||||||
|
|
||||||
verbosedebugf("CheckCacheExpiration: Deleting%7d %7d %p %s",
|
|
||||||
m->timenow - rr->TimeRcvd, rr->resrec.rroriginalttl, rr->CRActiveQuestion, CRDisplayString(m, rr));
|
|
||||||
if (rr->CRActiveQuestion) // If this record has one or more active questions, tell them it's going away
|
if (rr->CRActiveQuestion) // If this record has one or more active questions, tell them it's going away
|
||||||
{
|
{
|
||||||
DNSQuestion *q = rr->CRActiveQuestion;
|
DNSQuestion *q = rr->CRActiveQuestion;
|
||||||
|
verbosedebugf("CheckCacheExpiration: Removing%7d %7d %p %s",
|
||||||
|
m->timenow - rr->TimeRcvd, rr->resrec.rroriginalttl, rr->CRActiveQuestion, CRDisplayString(m, rr));
|
||||||
// When a cache record is about to expire, we expect to do four queries at 80-82%, 85-87%, 90-92% and
|
// When a cache record is about to expire, we expect to do four queries at 80-82%, 85-87%, 90-92% and
|
||||||
// then 95-97% of the TTL. If the DNS server does not respond, then we will remove the cache entry
|
// then 95-97% of the TTL. If the DNS server does not respond, then we will remove the cache entry
|
||||||
// before we pick a new DNS server. As the question interval is set to MaxQuestionInterval, we may
|
// before we pick a new DNS server. As the question interval is set to MaxQuestionInterval, we may
|
||||||
@ -4657,7 +4675,28 @@ mDNSlocal void CheckCacheExpiration(mDNS *const m, const mDNSu32 slot, CacheGrou
|
|||||||
CacheRecordRmv(m, rr);
|
CacheRecordRmv(m, rr);
|
||||||
m->rrcache_active--;
|
m->rrcache_active--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event += MAX_GHOST_TIME; // Adjust so we can check for a ghost expiration
|
||||||
|
if (rr->resrec.mortality == Mortality_Mortal || // Normal expired mortal record that needs released
|
||||||
|
(rr->resrec.mortality == Mortality_Ghost && m->timenow - event >= 0)) // A ghost record that expired more than MAX_GHOST_TIME ago
|
||||||
|
{ // Release as normal
|
||||||
|
*rp = rr->next; // Cut it from the list before ReleaseCacheRecord
|
||||||
|
verbosedebugf("CheckCacheExpiration: Deleting (%s)%7d %7d %p %s",
|
||||||
|
MortalityDisplayString(rr->resrec.mortality),
|
||||||
|
m->timenow - rr->TimeRcvd, rr->resrec.rroriginalttl, rr->CRActiveQuestion, CRDisplayString(m, rr));
|
||||||
ReleaseCacheRecord(m, rr);
|
ReleaseCacheRecord(m, rr);
|
||||||
|
recordReleased = mDNStrue;
|
||||||
|
}
|
||||||
|
else // An immortal record needs to become a ghost when it expires
|
||||||
|
{ // Don't release this entry
|
||||||
|
if (rr->resrec.mortality == Mortality_Immortal)
|
||||||
|
{
|
||||||
|
rr->resrec.mortality = Mortality_Ghost; // Expired immortal records become ghosts
|
||||||
|
verbosedebugf("CheckCacheExpiration: NOT Deleting (%s)%7d %7d %p %s",
|
||||||
|
MortalityDisplayString(rr->resrec.mortality),
|
||||||
|
m->timenow - rr->TimeRcvd, rr->resrec.rroriginalttl, rr->CRActiveQuestion, CRDisplayString(m, rr));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // else, not expired; see if we need to query
|
else // else, not expired; see if we need to query
|
||||||
{
|
{
|
||||||
@ -4682,6 +4721,10 @@ mDNSlocal void CheckCacheExpiration(mDNS *const m, const mDNSu32 slot, CacheGrou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!recordReleased) // Schedule if we did not release the record
|
||||||
|
{
|
||||||
verbosedebugf("CheckCacheExpiration:%6d %5d %s",
|
verbosedebugf("CheckCacheExpiration:%6d %5d %s",
|
||||||
(event - m->timenow) / mDNSPlatformOneSecond, CacheCheckGracePeriod(rr), CRDisplayString(m, rr));
|
(event - m->timenow) / mDNSPlatformOneSecond, CacheCheckGracePeriod(rr), CRDisplayString(m, rr));
|
||||||
if (m->rrcache_nextcheck[slot] - event > 0)
|
if (m->rrcache_nextcheck[slot] - event > 0)
|
||||||
@ -4893,12 +4936,7 @@ mDNSlocal void AnswerNewQuestion(mDNS *const m)
|
|||||||
{
|
{
|
||||||
// SecsSinceRcvd is whole number of elapsed seconds, rounded down
|
// SecsSinceRcvd is whole number of elapsed seconds, rounded down
|
||||||
mDNSu32 SecsSinceRcvd = ((mDNSu32)(m->timenow - rr->TimeRcvd)) / mDNSPlatformOneSecond;
|
mDNSu32 SecsSinceRcvd = ((mDNSu32)(m->timenow - rr->TimeRcvd)) / mDNSPlatformOneSecond;
|
||||||
if (rr->resrec.rroriginalttl <= SecsSinceRcvd)
|
if (rr->resrec.rroriginalttl <= SecsSinceRcvd && q->allowExpired != AllowExpired_AllowExpiredAnswers) continue; // Go to next one in loop
|
||||||
{
|
|
||||||
LogMsg("AnswerNewQuestion: How is rr->resrec.rroriginalttl %lu <= SecsSinceRcvd %lu for %s %d %d",
|
|
||||||
rr->resrec.rroriginalttl, SecsSinceRcvd, CRDisplayString(m, rr), m->timenow, rr->TimeRcvd);
|
|
||||||
continue; // Go to next one in loop
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this record set is marked unique, then that means we can reasonably assume we have the whole set
|
// If this record set is marked unique, then that means we can reasonably assume we have the whole set
|
||||||
// -- we don't need to rush out on the network and query immediately to see if there are more answers out there
|
// -- we don't need to rush out on the network and query immediately to see if there are more answers out there
|
||||||
@ -4908,6 +4946,9 @@ mDNSlocal void AnswerNewQuestion(mDNS *const m)
|
|||||||
if (rr->resrec.rdlength > SmallRecordLimit) q->LargeAnswers++;
|
if (rr->resrec.rdlength > SmallRecordLimit) q->LargeAnswers++;
|
||||||
if (rr->resrec.RecordType & kDNSRecordTypePacketUniqueMask) q->UniqueAnswers++;
|
if (rr->resrec.RecordType & kDNSRecordTypePacketUniqueMask) q->UniqueAnswers++;
|
||||||
AnsweredFromCache = mDNStrue;
|
AnsweredFromCache = mDNStrue;
|
||||||
|
#if AWD_METRICS
|
||||||
|
if (q->metrics.expiredAnswerState == ExpiredAnswer_Allowed) q->metrics.expiredAnswerState = ExpiredAnswer_AnsweredWithExpired;
|
||||||
|
#endif
|
||||||
AnswerCurrentQuestionWithResourceRecord(m, rr, QC_add);
|
AnswerCurrentQuestionWithResourceRecord(m, rr, QC_add);
|
||||||
if (m->CurrentQuestion != q) break; // If callback deleted q, then we're finished here
|
if (m->CurrentQuestion != q) break; // If callback deleted q, then we're finished here
|
||||||
}
|
}
|
||||||
@ -4930,6 +4971,21 @@ mDNSlocal void AnswerNewQuestion(mDNS *const m)
|
|||||||
|
|
||||||
if (m->CurrentQuestion != q) { debugf("AnswerNewQuestion: Question deleted while giving negative answer"); goto exit; }
|
if (m->CurrentQuestion != q) { debugf("AnswerNewQuestion: Question deleted while giving negative answer"); goto exit; }
|
||||||
|
|
||||||
|
if (q->allowExpired == AllowExpired_AllowExpiredAnswers)
|
||||||
|
{
|
||||||
|
q->allowExpired = AllowExpired_MakeAnswersImmortal; // After looking through the cache for an answer, demote to make immortal
|
||||||
|
if (q->firstExpiredQname.c[0]) // If an original query name was saved on an expired answer, start it over in case it is updated
|
||||||
|
{
|
||||||
|
LogMsg("AnswerNewQuestion: Restarting original question %p firstExpiredQname %##s for allowExpiredAnswers question", q, &q->firstExpiredQname.c);
|
||||||
|
mDNS_StopQuery_internal(m, q); // Stop old query
|
||||||
|
AssignDomainName(&q->qname, &q->firstExpiredQname); // Update qname
|
||||||
|
q->qnamehash = DomainNameHashValue(&q->qname); // and namehash
|
||||||
|
mDNS_StartQuery_internal(m, q); // start new query
|
||||||
|
q->CNAMEReferrals = 0; // Reset referral count
|
||||||
|
q->firstExpiredQname.c[0] = 0; // Erase the domain name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Note: When a query gets suppressed or retried with search domains, we de-activate the question.
|
// Note: When a query gets suppressed or retried with search domains, we de-activate the question.
|
||||||
// Hence we don't execute the following block of code for those cases.
|
// Hence we don't execute the following block of code for those cases.
|
||||||
if (ShouldQueryImmediately && ActiveQuestion(q))
|
if (ShouldQueryImmediately && ActiveQuestion(q))
|
||||||
@ -7467,6 +7523,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con
|
|||||||
AuthRecord **nrp = &ResponseRecords;
|
AuthRecord **nrp = &ResponseRecords;
|
||||||
|
|
||||||
#if POOF_ENABLED
|
#if POOF_ENABLED
|
||||||
|
mDNSBool notD2D = !mDNSPlatformInterfaceIsD2D(InterfaceID); // We don't run the POOF algorithm on D2D interfaces.
|
||||||
CacheRecord *ExpectedAnswers = mDNSNULL; // Records in our cache we expect to see updated
|
CacheRecord *ExpectedAnswers = mDNSNULL; // Records in our cache we expect to see updated
|
||||||
CacheRecord **eap = &ExpectedAnswers;
|
CacheRecord **eap = &ExpectedAnswers;
|
||||||
#endif // POOF_ENABLED
|
#endif // POOF_ENABLED
|
||||||
@ -7626,6 +7683,8 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con
|
|||||||
if (QuestionNeedsMulticastResponse && !(query->h.flags.b[0] & kDNSFlag0_TC))
|
if (QuestionNeedsMulticastResponse && !(query->h.flags.b[0] & kDNSFlag0_TC))
|
||||||
{
|
{
|
||||||
#if POOF_ENABLED
|
#if POOF_ENABLED
|
||||||
|
if (notD2D)
|
||||||
|
{
|
||||||
CacheGroup *cg = CacheGroupForName(m, pktq.qnamehash, &pktq.qname);
|
CacheGroup *cg = CacheGroupForName(m, pktq.qnamehash, &pktq.qname);
|
||||||
CacheRecord *cr;
|
CacheRecord *cr;
|
||||||
|
|
||||||
@ -7638,6 +7697,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con
|
|||||||
*eap = cr;
|
*eap = cr;
|
||||||
eap = &cr->NextInKAList;
|
eap = &cr->NextInKAList;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif // POOF_ENABLED
|
#endif // POOF_ENABLED
|
||||||
|
|
||||||
// Check if this question is the same as any of mine.
|
// Check if this question is the same as any of mine.
|
||||||
@ -7728,6 +7788,8 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con
|
|||||||
ourcacherr = FindIdenticalRecordInCache(m, &m->rec.r.resrec);
|
ourcacherr = FindIdenticalRecordInCache(m, &m->rec.r.resrec);
|
||||||
|
|
||||||
#if POOF_ENABLED
|
#if POOF_ENABLED
|
||||||
|
if (notD2D)
|
||||||
|
{
|
||||||
// Having built our ExpectedAnswers list from the questions in this packet, we then remove
|
// Having built our ExpectedAnswers list from the questions in this packet, we then remove
|
||||||
// any records that are suppressed by the Known Answer list in this packet.
|
// any records that are suppressed by the Known Answer list in this packet.
|
||||||
eap = &ExpectedAnswers;
|
eap = &ExpectedAnswers;
|
||||||
@ -7738,6 +7800,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con
|
|||||||
{ *eap = cr->NextInKAList; cr->NextInKAList = mDNSNULL; }
|
{ *eap = cr->NextInKAList; cr->NextInKAList = mDNSNULL; }
|
||||||
else eap = &cr->NextInKAList;
|
else eap = &cr->NextInKAList;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif // POOF_ENABLED
|
#endif // POOF_ENABLED
|
||||||
|
|
||||||
// See if this Known-Answer is a surprise to us. If so, we shouldn't suppress our own query.
|
// See if this Known-Answer is a surprise to us. If so, we shouldn't suppress our own query.
|
||||||
@ -7900,7 +7963,7 @@ exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if POOF_ENABLED
|
#if POOF_ENABLED
|
||||||
while (ExpectedAnswers)
|
while (ExpectedAnswers && notD2D)
|
||||||
{
|
{
|
||||||
CacheRecord *cr = ExpectedAnswers;
|
CacheRecord *cr = ExpectedAnswers;
|
||||||
ExpectedAnswers = cr->NextInKAList;
|
ExpectedAnswers = cr->NextInKAList;
|
||||||
@ -8110,6 +8173,7 @@ mDNSexport CacheRecord *CreateNewCacheEntry(mDNS *const m, const mDNSu32 slot, C
|
|||||||
*rr = m->rec.r; // Block copy the CacheRecord object
|
*rr = m->rec.r; // Block copy the CacheRecord object
|
||||||
rr->resrec.rdata = saveptr; // Restore rr->resrec.rdata after the structure assignment
|
rr->resrec.rdata = saveptr; // Restore rr->resrec.rdata after the structure assignment
|
||||||
rr->resrec.name = cg->name; // And set rr->resrec.name to point into our CacheGroup header
|
rr->resrec.name = cg->name; // And set rr->resrec.name to point into our CacheGroup header
|
||||||
|
rr->resrec.mortality = Mortality_Mortal;
|
||||||
|
|
||||||
// We need to add the anonymous info before we call CacheRecordAdd so that
|
// We need to add the anonymous info before we call CacheRecordAdd so that
|
||||||
// if it finds a matching question with this record, it bumps up the counters like
|
// if it finds a matching question with this record, it bumps up the counters like
|
||||||
@ -8176,6 +8240,7 @@ mDNSlocal void RefreshCacheRecord(mDNS *const m, CacheRecord *rr, mDNSu32 ttl)
|
|||||||
rr->TimeRcvd = m->timenow;
|
rr->TimeRcvd = m->timenow;
|
||||||
rr->resrec.rroriginalttl = ttl;
|
rr->resrec.rroriginalttl = ttl;
|
||||||
rr->UnansweredQueries = 0;
|
rr->UnansweredQueries = 0;
|
||||||
|
if (rr->resrec.mortality != Mortality_Mortal) rr->resrec.mortality = Mortality_Immortal;
|
||||||
SetNextCacheCheckTimeForRecord(m, rr);
|
SetNextCacheCheckTimeForRecord(m, rr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8246,7 +8311,7 @@ mDNSlocal mDNSBool IsResponseAcceptable(mDNS *const m, const CacheRecord *crlist
|
|||||||
|
|
||||||
if (target && cr->resrec.rdatahash == rr->namehash && SameDomainName(target, rr->name))
|
if (target && cr->resrec.rdatahash == rr->namehash && SameDomainName(target, rr->name))
|
||||||
{
|
{
|
||||||
LogInfo("IsResponseAcceptable: Found a matching entry for %##s in the CacheFlushRecords %s", rr->name->c, CRDisplayString(m, cr));
|
LogDebug("IsResponseAcceptable: Found a matching entry for %##s in the CacheFlushRecords %s", rr->name->c, CRDisplayString(m, cr));
|
||||||
return (mDNStrue);
|
return (mDNStrue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8745,6 +8810,12 @@ mDNSlocal CacheRecord* mDNSCoreReceiveCacheCheck(mDNS *const m, const DNSMessage
|
|||||||
|
|
||||||
m->mDNSStats.CacheRefreshed++;
|
m->mDNSStats.CacheRefreshed++;
|
||||||
|
|
||||||
|
if (rr->resrec.mortality == Mortality_Ghost && unicastQuestion && (unicastQuestion->allowExpired != AllowExpired_AllowExpiredAnswers) && !rr->DelayDelivery)
|
||||||
|
{
|
||||||
|
rr->DelayDelivery = NonZeroTime(m->timenow);
|
||||||
|
debugf("mDNSCoreReceiveCacheCheck: Reset DelayDelivery for mortalityExpired EXP:%d RR %s", m->timenow - RRExpireTime(rr), CRDisplayString(m, rr));
|
||||||
|
}
|
||||||
|
|
||||||
if (rr->resrec.rroriginalttl == 0) debugf("uDNS rescuing %s", CRDisplayString(m, rr));
|
if (rr->resrec.rroriginalttl == 0) debugf("uDNS rescuing %s", CRDisplayString(m, rr));
|
||||||
RefreshCacheRecord(m, rr, m->rec.r.resrec.rroriginalttl);
|
RefreshCacheRecord(m, rr, m->rec.r.resrec.rroriginalttl);
|
||||||
rr->responseFlags = response->h.flags;
|
rr->responseFlags = response->h.flags;
|
||||||
@ -9513,6 +9584,12 @@ exit:
|
|||||||
r1->resrec.rrtype == r2->resrec.rrtype &&
|
r1->resrec.rrtype == r2->resrec.rrtype &&
|
||||||
r1->resrec.rrclass == r2->resrec.rrclass)
|
r1->resrec.rrclass == r2->resrec.rrclass)
|
||||||
{
|
{
|
||||||
|
if (r1->resrec.mortality == Mortality_Mortal && r2->resrec.mortality != Mortality_Mortal)
|
||||||
|
{
|
||||||
|
verbosedebugf("mDNSCoreReceiveResponse: R1(%p) is being immortalized by R2(%p)", r1, r2);
|
||||||
|
r1->resrec.mortality = Mortality_Immortal; // Immortalize the replacement record
|
||||||
|
}
|
||||||
|
|
||||||
// If record is recent, just ensure the whole RRSet has the same TTL (as required by DNS semantics)
|
// If record is recent, just ensure the whole RRSet has the same TTL (as required by DNS semantics)
|
||||||
// else, if record is old, mark it to be flushed
|
// else, if record is old, mark it to be flushed
|
||||||
if (m->timenow - r2->TimeRcvd < mDNSPlatformOneSecond && RRExpireTime(r2) - m->timenow > mDNSPlatformOneSecond)
|
if (m->timenow - r2->TimeRcvd < mDNSPlatformOneSecond && RRExpireTime(r2) - m->timenow > mDNSPlatformOneSecond)
|
||||||
@ -9588,7 +9665,23 @@ exit:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if AWD_METRICS
|
||||||
|
if (r2->resrec.mortality == Mortality_Ghost)
|
||||||
|
{
|
||||||
|
DNSQuestion * q;
|
||||||
|
for (q = m->Questions; q; q=q->next)
|
||||||
|
{
|
||||||
|
if (!q->LongLived && ActiveQuestion(q) &&
|
||||||
|
ResourceRecordAnswersQuestion(&r2->resrec, q) &&
|
||||||
|
q->metrics.expiredAnswerState == ExpiredAnswer_AnsweredWithExpired)
|
||||||
|
{
|
||||||
|
q->metrics.expiredAnswerState = ExpiredAnswer_ExpiredAnswerChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// Old uDNS records are scheduled to be purged instead of given at most one second to live.
|
// Old uDNS records are scheduled to be purged instead of given at most one second to live.
|
||||||
|
r2->resrec.mortality = Mortality_Mortal; // We want it purged, so remove any immortality
|
||||||
mDNS_PurgeCacheResourceRecord(m, r2);
|
mDNS_PurgeCacheResourceRecord(m, r2);
|
||||||
purgedRecords = mDNStrue;
|
purgedRecords = mDNStrue;
|
||||||
}
|
}
|
||||||
@ -10207,7 +10300,7 @@ mDNSlocal void mDNSCoreReceiveUpdate(mDNS *const m,
|
|||||||
if (!InterfaceID || !m->SPSSocket || !mDNSSameIPPort(dstport, m->SPSSocket->port)) return;
|
if (!InterfaceID || !m->SPSSocket || !mDNSSameIPPort(dstport, m->SPSSocket->port)) return;
|
||||||
|
|
||||||
if (mDNS_PacketLoggingEnabled)
|
if (mDNS_PacketLoggingEnabled)
|
||||||
DumpPacket(m, mStatus_NoError, mDNSfalse, "UDP", srcaddr, srcport, dstaddr, dstport, msg, end);
|
DumpPacket(mStatus_NoError, mDNSfalse, "UDP", srcaddr, srcport, dstaddr, dstport, msg, end);
|
||||||
|
|
||||||
ptr = LocateOptRR(msg, end, DNSOpt_LeaseData_Space + DNSOpt_OwnerData_ID_Space);
|
ptr = LocateOptRR(msg, end, DNSOpt_LeaseData_Space + DNSOpt_OwnerData_ID_Space);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
@ -10466,7 +10559,6 @@ mDNSexport void MakeNegativeCacheRecord(mDNS *const m, CacheRecord *const cr,
|
|||||||
cr->TimeRcvd = m->timenow;
|
cr->TimeRcvd = m->timenow;
|
||||||
cr->DelayDelivery = 0;
|
cr->DelayDelivery = 0;
|
||||||
cr->NextRequiredQuery = m->timenow;
|
cr->NextRequiredQuery = m->timenow;
|
||||||
cr->LastUsed = m->timenow;
|
|
||||||
cr->CRActiveQuestion = mDNSNULL;
|
cr->CRActiveQuestion = mDNSNULL;
|
||||||
cr->UnansweredQueries = 0;
|
cr->UnansweredQueries = 0;
|
||||||
cr->LastUnansweredTime = 0;
|
cr->LastUnansweredTime = 0;
|
||||||
@ -10561,7 +10653,7 @@ mDNSexport void mDNSCoreReceive(mDNS *const m, DNSMessage *const msg, const mDNS
|
|||||||
{
|
{
|
||||||
ifid = mDNSInterface_Any;
|
ifid = mDNSInterface_Any;
|
||||||
if (mDNS_PacketLoggingEnabled)
|
if (mDNS_PacketLoggingEnabled)
|
||||||
DumpPacket(m, mStatus_NoError, mDNSfalse, TLS ? "TLS" : !dstaddr ? "TCP" : "UDP", srcaddr, srcport, dstaddr, dstport, msg, end);
|
DumpPacket(mStatus_NoError, mDNSfalse, TLS ? "TLS" : !dstaddr ? "TCP" : "UDP", srcaddr, srcport, dstaddr, dstport, msg, end);
|
||||||
uDNS_ReceiveMsg(m, msg, end, srcaddr, srcport);
|
uDNS_ReceiveMsg(m, msg, end, srcaddr, srcport);
|
||||||
// Note: mDNSCore also needs to get access to received unicast responses
|
// Note: mDNSCore also needs to get access to received unicast responses
|
||||||
}
|
}
|
||||||
@ -11126,11 +11218,11 @@ mDNSlocal DNSServer *GetServerForName(mDNS *m, const domainname *name, mDNSInter
|
|||||||
curmatch = GetBestServer(m, name, InterfaceID, ServiceID, allValid, mDNSNULL, mDNStrue);
|
curmatch = GetBestServer(m, name, InterfaceID, ServiceID, allValid, mDNSNULL, mDNStrue);
|
||||||
|
|
||||||
if (curmatch != mDNSNULL)
|
if (curmatch != mDNSNULL)
|
||||||
LogInfo("GetServerForName: DNS server %#a:%d (Penalty Time Left %d) (Scope %s:%p) found for name %##s", &curmatch->addr,
|
LogInfo("GetServerForName: DNS server %#a:%d (Penalty Time Left %d) (Scope %s:%p) for %##s", &curmatch->addr,
|
||||||
mDNSVal16(curmatch->port), (curmatch->penaltyTime ? (curmatch->penaltyTime - m->timenow) : 0), ifname ? ifname : "None",
|
mDNSVal16(curmatch->port), (curmatch->penaltyTime ? (curmatch->penaltyTime - m->timenow) : 0), ifname ? ifname : "None",
|
||||||
InterfaceID, name);
|
InterfaceID, name);
|
||||||
else
|
else
|
||||||
LogInfo("GetServerForName: no DNS server (Scope %s:%p) found for name %##s", ifname ? ifname : "None", InterfaceID, name);
|
LogInfo("GetServerForName: no DNS server (Scope %s:%p) for %##s", ifname ? ifname : "None", InterfaceID, name);
|
||||||
|
|
||||||
return(curmatch);
|
return(curmatch);
|
||||||
}
|
}
|
||||||
@ -11159,14 +11251,14 @@ mDNSexport DNSServer *GetServerForQuestion(mDNS *m, DNSQuestion *question)
|
|||||||
|
|
||||||
if (curmatch != mDNSNULL)
|
if (curmatch != mDNSNULL)
|
||||||
{
|
{
|
||||||
LogInfo("GetServerForQuestion: %p DNS server (%p) %#a:%d (Penalty Time Left %d) (Scope %s:%p:%d) found for name %##s (%s)",
|
LogInfo("GetServerForQuestion: %p DNS server (%p) %#a:%d (Penalty Time Left %d) (Scope %s:%p:%d) for %##s (%s)",
|
||||||
question, curmatch, &curmatch->addr, mDNSVal16(curmatch->port),
|
question, curmatch, &curmatch->addr, mDNSVal16(curmatch->port),
|
||||||
(curmatch->penaltyTime ? (curmatch->penaltyTime - m->timenow) : 0), ifname ? ifname : "None",
|
(curmatch->penaltyTime ? (curmatch->penaltyTime - m->timenow) : 0), ifname ? ifname : "None",
|
||||||
InterfaceID, question->ServiceID, name, DNSTypeName(question->qtype));
|
InterfaceID, question->ServiceID, name, DNSTypeName(question->qtype));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogInfo("GetServerForQuestion: %p no DNS server (Scope %s:%p:%d) found for name %##s (%s)",
|
LogInfo("GetServerForQuestion: %p no DNS server (Scope %s:%p:%d) for %##s (%s)",
|
||||||
question, ifname ? ifname : "None", InterfaceID, question->ServiceID, name, DNSTypeName(question->qtype));
|
question, ifname ? ifname : "None", InterfaceID, question->ServiceID, name, DNSTypeName(question->qtype));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11218,14 +11310,14 @@ mDNSlocal mDNSBool ShouldSuppressUnicastQuery(mDNS *const m, DNSQuestion *q, DNS
|
|||||||
// Some callers don't check for the qtype
|
// Some callers don't check for the qtype
|
||||||
if (q->qtype != kDNSType_A && q->qtype != kDNSType_AAAA)
|
if (q->qtype != kDNSType_A && q->qtype != kDNSType_AAAA)
|
||||||
{
|
{
|
||||||
LogInfo("ShouldSuppressUnicastQuery: Query not suppressed for %##s, qtype %s, not A/AAAA type", q->qname.c, DNSTypeName(q->qtype));
|
LogDebug("ShouldSuppressUnicastQuery: Query not suppressed for %##s, qtype %s, not A/AAAA type", q->qname.c, DNSTypeName(q->qtype));
|
||||||
return mDNSfalse;
|
return mDNSfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private domains are exempted irrespective of what the DNSServer says
|
// Private domains are exempted irrespective of what the DNSServer says
|
||||||
if (IsPrivateDomain(m, q))
|
if (IsPrivateDomain(m, q))
|
||||||
{
|
{
|
||||||
LogInfo("ShouldSuppressUnicastQuery: Query not suppressed for %##s, qtype %s, Private Domain", q->qname.c, DNSTypeName(q->qtype));
|
LogDebug("ShouldSuppressUnicastQuery: Query not suppressed for %##s, qtype %s, Private Domain", q->qname.c, DNSTypeName(q->qtype));
|
||||||
return mDNSfalse;
|
return mDNSfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11238,20 +11330,20 @@ mDNSlocal mDNSBool ShouldSuppressUnicastQuery(mDNS *const m, DNSQuestion *q, DNS
|
|||||||
// Check if the DNS Configuration allows A/AAAA queries to be sent
|
// Check if the DNS Configuration allows A/AAAA queries to be sent
|
||||||
if ((q->qtype == kDNSType_A) && (d->req_A))
|
if ((q->qtype == kDNSType_A) && (d->req_A))
|
||||||
{
|
{
|
||||||
LogInfo("ShouldSuppressUnicastQuery: Query not suppressed for %##s, qtype %s, DNSServer %##s %#a:%d allows A queries", q->qname.c,
|
LogDebug("ShouldSuppressUnicastQuery: Query not suppressed for %##s, qtype %s, DNSServer %##s %#a:%d allows A queries", q->qname.c,
|
||||||
DNSTypeName(q->qtype), d->domain.c, &d->addr, mDNSVal16(d->port));
|
DNSTypeName(q->qtype), d->domain.c, &d->addr, mDNSVal16(d->port));
|
||||||
return mDNSfalse;
|
return mDNSfalse;
|
||||||
}
|
}
|
||||||
if ((q->qtype == kDNSType_AAAA) && (d->req_AAAA))
|
if ((q->qtype == kDNSType_AAAA) && (d->req_AAAA))
|
||||||
{
|
{
|
||||||
LogInfo("ShouldSuppressUnicastQuery: Query not suppressed for %##s, qtype %s, DNSServer %##s %#a:%d allows AAAA queries", q->qname.c,
|
LogDebug("ShouldSuppressUnicastQuery: Query not suppressed for %##s, qtype %s, DNSServer %##s %#a:%d allows AAAA queries", q->qname.c,
|
||||||
DNSTypeName(q->qtype), d->domain.c, &d->addr, mDNSVal16(d->port));
|
DNSTypeName(q->qtype), d->domain.c, &d->addr, mDNSVal16(d->port));
|
||||||
return mDNSfalse;
|
return mDNSfalse;
|
||||||
}
|
}
|
||||||
#if USE_DNS64
|
#if USE_DNS64
|
||||||
if (DNS64IsQueryingARecord(q->dns64.state))
|
if (DNS64IsQueryingARecord(q->dns64.state))
|
||||||
{
|
{
|
||||||
LogInfo("ShouldSuppressUnicastQuery: DNS64 query not suppressed for %##s, qtype %s", q->qname.c, DNSTypeName(q->qtype));
|
LogDebug("ShouldSuppressUnicastQuery: DNS64 query not suppressed for %##s, qtype %s", q->qname.c, DNSTypeName(q->qtype));
|
||||||
return mDNSfalse;
|
return mDNSfalse;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -11652,6 +11744,7 @@ mDNSlocal void InitDNSConfig(mDNS *const m, DNSQuestion *const question)
|
|||||||
question->StopTime = (question->TimeoutQuestion) ? question->StopTime : 0;
|
question->StopTime = (question->TimeoutQuestion) ? question->StopTime : 0;
|
||||||
#if AWD_METRICS
|
#if AWD_METRICS
|
||||||
mDNSPlatformMemZero(&question->metrics, sizeof(question->metrics));
|
mDNSPlatformMemZero(&question->metrics, sizeof(question->metrics));
|
||||||
|
question->metrics.expiredAnswerState = (question->allowExpired != AllowExpired_None) ? ExpiredAnswer_Allowed : ExpiredAnswer_None;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Need not initialize the DNS Configuration for Local Only OR P2P Questions when timeout not specified
|
// Need not initialize the DNS Configuration for Local Only OR P2P Questions when timeout not specified
|
||||||
@ -11672,7 +11765,7 @@ mDNSlocal void InitDNSConfig(mDNS *const m, DNSQuestion *const question)
|
|||||||
}
|
}
|
||||||
|
|
||||||
question->qDNSServer = GetServerForQuestion(m, question);
|
question->qDNSServer = GetServerForQuestion(m, question);
|
||||||
LogInfo("InitDNSConfig: question %p %##s (%s) Timeout %d, DNS Server %#a:%d",
|
LogDebug("InitDNSConfig: question %p %##s (%s) Timeout %d, DNS Server %#a:%d",
|
||||||
question, question->qname.c, DNSTypeName(question->qtype), timeout,
|
question, question->qname.c, DNSTypeName(question->qtype), timeout,
|
||||||
question->qDNSServer ? &question->qDNSServer->addr : mDNSNULL,
|
question->qDNSServer ? &question->qDNSServer->addr : mDNSNULL,
|
||||||
mDNSVal16(question->qDNSServer ? question->qDNSServer->port : zeroIPPort));
|
mDNSVal16(question->qDNSServer ? question->qDNSServer->port : zeroIPPort));
|
||||||
@ -12113,7 +12206,7 @@ mDNSexport mStatus mDNS_StopQuery_internal(mDNS *const m, DNSQuestion *const que
|
|||||||
queryName = question->metrics.originalQName ? question->metrics.originalQName : &question->qname;
|
queryName = question->metrics.originalQName ? question->metrics.originalQName : &question->qname;
|
||||||
isForCell = (question->qDNSServer && question->qDNSServer->cellIntf);
|
isForCell = (question->qDNSServer && question->qDNSServer->cellIntf);
|
||||||
durationMs = ((m->timenow - question->metrics.firstQueryTime) * 1000) / mDNSPlatformOneSecond;
|
durationMs = ((m->timenow - question->metrics.firstQueryTime) * 1000) / mDNSPlatformOneSecond;
|
||||||
MetricsUpdateDNSQueryStats(queryName, question->qtype, mDNSNULL, question->metrics.querySendCount, durationMs, isForCell);
|
MetricsUpdateDNSQueryStats(queryName, question->qtype, mDNSNULL, question->metrics.querySendCount, question->metrics.expiredAnswerState, durationMs, isForCell);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Take care to cut question from list *before* calling UpdateQuestionDuplicates
|
// Take care to cut question from list *before* calling UpdateQuestionDuplicates
|
||||||
@ -12333,7 +12426,7 @@ mDNSexport mStatus mDNS_Reconfirm(mDNS *const m, CacheRecord *const cr)
|
|||||||
mStatus status;
|
mStatus status;
|
||||||
mDNS_Lock(m);
|
mDNS_Lock(m);
|
||||||
status = mDNS_Reconfirm_internal(m, cr, kDefaultReconfirmTimeForNoAnswer);
|
status = mDNS_Reconfirm_internal(m, cr, kDefaultReconfirmTimeForNoAnswer);
|
||||||
if (status == mStatus_NoError) ReconfirmAntecedents(m, cr->resrec.name, cr->resrec.namehash, 0);
|
if (status == mStatus_NoError) ReconfirmAntecedents(m, cr->resrec.name, cr->resrec.namehash, cr->resrec.InterfaceID, 0);
|
||||||
mDNS_Unlock(m);
|
mDNS_Unlock(m);
|
||||||
return(status);
|
return(status);
|
||||||
}
|
}
|
||||||
@ -12346,7 +12439,7 @@ mDNSexport mStatus mDNS_ReconfirmByValue(mDNS *const m, ResourceRecord *const rr
|
|||||||
cr = FindIdenticalRecordInCache(m, rr);
|
cr = FindIdenticalRecordInCache(m, rr);
|
||||||
debugf("mDNS_ReconfirmByValue: %p %s", cr, RRDisplayString(m, rr));
|
debugf("mDNS_ReconfirmByValue: %p %s", cr, RRDisplayString(m, rr));
|
||||||
if (cr) status = mDNS_Reconfirm_internal(m, cr, kDefaultReconfirmTimeForNoAnswer);
|
if (cr) status = mDNS_Reconfirm_internal(m, cr, kDefaultReconfirmTimeForNoAnswer);
|
||||||
if (status == mStatus_NoError) ReconfirmAntecedents(m, cr->resrec.name, cr->resrec.namehash, 0);
|
if (status == mStatus_NoError) ReconfirmAntecedents(m, cr->resrec.name, cr->resrec.namehash, cr->resrec.InterfaceID, 0);
|
||||||
mDNS_Unlock(m);
|
mDNS_Unlock(m);
|
||||||
return(status);
|
return(status);
|
||||||
}
|
}
|
||||||
@ -13152,6 +13245,7 @@ mDNSexport void mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *se
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
rr->resrec.mortality = Mortality_Mortal;
|
||||||
mDNS_PurgeCacheResourceRecord(m, rr);
|
mDNS_PurgeCacheResourceRecord(m, rr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13349,7 +13443,7 @@ mDNSexport mDNSu32 deriveD2DFlagsFromAuthRecType(AuthRecType authRecType)
|
|||||||
// If the optional target host parameter is set, then the storage it points to must remain valid for the lifetime of the service registration
|
// If the optional target host parameter is set, then the storage it points to must remain valid for the lifetime of the service registration
|
||||||
mDNSexport mStatus mDNS_RegisterService(mDNS *const m, ServiceRecordSet *sr,
|
mDNSexport mStatus mDNS_RegisterService(mDNS *const m, ServiceRecordSet *sr,
|
||||||
const domainlabel *const name, const domainname *const type, const domainname *const domain,
|
const domainlabel *const name, const domainname *const type, const domainname *const domain,
|
||||||
const domainname *const host, mDNSIPPort port, const mDNSu8 txtinfo[], mDNSu16 txtlen,
|
const domainname *const host, mDNSIPPort port, RData *const txtrdata, const mDNSu8 txtinfo[], mDNSu16 txtlen,
|
||||||
AuthRecord *SubTypes, mDNSu32 NumSubTypes,
|
AuthRecord *SubTypes, mDNSu32 NumSubTypes,
|
||||||
mDNSInterfaceID InterfaceID, mDNSServiceCallback Callback, void *Context, mDNSu32 flags)
|
mDNSInterfaceID InterfaceID, mDNSServiceCallback Callback, void *Context, mDNSu32 flags)
|
||||||
{
|
{
|
||||||
@ -13386,7 +13480,7 @@ mDNSexport mStatus mDNS_RegisterService(mDNS *const m, ServiceRecordSet *sr,
|
|||||||
hostTTL = kHostNameTTL;
|
hostTTL = kHostNameTTL;
|
||||||
|
|
||||||
mDNS_SetupResourceRecord(&sr->RR_SRV, mDNSNULL, InterfaceID, kDNSType_SRV, hostTTL, recordType, artype, ServiceCallback, sr);
|
mDNS_SetupResourceRecord(&sr->RR_SRV, mDNSNULL, InterfaceID, kDNSType_SRV, hostTTL, recordType, artype, ServiceCallback, sr);
|
||||||
mDNS_SetupResourceRecord(&sr->RR_TXT, mDNSNULL, InterfaceID, kDNSType_TXT, kStandardTTL, recordType, artype, ServiceCallback, sr);
|
mDNS_SetupResourceRecord(&sr->RR_TXT, txtrdata, InterfaceID, kDNSType_TXT, kStandardTTL, recordType, artype, ServiceCallback, sr);
|
||||||
|
|
||||||
// If port number is zero, that means the client is really trying to do a RegisterNoSuchService
|
// If port number is zero, that means the client is really trying to do a RegisterNoSuchService
|
||||||
if (mDNSIPPortIsZero(port))
|
if (mDNSIPPortIsZero(port))
|
||||||
@ -13596,7 +13690,9 @@ mDNSexport mStatus mDNS_RenameAndReregisterService(mDNS *const m, ServiceRecordS
|
|||||||
else debugf("%##s service (domain %##s) renamed from \"%#s\" to \"%#s\"",type.c, domain.c, name1.c, newname->c);
|
else debugf("%##s service (domain %##s) renamed from \"%#s\" to \"%#s\"",type.c, domain.c, name1.c, newname->c);
|
||||||
|
|
||||||
err = mDNS_RegisterService(m, sr, newname, &type, &domain,
|
err = mDNS_RegisterService(m, sr, newname, &type, &domain,
|
||||||
host, sr->RR_SRV.resrec.rdata->u.srv.port, sr->RR_TXT.resrec.rdata->u.txt.c, sr->RR_TXT.resrec.rdlength,
|
host, sr->RR_SRV.resrec.rdata->u.srv.port,
|
||||||
|
(sr->RR_TXT.resrec.rdata != &sr->RR_TXT.rdatastorage) ? sr->RR_TXT.resrec.rdata : mDNSNULL,
|
||||||
|
sr->RR_TXT.resrec.rdata->u.txt.c, sr->RR_TXT.resrec.rdlength,
|
||||||
sr->SubTypes, sr->NumSubTypes,
|
sr->SubTypes, sr->NumSubTypes,
|
||||||
sr->RR_PTR.resrec.InterfaceID, sr->ServiceCallback, sr->ServiceContext, sr->flags);
|
sr->RR_PTR.resrec.InterfaceID, sr->ServiceCallback, sr->ServiceContext, sr->flags);
|
||||||
|
|
||||||
@ -14235,6 +14331,7 @@ mDNSlocal void SleepProxyServerCallback(mDNS *const m, ServiceRecordSet *const s
|
|||||||
mDNS_RegisterService(m, srs,
|
mDNS_RegisterService(m, srs,
|
||||||
&name, &SleepProxyServiceType, &localdomain,
|
&name, &SleepProxyServiceType, &localdomain,
|
||||||
mDNSNULL, m->SPSSocket->port, // Host, port
|
mDNSNULL, m->SPSSocket->port, // Host, port
|
||||||
|
mDNSNULL,
|
||||||
(mDNSu8 *)"", 1, // TXT data, length
|
(mDNSu8 *)"", 1, // TXT data, length
|
||||||
mDNSNULL, 0, // Subtypes (none)
|
mDNSNULL, 0, // Subtypes (none)
|
||||||
mDNSInterface_Any, // Interface ID
|
mDNSInterface_Any, // Interface ID
|
||||||
@ -14953,6 +15050,7 @@ mDNSexport mStatus uDNS_SetupDNSConfig(mDNS *const m)
|
|||||||
{
|
{
|
||||||
LogInfo("uDNS_SetupDNSConfig: Purging Resourcerecord %s, New DNS server %#a , Old DNS server %#a", CRDisplayString(m, cr),
|
LogInfo("uDNS_SetupDNSConfig: Purging Resourcerecord %s, New DNS server %#a , Old DNS server %#a", CRDisplayString(m, cr),
|
||||||
&ptr->addr, (cr->resrec.rDNSServer != mDNSNULL ? &cr->resrec.rDNSServer->addr : mDNSNULL));
|
&ptr->addr, (cr->resrec.rDNSServer != mDNSNULL ? &cr->resrec.rDNSServer->addr : mDNSNULL));
|
||||||
|
cr->resrec.mortality = Mortality_Mortal;
|
||||||
mDNS_PurgeCacheResourceRecord(m, cr);
|
mDNS_PurgeCacheResourceRecord(m, cr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -15021,6 +15119,7 @@ mDNSexport mStatus uDNS_SetupDNSConfig(mDNS *const m)
|
|||||||
cr->resrec.rDNSServer = mDNSNULL;
|
cr->resrec.rDNSServer = mDNSNULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cr->resrec.mortality = Mortality_Mortal;
|
||||||
PurgeOrReconfirmCacheRecord(m, cr, ptr, mDNStrue);
|
PurgeOrReconfirmCacheRecord(m, cr, ptr, mDNStrue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2015 Apple Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -99,12 +99,14 @@ extern "C" {
|
|||||||
#define LogOperation(... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_OPERATION, __VA_ARGS__);} while (0)
|
#define LogOperation(... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_OPERATION, __VA_ARGS__);} while (0)
|
||||||
#define LogSPS(... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_SPS, __VA_ARGS__);} while (0)
|
#define LogSPS(... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_SPS, __VA_ARGS__);} while (0)
|
||||||
#define LogInfo(... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_INFO, __VA_ARGS__);} while (0)
|
#define LogInfo(... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_INFO, __VA_ARGS__);} while (0)
|
||||||
|
#define LogDebug(... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_DEBUG, __VA_ARGS__);} while (0)
|
||||||
#elif (MDNS_GNU_VA_ARGS)
|
#elif (MDNS_GNU_VA_ARGS)
|
||||||
#define debug_noop( ARGS... ) ((void)0)
|
#define debug_noop( ARGS... ) ((void)0)
|
||||||
#define LogMsg( ARGS... ) LogMsgWithLevel(MDNS_LOG_MSG, ARGS)
|
#define LogMsg( ARGS... ) LogMsgWithLevel(MDNS_LOG_MSG, ARGS)
|
||||||
#define LogOperation( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_OPERATION, ARGS);} while (0)
|
#define LogOperation( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_OPERATION, ARGS);} while (0)
|
||||||
#define LogSPS( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_SPS, ARGS);} while (0)
|
#define LogSPS( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_SPS, ARGS);} while (0)
|
||||||
#define LogInfo( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_INFO, ARGS);} while (0)
|
#define LogInfo( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_INFO, ARGS);} while (0)
|
||||||
|
#define LogDebug( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_DEBUG, ARGS);} while (0)
|
||||||
#else
|
#else
|
||||||
#error Unknown variadic macros
|
#error Unknown variadic macros
|
||||||
#endif
|
#endif
|
||||||
@ -116,10 +118,12 @@ extern "C" {
|
|||||||
#define LogOperation (mDNS_LoggingEnabled == 0) ? ((void)0) : LogOperation_
|
#define LogOperation (mDNS_LoggingEnabled == 0) ? ((void)0) : LogOperation_
|
||||||
#define LogSPS (mDNS_LoggingEnabled == 0) ? ((void)0) : LogSPS_
|
#define LogSPS (mDNS_LoggingEnabled == 0) ? ((void)0) : LogSPS_
|
||||||
#define LogInfo (mDNS_LoggingEnabled == 0) ? ((void)0) : LogInfo_
|
#define LogInfo (mDNS_LoggingEnabled == 0) ? ((void)0) : LogInfo_
|
||||||
|
#define LogDebug (mDNS_LoggingEnabled == 0) ? ((void)0) : LogDebug_
|
||||||
extern void LogMsg_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
extern void LogMsg_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
||||||
extern void LogOperation_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
extern void LogOperation_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
||||||
extern void LogSPS_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
extern void LogSPS_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
||||||
extern void LogInfo_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
extern void LogInfo_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
||||||
|
extern void LogDebug_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MDNS_DEBUGMSGS
|
#if MDNS_DEBUGMSGS
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2017 Apple Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -101,6 +101,10 @@ extern "C" {
|
|||||||
#define MaximumRDSize 264
|
#define MaximumRDSize 264
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MDNSRESPONDER_BTMM_SUPPORT)
|
||||||
|
#define MDNSRESPONDER_BTMM_SUPPORT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
// Function scope indicators
|
// Function scope indicators
|
||||||
|
|
||||||
@ -1335,6 +1339,13 @@ typedef struct McastResolver
|
|||||||
mDNSu32 timeout; // timeout value for questions
|
mDNSu32 timeout; // timeout value for questions
|
||||||
} McastResolver;
|
} McastResolver;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
Mortality_Mortal = 0, // This cache record can expire and get purged
|
||||||
|
Mortality_Immortal = 1, // Allow this record to remain in the cache indefinitely
|
||||||
|
Mortality_Ghost = 2 // An immortal record that has expired and can linger in the cache
|
||||||
|
};
|
||||||
|
typedef mDNSu8 MortalityState;
|
||||||
|
|
||||||
// scoped values for DNSServer matching
|
// scoped values for DNSServer matching
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -1386,6 +1397,7 @@ typedef struct
|
|||||||
struct ResourceRecord_struct
|
struct ResourceRecord_struct
|
||||||
{
|
{
|
||||||
mDNSu8 RecordType; // See kDNSRecordTypes enum.
|
mDNSu8 RecordType; // See kDNSRecordTypes enum.
|
||||||
|
MortalityState mortality; // Mortality of this resource record (See MortalityState enum)
|
||||||
mDNSu16 rrtype; // See DNS_TypeValues enum.
|
mDNSu16 rrtype; // See DNS_TypeValues enum.
|
||||||
mDNSu16 rrclass; // See DNS_ClassValues enum.
|
mDNSu16 rrclass; // See DNS_ClassValues enum.
|
||||||
mDNSu32 rroriginalttl; // In seconds
|
mDNSu32 rroriginalttl; // In seconds
|
||||||
@ -1399,7 +1411,6 @@ struct ResourceRecord_struct
|
|||||||
// ReconfirmAntecedents(), etc., use rdatahash as a pre-flight check to see
|
// ReconfirmAntecedents(), etc., use rdatahash as a pre-flight check to see
|
||||||
// whether it's worth doing a full SameDomainName() call. If the rdatahash
|
// whether it's worth doing a full SameDomainName() call. If the rdatahash
|
||||||
// is not a correct case-insensitive name hash, they'll get false negatives.
|
// is not a correct case-insensitive name hash, they'll get false negatives.
|
||||||
|
|
||||||
// Grouping pointers together at the end of the structure improves the memory layout efficiency
|
// Grouping pointers together at the end of the structure improves the memory layout efficiency
|
||||||
mDNSInterfaceID InterfaceID; // Set if this RR is specific to one interface
|
mDNSInterfaceID InterfaceID; // Set if this RR is specific to one interface
|
||||||
// For records received off the wire, InterfaceID is *always* set to the receiving interface
|
// For records received off the wire, InterfaceID is *always* set to the receiving interface
|
||||||
@ -1638,7 +1649,7 @@ struct CacheRecord_struct
|
|||||||
mDNSs32 TimeRcvd; // In platform time units
|
mDNSs32 TimeRcvd; // In platform time units
|
||||||
mDNSs32 DelayDelivery; // Set if we want to defer delivery of this answer to local clients
|
mDNSs32 DelayDelivery; // Set if we want to defer delivery of this answer to local clients
|
||||||
mDNSs32 NextRequiredQuery; // In platform time units
|
mDNSs32 NextRequiredQuery; // In platform time units
|
||||||
mDNSs32 LastUsed; // In platform time units
|
// Extra four bytes here (on 64bit)
|
||||||
DNSQuestion *CRActiveQuestion; // Points to an active question referencing this answer. Can never point to a NewQuestion.
|
DNSQuestion *CRActiveQuestion; // Points to an active question referencing this answer. Can never point to a NewQuestion.
|
||||||
mDNSs32 LastUnansweredTime; // In platform time units; last time we incremented UnansweredQueries
|
mDNSs32 LastUnansweredTime; // In platform time units; last time we incremented UnansweredQueries
|
||||||
mDNSu8 UnansweredQueries; // Number of times we've issued a query for this record without getting an answer
|
mDNSu8 UnansweredQueries; // Number of times we've issued a query for this record without getting an answer
|
||||||
@ -1812,7 +1823,12 @@ typedef enum {
|
|||||||
DNSPUSH_ESTABLISHED = 4
|
DNSPUSH_ESTABLISHED = 4
|
||||||
} DNSPush_State;
|
} DNSPush_State;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AllowExpired_None = 0, // Don't allow expired answers or mark answers immortal (behave normally)
|
||||||
|
AllowExpired_MakeAnswersImmortal = 1, // Any answers to this question get marked as immortal
|
||||||
|
AllowExpired_AllowExpiredAnswers = 2 // Allow already expired answers from the cache
|
||||||
|
};
|
||||||
|
typedef mDNSu8 AllowExpiredState;
|
||||||
|
|
||||||
#define HMAC_LEN 64
|
#define HMAC_LEN 64
|
||||||
#define HMAC_IPAD 0x36
|
#define HMAC_IPAD 0x36
|
||||||
@ -1899,12 +1915,25 @@ typedef enum { DNSSECValNotRequired = 0, DNSSECValRequired, DNSSECValInProgress,
|
|||||||
#define AWD_METRICS (USE_AWD && TARGET_OS_IOS)
|
#define AWD_METRICS (USE_AWD && TARGET_OS_IOS)
|
||||||
|
|
||||||
#if AWD_METRICS
|
#if AWD_METRICS
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
ExpiredAnswer_None = 0, // No expired answers used
|
||||||
|
ExpiredAnswer_Allowed = 1, // An expired answer is allowed by this request
|
||||||
|
ExpiredAnswer_AnsweredWithExpired = 2, // Question was answered with an expired answer
|
||||||
|
ExpiredAnswer_ExpiredAnswerChanged = 3, // Expired answer changed on refresh
|
||||||
|
|
||||||
|
ExpiredAnswer_EnumCount
|
||||||
|
};
|
||||||
|
typedef mDNSu8 ExpiredAnswerMetric;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
domainname * originalQName; // Name of original A/AAAA record if this question is for a CNAME record.
|
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.
|
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.
|
mDNSs32 firstQueryTime; // The time when the first query was sent to a DNS server.
|
||||||
mDNSBool answered; // Has this question been answered?
|
mDNSBool answered; // Has this question been answered?
|
||||||
|
ExpiredAnswerMetric expiredAnswerState; // Expired answer state (see ExpiredAnswerMetric above)
|
||||||
|
|
||||||
} uDNSMetrics;
|
} uDNSMetrics;
|
||||||
#endif
|
#endif
|
||||||
@ -1977,6 +2006,7 @@ struct DNSQuestion_struct
|
|||||||
mDNSu16 noServerResponse; // At least one server did not respond.
|
mDNSu16 noServerResponse; // At least one server did not respond.
|
||||||
mDNSu16 triedAllServersOnce; // Tried all DNS servers once
|
mDNSu16 triedAllServersOnce; // Tried all DNS servers once
|
||||||
mDNSu8 unansweredQueries; // The number of unanswered queries to this server
|
mDNSu8 unansweredQueries; // The number of unanswered queries to this server
|
||||||
|
AllowExpiredState allowExpired; // Allow expired answers state (see enum AllowExpired_None, etc. above)
|
||||||
|
|
||||||
ZoneData *nta; // Used for getting zone data for private or LLQ query
|
ZoneData *nta; // Used for getting zone data for private or LLQ query
|
||||||
mDNSAddr servAddr; // Address and port learned from _dns-llq, _dns-llq-tls or _dns-query-tls SRV query
|
mDNSAddr servAddr; // Address and port learned from _dns-llq, _dns-llq-tls or _dns-query-tls SRV query
|
||||||
@ -2016,6 +2046,7 @@ struct DNSQuestion_struct
|
|||||||
mDNSIPPort TargetPort; // Must be set if Target is set
|
mDNSIPPort TargetPort; // Must be set if Target is set
|
||||||
mDNSOpaque16 TargetQID; // Must be set if Target is set
|
mDNSOpaque16 TargetQID; // Must be set if Target is set
|
||||||
domainname qname;
|
domainname qname;
|
||||||
|
domainname firstExpiredQname; // first expired qname in request chain
|
||||||
mDNSu16 qtype;
|
mDNSu16 qtype;
|
||||||
mDNSu16 qclass;
|
mDNSu16 qclass;
|
||||||
mDNSBool LongLived; // Set by client for calls to mDNS_StartQuery to indicate LLQs to unicast layer.
|
mDNSBool LongLived; // Set by client for calls to mDNS_StartQuery to indicate LLQs to unicast layer.
|
||||||
@ -2778,7 +2809,7 @@ extern void mDNS_SetupResourceRecord(AuthRecord *rr, RData *RDataStorage, mDN
|
|||||||
extern mDNSu32 deriveD2DFlagsFromAuthRecType(AuthRecType authRecType);
|
extern mDNSu32 deriveD2DFlagsFromAuthRecType(AuthRecType authRecType);
|
||||||
extern mStatus mDNS_RegisterService (mDNS *const m, ServiceRecordSet *sr,
|
extern mStatus mDNS_RegisterService (mDNS *const m, ServiceRecordSet *sr,
|
||||||
const domainlabel *const name, const domainname *const type, const domainname *const domain,
|
const domainlabel *const name, const domainname *const type, const domainname *const domain,
|
||||||
const domainname *const host, mDNSIPPort port, const mDNSu8 txtinfo[], mDNSu16 txtlen,
|
const domainname *const host, mDNSIPPort port, RData *txtrdata, const mDNSu8 txtinfo[], mDNSu16 txtlen,
|
||||||
AuthRecord *SubTypes, mDNSu32 NumSubTypes,
|
AuthRecord *SubTypes, mDNSu32 NumSubTypes,
|
||||||
mDNSInterfaceID InterfaceID, mDNSServiceCallback Callback, void *Context, mDNSu32 flags);
|
mDNSInterfaceID InterfaceID, mDNSServiceCallback Callback, void *Context, mDNSu32 flags);
|
||||||
extern mStatus mDNS_AddRecordToService(mDNS *const m, ServiceRecordSet *sr, ExtraResourceRecord *extra, RData *rdata, mDNSu32 ttl, mDNSu32 flags);
|
extern mStatus mDNS_AddRecordToService(mDNS *const m, ServiceRecordSet *sr, ExtraResourceRecord *extra, RData *rdata, mDNSu32 ttl, mDNSu32 flags);
|
||||||
@ -2939,6 +2970,7 @@ extern char *GetRRDisplayString_rdb(const ResourceRecord *const rr, const RDataB
|
|||||||
#define RRDisplayString(m, rr) GetRRDisplayString_rdb(rr, &(rr)->rdata->u, (m)->MsgBuffer)
|
#define RRDisplayString(m, rr) GetRRDisplayString_rdb(rr, &(rr)->rdata->u, (m)->MsgBuffer)
|
||||||
#define ARDisplayString(m, rr) GetRRDisplayString_rdb(&(rr)->resrec, &(rr)->resrec.rdata->u, (m)->MsgBuffer)
|
#define ARDisplayString(m, rr) GetRRDisplayString_rdb(&(rr)->resrec, &(rr)->resrec.rdata->u, (m)->MsgBuffer)
|
||||||
#define CRDisplayString(m, rr) GetRRDisplayString_rdb(&(rr)->resrec, &(rr)->resrec.rdata->u, (m)->MsgBuffer)
|
#define CRDisplayString(m, rr) GetRRDisplayString_rdb(&(rr)->resrec, &(rr)->resrec.rdata->u, (m)->MsgBuffer)
|
||||||
|
#define MortalityDisplayString(M) (M == Mortality_Mortal ? "mortal" : (M == Mortality_Immortal ? "immortal" : "ghost"))
|
||||||
extern mDNSBool mDNSSameAddress(const mDNSAddr *ip1, const mDNSAddr *ip2);
|
extern mDNSBool mDNSSameAddress(const mDNSAddr *ip1, const mDNSAddr *ip2);
|
||||||
extern void IncrementLabelSuffix(domainlabel *name, mDNSBool RichText);
|
extern void IncrementLabelSuffix(domainlabel *name, mDNSBool RichText);
|
||||||
extern mDNSBool mDNSv4AddrIsRFC1918(const mDNSv4Addr * const addr); // returns true for RFC1918 private addresses
|
extern mDNSBool mDNSv4AddrIsRFC1918(const mDNSv4Addr * const addr); // returns true for RFC1918 private addresses
|
||||||
@ -3601,17 +3633,17 @@ struct CompileTimeAssertionChecks_mDNS
|
|||||||
char sizecheck_AuthRecord [(sizeof(AuthRecord) <= 1208) ? 1 : -1];
|
char sizecheck_AuthRecord [(sizeof(AuthRecord) <= 1208) ? 1 : -1];
|
||||||
char sizecheck_CacheRecord [(sizeof(CacheRecord) <= 232) ? 1 : -1];
|
char sizecheck_CacheRecord [(sizeof(CacheRecord) <= 232) ? 1 : -1];
|
||||||
char sizecheck_CacheGroup [(sizeof(CacheGroup) <= 232) ? 1 : -1];
|
char sizecheck_CacheGroup [(sizeof(CacheGroup) <= 232) ? 1 : -1];
|
||||||
char sizecheck_DNSQuestion [(sizeof(DNSQuestion) <= 912) ? 1 : -1];
|
char sizecheck_DNSQuestion [(sizeof(DNSQuestion) <= 1168) ? 1 : -1];
|
||||||
|
|
||||||
char sizecheck_ZoneData [(sizeof(ZoneData) <= 1744) ? 1 : -1];
|
char sizecheck_ZoneData [(sizeof(ZoneData) <= 2000) ? 1 : -1];
|
||||||
char sizecheck_NATTraversalInfo [(sizeof(NATTraversalInfo) <= 200) ? 1 : -1];
|
char sizecheck_NATTraversalInfo [(sizeof(NATTraversalInfo) <= 200) ? 1 : -1];
|
||||||
char sizecheck_HostnameInfo [(sizeof(HostnameInfo) <= 3050) ? 1 : -1];
|
char sizecheck_HostnameInfo [(sizeof(HostnameInfo) <= 3050) ? 1 : -1];
|
||||||
char sizecheck_DNSServer [(sizeof(DNSServer) <= 330) ? 1 : -1];
|
char sizecheck_DNSServer [(sizeof(DNSServer) <= 330) ? 1 : -1];
|
||||||
char sizecheck_NetworkInterfaceInfo[(sizeof(NetworkInterfaceInfo) <= 7376) ? 1 : -1];
|
char sizecheck_NetworkInterfaceInfo[(sizeof(NetworkInterfaceInfo) <= 8400) ? 1 : -1];
|
||||||
char sizecheck_ServiceRecordSet [(sizeof(ServiceRecordSet) <= 5540) ? 1 : -1];
|
char sizecheck_ServiceRecordSet [(sizeof(ServiceRecordSet) <= 5540) ? 1 : -1];
|
||||||
char sizecheck_DomainAuthInfo [(sizeof(DomainAuthInfo) <= 7888) ? 1 : -1];
|
char sizecheck_DomainAuthInfo [(sizeof(DomainAuthInfo) <= 7888) ? 1 : -1];
|
||||||
#if APPLE_OSX_mDNSResponder
|
#if APPLE_OSX_mDNSResponder
|
||||||
char sizecheck_ClientTunnel [(sizeof(ClientTunnel) <= 1256) ? 1 : -1];
|
char sizecheck_ClientTunnel [(sizeof(ClientTunnel) <= 1512) ? 1 : -1];
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5807,7 +5807,7 @@ struct CompileTimeAssertionChecks_uDNS
|
|||||||
// other overly-large structures instead of having a pointer to them, can inadvertently
|
// other overly-large structures instead of having a pointer to them, can inadvertently
|
||||||
// cause structure sizes (and therefore memory usage) to balloon unreasonably.
|
// cause structure sizes (and therefore memory usage) to balloon unreasonably.
|
||||||
char sizecheck_tcpInfo_t [(sizeof(tcpInfo_t) <= 9056) ? 1 : -1];
|
char sizecheck_tcpInfo_t [(sizeof(tcpInfo_t) <= 9056) ? 1 : -1];
|
||||||
char sizecheck_SearchListElem[(sizeof(SearchListElem) <= 5000) ? 1 : -1];
|
char sizecheck_SearchListElem[(sizeof(SearchListElem) <= 6136) ? 1 : -1];
|
||||||
};
|
};
|
||||||
|
|
||||||
#if COMPILER_LIKES_PRAGMA_MARK
|
#if COMPILER_LIKES_PRAGMA_MARK
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2016 Apple Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -97,7 +97,6 @@ static mDNSu8 *const compression_limit = (mDNSu8 *) &compression_base_msg + size
|
|||||||
static mDNSu8 *const compression_lhs = (mDNSu8 *const) compression_base_msg.data + 27;
|
static mDNSu8 *const compression_lhs = (mDNSu8 *const) compression_base_msg.data + 27;
|
||||||
|
|
||||||
mDNSlocal void FreeD2DARElemCallback(mDNS *const m, AuthRecord *const rr, mStatus result);
|
mDNSlocal void FreeD2DARElemCallback(mDNS *const m, AuthRecord *const rr, mStatus result);
|
||||||
mDNSlocal void PrintHex(mDNSu8 *data, mDNSu16 len);
|
|
||||||
|
|
||||||
typedef struct D2DRecordListElem
|
typedef struct D2DRecordListElem
|
||||||
{
|
{
|
||||||
@ -167,42 +166,13 @@ mDNSlocal mDNSu8 * DNSNameCompressionBuildRHS(mDNSu8 *start, const ResourceRecor
|
|||||||
return putRData(&compression_base_msg, start, compression_limit, resourceRecord);
|
return putRData(&compression_base_msg, start, compression_limit, resourceRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PRINT_DEBUG_BYTES_LIMIT 64 // set limit on number of record bytes printed for debugging
|
|
||||||
|
|
||||||
mDNSlocal void PrintHex(mDNSu8 *data, mDNSu16 len)
|
|
||||||
{
|
|
||||||
mDNSu8 *end;
|
|
||||||
char buffer[49] = {0};
|
|
||||||
char *bufend = buffer + sizeof(buffer);
|
|
||||||
|
|
||||||
if (len > PRINT_DEBUG_BYTES_LIMIT)
|
|
||||||
{
|
|
||||||
LogInfo(" (limiting debug output to %d bytes)", PRINT_DEBUG_BYTES_LIMIT);
|
|
||||||
len = PRINT_DEBUG_BYTES_LIMIT;
|
|
||||||
}
|
|
||||||
end = data + len;
|
|
||||||
|
|
||||||
while(data < end)
|
|
||||||
{
|
|
||||||
char *ptr = buffer;
|
|
||||||
for(; data < end && ptr < bufend-1; ptr+=3,data++)
|
|
||||||
mDNS_snprintf(ptr, bufend - ptr, "%02X ", *data);
|
|
||||||
LogInfo(" %s", buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mDNSlocal void PrintHelper(const char *const tag, mDNSu8 *lhs, mDNSu16 lhs_len, mDNSu8 *rhs, mDNSu16 rhs_len)
|
mDNSlocal void PrintHelper(const char *const tag, mDNSu8 *lhs, mDNSu16 lhs_len, mDNSu8 *rhs, mDNSu16 rhs_len)
|
||||||
{
|
{
|
||||||
if (!mDNS_LoggingEnabled) return;
|
if (mDNS_LoggingEnabled)
|
||||||
|
{
|
||||||
LogInfo("%s:", tag);
|
LogDebug("%s: LHS: (%d bytes) %.*H", tag, lhs_len, lhs_len, lhs);
|
||||||
LogInfo(" LHS: (%d bytes)", lhs_len);
|
if (rhs) LogDebug("%s: RHS: (%d bytes) %.*H", tag, rhs_len, rhs_len, rhs);
|
||||||
PrintHex(lhs, lhs_len);
|
}
|
||||||
|
|
||||||
if (!rhs) return;
|
|
||||||
|
|
||||||
LogInfo(" RHS: (%d bytes)", rhs_len);
|
|
||||||
PrintHex(rhs, rhs_len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mDNSlocal void FreeD2DARElemCallback(mDNS *const m, AuthRecord *const rr, mStatus result)
|
mDNSlocal void FreeD2DARElemCallback(mDNS *const m, AuthRecord *const rr, mStatus result)
|
||||||
@ -333,9 +303,8 @@ mDNSlocal mStatus xD2DParse(const mDNSu8 * const lhs, const mDNSu16 lhs_len, con
|
|||||||
|
|
||||||
if (mDNS_LoggingEnabled)
|
if (mDNS_LoggingEnabled)
|
||||||
{
|
{
|
||||||
LogInfo("%s", __func__);
|
const int len = (int)(compression_lhs - (mDNSu8*)&compression_base_msg);
|
||||||
LogInfo(" Static Bytes: (%d bytes)", compression_lhs - (mDNSu8*)&compression_base_msg);
|
LogInfo("xD2DParse: Static Bytes: (%d bytes) %.*H", len, len, &compression_base_msg);
|
||||||
PrintHex((mDNSu8*)&compression_base_msg, compression_lhs - (mDNSu8*)&compression_base_msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mDNSu8 *ptr = compression_lhs; // pointer to the end of our fake packet
|
mDNSu8 *ptr = compression_lhs; // pointer to the end of our fake packet
|
||||||
@ -366,8 +335,8 @@ mDNSlocal mStatus xD2DParse(const mDNSu8 * const lhs, const mDNSu16 lhs_len, con
|
|||||||
|
|
||||||
if (mDNS_LoggingEnabled)
|
if (mDNS_LoggingEnabled)
|
||||||
{
|
{
|
||||||
LogInfo(" Our Bytes (%d bytes): ", ptr - compression_lhs);
|
const int len = (int)(ptr - compression_lhs);
|
||||||
PrintHex(compression_lhs, ptr - compression_lhs);
|
LogInfo("xD2DParse: Our Bytes (%d bytes): %.*H", len, len, compression_lhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = (mDNSu8 *) GetLargeResourceRecord(m, &compression_base_msg, compression_lhs, ptr, mDNSInterface_Any, kDNSRecordTypePacketAns, &m->rec);
|
ptr = (mDNSu8 *) GetLargeResourceRecord(m, &compression_base_msg, compression_lhs, ptr, mDNSInterface_Any, kDNSRecordTypePacketAns, &m->rec);
|
||||||
|
@ -22,7 +22,13 @@
|
|||||||
#include "DNS64.h"
|
#include "DNS64.h"
|
||||||
|
|
||||||
#include <AssertMacros.h>
|
#include <AssertMacros.h>
|
||||||
#include <network/nat64.h>
|
|
||||||
|
#if __has_include(<nw/private.h>)
|
||||||
|
#include <nw/private.h>
|
||||||
|
#else
|
||||||
|
#include <network/nat64.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2012 Apple Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -15,14 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Suppress "warning: 'DNSServiceDiscoveryMachPort' is deprecated" messages -- we already know this code is building the deprecated API
|
|
||||||
// Since we compile with all warnings treated as errors, we have to turn off the warnings here or the project won't compile
|
|
||||||
#include <AvailabilityMacros.h>
|
|
||||||
#undef AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED
|
|
||||||
#define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED
|
|
||||||
#undef AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3
|
|
||||||
#define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3
|
|
||||||
|
|
||||||
#include "../mDNSMacOSX/DNSServiceDiscovery.h"
|
#include "../mDNSMacOSX/DNSServiceDiscovery.h"
|
||||||
#include "DNSServiceDiscoveryDefines.h"
|
#include "DNSServiceDiscoveryDefines.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002, 2004, 2006, 2011 Apple Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -31,8 +31,9 @@
|
|||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <os/availability.h>
|
||||||
|
|
||||||
#include <AvailabilityMacros.h>
|
#define kDNSServiceDiscoveryDeprecatedMsg "This API was deprecated in Mac OS X 10.3 and replaced by the portable cross-platform /usr/include/dns_sd.h API"
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
@ -90,7 +91,7 @@ typedef uint32_t DNSRecordReference;
|
|||||||
call to the specified callout function.
|
call to the specified callout function.
|
||||||
@param replyMsg The Mach message.
|
@param replyMsg The Mach message.
|
||||||
*/
|
*/
|
||||||
void DNSServiceDiscovery_handleReply(void *replyMsg);
|
void DNSServiceDiscovery_handleReply(void *replyMsg) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* DNS Service Browser */
|
/* DNS Service Browser */
|
||||||
@ -125,7 +126,7 @@ dns_service_discovery_ref DNSServiceBrowserCreate
|
|||||||
const char *domain,
|
const char *domain,
|
||||||
DNSServiceBrowserReply callBack,
|
DNSServiceBrowserReply callBack,
|
||||||
void *context
|
void *context
|
||||||
) AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3;
|
) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* Resolver requests */
|
/* Resolver requests */
|
||||||
@ -158,7 +159,7 @@ dns_service_discovery_ref DNSServiceResolverResolve
|
|||||||
const char *domain,
|
const char *domain,
|
||||||
DNSServiceResolverReply callBack,
|
DNSServiceResolverReply callBack,
|
||||||
void *context
|
void *context
|
||||||
) AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3;
|
) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* Mach port accessor and deallocation */
|
/* Mach port accessor and deallocation */
|
||||||
@ -173,7 +174,7 @@ dns_service_discovery_ref DNSServiceResolverResolve
|
|||||||
specified or some other error occurred which prevented the
|
specified or some other error occurred which prevented the
|
||||||
resolution from being started.
|
resolution from being started.
|
||||||
*/
|
*/
|
||||||
mach_port_t DNSServiceDiscoveryMachPort(dns_service_discovery_ref dnsServiceDiscovery) AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3;
|
mach_port_t DNSServiceDiscoveryMachPort(dns_service_discovery_ref dnsServiceDiscovery) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function DNSServiceDiscoveryDeallocate
|
@function DNSServiceDiscoveryDeallocate
|
||||||
@ -181,7 +182,7 @@ mach_port_t DNSServiceDiscoveryMachPort(dns_service_discovery_ref dnsServiceDisc
|
|||||||
@param dnsServiceDiscovery A dns_service_discovery_ref as returned from a creation or enumeration call
|
@param dnsServiceDiscovery A dns_service_discovery_ref as returned from a creation or enumeration call
|
||||||
@result void
|
@result void
|
||||||
*/
|
*/
|
||||||
void DNSServiceDiscoveryDeallocate(dns_service_discovery_ref dnsServiceDiscovery) AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3;
|
void DNSServiceDiscoveryDeallocate(dns_service_discovery_ref dnsServiceDiscovery) API_DEPRECATED(kDNSServiceDiscoveryDeprecatedMsg, macos(10.2, 10.3));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>DEFAULT-OPTIONS</key>
|
||||||
|
<dict>
|
||||||
|
<key>Level</key>
|
||||||
|
<dict>
|
||||||
|
<key>Persist</key>
|
||||||
|
<string>Info</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>DEFAULT-OPTIONS</key>
|
||||||
|
<dict>
|
||||||
|
<key>Level</key>
|
||||||
|
<dict>
|
||||||
|
<key>Persist</key>
|
||||||
|
<string>Inherit</string>
|
||||||
|
<key>Enable</key>
|
||||||
|
<string>Inherit</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -26,7 +26,7 @@ extern "C" {
|
|||||||
|
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
mStatus MetricsInit(void);
|
mStatus MetricsInit(void);
|
||||||
void MetricsUpdateDNSQueryStats(const domainname *inQueryName, mDNSu16 inType, const ResourceRecord *inRR, mDNSu32 inSendCount, mDNSu32 inLatencyMs, mDNSBool inForCell);
|
void MetricsUpdateDNSQueryStats(const domainname *inQueryName, mDNSu16 inType, const ResourceRecord *inRR, mDNSu32 inSendCount, ExpiredAnswerMetric inExpiredAnswerState, mDNSu32 inLatencyMs, mDNSBool inForCell);
|
||||||
void MetricsUpdateDNSResolveStats(const domainname *inQueryName, const ResourceRecord *inRR, mDNSBool inForCell);
|
void MetricsUpdateDNSResolveStats(const domainname *inQueryName, const ResourceRecord *inRR, mDNSBool inForCell);
|
||||||
void MetricsUpdateDNSQuerySize(mDNSu32 inSize);
|
void MetricsUpdateDNSQuerySize(mDNSu32 inSize);
|
||||||
void MetricsUpdateDNSResponseSize(mDNSu32 inSize);
|
void MetricsUpdateDNSResponseSize(mDNSu32 inSize);
|
||||||
|
@ -96,6 +96,7 @@ SOFT_LINK_CLASS(WirelessDiagnostics, AWDMDNSResponderDNSMessageSizeStats)
|
|||||||
#define kQueryStatsMaxQuerySendCount 10
|
#define kQueryStatsMaxQuerySendCount 10
|
||||||
#define kQueryStatsSendCountBinCount (kQueryStatsMaxQuerySendCount + 1)
|
#define kQueryStatsSendCountBinCount (kQueryStatsMaxQuerySendCount + 1)
|
||||||
#define kQueryStatsLatencyBinCount 55
|
#define kQueryStatsLatencyBinCount 55
|
||||||
|
#define kQueryStatsExpiredAnswerStateCount (ExpiredAnswer_EnumCount)
|
||||||
#define kResolveStatsMaxObjCount 2000
|
#define kResolveStatsMaxObjCount 2000
|
||||||
|
|
||||||
//===========================================================================================================================
|
//===========================================================================================================================
|
||||||
@ -152,6 +153,7 @@ typedef struct
|
|||||||
uint16_t responseLatencyBins[kQueryStatsLatencyBinCount];
|
uint16_t responseLatencyBins[kQueryStatsLatencyBinCount];
|
||||||
uint16_t negAnsweredQuerySendCountBins[kQueryStatsSendCountBinCount];
|
uint16_t negAnsweredQuerySendCountBins[kQueryStatsSendCountBinCount];
|
||||||
uint16_t negResponseLatencyBins[kQueryStatsLatencyBinCount];
|
uint16_t negResponseLatencyBins[kQueryStatsLatencyBinCount];
|
||||||
|
uint16_t expiredAnswerStateBins[kQueryStatsExpiredAnswerStateCount];
|
||||||
|
|
||||||
} DNSHist;
|
} DNSHist;
|
||||||
|
|
||||||
@ -159,6 +161,7 @@ check_compile_time(sizeof(DNSHist) <= 512);
|
|||||||
check_compile_time(countof_field(DNSHist, unansweredQuerySendCountBins) == (kQueryStatsMaxQuerySendCount + 1));
|
check_compile_time(countof_field(DNSHist, unansweredQuerySendCountBins) == (kQueryStatsMaxQuerySendCount + 1));
|
||||||
check_compile_time(countof_field(DNSHist, answeredQuerySendCountBins) == (kQueryStatsMaxQuerySendCount + 1));
|
check_compile_time(countof_field(DNSHist, answeredQuerySendCountBins) == (kQueryStatsMaxQuerySendCount + 1));
|
||||||
check_compile_time(countof_field(DNSHist, negAnsweredQuerySendCountBins) == (kQueryStatsMaxQuerySendCount + 1));
|
check_compile_time(countof_field(DNSHist, negAnsweredQuerySendCountBins) == (kQueryStatsMaxQuerySendCount + 1));
|
||||||
|
check_compile_time(countof_field(DNSHist, expiredAnswerStateBins) == (kQueryStatsExpiredAnswerStateCount));
|
||||||
|
|
||||||
// Important: Do not modify kResponseLatencyMsLimits because the code used to generate AWD reports expects the response
|
// Important: Do not modify kResponseLatencyMsLimits because the code used to generate AWD reports expects the response
|
||||||
// latency histogram bins to observe these time interval upper bounds.
|
// latency histogram bins to observe these time interval upper bounds.
|
||||||
@ -344,7 +347,7 @@ check_compile_time(sizeof(DNSMessageSizeStats) <= 132);
|
|||||||
mDNSlocal mStatus QueryStatsCreate(const char *inDomainStr, const char *inAltDomainStr, QueryNameTest_f inTest, mDNSBool inTerminal, QueryStats **outStats);
|
mDNSlocal mStatus QueryStatsCreate(const char *inDomainStr, const char *inAltDomainStr, QueryNameTest_f inTest, mDNSBool inTerminal, QueryStats **outStats);
|
||||||
mDNSlocal void QueryStatsFree(QueryStats *inStats);
|
mDNSlocal void QueryStatsFree(QueryStats *inStats);
|
||||||
mDNSlocal void QueryStatsFreeList(QueryStats *inList);
|
mDNSlocal void QueryStatsFreeList(QueryStats *inList);
|
||||||
mDNSlocal mStatus QueryStatsUpdate(QueryStats *inStats, int inType, const ResourceRecord *inRR, mDNSu32 inQuerySendCount, mDNSu32 inLatencyMs, mDNSBool inForCell);
|
mDNSlocal mStatus QueryStatsUpdate(QueryStats *inStats, int inType, const ResourceRecord *inRR, mDNSu32 inQuerySendCount, ExpiredAnswerMetric inExpiredAnswerState, mDNSu32 inLatencyMs, mDNSBool inForCell);
|
||||||
mDNSlocal const char * QueryStatsGetDomainString(const QueryStats *inStats);
|
mDNSlocal const char * QueryStatsGetDomainString(const QueryStats *inStats);
|
||||||
mDNSlocal mDNSBool QueryStatsDomainTest(const QueryStats *inStats, const domainname *inQueryName);
|
mDNSlocal mDNSBool QueryStatsDomainTest(const QueryStats *inStats, const domainname *inQueryName);
|
||||||
mDNSlocal mDNSBool QueryStatsHostnameTest(const QueryStats *inStats, const domainname *inQueryName);
|
mDNSlocal mDNSBool QueryStatsHostnameTest(const QueryStats *inStats, const domainname *inQueryName);
|
||||||
@ -492,7 +495,7 @@ mStatus MetricsInit(void)
|
|||||||
// MetricsUpdateDNSQueryStats
|
// MetricsUpdateDNSQueryStats
|
||||||
//===========================================================================================================================
|
//===========================================================================================================================
|
||||||
|
|
||||||
mDNSexport void MetricsUpdateDNSQueryStats(const domainname *inQueryName, mDNSu16 inType, const ResourceRecord *inRR, mDNSu32 inSendCount, mDNSu32 inLatencyMs, mDNSBool inForCell)
|
mDNSexport void MetricsUpdateDNSQueryStats(const domainname *inQueryName, mDNSu16 inType, const ResourceRecord *inRR, mDNSu32 inSendCount, ExpiredAnswerMetric inExpiredAnswerState, mDNSu32 inLatencyMs, mDNSBool inForCell)
|
||||||
{
|
{
|
||||||
QueryStats * stats;
|
QueryStats * stats;
|
||||||
mDNSBool match;
|
mDNSBool match;
|
||||||
@ -505,7 +508,7 @@ mDNSexport void MetricsUpdateDNSQueryStats(const domainname *inQueryName, mDNSu1
|
|||||||
match = stats->test(stats, inQueryName);
|
match = stats->test(stats, inQueryName);
|
||||||
if (match)
|
if (match)
|
||||||
{
|
{
|
||||||
QueryStatsUpdate(stats, inType, inRR, inSendCount, inLatencyMs, inForCell);
|
QueryStatsUpdate(stats, inType, inRR, inSendCount, inExpiredAnswerState, inLatencyMs, inForCell);
|
||||||
if (stats->terminal) break;
|
if (stats->terminal) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -839,7 +842,7 @@ mDNSlocal void QueryStatsFreeList(QueryStats *inList)
|
|||||||
// QueryStatsUpdate
|
// QueryStatsUpdate
|
||||||
//===========================================================================================================================
|
//===========================================================================================================================
|
||||||
|
|
||||||
mDNSlocal mStatus QueryStatsUpdate(QueryStats *inStats, int inType, const ResourceRecord *inRR, mDNSu32 inQuerySendCount, mDNSu32 inLatencyMs, mDNSBool inForCell)
|
mDNSlocal mStatus QueryStatsUpdate(QueryStats *inStats, int inType, const ResourceRecord *inRR, mDNSu32 inQuerySendCount, ExpiredAnswerMetric inExpiredAnswerState, mDNSu32 inLatencyMs, mDNSBool inForCell)
|
||||||
{
|
{
|
||||||
mStatus err;
|
mStatus err;
|
||||||
DNSHistSet * set;
|
DNSHistSet * set;
|
||||||
@ -892,6 +895,7 @@ mDNSlocal mStatus QueryStatsUpdate(QueryStats *inStats, int inType, const Resour
|
|||||||
for (i = 0; (i < (int)countof(kResponseLatencyMsLimits)) && (inLatencyMs >= kResponseLatencyMsLimits[i]); ++i) {}
|
for (i = 0; (i < (int)countof(kResponseLatencyMsLimits)) && (inLatencyMs >= kResponseLatencyMsLimits[i]); ++i) {}
|
||||||
increment_saturate(hist->unansweredQueryDurationBins[i], UINT16_MAX);
|
increment_saturate(hist->unansweredQueryDurationBins[i], UINT16_MAX);
|
||||||
}
|
}
|
||||||
|
increment_saturate(hist->expiredAnswerStateBins[Min(inExpiredAnswerState, (kQueryStatsExpiredAnswerStateCount-1))], UINT16_MAX);
|
||||||
err = mStatus_NoError;
|
err = mStatus_NoError;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@ -2061,6 +2065,7 @@ mDNSlocal mStatus CreateAWDDNSDomainStats(DNSHist *inHist, const char *inDomain,
|
|||||||
size_t binCount;
|
size_t binCount;
|
||||||
uint32_t sendCountBins[kQueryStatsSendCountBinCount];
|
uint32_t sendCountBins[kQueryStatsSendCountBinCount];
|
||||||
uint32_t latencyBins[kQueryStatsLatencyBinCount];
|
uint32_t latencyBins[kQueryStatsLatencyBinCount];
|
||||||
|
uint32_t expiredAnswerBins[kQueryStatsExpiredAnswerStateCount];
|
||||||
|
|
||||||
awdStats = [[AWDDNSDomainStatsSoft alloc] init];
|
awdStats = [[AWDDNSDomainStatsSoft alloc] init];
|
||||||
require_action_quiet(awdStats, exit, err = mStatus_UnknownErr);
|
require_action_quiet(awdStats, exit, err = mStatus_UnknownErr);
|
||||||
@ -2108,6 +2113,11 @@ mDNSlocal mStatus CreateAWDDNSDomainStats(DNSHist *inHist, const char *inDomain,
|
|||||||
[awdStats setUnansweredQueryDurationMs:latencyBins count:(NSUInteger)binCount];
|
[awdStats setUnansweredQueryDurationMs:latencyBins count:(NSUInteger)binCount];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expired answers states
|
||||||
|
|
||||||
|
binCount = CopyHistogramBins(expiredAnswerBins, inHist->expiredAnswerStateBins, kQueryStatsExpiredAnswerStateCount);
|
||||||
|
[awdStats setExpiredAnswerStates:expiredAnswerBins count:(NSUInteger)binCount];
|
||||||
|
|
||||||
*outStats = awdStats;
|
*outStats = awdStats;
|
||||||
awdStats = nil;
|
awdStats = nil;
|
||||||
err = mStatus_NoError;
|
err = mStatus_NoError;
|
||||||
@ -2166,6 +2176,9 @@ mDNSlocal void LogDNSHist(const DNSHist *inHist, const char *inDomain, mDNSBool
|
|||||||
LogMsgNoIdent("Answered questions %4u", totalAnswered);
|
LogMsgNoIdent("Answered questions %4u", totalAnswered);
|
||||||
LogMsgNoIdent("Negatively answered questions %4u", totalNegAnswered);
|
LogMsgNoIdent("Negatively answered questions %4u", totalNegAnswered);
|
||||||
LogMsgNoIdent("Unanswered questions %4u", totalUnanswered);
|
LogMsgNoIdent("Unanswered questions %4u", totalUnanswered);
|
||||||
|
LogMsgNoIdent("Expired - no cached answer %4u", inHist->expiredAnswerStateBins[ExpiredAnswer_Allowed]);
|
||||||
|
LogMsgNoIdent("Expired - answered from cache %4u", inHist->expiredAnswerStateBins[ExpiredAnswer_AnsweredWithExpired]);
|
||||||
|
LogMsgNoIdent("Expired - cache changed %4u", inHist->expiredAnswerStateBins[ExpiredAnswer_ExpiredAnswerChanged]);
|
||||||
LogMsgNoIdent("-- Query send counts ---------");
|
LogMsgNoIdent("-- Query send counts ---------");
|
||||||
LogDNSHistSendCounts(inHist->answeredQuerySendCountBins);
|
LogDNSHistSendCounts(inHist->answeredQuerySendCountBins);
|
||||||
LogMsgNoIdent("-- Query send counts (NAQs) --");
|
LogMsgNoIdent("-- Query send counts (NAQs) --");
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>DEFAULT-OPTIONS</key>
|
|
||||||
<dict>
|
|
||||||
<key>Default-Privacy-Setting</key>
|
|
||||||
<string>Public</string>
|
|
||||||
<key>Level</key>
|
|
||||||
<dict>
|
|
||||||
<key>Persist</key>
|
|
||||||
<string>Inherit</string>
|
|
||||||
<key>Enable</key>
|
|
||||||
<string>Inherit</string>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
|
|
380
mDNSResponder/mDNSMacOSX/Scripts/bonjour-mcast-diagnose
Executable file
380
mDNSResponder/mDNSMacOSX/Scripts/bonjour-mcast-diagnose
Executable file
@ -0,0 +1,380 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2017-2018 Apple Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# This script is currently for Apple Internal use only.
|
||||||
|
#
|
||||||
|
|
||||||
|
version=1.4
|
||||||
|
script=${BASH_SOURCE[0]}
|
||||||
|
dnssdutil=${dnssdutil:-dnssdutil}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# PrintUsage
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
PrintUsage()
|
||||||
|
{
|
||||||
|
echo ""
|
||||||
|
echo "Usage: $( basename "${script}" ) [options]"
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo " -V Display version of this script and exit."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# LogOut
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
LogOut()
|
||||||
|
{
|
||||||
|
echo "$( date '+%Y-%m-%d %H:%M:%S%z' ): $*"
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# LogMsg
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
LogMsg()
|
||||||
|
{
|
||||||
|
echo "$*"
|
||||||
|
if [ -d "${workPath}" ]; then
|
||||||
|
LogOut "$*" >> "${workPath}/log.txt"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# ErrQuit
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
ErrQuit()
|
||||||
|
{
|
||||||
|
echo "error: $*"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# SignalHandler
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
SignalHandler()
|
||||||
|
{
|
||||||
|
LogMsg "Exiting due to signal."
|
||||||
|
trap '' SIGINT SIGTERM
|
||||||
|
pkill -TERM -P $$
|
||||||
|
wait
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# ExitHandler
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
ExitHandler()
|
||||||
|
{
|
||||||
|
if [ -d "${tempPath}" ]; then
|
||||||
|
rm -fr "${tempPath}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# RunNetStat
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
RunNetStat()
|
||||||
|
{
|
||||||
|
LogMsg "Running netstat -g -n -s"
|
||||||
|
netstat -g -n -s &> "${workPath}/netstat-g-n-s.txt"
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# StartPacketCapture
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
StartPacketCapture()
|
||||||
|
{
|
||||||
|
LogMsg "Starting tcpdump."
|
||||||
|
tcpdump -n -w "${workPath}/tcpdump.pcapng" &> "${workPath}/tcpdump.txt" &
|
||||||
|
tcpdumpPID=$!
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# SaveExistingPacketCaptures
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
SaveExistingPacketCaptures()
|
||||||
|
{
|
||||||
|
LogMsg "Saving existing mDNS packet captures."
|
||||||
|
mkdir "${workPath}/pcaps"
|
||||||
|
for file in /tmp/mdns-tcpdump.pcapng*; do
|
||||||
|
[ -e "${file}" ] || continue
|
||||||
|
baseName=$( sed -E 's/^mdns-tcpdump.pcapng([0-9]+)$/mdns-tcpdump-\1.pcapng/' <<< "$( basename ${file} )" )
|
||||||
|
gzip < ${file} > "${workPath}/pcaps/${baseName}.gz"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# StopPacketCapture
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
StopPacketCapture()
|
||||||
|
{
|
||||||
|
LogMsg "Stopping tcpdump."
|
||||||
|
kill -TERM ${tcpdumpPID}
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# RunInterfaceMulticastTests
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
RunInterfaceMulticastTests()
|
||||||
|
{
|
||||||
|
local ifname="$1"
|
||||||
|
local allHostsV4=224.0.0.1
|
||||||
|
local allHostsV6=ff02::1
|
||||||
|
local mDNSV4=224.0.0.251
|
||||||
|
local mDNSV6=ff02::fb
|
||||||
|
local serviceList=( $( "${dnssdutil}" queryrecord -i "${ifname}" -A -t ptr -n _services._dns-sd._udp.local -l 6 | sed -E -n 's/.*(_.*_(tcp|udp)\.local\.)$/\1/p' | sort -u ) )
|
||||||
|
local log="${workPath}/mcast-test-log-${ifname}.txt"
|
||||||
|
|
||||||
|
LogOut "List of services: ${serviceList[*]}" >> "${log}"
|
||||||
|
# Ping All Hosts IPv4 multicast address.
|
||||||
|
|
||||||
|
local routeOutput=$( route -n get -ifscope ${ifname} "${allHostsV4}" 2> /dev/null )
|
||||||
|
if [ -n "${routeOutput}" ]; then
|
||||||
|
LogOut "Pinging "${allHostsV4}" on interface ${ifname}." >> "${log}"
|
||||||
|
ping -t 5 -b ${ifname} "${allHostsV4}" &> "${workPath}/ping-all-hosts-${ifname}.txt"
|
||||||
|
else
|
||||||
|
LogOut "No route to "${allHostsV4}" on interface ${ifname}." >> "${log}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ping mDNS IPv4 multicast address.
|
||||||
|
|
||||||
|
routeOutput=$( route -n get -ifscope ${ifname} "${mDNSV4}" 2> /dev/null )
|
||||||
|
if [ -n "${routeOutput}" ]; then
|
||||||
|
LogOut "Pinging "${mDNSV4}" on interface ${ifname}." >> "${log}"
|
||||||
|
ping -t 5 -b ${ifname} "${mDNSV4}" &> "${workPath}/ping-mDNS-${ifname}.txt"
|
||||||
|
else
|
||||||
|
LogOut "No route to "${mDNSV4}" on interface ${ifname}." >> "${log}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ping All Hosts IPv6 multicast address.
|
||||||
|
|
||||||
|
routeOutput=$( route -n get -ifscope ${ifname} -inet6 "${allHostsV6}" 2> /dev/null )
|
||||||
|
if [ -n "${routeOutput}" ]; then
|
||||||
|
LogOut "Pinging "${allHostsV6}" on interface ${ifname}." >> "${log}"
|
||||||
|
ping6 -c 6 -I ${ifname} "${allHostsV6}" &> "${workPath}/ping6-all-hosts-${ifname}.txt"
|
||||||
|
else
|
||||||
|
LogOut "No route to "${allHostsV6}" on interface ${ifname}." >> "${log}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ping mDNS IPv6 multicast address.
|
||||||
|
|
||||||
|
routeOutput=$( route -n get -ifscope ${ifname} -inet6 "${mDNSV6}" 2> /dev/null )
|
||||||
|
if [ -n "${routeOutput}" ]; then
|
||||||
|
LogOut "Pinging "${mDNSV6}" on interface ${ifname}." >> "${log}"
|
||||||
|
ping6 -c 6 -I ${ifname} "${mDNSV6}" &> "${workPath}/ping6-mDNS-${ifname}.txt"
|
||||||
|
else
|
||||||
|
LogOut "No route to "${mDNSV6}" on interface ${ifname}." >> "${log}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Send mDNS queries for services.
|
||||||
|
|
||||||
|
for service in "${serviceList[@]}"; do
|
||||||
|
LogOut "Sending mDNS queries for "${service}" on interface ${ifname}." >> "${log}"
|
||||||
|
for(( i = 1; i <= 3; ++i )); do
|
||||||
|
printf "\n"
|
||||||
|
"${dnssdutil}" mdnsquery -i "${ifname}" -n "${service}" -t ptr -r 2
|
||||||
|
printf "\n"
|
||||||
|
"${dnssdutil}" mdnsquery -i "${ifname}" -n "${service}" -t ptr -r 1 --QU -p 5353
|
||||||
|
printf "\n"
|
||||||
|
done >> "${workPath}/mdnsquery-${ifname}.txt" 2>&1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# RunMulticastTests
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
RunMulticastTests()
|
||||||
|
{
|
||||||
|
local interfaces=( $( ifconfig -l -u ) )
|
||||||
|
local skipPrefixes=( ap awdl bridge ipsec lo p2p pdp_ip pktap UDC utun )
|
||||||
|
local ifname=""
|
||||||
|
local pid=""
|
||||||
|
local pids=()
|
||||||
|
|
||||||
|
LogMsg "List of interfaces: ${interfaces[*]}"
|
||||||
|
for ifname in "${interfaces[@]}"; do
|
||||||
|
local skip=false
|
||||||
|
for prefix in ${skipPrefixes[@]}; do
|
||||||
|
if [[ ${ifname} =~ ^${prefix}[0-9]*$ ]]; then
|
||||||
|
skip=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${skip}" != "true" ]; then
|
||||||
|
ifconfig ${ifname} | grep -q inet
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
skip=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${skip}" == "true" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
LogMsg "Starting interface multicast tests for ${ifname}."
|
||||||
|
RunInterfaceMulticastTests "${ifname}" & pids+=($!)
|
||||||
|
done
|
||||||
|
|
||||||
|
LogMsg "Waiting for interface multicast tests to complete..."
|
||||||
|
for pid in "${pids[@]}"; do
|
||||||
|
wait "${pid}"
|
||||||
|
done
|
||||||
|
LogMsg "All interface multicast tests completed."
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# RunBrowseTest
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
RunBrowseTest()
|
||||||
|
{
|
||||||
|
LogMsg "Running dnssdutil browseAll command."
|
||||||
|
"${dnssdutil}" browseAll -A -d local -b 10 -c 10 &> "${workPath}/browseAll.txt"
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# IsMacOS
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
IsMacOS()
|
||||||
|
{
|
||||||
|
[[ $( sw_vers -productName ) =~ ^Mac\ OS ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# ArchiveLogs
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
ArchiveLogs()
|
||||||
|
{
|
||||||
|
local workdir=$( basename "${workPath}" )
|
||||||
|
local archivePath="${dstPath}/${workdir}.tar.gz"
|
||||||
|
|
||||||
|
LogMsg "Archiving logs."
|
||||||
|
echo "---"
|
||||||
|
tar -C "${tempPath}" -czf "${archivePath}" "${workdir}"
|
||||||
|
if [ -e "${archivePath}" ]; then
|
||||||
|
echo "Created log archive at ${archivePath}"
|
||||||
|
echo "*** Please run sysdiagnose NOW. ***"
|
||||||
|
echo "Attach both the log archive and the sysdiagnose archive to the radar."
|
||||||
|
if IsMacOS; then
|
||||||
|
open "${dstPath}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Failed to create archive at ${archivePath}."
|
||||||
|
fi
|
||||||
|
echo "---"
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# CreateWorkDirName
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
CreateWorkDirName()
|
||||||
|
{
|
||||||
|
local suffix=""
|
||||||
|
local productName=$( sw_vers -productName )
|
||||||
|
if [ -n "${productName}" ]; then
|
||||||
|
suffix+="_${productName}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local model=""
|
||||||
|
if IsMacOS; then
|
||||||
|
model=$( sysctl -n hw.model )
|
||||||
|
model=${model//,/-}
|
||||||
|
else
|
||||||
|
model=$( gestalt_query -undecorated DeviceName )
|
||||||
|
fi
|
||||||
|
if [ -n "${model}" ]; then
|
||||||
|
suffix+="_${model}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local buildVersion=$( sw_vers -buildVersion )
|
||||||
|
if [ -n "${buildVersion}" ]; then
|
||||||
|
suffix+="_${buildVersion}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
suffix=${suffix//[^A-Za-z0-9._-]/_}
|
||||||
|
|
||||||
|
printf "bonjour-mcast-diags_$( date '+%Y.%m.%d_%H-%M-%S%z' )${suffix}"
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# main
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
while getopts ":hV" option; do
|
||||||
|
case "${option}" in
|
||||||
|
h)
|
||||||
|
PrintUsage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
V)
|
||||||
|
echo "$( basename "${script}" ) version ${version}"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
ErrQuit "option '${OPTARG}' requires an argument."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ErrQuit "unknown option '${OPTARG}'."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
[ "${OPTIND}" -gt "$#" ] || ErrQuit "unexpected argument \""${!OPTIND}"\"."
|
||||||
|
|
||||||
|
if IsMacOS; then
|
||||||
|
if [ "${EUID}" -ne 0 ]; then
|
||||||
|
echo "Re-launching with sudo"
|
||||||
|
exec sudo ${script}
|
||||||
|
fi
|
||||||
|
dstPath=/var/tmp
|
||||||
|
else
|
||||||
|
[ "${EUID}" -eq 0 ] || ErrQuit "$( basename "${script}" ) needs to be run as root."
|
||||||
|
dstPath=/var/mobile/Library/Logs/CrashReporter
|
||||||
|
fi
|
||||||
|
|
||||||
|
tempPath=$( mktemp -d -q ) || ErrQuit "Failed to make temp directory."
|
||||||
|
workPath="${tempPath}/$( CreateWorkDirName )"
|
||||||
|
mkdir "${workPath}" || ErrQuit "Failed to make work directory."
|
||||||
|
|
||||||
|
trap SignalHandler SIGINT SIGTERM
|
||||||
|
trap ExitHandler EXIT
|
||||||
|
|
||||||
|
LogMsg "About: $( basename "${script}" ) version ${version} ($( md5 -q ${script} ))."
|
||||||
|
if [ "${dnssdutil}" != "dnssdutil" ]; then
|
||||||
|
if [ -x "$( which "${dnssdutil}" )" ]; then
|
||||||
|
LogMsg "Using $( "${dnssdutil}" -V ) at $( which "${dnssdutil}" )."
|
||||||
|
else
|
||||||
|
LogMsg "WARNING: dnssdutil (${dnssdutil}) isn't an executable."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
RunNetStat
|
||||||
|
StartPacketCapture
|
||||||
|
SaveExistingPacketCaptures
|
||||||
|
RunBrowseTest
|
||||||
|
RunMulticastTests
|
||||||
|
StopPacketCapture
|
||||||
|
ArchiveLogs
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
56
mDNSResponder/mDNSMacOSX/Scripts/bonjour-start-mdns-tcpdump
Executable file
56
mDNSResponder/mDNSMacOSX/Scripts/bonjour-start-mdns-tcpdump
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Apple Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# This script is currently for Apple Internal use only.
|
||||||
|
#
|
||||||
|
|
||||||
|
version=1.0
|
||||||
|
script=${BASH_SOURCE[0]}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# PrintUsage
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
PrintUsage()
|
||||||
|
{
|
||||||
|
echo ""
|
||||||
|
echo "Usage: $( basename "${script}" ) [options]"
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo " -V Display version of this script and exit."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
#============================================================================================================================
|
||||||
|
# main
|
||||||
|
#============================================================================================================================
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
while getopts ":hV" option; do
|
||||||
|
case "${option}" in
|
||||||
|
h)
|
||||||
|
PrintUsage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
V)
|
||||||
|
echo "$( basename "${script}" ) version ${version}"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
ErrQuit "option '${OPTARG}' requires an argument."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ErrQuit "unknown option '${OPTARG}'."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
[ "${OPTIND}" -gt "$#" ] || ErrQuit "unexpected argument \""${!OPTIND}"\"."
|
||||||
|
|
||||||
|
launchctl load /Library/LaunchDaemons/com.apple.mDNSResponder.mdns-tcpdump.plist
|
||||||
|
launchctl start com.apple.mDNSResponder.mdns-tcpdump
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//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.mdns-tcpdump</string>
|
||||||
|
<key>ProgramArguments</key>
|
||||||
|
<array>
|
||||||
|
<string>/usr/sbin/tcpdump</string>
|
||||||
|
<string>-w</string>
|
||||||
|
<string>/tmp/mdns-tcpdump.pcapng</string>
|
||||||
|
<string>-C</string>
|
||||||
|
<string>10</string>
|
||||||
|
<string>-W</string>
|
||||||
|
<string>16</string>
|
||||||
|
<string>( udp port 5353 ) or arp or icmp or icmp6</string>
|
||||||
|
</array>
|
||||||
|
<key>KeepAlive</key>
|
||||||
|
<false/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -62,6 +62,7 @@ static os_log_t log_general = NULL;
|
|||||||
#define kPreferencesKey_DebugLogging CFSTR("DebugLogging")
|
#define kPreferencesKey_DebugLogging CFSTR("DebugLogging")
|
||||||
#define kPreferencesKey_UnicastPacketLogging CFSTR("UnicastPacketLogging")
|
#define kPreferencesKey_UnicastPacketLogging CFSTR("UnicastPacketLogging")
|
||||||
#define kPreferencesKey_AlwaysAppendSearchDomains CFSTR("AlwaysAppendSearchDomains")
|
#define kPreferencesKey_AlwaysAppendSearchDomains CFSTR("AlwaysAppendSearchDomains")
|
||||||
|
#define kPreferencesKey_EnableAllowExpired CFSTR("EnableAllowExpired")
|
||||||
#define kPreferencesKey_NoMulticastAdvertisements CFSTR("NoMulticastAdvertisements")
|
#define kPreferencesKey_NoMulticastAdvertisements CFSTR("NoMulticastAdvertisements")
|
||||||
#define kPreferencesKey_StrictUnicastOrdering CFSTR("StrictUnicastOrdering")
|
#define kPreferencesKey_StrictUnicastOrdering CFSTR("StrictUnicastOrdering")
|
||||||
#define kPreferencesKey_OfferSleepProxyService CFSTR("OfferSleepProxyService")
|
#define kPreferencesKey_OfferSleepProxyService CFSTR("OfferSleepProxyService")
|
||||||
@ -84,13 +85,13 @@ static os_log_t log_general = NULL;
|
|||||||
|
|
||||||
static mDNS_PlatformSupport PlatformStorage;
|
static mDNS_PlatformSupport PlatformStorage;
|
||||||
|
|
||||||
// Start off with a default cache of 32K (141 records of 232 bytes each)
|
// Start off with a default cache of 32K (136 records of 240 bytes each)
|
||||||
// Each time we grow the cache we add another 141 records
|
// Each time we grow the cache we add another 136 records
|
||||||
// 141 * 232 = 32712 bytes.
|
// 136 * 240 = 32640 bytes.
|
||||||
// This fits in eight 4kB pages, with 56 bytes spare for memory block headers and similar overhead
|
// This fits in eight 4kB pages, with 128 bytes spare for memory block headers and similar overhead
|
||||||
#define RR_CACHE_SIZE ((32*1024) / sizeof(CacheRecord))
|
#define RR_CACHE_SIZE ((32*1024) / sizeof(CacheRecord))
|
||||||
static CacheEntity rrcachestorage[RR_CACHE_SIZE];
|
static CacheEntity rrcachestorage[RR_CACHE_SIZE];
|
||||||
struct CompileTimeAssertionChecks_RR_CACHE_SIZE { char a[(RR_CACHE_SIZE >= 141) ? 1 : -1]; };
|
struct CompileTimeAssertionChecks_RR_CACHE_SIZE { char a[(RR_CACHE_SIZE >= 136) ? 1 : -1]; };
|
||||||
#define kRRCacheGrowSize (sizeof(CacheEntity) * RR_CACHE_SIZE)
|
#define kRRCacheGrowSize (sizeof(CacheEntity) * RR_CACHE_SIZE)
|
||||||
|
|
||||||
|
|
||||||
@ -107,6 +108,7 @@ static mDNSBool NoMulticastAdvertisements = mDNSfalse; // By default, advertise
|
|||||||
|
|
||||||
extern mDNSBool StrictUnicastOrdering;
|
extern mDNSBool StrictUnicastOrdering;
|
||||||
extern mDNSBool AlwaysAppendSearchDomains;
|
extern mDNSBool AlwaysAppendSearchDomains;
|
||||||
|
extern mDNSBool EnableAllowExpired;
|
||||||
|
|
||||||
#if ENABLE_BLE_TRIGGERED_BONJOUR
|
#if ENABLE_BLE_TRIGGERED_BONJOUR
|
||||||
extern mDNSBool EnableBLEBasedDiscovery;
|
extern mDNSBool EnableBLEBasedDiscovery;
|
||||||
@ -571,7 +573,7 @@ mDNSexport void mDNSPlatformLogToFile(int log_level, const char *buffer)
|
|||||||
if (!log_general)
|
if (!log_general)
|
||||||
os_log_error(OS_LOG_DEFAULT, "Could NOT create log handle in init_logging()");
|
os_log_error(OS_LOG_DEFAULT, "Could NOT create log handle in init_logging()");
|
||||||
else
|
else
|
||||||
os_log_with_type(log_general, log_level, "%s", buffer);
|
os_log_with_type(log_general, log_level, "%{private}s", buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,6 +654,7 @@ mDNSlocal void SignalCallback(CFMachPortRef port, void *msg, CFIndex size, void
|
|||||||
mDNS_Lock(m);
|
mDNS_Lock(m);
|
||||||
FORALL_CACHERECORDS(slot, cg, rr)
|
FORALL_CACHERECORDS(slot, cg, rr)
|
||||||
{
|
{
|
||||||
|
rr->resrec.mortality = Mortality_Mortal;
|
||||||
mDNS_PurgeCacheResourceRecord(m, rr);
|
mDNS_PurgeCacheResourceRecord(m, rr);
|
||||||
}
|
}
|
||||||
// Restart unicast and multicast queries
|
// Restart unicast and multicast queries
|
||||||
@ -763,6 +766,7 @@ mDNSlocal void SignalDispatch(dispatch_source_t source)
|
|||||||
mDNS_Lock(m);
|
mDNS_Lock(m);
|
||||||
FORALL_CACHERECORDS(slot, cg, rr)
|
FORALL_CACHERECORDS(slot, cg, rr)
|
||||||
{
|
{
|
||||||
|
rr->resrec.mortality = Mortality_Mortal;
|
||||||
mDNS_PurgeCacheResourceRecord(m, rr);
|
mDNS_PurgeCacheResourceRecord(m, rr);
|
||||||
}
|
}
|
||||||
// Restart unicast and multicast queries
|
// Restart unicast and multicast queries
|
||||||
@ -1528,6 +1532,7 @@ mDNSexport int main(int argc, char **argv)
|
|||||||
UseInternalSleepProxy = (i+1<argc && mDNSIsDigit(argv[i+1][0]) && argv[i+1][1]==0) ? atoi(argv[++i]) : 1;
|
UseInternalSleepProxy = (i+1<argc && mDNSIsDigit(argv[i+1][0]) && argv[i+1][1]==0) ? atoi(argv[++i]) : 1;
|
||||||
if (!strcasecmp(argv[i], "-StrictUnicastOrdering" )) StrictUnicastOrdering = mDNStrue;
|
if (!strcasecmp(argv[i], "-StrictUnicastOrdering" )) StrictUnicastOrdering = mDNStrue;
|
||||||
if (!strcasecmp(argv[i], "-AlwaysAppendSearchDomains")) AlwaysAppendSearchDomains = mDNStrue;
|
if (!strcasecmp(argv[i], "-AlwaysAppendSearchDomains")) AlwaysAppendSearchDomains = mDNStrue;
|
||||||
|
if (!strcasecmp(argv[i], "-DisableAllowExpired" )) EnableAllowExpired = mDNSfalse;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (!strcasecmp(argv[i], "-UseDebugSocket")) useDebugSocket = mDNStrue;
|
if (!strcasecmp(argv[i], "-UseDebugSocket")) useDebugSocket = mDNStrue;
|
||||||
if (!strcasecmp(argv[i], "-NoSandbox")) useSandbox = mDNSfalse;
|
if (!strcasecmp(argv[i], "-NoSandbox")) useSandbox = mDNSfalse;
|
||||||
@ -1568,6 +1573,7 @@ mDNSexport int main(int argc, char **argv)
|
|||||||
NoMulticastAdvertisements = PreferencesGetValueBool(kPreferencesKey_NoMulticastAdvertisements, NoMulticastAdvertisements);
|
NoMulticastAdvertisements = PreferencesGetValueBool(kPreferencesKey_NoMulticastAdvertisements, NoMulticastAdvertisements);
|
||||||
StrictUnicastOrdering = PreferencesGetValueBool(kPreferencesKey_StrictUnicastOrdering, StrictUnicastOrdering);
|
StrictUnicastOrdering = PreferencesGetValueBool(kPreferencesKey_StrictUnicastOrdering, StrictUnicastOrdering);
|
||||||
AlwaysAppendSearchDomains = PreferencesGetValueBool(kPreferencesKey_AlwaysAppendSearchDomains, AlwaysAppendSearchDomains);
|
AlwaysAppendSearchDomains = PreferencesGetValueBool(kPreferencesKey_AlwaysAppendSearchDomains, AlwaysAppendSearchDomains);
|
||||||
|
EnableAllowExpired = PreferencesGetValueBool(kPreferencesKey_EnableAllowExpired, EnableAllowExpired);
|
||||||
OfferSleepProxyService = PreferencesGetValueInt(kPreferencesKey_OfferSleepProxyService, OfferSleepProxyService);
|
OfferSleepProxyService = PreferencesGetValueInt(kPreferencesKey_OfferSleepProxyService, OfferSleepProxyService);
|
||||||
UseInternalSleepProxy = PreferencesGetValueInt(kPreferencesKey_UseInternalSleepProxy, UseInternalSleepProxy);
|
UseInternalSleepProxy = PreferencesGetValueInt(kPreferencesKey_UseInternalSleepProxy, UseInternalSleepProxy);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-2015 Apple Inc. All rights reserved.
|
* Copyright (c) 2007-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -55,10 +55,10 @@ static int64_t maxwait_secs = 5LL;
|
|||||||
//*************************************************************************************************************
|
//*************************************************************************************************************
|
||||||
// Utility Functions
|
// Utility Functions
|
||||||
|
|
||||||
static void LogDebug(const char *prefix, xpc_object_t o)
|
static void HelperLog(const char *prefix, xpc_object_t o)
|
||||||
{
|
{
|
||||||
char *desc = xpc_copy_description(o);
|
char *desc = xpc_copy_description(o);
|
||||||
mDNSHELPER_DEBUG("LogDebug %s: %s", prefix, desc);
|
mDNSHELPER_DEBUG("HelperLog %s: %s", prefix, desc);
|
||||||
free(desc);
|
free(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ mDNSlocal int SendDict_ToServer(xpc_object_t msg)
|
|||||||
{
|
{
|
||||||
__block int errorcode = kHelperErr_NoResponse;
|
__block int errorcode = kHelperErr_NoResponse;
|
||||||
|
|
||||||
LogDebug("SendDict_ToServer Sending msg to Daemon", msg);
|
HelperLog("SendDict_ToServer Sending msg to Daemon", msg);
|
||||||
|
|
||||||
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
||||||
dispatch_retain(sem); // for the block below
|
dispatch_retain(sem); // for the block below
|
||||||
@ -94,7 +94,7 @@ mDNSlocal int SendDict_ToServer(xpc_object_t msg)
|
|||||||
|
|
||||||
if (type == XPC_TYPE_DICTIONARY)
|
if (type == XPC_TYPE_DICTIONARY)
|
||||||
{
|
{
|
||||||
LogDebug("SendDict_ToServer Received reply msg from Daemon", recv_msg);
|
HelperLog("SendDict_ToServer Received reply msg from Daemon", recv_msg);
|
||||||
uint64_t reply_status = xpc_dictionary_get_uint64(recv_msg, kHelperReplyStatus);
|
uint64_t reply_status = xpc_dictionary_get_uint64(recv_msg, kHelperReplyStatus);
|
||||||
errorcode = xpc_dictionary_get_int64(recv_msg, kHelperErrCode);
|
errorcode = xpc_dictionary_get_int64(recv_msg, kHelperErrCode);
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ mDNSlocal int SendDict_ToServer(xpc_object_t msg)
|
|||||||
{
|
{
|
||||||
LogMsg("SendDict_ToServer Received unexpected reply from daemon [%s]",
|
LogMsg("SendDict_ToServer Received unexpected reply from daemon [%s]",
|
||||||
xpc_dictionary_get_string(recv_msg, XPC_ERROR_KEY_DESCRIPTION));
|
xpc_dictionary_get_string(recv_msg, XPC_ERROR_KEY_DESCRIPTION));
|
||||||
LogDebug("SendDict_ToServer Unexpected Reply contents", recv_msg);
|
HelperLog("SendDict_ToServer Unexpected Reply contents", recv_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch_semaphore_signal(sem);
|
dispatch_semaphore_signal(sem);
|
||||||
@ -137,7 +137,7 @@ mDNSlocal xpc_object_t SendDict_GetReply(xpc_object_t msg)
|
|||||||
if (!dict) return NULL;
|
if (!dict) return NULL;
|
||||||
xpc_retain(dict);
|
xpc_retain(dict);
|
||||||
|
|
||||||
LogDebug("SendDict_GetReply Sending msg to Daemon", msg);
|
HelperLog("SendDict_GetReply Sending msg to Daemon", msg);
|
||||||
|
|
||||||
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
||||||
dispatch_retain(sem); // for the block below
|
dispatch_retain(sem); // for the block below
|
||||||
@ -148,7 +148,7 @@ mDNSlocal xpc_object_t SendDict_GetReply(xpc_object_t msg)
|
|||||||
|
|
||||||
if (type == XPC_TYPE_DICTIONARY)
|
if (type == XPC_TYPE_DICTIONARY)
|
||||||
{
|
{
|
||||||
LogDebug("SendDict_GetReply Received reply msg from Daemon", recv_msg);
|
HelperLog("SendDict_GetReply Received reply msg from Daemon", recv_msg);
|
||||||
uint64_t reply_status = xpc_dictionary_get_uint64(recv_msg, kHelperReplyStatus);
|
uint64_t reply_status = xpc_dictionary_get_uint64(recv_msg, kHelperReplyStatus);
|
||||||
|
|
||||||
switch (reply_status)
|
switch (reply_status)
|
||||||
@ -171,7 +171,7 @@ mDNSlocal xpc_object_t SendDict_GetReply(xpc_object_t msg)
|
|||||||
{
|
{
|
||||||
LogMsg("SendDict_GetReply Received unexpected reply from daemon [%s]",
|
LogMsg("SendDict_GetReply Received unexpected reply from daemon [%s]",
|
||||||
xpc_dictionary_get_string(recv_msg, XPC_ERROR_KEY_DESCRIPTION));
|
xpc_dictionary_get_string(recv_msg, XPC_ERROR_KEY_DESCRIPTION));
|
||||||
LogDebug("SendDict_GetReply Unexpected Reply contents", recv_msg);
|
HelperLog("SendDict_GetReply Unexpected Reply contents", recv_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch_semaphore_signal(sem);
|
dispatch_semaphore_signal(sem);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-2015 Apple Inc. All rights reserved.
|
* Copyright (c) 2007-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -710,7 +710,12 @@ fin:
|
|||||||
|
|
||||||
enum DNSKeyFormat
|
enum DNSKeyFormat
|
||||||
{
|
{
|
||||||
formatNotDNSKey, formatDdnsTypeItem, formatDnsPrefixedServiceItem, formatBtmmPrefixedServiceItem
|
formatNotDNSKey,
|
||||||
|
formatDdnsTypeItem,
|
||||||
|
formatDnsPrefixedServiceItem,
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
|
formatBtmmPrefixedServiceItem
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// On Mac OS X on Intel, the four-character string seems to be stored backwards, at least sometimes.
|
// On Mac OS X on Intel, the four-character string seems to be stored backwards, at least sometimes.
|
||||||
@ -720,7 +725,9 @@ enum DNSKeyFormat
|
|||||||
|
|
||||||
|
|
||||||
#ifndef NO_SECURITYFRAMEWORK
|
#ifndef NO_SECURITYFRAMEWORK
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
static const char btmmprefix[] = "btmmdns:";
|
static const char btmmprefix[] = "btmmdns:";
|
||||||
|
#endif
|
||||||
static const char dnsprefix[] = "dns:";
|
static const char dnsprefix[] = "dns:";
|
||||||
static const char ddns[] = "ddns";
|
static const char ddns[] = "ddns";
|
||||||
static const char ddnsrev[] = "sndd";
|
static const char ddnsrev[] = "sndd";
|
||||||
@ -778,8 +785,10 @@ static enum DNSKeyFormat getDNSKeyFormat(SecKeychainItemRef item, SecKeychainAtt
|
|||||||
}
|
}
|
||||||
if (attributes->attr[1].length >= sizeof(dnsprefix)-1 && 0 == strncasecmp(attributes->attr[1].data, dnsprefix, sizeof(dnsprefix)-1))
|
if (attributes->attr[1].length >= sizeof(dnsprefix)-1 && 0 == strncasecmp(attributes->attr[1].data, dnsprefix, sizeof(dnsprefix)-1))
|
||||||
format = formatDnsPrefixedServiceItem;
|
format = formatDnsPrefixedServiceItem;
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
else if (attributes->attr[1].length >= sizeof(btmmprefix)-1 && 0 == strncasecmp(attributes->attr[1].data, btmmprefix, sizeof(btmmprefix)-1))
|
else if (attributes->attr[1].length >= sizeof(btmmprefix)-1 && 0 == strncasecmp(attributes->attr[1].data, btmmprefix, sizeof(btmmprefix)-1))
|
||||||
format = formatBtmmPrefixedServiceItem;
|
format = formatBtmmPrefixedServiceItem;
|
||||||
|
#endif
|
||||||
else if (attributes->attr[0].length == sizeof(ddns)-1 && 0 == strncasecmp(attributes->attr[0].data, ddns, sizeof(ddns)-1))
|
else if (attributes->attr[0].length == sizeof(ddns)-1 && 0 == strncasecmp(attributes->attr[0].data, ddns, sizeof(ddns)-1))
|
||||||
format = formatDdnsTypeItem;
|
format = formatDdnsTypeItem;
|
||||||
else if (attributes->attr[0].length == sizeof(ddnsrev)-1 && 0 == strncasecmp(attributes->attr[0].data, ddnsrev, sizeof(ddnsrev)-1))
|
else if (attributes->attr[0].length == sizeof(ddnsrev)-1 && 0 == strncasecmp(attributes->attr[0].data, ddnsrev, sizeof(ddnsrev)-1))
|
||||||
@ -821,7 +830,9 @@ static CFPropertyListRef copyKeychainItemInfo(SecKeychainItemRef item, SecKeycha
|
|||||||
data = CFDataCreate(kCFAllocatorDefault, attributes->attr[1].data, attributes->attr[1].length);
|
data = CFDataCreate(kCFAllocatorDefault, attributes->attr[1].data, attributes->attr[1].length);
|
||||||
break;
|
break;
|
||||||
case formatDnsPrefixedServiceItem:
|
case formatDnsPrefixedServiceItem:
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
case formatBtmmPrefixedServiceItem:
|
case formatBtmmPrefixedServiceItem:
|
||||||
|
#endif
|
||||||
data = CFDataCreate(kCFAllocatorDefault, attributes->attr[1].data, attributes->attr[1].length);
|
data = CFDataCreate(kCFAllocatorDefault, attributes->attr[1].data, attributes->attr[1].length);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2016 Apple Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -86,22 +86,22 @@
|
|||||||
#include <SystemConfiguration/SCPrivate.h>
|
#include <SystemConfiguration/SCPrivate.h>
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
// For WiFiManagerClientRef etc, declarations.
|
#include <MobileWiFi/WiFiManagerClient.h> // For WiFiManagerClientRef etc, declarations.
|
||||||
#include <MobileGestalt.h>
|
|
||||||
#include <MobileWiFi/WiFiManagerClient.h>
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <os/variant_private.h> // For os_variant_has_internal_diagnostics().
|
||||||
#endif // TARGET_OS_IPHONE
|
#endif // TARGET_OS_IPHONE
|
||||||
|
|
||||||
// Include definition of opaque_presence_indication for KEV_DL_NODE_PRESENCE handling logic.
|
// Include definition of opaque_presence_indication for KEV_DL_NODE_PRESENCE handling logic.
|
||||||
#include <Kernel/IOKit/apple80211/apple80211_var.h>
|
#include <Kernel/IOKit/apple80211/apple80211_var.h>
|
||||||
#include <network_information.h> // for nwi_state
|
#include <network_information.h> // for nwi_state
|
||||||
|
|
||||||
#if APPLE_OSX_mDNSResponder
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
#include <AWACS.h>
|
#include <AWACS.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if APPLE_OSX_mDNSResponder
|
||||||
#include <ne_session.h> // for ne_session_set_socket_attributes()
|
#include <ne_session.h> // for ne_session_set_socket_attributes()
|
||||||
#else
|
#endif
|
||||||
#define NO_AWACS 1
|
|
||||||
#endif // APPLE_OSX_mDNSResponder
|
|
||||||
|
|
||||||
#if APPLE_OSX_mDNSResponder && !TARGET_OS_EMBEDDED
|
#if APPLE_OSX_mDNSResponder && !TARGET_OS_EMBEDDED
|
||||||
#include <IOKit/platform/IOPlatformSupportPrivate.h>
|
#include <IOKit/platform/IOPlatformSupportPrivate.h>
|
||||||
@ -153,9 +153,11 @@ static CFStringRef NetworkChangedKey_Computername;
|
|||||||
static CFStringRef NetworkChangedKey_DNS;
|
static CFStringRef NetworkChangedKey_DNS;
|
||||||
static CFStringRef NetworkChangedKey_StateInterfacePrefix;
|
static CFStringRef NetworkChangedKey_StateInterfacePrefix;
|
||||||
static CFStringRef NetworkChangedKey_DynamicDNS = CFSTR("Setup:/Network/DynamicDNS");
|
static CFStringRef NetworkChangedKey_DynamicDNS = CFSTR("Setup:/Network/DynamicDNS");
|
||||||
|
static CFStringRef NetworkChangedKey_PowerSettings = CFSTR("State:/IOKit/PowerManagement/CurrentSettings");
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
static CFStringRef NetworkChangedKey_BackToMyMac = CFSTR("Setup:/Network/BackToMyMac");
|
static CFStringRef NetworkChangedKey_BackToMyMac = CFSTR("Setup:/Network/BackToMyMac");
|
||||||
static CFStringRef NetworkChangedKey_BTMMConnectivity = CFSTR("State:/Network/Connectivity");
|
static CFStringRef NetworkChangedKey_BTMMConnectivity = CFSTR("State:/Network/Connectivity");
|
||||||
static CFStringRef NetworkChangedKey_PowerSettings = CFSTR("State:/IOKit/PowerManagement/CurrentSettings");
|
#endif
|
||||||
|
|
||||||
static char HINFO_HWstring_buffer[32];
|
static char HINFO_HWstring_buffer[32];
|
||||||
static char *HINFO_HWstring = "Device";
|
static char *HINFO_HWstring = "Device";
|
||||||
@ -794,8 +796,8 @@ mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const ms
|
|||||||
s, InterfaceID, ifa_name, dst->type, dst, mDNSVal16(dstPort), s, err, sendto_errno, strerror(sendto_errno), (mDNSu32)(m->timenow));
|
s, InterfaceID, ifa_name, dst->type, dst, mDNSVal16(dstPort), s, err, sendto_errno, strerror(sendto_errno), (mDNSu32)(m->timenow));
|
||||||
if (!mDNSAddressIsAllDNSLinkGroup(dst))
|
if (!mDNSAddressIsAllDNSLinkGroup(dst))
|
||||||
{
|
{
|
||||||
if (sendto_errno == EHOSTUNREACH) return(mStatus_HostUnreachErr);
|
if ((sendto_errno == EHOSTUNREACH) || (sendto_errno == ENETUNREACH)) return(mStatus_HostUnreachErr);
|
||||||
if (sendto_errno == EHOSTDOWN || sendto_errno == ENETDOWN || sendto_errno == ENETUNREACH) return(mStatus_TransientErr);
|
if ((sendto_errno == EHOSTDOWN) || (sendto_errno == ENETDOWN)) return(mStatus_TransientErr);
|
||||||
}
|
}
|
||||||
// Don't report EHOSTUNREACH in the first three minutes after boot
|
// Don't report EHOSTUNREACH in the first three minutes after boot
|
||||||
// This is because mDNSResponder intentionally starts up early in the boot process (See <rdar://problem/3409090>)
|
// This is because mDNSResponder intentionally starts up early in the boot process (See <rdar://problem/3409090>)
|
||||||
@ -3310,6 +3312,40 @@ mDNSlocal u_int64_t getExtendedFlags(char * ifa_name)
|
|||||||
return ifr.ifr_eflags;
|
return ifr.ifr_eflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
// IFRTYPE_FUNCTIONAL_INTCOPROC type interfaces on macOS do not support Bonjour discovery.
|
||||||
|
mDNSlocal mDNSBool isCoprocessorInterface(int sockFD, char * ifa_name)
|
||||||
|
{
|
||||||
|
struct ifreq ifr;
|
||||||
|
|
||||||
|
if (sockFD < 0)
|
||||||
|
{
|
||||||
|
LogMsg("isCoprocessorInterface: invalid socket FD passed: %d", sockFD);
|
||||||
|
return mDNSfalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&ifr, 0, sizeof(struct ifreq));
|
||||||
|
strlcpy(ifr.ifr_name, ifa_name, sizeof(ifr.ifr_name));
|
||||||
|
|
||||||
|
if (ioctl(sockFD, SIOCGIFFUNCTIONALTYPE, (caddr_t)&ifr) == -1)
|
||||||
|
{
|
||||||
|
LogMsg("isCoprocessorInterface: SIOCGIFFUNCTIONALTYPE failed, errno = %d (%s)", errno, strerror(errno));
|
||||||
|
return mDNSfalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ifr.ifr_functional_type == IFRTYPE_FUNCTIONAL_INTCOPROC)
|
||||||
|
{
|
||||||
|
LogMsg("isCoprocessorInterface: %s marked as coprocessor interface", ifa_name);
|
||||||
|
return mDNStrue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return mDNSfalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // TARGET_OS_OSX
|
||||||
|
#define isCoprocessorInterface(A, B) mDNSfalse
|
||||||
|
#endif // TARGET_OS_OSX
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
|
|
||||||
// Function pointers for the routines we use in the MobileWiFi framework.
|
// Function pointers for the routines we use in the MobileWiFi framework.
|
||||||
@ -3499,7 +3535,17 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(struct ifaddrs *ifa, mDNSs
|
|||||||
// we get the corresponding name for the interface index on which the packet was received and check against
|
// we get the corresponding name for the interface index on which the packet was received and check against
|
||||||
// the InterfaceList for a matching name. So, keep the name in sync
|
// the InterfaceList for a matching name. So, keep the name in sync
|
||||||
strlcpy((*p)->ifinfo.ifname, ifa->ifa_name, sizeof((*p)->ifinfo.ifname));
|
strlcpy((*p)->ifinfo.ifname, ifa->ifa_name, sizeof((*p)->ifinfo.ifname));
|
||||||
|
|
||||||
|
// Determine if multicast state has changed.
|
||||||
|
const mDNSBool txrx = MulticastInterface(*p);
|
||||||
|
if ((*p)->ifinfo.McastTxRx != txrx)
|
||||||
|
{
|
||||||
|
(*p)->ifinfo.McastTxRx = txrx;
|
||||||
|
(*p)->Exists = MulticastStateChanged; // State change; need to deregister and reregister this interface
|
||||||
|
}
|
||||||
|
else
|
||||||
(*p)->Exists = mDNStrue;
|
(*p)->Exists = mDNStrue;
|
||||||
|
|
||||||
// If interface was not in getifaddrs list last time we looked, but it is now, update 'AppearanceTime' for this record
|
// If interface was not in getifaddrs list last time we looked, but it is now, update 'AppearanceTime' for this record
|
||||||
if ((*p)->LastSeen != utc) (*p)->AppearanceTime = utc;
|
if ((*p)->LastSeen != utc) (*p)->AppearanceTime = utc;
|
||||||
|
|
||||||
@ -3539,7 +3585,6 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(struct ifaddrs *ifa, mDNSs
|
|||||||
// We can be configured to disable multicast advertisement, but we want to to support
|
// We can be configured to disable multicast advertisement, but we want to to support
|
||||||
// local-only services, which need a loopback address record.
|
// local-only services, which need a loopback address record.
|
||||||
i->ifinfo.Advertise = m->DivertMulticastAdvertisements ? ((ifa->ifa_flags & IFF_LOOPBACK) ? mDNStrue : mDNSfalse) : m->AdvertiseLocalAddresses;
|
i->ifinfo.Advertise = m->DivertMulticastAdvertisements ? ((ifa->ifa_flags & IFF_LOOPBACK) ? mDNStrue : mDNSfalse) : m->AdvertiseLocalAddresses;
|
||||||
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.Loopback = ((ifa->ifa_flags & IFF_LOOPBACK) != 0) ? mDNStrue : mDNSfalse;
|
||||||
i->ifinfo.IgnoreIPv4LL = ((eflags & IFEF_ARPLL) != 0) ? mDNSfalse : mDNStrue;
|
i->ifinfo.IgnoreIPv4LL = ((eflags & IFEF_ARPLL) != 0) ? mDNSfalse : mDNStrue;
|
||||||
|
|
||||||
@ -3566,6 +3611,7 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(struct ifaddrs *ifa, mDNSs
|
|||||||
LogInfo("AddInterfaceToList: D2DInterface set for %s", ifa->ifa_name);
|
LogInfo("AddInterfaceToList: D2DInterface set for %s", ifa->ifa_name);
|
||||||
|
|
||||||
i->isExpensive = (eflags & IFEF_EXPENSIVE) ? mDNStrue: mDNSfalse;
|
i->isExpensive = (eflags & IFEF_EXPENSIVE) ? mDNStrue: mDNSfalse;
|
||||||
|
i->isAWDL = (eflags & IFEF_AWDL) ? mDNStrue: mDNSfalse;
|
||||||
if (eflags & IFEF_AWDL)
|
if (eflags & IFEF_AWDL)
|
||||||
{
|
{
|
||||||
// Set SupportsUnicastMDNSResponse false for the AWDL interface since unicast reserves
|
// Set SupportsUnicastMDNSResponse false for the AWDL interface since unicast reserves
|
||||||
@ -3590,6 +3636,8 @@ mDNSlocal NetworkInterfaceInfoOSX *AddInterfaceToList(struct ifaddrs *ifa, mDNSs
|
|||||||
i->BPF_len = 0;
|
i->BPF_len = 0;
|
||||||
i->Registered = mDNSNULL;
|
i->Registered = mDNSNULL;
|
||||||
|
|
||||||
|
// MulticastInterface() depends on the "m" and "ifa_flags" values being initialized above.
|
||||||
|
i->ifinfo.McastTxRx = MulticastInterface(i);
|
||||||
// Do this AFTER i->BSSID has been set up
|
// Do this AFTER i->BSSID has been set up
|
||||||
i->ifinfo.NetWake = (eflags & IFEF_EXPENSIVE)? mDNSfalse : NetWakeInterface(i);
|
i->ifinfo.NetWake = (eflags & IFEF_EXPENSIVE)? mDNSfalse : NetWakeInterface(i);
|
||||||
GetMAC(&i->ifinfo.MAC, scope_id);
|
GetMAC(&i->ifinfo.MAC, scope_id);
|
||||||
@ -4827,14 +4875,14 @@ mDNSlocal mStatus UpdateInterfaceList(mDNSs32 utc)
|
|||||||
mDNSPlatformMemCopy(m->PrimaryMAC.b, sdl->sdl_data + sdl->sdl_nlen, 6);
|
mDNSPlatformMemCopy(m->PrimaryMAC.b, sdl->sdl_data + sdl->sdl_nlen, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifa->ifa_flags & IFF_UP && ifa->ifa_addr)
|
if (ifa->ifa_flags & IFF_UP && ifa->ifa_addr && !isCoprocessorInterface(InfoSocket, ifa->ifa_name))
|
||||||
if (ifa->ifa_addr->sa_family == AF_INET || ifa->ifa_addr->sa_family == AF_INET6)
|
if (ifa->ifa_addr->sa_family == AF_INET || ifa->ifa_addr->sa_family == AF_INET6)
|
||||||
{
|
{
|
||||||
if (!ifa->ifa_netmask)
|
if (!ifa->ifa_netmask)
|
||||||
{
|
{
|
||||||
mDNSAddr ip;
|
mDNSAddr ip;
|
||||||
SetupAddr(&ip, ifa->ifa_addr);
|
SetupAddr(&ip, ifa->ifa_addr);
|
||||||
LogMsg("getifaddrs: ifa_netmask is NULL for %5s(%d) Flags %04X Family %2d %#a",
|
LogMsg("UpdateInterfaceList: ifa_netmask is NULL for %5s(%d) Flags %04X Family %2d %#a",
|
||||||
ifa->ifa_name, if_nametoindex(ifa->ifa_name), ifa->ifa_flags, ifa->ifa_addr->sa_family, &ip);
|
ifa->ifa_name, if_nametoindex(ifa->ifa_name), ifa->ifa_flags, ifa->ifa_addr->sa_family, &ip);
|
||||||
}
|
}
|
||||||
// Apparently it's normal for the sa_family of an ifa_netmask to sometimes be zero, so we don't complain about that
|
// Apparently it's normal for the sa_family of an ifa_netmask to sometimes be zero, so we don't complain about that
|
||||||
@ -4843,7 +4891,7 @@ mDNSlocal mStatus UpdateInterfaceList(mDNSs32 utc)
|
|||||||
{
|
{
|
||||||
mDNSAddr ip;
|
mDNSAddr ip;
|
||||||
SetupAddr(&ip, ifa->ifa_addr);
|
SetupAddr(&ip, ifa->ifa_addr);
|
||||||
LogMsg("getifaddrs ifa_netmask for %5s(%d) Flags %04X Family %2d %#a has different family: %d",
|
LogMsg("UpdateInterfaceList: ifa_netmask for %5s(%d) Flags %04X Family %2d %#a has different family: %d",
|
||||||
ifa->ifa_name, if_nametoindex(ifa->ifa_name), ifa->ifa_flags, ifa->ifa_addr->sa_family, &ip, ifa->ifa_netmask->sa_family);
|
ifa->ifa_name, if_nametoindex(ifa->ifa_name), ifa->ifa_flags, ifa->ifa_addr->sa_family, &ip, ifa->ifa_netmask->sa_family);
|
||||||
}
|
}
|
||||||
// Currently we use a few internal ones like mDNSInterfaceID_LocalOnly etc. that are negative values (0, -1, -2).
|
// Currently we use a few internal ones like mDNSInterfaceID_LocalOnly etc. that are negative values (0, -1, -2).
|
||||||
@ -4900,19 +4948,6 @@ mDNSlocal mStatus UpdateInterfaceList(mDNSs32 utc)
|
|||||||
if (!foundav4 && v4Loopback) AddInterfaceToList(v4Loopback, utc);
|
if (!foundav4 && v4Loopback) AddInterfaceToList(v4Loopback, utc);
|
||||||
if (!foundav6 && v6Loopback) AddInterfaceToList(v6Loopback, utc);
|
if (!foundav6 && v6Loopback) AddInterfaceToList(v6Loopback, utc);
|
||||||
|
|
||||||
// Now the list is complete, set the McastTxRx setting for each interface.
|
|
||||||
NetworkInterfaceInfoOSX *i;
|
|
||||||
for (i = m->p->InterfaceList; i; i = i->next)
|
|
||||||
if (i->Exists)
|
|
||||||
{
|
|
||||||
mDNSBool txrx = MulticastInterface(i);
|
|
||||||
if (i->ifinfo.McastTxRx != txrx)
|
|
||||||
{
|
|
||||||
i->ifinfo.McastTxRx = txrx;
|
|
||||||
i->Exists = MulticastStateChanged; // State change; need to deregister and reregister this interface
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InfoSocket >= 0)
|
if (InfoSocket >= 0)
|
||||||
close(InfoSocket);
|
close(InfoSocket);
|
||||||
|
|
||||||
@ -5234,7 +5269,7 @@ mDNSlocal int ClearInactiveInterfaces(mDNSs32 utc)
|
|||||||
if (!i->Exists)
|
if (!i->Exists)
|
||||||
{
|
{
|
||||||
if (i->LastSeen == utc) i->LastSeen = utc - 1;
|
if (i->LastSeen == utc) i->LastSeen = utc - 1;
|
||||||
mDNSBool delete = (NumCacheRecordsForInterfaceID(m, i->ifinfo.InterfaceID) == 0) && (utc - i->LastSeen >= 60);
|
const mDNSBool delete = (i->isAWDL || (NumCacheRecordsForInterfaceID(m, i->ifinfo.InterfaceID) == 0)) && (utc - i->LastSeen >= 60);
|
||||||
LogInfo("ClearInactiveInterfaces: %-13s %5s(%lu) %.6a InterfaceID %p(%p) %#a/%d Age %d%s", delete ? "Deleting" : "Holding",
|
LogInfo("ClearInactiveInterfaces: %-13s %5s(%lu) %.6a InterfaceID %p(%p) %#a/%d Age %d%s", delete ? "Deleting" : "Holding",
|
||||||
i->ifinfo.ifname, i->scope_id, &i->BSSID, i->ifinfo.InterfaceID, i,
|
i->ifinfo.ifname, i->scope_id, &i->BSSID, i->ifinfo.InterfaceID, i,
|
||||||
&i->ifinfo.ip, CountMaskBits(&i->ifinfo.mask), utc - i->LastSeen,
|
&i->ifinfo.ip, CountMaskBits(&i->ifinfo.mask), utc - i->LastSeen,
|
||||||
@ -5818,6 +5853,7 @@ mDNSlocal void SetupDDNSDomains(domainname *const fqdn, DNameListElem **RegDomai
|
|||||||
}
|
}
|
||||||
CFRelease(ddnsdict);
|
CFRelease(ddnsdict);
|
||||||
}
|
}
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
if (RegDomains)
|
if (RegDomains)
|
||||||
{
|
{
|
||||||
CFDictionaryRef btmm = SCDynamicStoreCopyValue(NULL, NetworkChangedKey_BackToMyMac);
|
CFDictionaryRef btmm = SCDynamicStoreCopyValue(NULL, NetworkChangedKey_BackToMyMac);
|
||||||
@ -5847,7 +5883,7 @@ mDNSlocal void SetupDDNSDomains(domainname *const fqdn, DNameListElem **RegDomai
|
|||||||
CFRelease(btmm);
|
CFRelease(btmm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns mDNSfalse, if it does not set the configuration i.e., if the DNS configuration did not change
|
// Returns mDNSfalse, if it does not set the configuration i.e., if the DNS configuration did not change
|
||||||
@ -6141,7 +6177,7 @@ mDNSexport void mDNSPlatformDynDNSHostNameStatusChanged(const domainname *const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if APPLE_OSX_mDNSResponder
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
#if !NO_AWACS
|
#if !NO_AWACS
|
||||||
|
|
||||||
// checks whether a domain is present in Setup:/Network/BackToMyMac. Just because there is a key in the
|
// checks whether a domain is present in Setup:/Network/BackToMyMac. Just because there is a key in the
|
||||||
@ -6283,7 +6319,7 @@ mDNSlocal void UpdateBTMMRelayConnection(mDNS *const m)
|
|||||||
else LogInfo("UpdateBTMMRelayConnection: Not calling AWS_Disconnect");
|
else LogInfo("UpdateBTMMRelayConnection: Not calling AWS_Disconnect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif !TARGET_OS_EMBEDDED
|
#else
|
||||||
mDNSlocal void UpdateBTMMRelayConnection(mDNS *const m)
|
mDNSlocal void UpdateBTMMRelayConnection(mDNS *const m)
|
||||||
{
|
{
|
||||||
(void) m; // Unused
|
(void) m; // Unused
|
||||||
@ -6291,11 +6327,9 @@ mDNSlocal void UpdateBTMMRelayConnection(mDNS *const m)
|
|||||||
}
|
}
|
||||||
#endif // ! NO_AWACS
|
#endif // ! NO_AWACS
|
||||||
|
|
||||||
#if !TARGET_OS_EMBEDDED
|
|
||||||
mDNSlocal void ProcessConndConfigChanges(void);
|
mDNSlocal void ProcessConndConfigChanges(void);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // APPLE_OSX_mDNSResponder
|
#endif // MDNSRESPONDER_BTMM_SUPPORT
|
||||||
|
|
||||||
// MUST be called holding the lock
|
// MUST be called holding the lock
|
||||||
mDNSlocal void SetDomainSecrets_internal(mDNS *m)
|
mDNSlocal void SetDomainSecrets_internal(mDNS *m)
|
||||||
@ -6369,11 +6403,13 @@ mDNSlocal void SetDomainSecrets_internal(mDNS *m)
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
if (!strncmp(stringbuf, dnsprefix, strlen(dnsprefix)))
|
if (!strncmp(stringbuf, dnsprefix, strlen(dnsprefix)))
|
||||||
offset = strlen(dnsprefix);
|
offset = strlen(dnsprefix);
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
else if (!strncmp(stringbuf, btmmprefix, strlen(btmmprefix)))
|
else if (!strncmp(stringbuf, btmmprefix, strlen(btmmprefix)))
|
||||||
{
|
{
|
||||||
AutoTunnel = mDNStrue;
|
AutoTunnel = mDNStrue;
|
||||||
offset = strlen(btmmprefix);
|
offset = strlen(btmmprefix);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
domainname domain;
|
domainname domain;
|
||||||
if (!MakeDomainNameFromDNSNameString(&domain, stringbuf + offset)) { LogMsg("SetDomainSecrets: bad key domain %s", stringbuf); continue; }
|
if (!MakeDomainNameFromDNSNameString(&domain, stringbuf + offset)) { LogMsg("SetDomainSecrets: bad key domain %s", stringbuf); continue; }
|
||||||
|
|
||||||
@ -6555,7 +6591,9 @@ mDNSlocal void SetDomainSecrets_internal(mDNS *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateAnonymousRacoonConfig(m); // Determine whether we need racoon to accept incoming connections
|
UpdateAnonymousRacoonConfig(m); // Determine whether we need racoon to accept incoming connections
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
ProcessConndConfigChanges(); // Update AutoTunnelInnerAddress values and default ipsec policies as necessary
|
ProcessConndConfigChanges(); // Update AutoTunnelInnerAddress values and default ipsec policies as necessary
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // APPLE_OSX_mDNSResponder
|
#endif // APPLE_OSX_mDNSResponder
|
||||||
|
|
||||||
@ -7236,8 +7274,9 @@ mDNSexport void RemoveAutoTunnel6Record(mDNS *const m)
|
|||||||
if (info->AutoTunnel)
|
if (info->AutoTunnel)
|
||||||
UpdateAutoTunnel6Record(m, info);
|
UpdateAutoTunnel6Record(m, info);
|
||||||
}
|
}
|
||||||
|
#endif /* APPLE_OSX_mDNSResponder */
|
||||||
|
|
||||||
#if !TARGET_OS_EMBEDDED
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
mDNSlocal mDNSBool IPv6AddressIsOnInterface(mDNSv6Addr ipv6Addr, char *ifname)
|
mDNSlocal mDNSBool IPv6AddressIsOnInterface(mDNSv6Addr ipv6Addr, char *ifname)
|
||||||
{
|
{
|
||||||
struct ifaddrs *ifa;
|
struct ifaddrs *ifa;
|
||||||
@ -7474,8 +7513,7 @@ mDNSlocal void ProcessConndConfigChanges(void)
|
|||||||
// If awacsd crashes or exits for some reason, restart it
|
// If awacsd crashes or exits for some reason, restart it
|
||||||
UpdateBTMMRelayConnection(m);
|
UpdateBTMMRelayConnection(m);
|
||||||
}
|
}
|
||||||
#endif // !TARGET_OS_EMBEDDED
|
#endif // MDNSRESPONDER_BTMM_SUPPORT
|
||||||
#endif /* APPLE_OSX_mDNSResponder */
|
|
||||||
|
|
||||||
mDNSlocal mDNSBool IsAppleNetwork(mDNS *const m)
|
mDNSlocal mDNSBool IsAppleNetwork(mDNS *const m)
|
||||||
{
|
{
|
||||||
@ -7580,9 +7618,11 @@ mDNSexport void mDNSMacOSXNetworkChanged(void)
|
|||||||
|
|
||||||
#if APPLE_OSX_mDNSResponder
|
#if APPLE_OSX_mDNSResponder
|
||||||
#if !TARGET_OS_EMBEDDED
|
#if !TARGET_OS_EMBEDDED
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
mDNS_Lock(m);
|
mDNS_Lock(m);
|
||||||
ProcessConndConfigChanges();
|
ProcessConndConfigChanges();
|
||||||
mDNS_Unlock(m);
|
mDNS_Unlock(m);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Scan to find client tunnels whose questions have completed,
|
// Scan to find client tunnels whose questions have completed,
|
||||||
// but whose local inner/outer addresses have changed since the tunnel was set up
|
// but whose local inner/outer addresses have changed since the tunnel was set up
|
||||||
@ -7806,14 +7846,18 @@ mDNSlocal void NetworkChanged(SCDynamicStoreRef store, CFArrayRef changedKeys, v
|
|||||||
//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
|
const mDNSs32 delay = (mDNSPlatformOneSecond + 39) / 40; // 25 ms delay
|
||||||
|
|
||||||
int c = CFArrayGetCount(changedKeys); // Count changes
|
const int c = CFArrayGetCount(changedKeys); // Count changes
|
||||||
CFRange range = { 0, c };
|
CFRange range = { 0, c };
|
||||||
int c_host = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Hostnames ) != 0);
|
const int c_host = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Hostnames ) != 0);
|
||||||
int c_comp = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Computername) != 0);
|
const int c_comp = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Computername) != 0);
|
||||||
int c_udns = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DNS ) != 0);
|
const int c_udns = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DNS ) != 0);
|
||||||
int c_ddns = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DynamicDNS ) != 0);
|
const int c_ddns = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DynamicDNS ) != 0);
|
||||||
int c_btmm = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_BackToMyMac ) != 0);
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
int c_v4ll = ChangedKeysHaveIPv4LL(changedKeys);
|
const int c_btmm = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_BackToMyMac ) != 0);
|
||||||
|
#else
|
||||||
|
const int c_btmm = 0;
|
||||||
|
#endif
|
||||||
|
const int c_v4ll = ChangedKeysHaveIPv4LL(changedKeys);
|
||||||
int c_fast = 0;
|
int c_fast = 0;
|
||||||
|
|
||||||
// Do immediate network changed processing for "p2p*" interfaces and
|
// Do immediate network changed processing for "p2p*" interfaces and
|
||||||
@ -7971,9 +8015,11 @@ mDNSlocal mStatus WatchForNetworkChanges(mDNS *const m)
|
|||||||
CFArrayAppendValue(keys, NetworkChangedKey_Computername);
|
CFArrayAppendValue(keys, NetworkChangedKey_Computername);
|
||||||
CFArrayAppendValue(keys, NetworkChangedKey_DNS);
|
CFArrayAppendValue(keys, NetworkChangedKey_DNS);
|
||||||
CFArrayAppendValue(keys, NetworkChangedKey_DynamicDNS);
|
CFArrayAppendValue(keys, NetworkChangedKey_DynamicDNS);
|
||||||
CFArrayAppendValue(keys, NetworkChangedKey_BackToMyMac);
|
|
||||||
CFArrayAppendValue(keys, NetworkChangedKey_PowerSettings);
|
CFArrayAppendValue(keys, NetworkChangedKey_PowerSettings);
|
||||||
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
|
CFArrayAppendValue(keys, NetworkChangedKey_BackToMyMac);
|
||||||
CFArrayAppendValue(keys, NetworkChangedKey_BTMMConnectivity);
|
CFArrayAppendValue(keys, NetworkChangedKey_BTMMConnectivity);
|
||||||
|
#endif
|
||||||
CFArrayAppendValue(patterns, pattern1);
|
CFArrayAppendValue(patterns, pattern1);
|
||||||
CFArrayAppendValue(patterns, pattern2);
|
CFArrayAppendValue(patterns, pattern2);
|
||||||
CFArrayAppendValue(patterns, CFSTR("State:/Network/Interface/[^/]+/AirPort"));
|
CFArrayAppendValue(patterns, CFSTR("State:/Network/Interface/[^/]+/AirPort"));
|
||||||
@ -8177,13 +8223,9 @@ mDNSlocal void removeCachedPeerRecords(mDNSu32 ifindex, mDNSAddr *ap, bool purge
|
|||||||
// Handle KEV_DL_NODE_PRESENCE event.
|
// Handle KEV_DL_NODE_PRESENCE event.
|
||||||
mDNSlocal void nodePresence(struct kev_dl_node_presence * p)
|
mDNSlocal void nodePresence(struct kev_dl_node_presence * p)
|
||||||
{
|
{
|
||||||
char buf[INET6_ADDRSTRLEN];
|
|
||||||
struct opaque_presence_indication *op = (struct opaque_presence_indication *) p->node_service_info;
|
struct opaque_presence_indication *op = (struct opaque_presence_indication *) p->node_service_info;
|
||||||
|
|
||||||
if (inet_ntop(AF_INET6, & p->sin6_node_address.sin6_addr, buf, sizeof(buf)))
|
LogInfo("nodePresence: IPv6 address: %.16a, SUI %d", p->sin6_node_address.sin6_addr.s6_addr, op->SUI);
|
||||||
LogInfo("nodePresence: IPv6 address: %s, SUI %d", buf, op->SUI);
|
|
||||||
else
|
|
||||||
LogInfo("nodePresence: inet_ntop() error");
|
|
||||||
|
|
||||||
// AWDL will generate a KEV_DL_NODE_PRESENCE event with SSTH field of
|
// AWDL will generate a KEV_DL_NODE_PRESENCE event with SSTH field of
|
||||||
// all zeroes when a node is present and has no services registered.
|
// all zeroes when a node is present and has no services registered.
|
||||||
@ -8203,17 +8245,11 @@ mDNSlocal void nodePresence(struct kev_dl_node_presence * p)
|
|||||||
mDNSlocal void nodeAbsence(struct kev_dl_node_absence * p)
|
mDNSlocal void nodeAbsence(struct kev_dl_node_absence * p)
|
||||||
{
|
{
|
||||||
mDNSAddr peerAddr;
|
mDNSAddr peerAddr;
|
||||||
char buf[INET6_ADDRSTRLEN];
|
|
||||||
|
|
||||||
if (inet_ntop(AF_INET6, & p->sin6_node_address.sin6_addr, buf, sizeof(buf)))
|
|
||||||
LogInfo("nodeAbsence: IPv6 address: %s", buf);
|
|
||||||
else
|
|
||||||
LogInfo("nodeAbsence: inet_ntop() error");
|
|
||||||
|
|
||||||
peerAddr.type = mDNSAddrType_IPv6;
|
peerAddr.type = mDNSAddrType_IPv6;
|
||||||
peerAddr.ip.v6 = *(mDNSv6Addr*)&p->sin6_node_address.sin6_addr;
|
peerAddr.ip.v6 = *(mDNSv6Addr*)&p->sin6_node_address.sin6_addr;
|
||||||
|
|
||||||
LogInfo("nodeAbsence: immediately purge cached records from this peer");
|
LogInfo("nodeAbsence: immediately purge cached records from %.16a", p->sin6_node_address.sin6_addr.s6_addr);
|
||||||
removeCachedPeerRecords(p->sdl_node_address.sdl_index, & peerAddr, true);
|
removeCachedPeerRecords(p->sdl_node_address.sdl_index, & peerAddr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8367,8 +8403,13 @@ mDNSlocal OSStatus KeychainChanged(SecKeychainEvent keychainEvent, SecKeychainCa
|
|||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
relevant = ((a->attr[0].length == 4 && (!strncasecmp(a->attr[0].data, "ddns", 4) || !strncasecmp(a->attr[0].data, "sndd", 4))) ||
|
relevant = ((a->attr[0].length == 4 && (!strncasecmp(a->attr[0].data, "ddns", 4) || !strncasecmp(a->attr[0].data, "sndd", 4))) ||
|
||||||
(a->attr[1].length >= mDNSPlatformStrLen(dnsprefix) && (!strncasecmp(a->attr[1].data, dnsprefix, mDNSPlatformStrLen(dnsprefix)))) ||
|
(a->attr[1].length >= mDNSPlatformStrLen(dnsprefix) && (!strncasecmp(a->attr[1].data, dnsprefix, mDNSPlatformStrLen(dnsprefix)))));
|
||||||
(a->attr[1].length >= mDNSPlatformStrLen(btmmprefix) && (!strncasecmp(a->attr[1].data, btmmprefix, mDNSPlatformStrLen(btmmprefix)))));
|
#if MDNSRESPONDER_BTMM_SUPPORT
|
||||||
|
if (!relevant && (a->attr[1].length >= mDNSPlatformStrLen(btmmprefix)) && !strncasecmp(a->attr[1].data, btmmprefix, mDNSPlatformStrLen(btmmprefix)))
|
||||||
|
{
|
||||||
|
relevant = mDNStrue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
SecKeychainItemFreeAttributesAndData(a, NULL);
|
SecKeychainItemFreeAttributesAndData(a, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9419,36 +9460,13 @@ mDNSlocal void CreatePTRRecord(const domainname *domain)
|
|||||||
// intentionally to avoid adding to the complexity of code handling /etc/hosts.
|
// intentionally to avoid adding to the complexity of code handling /etc/hosts.
|
||||||
mDNSlocal void SetupLocalHostRecords(void)
|
mDNSlocal void SetupLocalHostRecords(void)
|
||||||
{
|
{
|
||||||
char buffer[MAX_REVERSE_MAPPING_NAME];
|
|
||||||
domainname name;
|
domainname name;
|
||||||
int i;
|
|
||||||
struct in6_addr addr;
|
|
||||||
mDNSu8 *ptr = addr.__u6_addr.__u6_addr8;
|
|
||||||
|
|
||||||
if (inet_pton(AF_INET, "127.0.0.1", &addr) == 1)
|
MakeDomainNameFromDNSNameString(&name, "1.0.0.127.in-addr.arpa.");
|
||||||
{
|
|
||||||
mDNS_snprintf(buffer, sizeof(buffer), "%d.%d.%d.%d.in-addr.arpa.",
|
|
||||||
ptr[3], ptr[2], ptr[1], ptr[0]);
|
|
||||||
MakeDomainNameFromDNSNameString(&name, buffer);
|
|
||||||
CreatePTRRecord(&name);
|
CreatePTRRecord(&name);
|
||||||
}
|
|
||||||
else LogMsg("SetupLocalHostRecords: ERROR!! inet_pton AF_INET failed");
|
|
||||||
|
|
||||||
if (inet_pton(AF_INET6, "::1", &addr) == 1)
|
MakeDomainNameFromDNSNameString(&name, "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.");
|
||||||
{
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
static const char hexValues[] = "0123456789ABCDEF";
|
|
||||||
buffer[i * 4 ] = hexValues[ptr[15 - i] & 0x0F];
|
|
||||||
buffer[i * 4 + 1] = '.';
|
|
||||||
buffer[i * 4 + 2] = hexValues[ptr[15 - i] >> 4];
|
|
||||||
buffer[i * 4 + 3] = '.';
|
|
||||||
}
|
|
||||||
mDNS_snprintf(&buffer[64], sizeof(buffer)-64, "ip6.arpa.");
|
|
||||||
MakeDomainNameFromDNSNameString(&name, buffer);
|
|
||||||
CreatePTRRecord(&name);
|
CreatePTRRecord(&name);
|
||||||
}
|
|
||||||
else LogMsg("SetupLocalHostRecords: ERROR!! inet_pton AF_INET6 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if APPLE_OSX_mDNSResponder // Don't compile for dnsextd target
|
#if APPLE_OSX_mDNSResponder // Don't compile for dnsextd target
|
||||||
@ -9465,6 +9483,56 @@ mDNSlocal void setSameDomainLabelPointer(void);
|
|||||||
// 6) client calls to enumerate domains now go over LocalOnly interface
|
// 6) client calls to enumerate domains now go over LocalOnly interface
|
||||||
// (!!!KRS may add outgoing interface in addition)
|
// (!!!KRS may add outgoing interface in addition)
|
||||||
|
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
mDNSlocal mDNSBool IsAppleInternalBuild(void)
|
||||||
|
{
|
||||||
|
return (os_variant_has_internal_diagnostics("com.apple.mDNSResponder") ? mDNStrue : mDNSfalse);
|
||||||
|
}
|
||||||
|
|
||||||
|
mDNSlocal mStatus RegisterLocalOnlyAddressRecord(const domainname *const name, mDNSu16 type, const void *rdata, mDNSu16 rdlength)
|
||||||
|
{
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case kDNSType_A:
|
||||||
|
if (rdlength != 4) return (mStatus_BadParamErr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kDNSType_AAAA:
|
||||||
|
if (rdlength != 16) return (mStatus_BadParamErr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return (mStatus_BadParamErr);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthRecord *rr = mallocL("etchosts", sizeof(*rr));
|
||||||
|
if (!rr) return (mStatus_NoMemoryErr);
|
||||||
|
mDNSPlatformMemZero(rr, sizeof(*rr));
|
||||||
|
|
||||||
|
mDNS_SetupResourceRecord(rr, NULL, mDNSInterface_LocalOnly, type, 1, kDNSRecordTypeKnownUnique, AuthRecordLocalOnly, FreeEtcHosts, NULL);
|
||||||
|
AssignDomainName(&rr->namestorage, name);
|
||||||
|
mDNSPlatformMemCopy(rr->resrec.rdata->u.data, rdata, rdlength);
|
||||||
|
|
||||||
|
const mStatus err = mDNS_Register_internal(&mDNSStorage, rr);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
LogMsg("RegisterLocalOnlyAddressRecord: mDNS_Register error %d registering %s", err, ARDisplayString(&mDNSStorage, rr));
|
||||||
|
freeL("etchosts", rr);
|
||||||
|
}
|
||||||
|
return (err);
|
||||||
|
}
|
||||||
|
|
||||||
|
mDNSlocal void RegisterLocalOnlyARecord(const domainname *const name, const mDNSv4Addr *const addr)
|
||||||
|
{
|
||||||
|
RegisterLocalOnlyAddressRecord(name, kDNSType_A, addr->b, (mDNSu16)sizeof(mDNSv4Addr));
|
||||||
|
}
|
||||||
|
|
||||||
|
mDNSlocal void RegisterLocalOnlyAAAARecord(const domainname *const name, const mDNSv6Addr *const addr)
|
||||||
|
{
|
||||||
|
RegisterLocalOnlyAddressRecord(name, kDNSType_AAAA, addr->b, (mDNSu16)sizeof(mDNSv6Addr));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
|
mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
|
||||||
{
|
{
|
||||||
mStatus err;
|
mStatus err;
|
||||||
@ -9694,7 +9762,41 @@ mDNSlocal mStatus mDNSPlatformInit_setup(mDNS *const m)
|
|||||||
#endif
|
#endif
|
||||||
if (SSLqueue == mDNSNULL) LogMsg("dispatch_queue_create: SSL queue NULL");
|
if (SSLqueue == mDNSNULL) LogMsg("dispatch_queue_create: SSL queue NULL");
|
||||||
|
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
// On device OSes (iOS, tvOS, watchOS, etc.), ignore /etc/hosts unless the OS is an internal build. When the /etc/hosts
|
||||||
|
// file is ignored, LocalOnly auth records will be registered for localhost and broadcasthost addresses contained in the
|
||||||
|
// standard /etc/hosts file:
|
||||||
|
//
|
||||||
|
// 127.0.0.1 localhost
|
||||||
|
// 255.255.255.255 broadcasthost
|
||||||
|
// ::1 localhost
|
||||||
|
|
||||||
|
if (!IsAppleInternalBuild())
|
||||||
|
{
|
||||||
|
const domainname *const localHostName = (const domainname *) "\x9" "localhost";
|
||||||
|
const domainname *const broadcastHostName = (const domainname *) "\xd" "broadcasthost";
|
||||||
|
const mDNSv4Addr localHostV4 = { { 127, 0, 0, 1 } };
|
||||||
|
mDNSv6Addr localHostV6;
|
||||||
|
|
||||||
|
// Register localhost 127.0.0.1 A record.
|
||||||
|
|
||||||
|
RegisterLocalOnlyARecord(localHostName, &localHostV4);
|
||||||
|
|
||||||
|
// Register broadcasthost 255.255.255.255 A record.
|
||||||
|
|
||||||
|
RegisterLocalOnlyARecord(broadcastHostName, &onesIPv4Addr);
|
||||||
|
|
||||||
|
// Register localhost ::1 AAAA record.
|
||||||
|
|
||||||
|
mDNSPlatformMemZero(&localHostV6, sizeof(localHostV6));
|
||||||
|
localHostV6.b[15] = 1;
|
||||||
|
RegisterLocalOnlyAAAARecord(localHostName, &localHostV6);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
mDNSMacOSXUpdateEtcHosts(m);
|
mDNSMacOSXUpdateEtcHosts(m);
|
||||||
|
}
|
||||||
SetupLocalHostRecords();
|
SetupLocalHostRecords();
|
||||||
|
|
||||||
return(mStatus_NoError);
|
return(mStatus_NoError);
|
||||||
|
@ -153,6 +153,7 @@ struct NetworkInterfaceInfoOSX_struct
|
|||||||
int BPF_mcfd; // Socket for our IPv6 ND group membership
|
int BPF_mcfd; // Socket for our IPv6 ND group membership
|
||||||
u_int BPF_len;
|
u_int BPF_len;
|
||||||
mDNSBool isExpensive; // True if this interface has the IFEF_EXPENSIVE flag set.
|
mDNSBool isExpensive; // True if this interface has the IFEF_EXPENSIVE flag set.
|
||||||
|
mDNSBool isAWDL; // True if this interface has the IFEF_AWDL flag set.
|
||||||
#ifdef MDNSRESPONDER_USES_LIB_DISPATCH_AS_PRIMARY_EVENT_LOOP_MECHANISM
|
#ifdef MDNSRESPONDER_USES_LIB_DISPATCH_AS_PRIMARY_EVENT_LOOP_MECHANISM
|
||||||
dispatch_source_t BPF_source;
|
dispatch_source_t BPF_source;
|
||||||
#else
|
#else
|
||||||
@ -272,7 +273,7 @@ struct CompileTimeAssertionChecks_mDNSMacOSX
|
|||||||
// Check our structures are reasonable sizes. Including overly-large buffers, or embedding
|
// Check our structures are reasonable sizes. Including overly-large buffers, or embedding
|
||||||
// other overly-large structures instead of having a pointer to them, can inadvertently
|
// other overly-large structures instead of having a pointer to them, can inadvertently
|
||||||
// cause structure sizes (and therefore memory usage) to balloon unreasonably.
|
// cause structure sizes (and therefore memory usage) to balloon unreasonably.
|
||||||
char sizecheck_NetworkInterfaceInfoOSX[(sizeof(NetworkInterfaceInfoOSX) <= 7464) ? 1 : -1];
|
char sizecheck_NetworkInterfaceInfoOSX[(sizeof(NetworkInterfaceInfoOSX) <= 8488) ? 1 : -1];
|
||||||
char sizecheck_mDNS_PlatformSupport [(sizeof(mDNS_PlatformSupport) <= 1378) ? 1 : -1];
|
char sizecheck_mDNS_PlatformSupport [(sizeof(mDNS_PlatformSupport) <= 1378) ? 1 : -1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
; -*- Mode: Scheme; tab-width: 4 -*-
|
; -*- Mode: Scheme; tab-width: 4 -*-
|
||||||
;
|
;
|
||||||
; Copyright (c) 2012-2015 Apple Inc. All rights reserved.
|
; Copyright (c) 2012-2018 Apple Inc. All rights reserved.
|
||||||
;
|
;
|
||||||
; Redistribution and use in source and binary forms, with or without
|
; Redistribution and use in source and binary forms, with or without
|
||||||
; modification, are permitted provided that the following conditions are met:
|
; modification, are permitted provided that the following conditions are met:
|
||||||
@ -128,7 +128,7 @@
|
|||||||
(literal "/private/var/preferences/SystemConfiguration/preferences.plist")
|
(literal "/private/var/preferences/SystemConfiguration/preferences.plist")
|
||||||
(subpath "/System/Library/Preferences/Logging")
|
(subpath "/System/Library/Preferences/Logging")
|
||||||
(subpath "/AppleInternal/Library/Preferences/Logging")
|
(subpath "/AppleInternal/Library/Preferences/Logging")
|
||||||
(subpath "/private/var/preferences/Logging/Subsystems")
|
(subpath "/private/var/preferences/Logging")
|
||||||
(subpath "/private/var/db/timezone")
|
(subpath "/private/var/db/timezone")
|
||||||
(subpath "/Library/Preferences/Logging"))
|
(subpath "/Library/Preferences/Logging"))
|
||||||
|
|
||||||
|
@ -271,8 +271,9 @@
|
|||||||
4AAE0C9A0C68EA81003882A5 /* mDNSResponderHelper.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4AAE0C7A0C68E97F003882A5 /* mDNSResponderHelper.8 */; };
|
4AAE0C9A0C68EA81003882A5 /* mDNSResponderHelper.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4AAE0C7A0C68E97F003882A5 /* mDNSResponderHelper.8 */; };
|
||||||
4BD2B63A134FE09F002B96D5 /* P2PPacketFilter.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD2B638134FE09F002B96D5 /* P2PPacketFilter.c */; };
|
4BD2B63A134FE09F002B96D5 /* P2PPacketFilter.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BD2B638134FE09F002B96D5 /* P2PPacketFilter.c */; };
|
||||||
4BD2B63B134FE09F002B96D5 /* P2PPacketFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD2B639134FE09F002B96D5 /* P2PPacketFilter.h */; };
|
4BD2B63B134FE09F002B96D5 /* P2PPacketFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD2B639134FE09F002B96D5 /* P2PPacketFilter.h */; };
|
||||||
729DF4601CD40630005ECF70 /* com.apple.mDNSResponder.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 729DF45F1CD40630005ECF70 /* com.apple.mDNSResponder.plist */; };
|
|
||||||
72FB5467166D5FCA0090B2D9 /* dnsctl.c in Sources */ = {isa = PBXBuildFile; fileRef = 72FB545A166D5F960090B2D9 /* dnsctl.c */; };
|
72FB5467166D5FCA0090B2D9 /* dnsctl.c in Sources */ = {isa = PBXBuildFile; fileRef = 72FB545A166D5F960090B2D9 /* dnsctl.c */; };
|
||||||
|
789036921F7AC1FA0077A962 /* libnetwork.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 789036911F7AC1F90077A962 /* libnetwork.tbd */; };
|
||||||
|
789036931F7AC2050077A962 /* libnetwork.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 789036911F7AC1F90077A962 /* libnetwork.tbd */; };
|
||||||
8415A6571897109000BDBA26 /* libdns_services.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8415A6561897109000BDBA26 /* libdns_services.dylib */; };
|
8415A6571897109000BDBA26 /* libdns_services.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8415A6561897109000BDBA26 /* libdns_services.dylib */; };
|
||||||
8417375C1B967D37000CD5C2 /* dnsctl_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 8417375A1B967CBE000CD5C2 /* dnsctl_server.c */; };
|
8417375C1B967D37000CD5C2 /* dnsctl_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 8417375A1B967CBE000CD5C2 /* dnsctl_server.c */; };
|
||||||
848DA5C7165477E000D2E8B4 /* xpc_services.c in Sources */ = {isa = PBXBuildFile; fileRef = 848DA5C6165477E000D2E8B4 /* xpc_services.c */; };
|
848DA5C7165477E000D2E8B4 /* xpc_services.c in Sources */ = {isa = PBXBuildFile; fileRef = 848DA5C6165477E000D2E8B4 /* xpc_services.c */; };
|
||||||
@ -324,8 +325,14 @@
|
|||||||
B7E06B0D1DBA9DFE00E4580C /* ClientCommon.c in Sources */ = {isa = PBXBuildFile; fileRef = FF5852100DD27BD300862BDF /* ClientCommon.c */; };
|
B7E06B0D1DBA9DFE00E4580C /* ClientCommon.c in Sources */ = {isa = PBXBuildFile; fileRef = FF5852100DD27BD300862BDF /* ClientCommon.c */; };
|
||||||
B7E06B0E1DBA9E9700E4580C /* DomainBrowser.strings in Resources */ = {isa = PBXBuildFile; fileRef = B7016F4F1D5D0D1900107E7C /* DomainBrowser.strings */; };
|
B7E06B0E1DBA9E9700E4580C /* DomainBrowser.strings in Resources */ = {isa = PBXBuildFile; fileRef = B7016F4F1D5D0D1900107E7C /* DomainBrowser.strings */; };
|
||||||
BD03E88D1AD31278005E8A81 /* SymptomReporter.c in Sources */ = {isa = PBXBuildFile; fileRef = BD03E88C1AD31278005E8A81 /* SymptomReporter.c */; };
|
BD03E88D1AD31278005E8A81 /* SymptomReporter.c in Sources */ = {isa = PBXBuildFile; fileRef = BD03E88C1AD31278005E8A81 /* SymptomReporter.c */; };
|
||||||
|
BD28AE8F207B892D00F0B257 /* bonjour-mcast-diagnose in Copy diagnose scripts */ = {isa = PBXBuildFile; fileRef = BD28AE8E207B88F600F0B257 /* bonjour-mcast-diagnose */; };
|
||||||
|
BD41B27D203EBE6100A53629 /* dns_sd.h in Headers */ = {isa = PBXBuildFile; fileRef = FFA572630AF190C20055A0F1 /* dns_sd.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
BD41F9C4209B60AC0077F8B6 /* libpcap.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = BD41F9C3209B60AC0077F8B6 /* libpcap.tbd */; };
|
||||||
BD691B2A1ED2F47100E6F317 /* DNS64.c in Sources */ = {isa = PBXBuildFile; fileRef = BD691B281ED2F43200E6F317 /* DNS64.c */; };
|
BD691B2A1ED2F47100E6F317 /* DNS64.c in Sources */ = {isa = PBXBuildFile; fileRef = BD691B281ED2F43200E6F317 /* DNS64.c */; };
|
||||||
BD691B2B1ED2F4AB00E6F317 /* DNS64.h in Headers */ = {isa = PBXBuildFile; fileRef = BD691B291ED2F43200E6F317 /* DNS64.h */; };
|
BD691B2B1ED2F4AB00E6F317 /* DNS64.h in Headers */ = {isa = PBXBuildFile; fileRef = BD691B291ED2F43200E6F317 /* DNS64.h */; };
|
||||||
|
BD75E940206ADEF400656ED3 /* com.apple.mDNSResponder.plist in Copy AppleInternal Logging Profile */ = {isa = PBXBuildFile; fileRef = BDB61846206ADDDF00AFF600 /* com.apple.mDNSResponder.plist */; };
|
||||||
|
BD893CE5206C0D980055F9E7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BD893CE4206C0D980055F9E7 /* SystemConfiguration.framework */; };
|
||||||
|
BD893CE7206C0EAF0055F9E7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BD893CE6206C0EAF0055F9E7 /* CoreFoundation.framework */; };
|
||||||
BD9BA7551EAF91FB00658CCF /* dnssdutil.c in Sources */ = {isa = PBXBuildFile; fileRef = BD9BA7541EAF91E700658CCF /* dnssdutil.c */; };
|
BD9BA7551EAF91FB00658CCF /* dnssdutil.c in Sources */ = {isa = PBXBuildFile; fileRef = BD9BA7541EAF91E700658CCF /* dnssdutil.c */; };
|
||||||
BD9BA7581EAF929C00658CCF /* CoreUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BD9BA7571EAF929C00658CCF /* CoreUtils.framework */; };
|
BD9BA7581EAF929C00658CCF /* CoreUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BD9BA7571EAF929C00658CCF /* CoreUtils.framework */; };
|
||||||
BDA3F08A1C48DB920054FB4B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BDA3F0891C48DB910054FB4B /* Foundation.framework */; };
|
BDA3F08A1C48DB920054FB4B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BDA3F0891C48DB910054FB4B /* Foundation.framework */; };
|
||||||
@ -333,6 +340,12 @@
|
|||||||
BDA3F08F1C48DCA50054FB4B /* Metrics.m in Sources */ = {isa = PBXBuildFile; fileRef = BDA3F0881C48DB6D0054FB4B /* Metrics.m */; };
|
BDA3F08F1C48DCA50054FB4B /* Metrics.m in Sources */ = {isa = PBXBuildFile; fileRef = BDA3F0881C48DB6D0054FB4B /* Metrics.m */; };
|
||||||
BDA9A7881B3A924C00523835 /* dns_sd_private.h in Headers */ = {isa = PBXBuildFile; fileRef = BDA9A7871B3A923600523835 /* dns_sd_private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
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, ); }; };
|
BDA9A7891B3A92A500523835 /* dns_sd_private.h in Headers */ = {isa = PBXBuildFile; fileRef = BDA9A7871B3A923600523835 /* dns_sd_private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||||
|
BDAF4BC020B52D3D0062219E /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BDAF4BBF20B52D3D0062219E /* CFNetwork.framework */; };
|
||||||
|
BDB04221203FEF4C00419961 /* dns_sd.h in Headers */ = {isa = PBXBuildFile; fileRef = FFA572630AF190C20055A0F1 /* dns_sd.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
BDB04222203FEF4D00419961 /* dns_sd.h in Headers */ = {isa = PBXBuildFile; fileRef = FFA572630AF190C20055A0F1 /* dns_sd.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
BDB04223203FF18000419961 /* dns_sd_private.h in Headers */ = {isa = PBXBuildFile; fileRef = BDA9A7871B3A923600523835 /* dns_sd_private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||||
|
BDB04224203FF18000419961 /* dns_sd_private.h in Headers */ = {isa = PBXBuildFile; fileRef = BDA9A7871B3A923600523835 /* dns_sd_private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||||
|
BDB61845206ADB9D00AFF600 /* com.apple.mDNSResponder.plist in Copy Base Logging Profile */ = {isa = PBXBuildFile; fileRef = BDB61843206ADB7700AFF600 /* com.apple.mDNSResponder.plist */; };
|
||||||
BDBF9B941ED74B9C001498A8 /* DNS64State.h in Headers */ = {isa = PBXBuildFile; fileRef = BDBF9B931ED74B8C001498A8 /* DNS64State.h */; };
|
BDBF9B941ED74B9C001498A8 /* DNS64State.h in Headers */ = {isa = PBXBuildFile; fileRef = BDBF9B931ED74B8C001498A8 /* DNS64State.h */; };
|
||||||
D284BE540ADD80740027CCDF /* dnssd_ipc.h in Headers */ = {isa = PBXBuildFile; fileRef = F5E11B5B04A28126019798ED /* dnssd_ipc.h */; };
|
D284BE540ADD80740027CCDF /* dnssd_ipc.h in Headers */ = {isa = PBXBuildFile; fileRef = F5E11B5B04A28126019798ED /* dnssd_ipc.h */; };
|
||||||
D284BE580ADD80740027CCDF /* mDNS.c in Sources */ = {isa = PBXBuildFile; fileRef = 6575FBE9022EAF5A00000109 /* mDNS.c */; };
|
D284BE580ADD80740027CCDF /* mDNS.c in Sources */ = {isa = PBXBuildFile; fileRef = 6575FBE9022EAF5A00000109 /* mDNS.c */; };
|
||||||
@ -717,14 +730,15 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
8418673D15AB8BFF00BB7F70 /* CopyFiles */ = {
|
8418673D15AB8BFF00BB7F70 /* Copy Base Logging Profile */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 8;
|
buildActionMask = 8;
|
||||||
dstPath = /System/Library/Preferences/Logging/Subsystems;
|
dstPath = /System/Library/Preferences/Logging/Subsystems;
|
||||||
dstSubfolderSpec = 0;
|
dstSubfolderSpec = 0;
|
||||||
files = (
|
files = (
|
||||||
729DF4601CD40630005ECF70 /* com.apple.mDNSResponder.plist in CopyFiles */,
|
BDB61845206ADB9D00AFF600 /* com.apple.mDNSResponder.plist in Copy Base Logging Profile */,
|
||||||
);
|
);
|
||||||
|
name = "Copy Base Logging Profile";
|
||||||
runOnlyForDeploymentPostprocessing = 1;
|
runOnlyForDeploymentPostprocessing = 1;
|
||||||
};
|
};
|
||||||
B7D566C61E81D9B600E43008 /* CopyFiles */ = {
|
B7D566C61E81D9B600E43008 /* CopyFiles */ = {
|
||||||
@ -738,6 +752,28 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
BD28AE8C207B888E00F0B257 /* Copy diagnose scripts */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 8;
|
||||||
|
dstPath = /usr/local/bin;
|
||||||
|
dstSubfolderSpec = 0;
|
||||||
|
files = (
|
||||||
|
BD28AE8F207B892D00F0B257 /* bonjour-mcast-diagnose in Copy diagnose scripts */,
|
||||||
|
);
|
||||||
|
name = "Copy diagnose scripts";
|
||||||
|
runOnlyForDeploymentPostprocessing = 1;
|
||||||
|
};
|
||||||
|
BD75E93F206ADEAD00656ED3 /* Copy AppleInternal Logging Profile */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 8;
|
||||||
|
dstPath = /AppleInternal/Library/Preferences/Logging/Subsystems;
|
||||||
|
dstSubfolderSpec = 0;
|
||||||
|
files = (
|
||||||
|
BD75E940206ADEF400656ED3 /* com.apple.mDNSResponder.plist in Copy AppleInternal Logging Profile */,
|
||||||
|
);
|
||||||
|
name = "Copy AppleInternal Logging Profile";
|
||||||
|
runOnlyForDeploymentPostprocessing = 1;
|
||||||
|
};
|
||||||
D284BE6A0ADD80740027CCDF /* CopyFiles */ = {
|
D284BE6A0ADD80740027CCDF /* CopyFiles */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 8;
|
buildActionMask = 8;
|
||||||
@ -891,9 +927,9 @@
|
|||||||
6575FBE9022EAF5A00000109 /* mDNS.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; name = mDNS.c; path = ../mDNSCore/mDNS.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
|
6575FBE9022EAF5A00000109 /* mDNS.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; name = mDNS.c; path = ../mDNSCore/mDNS.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
|
||||||
6575FBEB022EAF7200000109 /* mDNSMacOSX.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = mDNSMacOSX.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
|
6575FBEB022EAF7200000109 /* mDNSMacOSX.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = mDNSMacOSX.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
|
||||||
6575FBEC022EAF7200000109 /* daemon.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = daemon.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
|
6575FBEC022EAF7200000109 /* daemon.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = daemon.c; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
|
||||||
729DF45F1CD40630005ECF70 /* com.apple.mDNSResponder.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = com.apple.mDNSResponder.plist; path = Private/com.apple.mDNSResponder.plist; sourceTree = "<group>"; };
|
|
||||||
72FB545A166D5F960090B2D9 /* dnsctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = dnsctl.c; path = ../Clients/dnsctl.c; sourceTree = "<group>"; };
|
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; };
|
72FB545F166D5FB00090B2D9 /* dnsctl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dnsctl; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
789036911F7AC1F90077A962 /* libnetwork.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libnetwork.tbd; path = usr/lib/libnetwork.tbd; sourceTree = SDKROOT; };
|
||||||
7F18A9F60587CEF6001880B3 /* DNSCommon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DNSCommon.c; path = ../mDNSCore/DNSCommon.c; sourceTree = SOURCE_ROOT; };
|
7F18A9F60587CEF6001880B3 /* DNSCommon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DNSCommon.c; path = ../mDNSCore/DNSCommon.c; sourceTree = SOURCE_ROOT; };
|
||||||
7F18A9F70587CEF6001880B3 /* uDNS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = uDNS.c; path = ../mDNSCore/uDNS.c; sourceTree = SOURCE_ROOT; };
|
7F18A9F70587CEF6001880B3 /* uDNS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = uDNS.c; path = ../mDNSCore/uDNS.c; sourceTree = SOURCE_ROOT; };
|
||||||
7F461DB5062DBF2900672BF3 /* DNSDigest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DNSDigest.c; path = ../mDNSCore/DNSDigest.c; sourceTree = SOURCE_ROOT; };
|
7F461DB5062DBF2900672BF3 /* DNSDigest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DNSDigest.c; path = ../mDNSCore/DNSDigest.c; sourceTree = SOURCE_ROOT; };
|
||||||
@ -952,8 +988,12 @@
|
|||||||
B7D6CA701D1076F3005E24CF /* DomainBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DomainBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
B7D6CA701D1076F3005E24CF /* DomainBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DomainBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
B7E5920F1DB687A700A38085 /* Base */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Base; path = Base.lproj/DNSServiceDiscoveryPref.nib; sourceTree = "<group>"; };
|
B7E5920F1DB687A700A38085 /* Base */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Base; path = Base.lproj/DNSServiceDiscoveryPref.nib; sourceTree = "<group>"; };
|
||||||
BD03E88C1AD31278005E8A81 /* SymptomReporter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SymptomReporter.c; sourceTree = "<group>"; };
|
BD03E88C1AD31278005E8A81 /* SymptomReporter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SymptomReporter.c; sourceTree = "<group>"; };
|
||||||
|
BD28AE8E207B88F600F0B257 /* bonjour-mcast-diagnose */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "bonjour-mcast-diagnose"; sourceTree = "<group>"; };
|
||||||
|
BD41F9C3209B60AC0077F8B6 /* libpcap.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libpcap.tbd; path = usr/lib/libpcap.tbd; sourceTree = SDKROOT; };
|
||||||
BD691B281ED2F43200E6F317 /* DNS64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DNS64.c; sourceTree = "<group>"; };
|
BD691B281ED2F43200E6F317 /* DNS64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DNS64.c; sourceTree = "<group>"; };
|
||||||
BD691B291ED2F43200E6F317 /* DNS64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNS64.h; sourceTree = "<group>"; };
|
BD691B291ED2F43200E6F317 /* DNS64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNS64.h; sourceTree = "<group>"; };
|
||||||
|
BD893CE4206C0D980055F9E7 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
|
||||||
|
BD893CE6206C0EAF0055F9E7 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
||||||
BD9BA7531EAF90E400658CCF /* dnssdutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dnssdutil; sourceTree = BUILT_PRODUCTS_DIR; };
|
BD9BA7531EAF90E400658CCF /* dnssdutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dnssdutil; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
BD9BA7541EAF91E700658CCF /* dnssdutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dnssdutil.c; path = ../Clients/dnssdutil.c; sourceTree = "<group>"; };
|
BD9BA7541EAF91E700658CCF /* dnssdutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dnssdutil.c; path = ../Clients/dnssdutil.c; sourceTree = "<group>"; };
|
||||||
BD9BA7571EAF929C00658CCF /* CoreUtils.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreUtils.framework; path = System/Library/PrivateFrameworks/CoreUtils.framework; sourceTree = SDKROOT; };
|
BD9BA7571EAF929C00658CCF /* CoreUtils.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreUtils.framework; path = System/Library/PrivateFrameworks/CoreUtils.framework; sourceTree = SDKROOT; };
|
||||||
@ -961,6 +1001,9 @@
|
|||||||
BDA3F0881C48DB6D0054FB4B /* Metrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Metrics.m; sourceTree = "<group>"; };
|
BDA3F0881C48DB6D0054FB4B /* Metrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Metrics.m; sourceTree = "<group>"; };
|
||||||
BDA3F0891C48DB910054FB4B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
BDA3F0891C48DB910054FB4B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||||
BDA9A7871B3A923600523835 /* dns_sd_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dns_sd_private.h; path = ../mDNSShared/dns_sd_private.h; sourceTree = "<group>"; };
|
BDA9A7871B3A923600523835 /* dns_sd_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dns_sd_private.h; path = ../mDNSShared/dns_sd_private.h; sourceTree = "<group>"; };
|
||||||
|
BDAF4BBF20B52D3D0062219E /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
|
||||||
|
BDB61843206ADB7700AFF600 /* com.apple.mDNSResponder.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.mDNSResponder.plist; sourceTree = "<group>"; };
|
||||||
|
BDB61846206ADDDF00AFF600 /* com.apple.mDNSResponder.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = com.apple.mDNSResponder.plist; sourceTree = "<group>"; };
|
||||||
BDBF9B931ED74B8C001498A8 /* DNS64State.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNS64State.h; sourceTree = "<group>"; };
|
BDBF9B931ED74B8C001498A8 /* DNS64State.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNS64State.h; sourceTree = "<group>"; };
|
||||||
BDE238C11DF69D8300B9F696 /* dns_sd_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dns_sd_internal.h; path = ../mDNSShared/dns_sd_internal.h; sourceTree = "<group>"; };
|
BDE238C11DF69D8300B9F696 /* dns_sd_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dns_sd_internal.h; path = ../mDNSShared/dns_sd_internal.h; sourceTree = "<group>"; };
|
||||||
D284BE730ADD80740027CCDF /* mDNSResponder */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mDNSResponder; sourceTree = BUILT_PRODUCTS_DIR; };
|
D284BE730ADD80740027CCDF /* mDNSResponder */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mDNSResponder; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@ -1084,6 +1127,7 @@
|
|||||||
21B830A61D8A63E400AE2001 /* CoreFoundation.framework in Frameworks */,
|
21B830A61D8A63E400AE2001 /* CoreFoundation.framework in Frameworks */,
|
||||||
21B830A21D8A63A300AE2001 /* libxml2.dylib in Frameworks */,
|
21B830A21D8A63A300AE2001 /* libxml2.dylib in Frameworks */,
|
||||||
37538E141D7A43B600226BE4 /* libicucore.dylib in Frameworks */,
|
37538E141D7A43B600226BE4 /* libicucore.dylib in Frameworks */,
|
||||||
|
789036931F7AC2050077A962 /* libnetwork.tbd in Frameworks */,
|
||||||
21B830A41D8A63BB00AE2001 /* Security.framework in Frameworks */,
|
21B830A41D8A63BB00AE2001 /* Security.framework in Frameworks */,
|
||||||
21B830A51D8A63CB00AE2001 /* IOKit.framework in Frameworks */,
|
21B830A51D8A63CB00AE2001 /* IOKit.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
@ -1149,7 +1193,11 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
BD41F9C4209B60AC0077F8B6 /* libpcap.tbd in Frameworks */,
|
||||||
|
BDAF4BC020B52D3D0062219E /* CFNetwork.framework in Frameworks */,
|
||||||
|
BD893CE7206C0EAF0055F9E7 /* CoreFoundation.framework in Frameworks */,
|
||||||
BD9BA7581EAF929C00658CCF /* CoreUtils.framework in Frameworks */,
|
BD9BA7581EAF929C00658CCF /* CoreUtils.framework in Frameworks */,
|
||||||
|
BD893CE5206C0D980055F9E7 /* SystemConfiguration.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -1164,6 +1212,7 @@
|
|||||||
D284BE660ADD80740027CCDF /* SystemConfiguration.framework in Frameworks */,
|
D284BE660ADD80740027CCDF /* SystemConfiguration.framework in Frameworks */,
|
||||||
21B830A81D8A642200AE2001 /* libicucore.dylib in Frameworks */,
|
21B830A81D8A642200AE2001 /* libicucore.dylib in Frameworks */,
|
||||||
219D5542149ED645004464AE /* libxml2.dylib in Frameworks */,
|
219D5542149ED645004464AE /* libxml2.dylib in Frameworks */,
|
||||||
|
789036921F7AC1FA0077A962 /* libnetwork.tbd in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -1246,6 +1295,8 @@
|
|||||||
19C28FBDFE9D53C911CA2CBB /* Products */,
|
19C28FBDFE9D53C911CA2CBB /* Products */,
|
||||||
37DDE9241BA382280092AC61 /* Unit Tests */,
|
37DDE9241BA382280092AC61 /* Unit Tests */,
|
||||||
BD9BA7561EAF929C00658CCF /* Frameworks */,
|
BD9BA7561EAF929C00658CCF /* Frameworks */,
|
||||||
|
BDB61842206ADB7700AFF600 /* LoggingProfiles */,
|
||||||
|
BD28AE8D207B88F600F0B257 /* Scripts */,
|
||||||
);
|
);
|
||||||
name = mDNSResponder;
|
name = mDNSResponder;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1267,7 +1318,6 @@
|
|||||||
21F51DBD1B3540DB0070B05C /* com.apple.dnsextd.plist */,
|
21F51DBD1B3540DB0070B05C /* com.apple.dnsextd.plist */,
|
||||||
21F51DBF1B35412D0070B05C /* com.apple.mDNSResponder.plist */,
|
21F51DBF1B35412D0070B05C /* com.apple.mDNSResponder.plist */,
|
||||||
21F51DBE1B3541030070B05C /* com.apple.mDNSResponderHelper.plist */,
|
21F51DBE1B3541030070B05C /* com.apple.mDNSResponderHelper.plist */,
|
||||||
729DF45F1CD40630005ECF70 /* com.apple.mDNSResponder.plist */,
|
|
||||||
21A57F4A145B2AE100939099 /* CryptoAlg.c */,
|
21A57F4A145B2AE100939099 /* CryptoAlg.c */,
|
||||||
21A57F4B145B2AE100939099 /* CryptoAlg.h */,
|
21A57F4B145B2AE100939099 /* CryptoAlg.h */,
|
||||||
21A57F51145B2B1400939099 /* CryptoSupport.c */,
|
21A57F51145B2B1400939099 /* CryptoSupport.c */,
|
||||||
@ -1568,14 +1618,44 @@
|
|||||||
path = macOS;
|
path = macOS;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
BD28AE8D207B88F600F0B257 /* Scripts */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
BD28AE8E207B88F600F0B257 /* bonjour-mcast-diagnose */,
|
||||||
|
);
|
||||||
|
path = Scripts;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
BD9BA7561EAF929C00658CCF /* Frameworks */ = {
|
BD9BA7561EAF929C00658CCF /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
BDAF4BBF20B52D3D0062219E /* CFNetwork.framework */,
|
||||||
|
BD41F9C3209B60AC0077F8B6 /* libpcap.tbd */,
|
||||||
|
BD893CE6206C0EAF0055F9E7 /* CoreFoundation.framework */,
|
||||||
|
BD893CE4206C0D980055F9E7 /* SystemConfiguration.framework */,
|
||||||
|
789036911F7AC1F90077A962 /* libnetwork.tbd */,
|
||||||
BD9BA7571EAF929C00658CCF /* CoreUtils.framework */,
|
BD9BA7571EAF929C00658CCF /* CoreUtils.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
BDB61842206ADB7700AFF600 /* LoggingProfiles */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
BDB61843206ADB7700AFF600 /* com.apple.mDNSResponder.plist */,
|
||||||
|
BDB61844206ADB7700AFF600 /* AppleInternal */,
|
||||||
|
);
|
||||||
|
path = LoggingProfiles;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
BDB61844206ADB7700AFF600 /* AppleInternal */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
BDB61846206ADDDF00AFF600 /* com.apple.mDNSResponder.plist */,
|
||||||
|
);
|
||||||
|
path = AppleInternal;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
DB2CC4420662DCE500335AB3 /* Java Support */ = {
|
DB2CC4420662DCE500335AB3 /* Java Support */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -1784,6 +1864,8 @@
|
|||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
BDB04221203FEF4C00419961 /* dns_sd.h in Headers */,
|
||||||
|
BDB04223203FF18000419961 /* dns_sd_private.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -1791,6 +1873,8 @@
|
|||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
BDB04222203FEF4D00419961 /* dns_sd.h in Headers */,
|
||||||
|
BDB04224203FF18000419961 /* dns_sd_private.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -1799,6 +1883,7 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
BDA9A7881B3A924C00523835 /* dns_sd_private.h in Headers */,
|
BDA9A7881B3A924C00523835 /* dns_sd_private.h in Headers */,
|
||||||
|
BD41B27D203EBE6100A53629 /* dns_sd.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -1881,7 +1966,6 @@
|
|||||||
2141DD19123FFCDB0086D23E /* Headers */,
|
2141DD19123FFCDB0086D23E /* Headers */,
|
||||||
2141DD1A123FFCDB0086D23E /* Sources */,
|
2141DD1A123FFCDB0086D23E /* Sources */,
|
||||||
2141DD1B123FFCDB0086D23E /* Frameworks */,
|
2141DD1B123FFCDB0086D23E /* Frameworks */,
|
||||||
2130256B12400DE600AC839F /* ShellScript */,
|
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@ -2115,8 +2199,10 @@
|
|||||||
4A7B9E7F14FDA21B00B84CC1 /* CopyFiles */,
|
4A7B9E7F14FDA21B00B84CC1 /* CopyFiles */,
|
||||||
4A7B9E8114FDA25500B84CC1 /* CopyFiles */,
|
4A7B9E8114FDA25500B84CC1 /* CopyFiles */,
|
||||||
D284BE6C0ADD80740027CCDF /* Run Script */,
|
D284BE6C0ADD80740027CCDF /* Run Script */,
|
||||||
8418673D15AB8BFF00BB7F70 /* CopyFiles */,
|
|
||||||
21F51DC01B35418C0070B05C /* CopyFiles */,
|
21F51DC01B35418C0070B05C /* CopyFiles */,
|
||||||
|
8418673D15AB8BFF00BB7F70 /* Copy Base Logging Profile */,
|
||||||
|
BD75E93F206ADEAD00656ED3 /* Copy AppleInternal Logging Profile */,
|
||||||
|
BD28AE8C207B888E00F0B257 /* Copy diagnose scripts */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@ -2439,19 +2525,6 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "if [ -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\nipsec=$(ls \"${SDKROOT}/usr/lib/libipsec.*\" 2> /dev/null | wc -l)\nif [ \"$ipsec\" != \"0\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/ipsec_options.h\"\ntouch \"${CONFIGURATION_TEMP_DIR}/ipsec_options.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libipsec.a\"\nelse\necho \"#define MDNS_NO_IPSEC 1\" > ${CONFIGURATION_TEMP_DIR}/ipsec_options.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}/libipsec.a\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/empty.c\"\nfi\n";
|
shellScript = "if [ -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\nipsec=$(ls \"${SDKROOT}/usr/lib/libipsec.*\" 2> /dev/null | wc -l)\nif [ \"$ipsec\" != \"0\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/ipsec_options.h\"\ntouch \"${CONFIGURATION_TEMP_DIR}/ipsec_options.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libipsec.a\"\nelse\necho \"#define MDNS_NO_IPSEC 1\" > ${CONFIGURATION_TEMP_DIR}/ipsec_options.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}/libipsec.a\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/empty.c\"\nfi\n";
|
||||||
};
|
};
|
||||||
2130256B12400DE600AC839F /* ShellScript */ = {
|
|
||||||
isa = PBXShellScriptBuildPhase;
|
|
||||||
buildActionMask = 8;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
inputPaths = (
|
|
||||||
);
|
|
||||||
outputPaths = (
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 1;
|
|
||||||
shellPath = /bin/sh;
|
|
||||||
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 */ = {
|
21DE714D115831CB00DD4BD1 /* ShellScript */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 8;
|
buildActionMask = 8;
|
||||||
@ -2463,7 +2536,7 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 1;
|
runOnlyForDeploymentPostprocessing = 1;
|
||||||
shellPath = "/bin/bash -e -x";
|
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}\n\nif [[ \"${ACTION}\" == \"installhdrs\" ]] || [[ \"${ACTION}\" == \"installapi\" ]]; 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";
|
||||||
};
|
};
|
||||||
37DDE9341BA384000092AC61 /* ShellScript */ = {
|
37DDE9341BA384000092AC61 /* ShellScript */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
@ -3154,7 +3227,6 @@
|
|||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"__APPLE_USE_RFC_3542=1",
|
"__APPLE_USE_RFC_3542=1",
|
||||||
"_DNS_SD_LIBDISPATCH=1",
|
|
||||||
"APPLE_OSX_mDNSResponder=1",
|
"APPLE_OSX_mDNSResponder=1",
|
||||||
"__MigTypeCheck=1",
|
"__MigTypeCheck=1",
|
||||||
"mDNSResponderVersion=${MVERS}",
|
"mDNSResponderVersion=${MVERS}",
|
||||||
@ -3249,7 +3321,6 @@
|
|||||||
"-lMobileGestalt",
|
"-lMobileGestalt",
|
||||||
);
|
);
|
||||||
"OTHER_LDFLAGS[sdk=macosx*][arch=*]" = (
|
"OTHER_LDFLAGS[sdk=macosx*][arch=*]" = (
|
||||||
"-lAWACS",
|
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
WebFilterDNS,
|
WebFilterDNS,
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
@ -3339,7 +3410,6 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"__APPLE_USE_RFC_3542=1",
|
"__APPLE_USE_RFC_3542=1",
|
||||||
"_DNS_SD_LIBDISPATCH=1",
|
|
||||||
"APPLE_OSX_mDNSResponder=1",
|
"APPLE_OSX_mDNSResponder=1",
|
||||||
"__MigTypeCheck=1",
|
"__MigTypeCheck=1",
|
||||||
"mDNSResponderVersion=${MVERS}",
|
"mDNSResponderVersion=${MVERS}",
|
||||||
@ -3431,6 +3501,7 @@
|
|||||||
INSTALLHDRS_SCRIPT_PHASE = YES;
|
INSTALLHDRS_SCRIPT_PHASE = YES;
|
||||||
INSTALL_PATH = /usr/local/lib/system;
|
INSTALL_PATH = /usr/local/lib/system;
|
||||||
PRODUCT_NAME = dns_sd;
|
PRODUCT_NAME = dns_sd;
|
||||||
|
PUBLIC_HEADERS_FOLDER_PATH = /usr/include;
|
||||||
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
|
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@ -3474,12 +3545,14 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"__DARWIN_NON_CANCELABLE=1",
|
"__DARWIN_NON_CANCELABLE=1",
|
||||||
);
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
||||||
INSTALLHDRS_COPY_PHASE = YES;
|
INSTALLHDRS_COPY_PHASE = YES;
|
||||||
INSTALLHDRS_SCRIPT_PHASE = YES;
|
INSTALLHDRS_SCRIPT_PHASE = YES;
|
||||||
INSTALL_PATH = /usr/lib/system;
|
INSTALL_PATH = /usr/lib/system;
|
||||||
INTERPOSITION_SIM_SUFFIX = "";
|
INTERPOSITION_SIM_SUFFIX = "";
|
||||||
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
|
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
|
||||||
|
IS_ZIPPERED = YES;
|
||||||
LINK_WITH_STANDARD_LIBRARIES = NO;
|
LINK_WITH_STANDARD_LIBRARIES = NO;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"-Wl,-umbrella,System",
|
"-Wl,-umbrella,System",
|
||||||
@ -3496,7 +3569,11 @@
|
|||||||
"-llaunch",
|
"-llaunch",
|
||||||
"-lsystem_asl",
|
"-lsystem_asl",
|
||||||
);
|
);
|
||||||
|
OTHER_TAPI_FLAGS = "-umbrella System -extra-public-header $(SRCROOT)/DNSServiceDiscovery.h";
|
||||||
PRODUCT_NAME = libsystem_dnssd;
|
PRODUCT_NAME = libsystem_dnssd;
|
||||||
|
PUBLIC_HEADERS_FOLDER_PATH = /usr/include;
|
||||||
|
SUPPORTS_TEXT_BASED_API = YES;
|
||||||
|
TAPI_VERIFY_MODE = Pedantic;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@ -3509,6 +3586,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"__DARWIN_NON_CANCELABLE=1",
|
"__DARWIN_NON_CANCELABLE=1",
|
||||||
);
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
||||||
INSTALL_PATH = /usr/lib/system;
|
INSTALL_PATH = /usr/lib/system;
|
||||||
INTERPOSITION_SIM_SUFFIX = "";
|
INTERPOSITION_SIM_SUFFIX = "";
|
||||||
@ -3529,7 +3607,11 @@
|
|||||||
"-llaunch",
|
"-llaunch",
|
||||||
"-lsystem_asl",
|
"-lsystem_asl",
|
||||||
);
|
);
|
||||||
|
OTHER_TAPI_FLAGS = "-umbrella System -extra-public-header $(SRCROOT)/DNSServiceDiscovery.h";
|
||||||
PRODUCT_NAME = libsystem_dnssd_debug;
|
PRODUCT_NAME = libsystem_dnssd_debug;
|
||||||
|
PUBLIC_HEADERS_FOLDER_PATH = /usr/include;
|
||||||
|
SUPPORTS_TEXT_BASED_API = YES;
|
||||||
|
TAPI_VERIFY_MODE = Pedantic;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@ -3543,6 +3625,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"__DARWIN_NON_CANCELABLE=1",
|
"__DARWIN_NON_CANCELABLE=1",
|
||||||
);
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||||
GENERATE_PROFILING_CODE = YES;
|
GENERATE_PROFILING_CODE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
||||||
INSTALL_PATH = /usr/lib/system;
|
INSTALL_PATH = /usr/lib/system;
|
||||||
@ -3564,7 +3647,11 @@
|
|||||||
"-llaunch",
|
"-llaunch",
|
||||||
"-lsystem_asl",
|
"-lsystem_asl",
|
||||||
);
|
);
|
||||||
|
OTHER_TAPI_FLAGS = "-umbrella System -extra-public-header $(SRCROOT)/DNSServiceDiscovery.h";
|
||||||
PRODUCT_NAME = libsystem_dnssd_profile;
|
PRODUCT_NAME = libsystem_dnssd_profile;
|
||||||
|
PUBLIC_HEADERS_FOLDER_PATH = /usr/include;
|
||||||
|
SUPPORTS_TEXT_BASED_API = YES;
|
||||||
|
TAPI_VERIFY_MODE = Pedantic;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@ -3755,6 +3842,7 @@
|
|||||||
INSTALLHDRS_SCRIPT_PHASE = YES;
|
INSTALLHDRS_SCRIPT_PHASE = YES;
|
||||||
INSTALL_PATH = /usr/local/lib/system;
|
INSTALL_PATH = /usr/local/lib/system;
|
||||||
PRODUCT_NAME = dns_sd;
|
PRODUCT_NAME = dns_sd;
|
||||||
|
PUBLIC_HEADERS_FOLDER_PATH = /usr/include;
|
||||||
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
|
"SKIP_INSTALL[sdk=iphonesimulator*]" = YES;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
@ -3836,7 +3924,6 @@
|
|||||||
);
|
);
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"__APPLE_USE_RFC_3542=1",
|
"__APPLE_USE_RFC_3542=1",
|
||||||
"_DNS_SD_LIBDISPATCH=1",
|
|
||||||
"APPLE_OSX_mDNSResponder=1",
|
"APPLE_OSX_mDNSResponder=1",
|
||||||
"__MigTypeCheck=1",
|
"__MigTypeCheck=1",
|
||||||
"mDNSResponderVersion=${MVERS}",
|
"mDNSResponderVersion=${MVERS}",
|
||||||
@ -3899,7 +3986,6 @@
|
|||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"__APPLE_USE_RFC_3542=1",
|
"__APPLE_USE_RFC_3542=1",
|
||||||
"_DNS_SD_LIBDISPATCH=1",
|
|
||||||
"APPLE_OSX_mDNSResponder=1",
|
"APPLE_OSX_mDNSResponder=1",
|
||||||
"__MigTypeCheck=1",
|
"__MigTypeCheck=1",
|
||||||
"mDNSResponderVersion=${MVERS}",
|
"mDNSResponderVersion=${MVERS}",
|
||||||
@ -4644,7 +4730,6 @@
|
|||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"__APPLE_USE_RFC_3542=1",
|
"__APPLE_USE_RFC_3542=1",
|
||||||
"_DNS_SD_LIBDISPATCH=1",
|
|
||||||
"APPLE_OSX_mDNSResponder=1",
|
"APPLE_OSX_mDNSResponder=1",
|
||||||
"__MigTypeCheck=1",
|
"__MigTypeCheck=1",
|
||||||
"mDNSResponderVersion=${MVERS}",
|
"mDNSResponderVersion=${MVERS}",
|
||||||
@ -4715,7 +4800,6 @@
|
|||||||
"-lMobileGestalt",
|
"-lMobileGestalt",
|
||||||
);
|
);
|
||||||
"OTHER_LDFLAGS[sdk=macosx*][arch=*]" = (
|
"OTHER_LDFLAGS[sdk=macosx*][arch=*]" = (
|
||||||
"-lAWACS",
|
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
WebFilterDNS,
|
WebFilterDNS,
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
@ -4807,6 +4891,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"__DARWIN_NON_CANCELABLE=1",
|
"__DARWIN_NON_CANCELABLE=1",
|
||||||
);
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
||||||
INSTALL_PATH = /usr/lib/system;
|
INSTALL_PATH = /usr/lib/system;
|
||||||
INTERPOSITION_SIM_SUFFIX = "";
|
INTERPOSITION_SIM_SUFFIX = "";
|
||||||
@ -4827,7 +4912,11 @@
|
|||||||
"-llaunch",
|
"-llaunch",
|
||||||
"-lsystem_asl",
|
"-lsystem_asl",
|
||||||
);
|
);
|
||||||
|
OTHER_TAPI_FLAGS = "-umbrella System -extra-public-header $(SRCROOT)/DNSServiceDiscovery.h";
|
||||||
PRODUCT_NAME = libsystem_dnssd_debug;
|
PRODUCT_NAME = libsystem_dnssd_debug;
|
||||||
|
PUBLIC_HEADERS_FOLDER_PATH = /usr/include;
|
||||||
|
SUPPORTS_TEXT_BASED_API = YES;
|
||||||
|
TAPI_VERIFY_MODE = Pedantic;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
@ -4841,6 +4930,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"__DARWIN_NON_CANCELABLE=1",
|
"__DARWIN_NON_CANCELABLE=1",
|
||||||
);
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||||
GENERATE_PROFILING_CODE = YES;
|
GENERATE_PROFILING_CODE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
||||||
INSTALL_PATH = /usr/lib/system;
|
INSTALL_PATH = /usr/lib/system;
|
||||||
@ -4862,7 +4952,11 @@
|
|||||||
"-llaunch",
|
"-llaunch",
|
||||||
"-lsystem_asl",
|
"-lsystem_asl",
|
||||||
);
|
);
|
||||||
|
OTHER_TAPI_FLAGS = "-umbrella System -extra-public-header $(SRCROOT)/DNSServiceDiscovery.h";
|
||||||
PRODUCT_NAME = libsystem_dnssd_profile;
|
PRODUCT_NAME = libsystem_dnssd_profile;
|
||||||
|
PUBLIC_HEADERS_FOLDER_PATH = /usr/include;
|
||||||
|
SUPPORTS_TEXT_BASED_API = YES;
|
||||||
|
TAPI_VERIFY_MODE = Pedantic;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
@ -4889,12 +4983,14 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"__DARWIN_NON_CANCELABLE=1",
|
"__DARWIN_NON_CANCELABLE=1",
|
||||||
);
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
HEADER_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders/";
|
||||||
INSTALLHDRS_COPY_PHASE = YES;
|
INSTALLHDRS_COPY_PHASE = YES;
|
||||||
INSTALLHDRS_SCRIPT_PHASE = YES;
|
INSTALLHDRS_SCRIPT_PHASE = YES;
|
||||||
INSTALL_PATH = /usr/lib/system;
|
INSTALL_PATH = /usr/lib/system;
|
||||||
INTERPOSITION_SIM_SUFFIX = "";
|
INTERPOSITION_SIM_SUFFIX = "";
|
||||||
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
|
"INTERPOSITION_SIM_SUFFIX[sdk=iphonesimulator*]" = _sim;
|
||||||
|
IS_ZIPPERED = YES;
|
||||||
LINK_WITH_STANDARD_LIBRARIES = NO;
|
LINK_WITH_STANDARD_LIBRARIES = NO;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"-Wl,-umbrella,System",
|
"-Wl,-umbrella,System",
|
||||||
@ -4911,7 +5007,11 @@
|
|||||||
"-llaunch",
|
"-llaunch",
|
||||||
"-lsystem_asl",
|
"-lsystem_asl",
|
||||||
);
|
);
|
||||||
|
OTHER_TAPI_FLAGS = "-umbrella System -extra-public-header $(SRCROOT)/DNSServiceDiscovery.h";
|
||||||
PRODUCT_NAME = libsystem_dnssd;
|
PRODUCT_NAME = libsystem_dnssd;
|
||||||
|
PUBLIC_HEADERS_FOLDER_PATH = /usr/include;
|
||||||
|
SUPPORTS_TEXT_BASED_API = YES;
|
||||||
|
TAPI_VERIFY_MODE = Pedantic;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,13 @@
|
|||||||
|
|
||||||
#include "mDNSMacOSX.h"
|
#include "mDNSMacOSX.h"
|
||||||
#include <libproc.h>
|
#include <libproc.h>
|
||||||
#include <network/private.h>
|
|
||||||
|
#if __has_include(<nw/private.h>)
|
||||||
|
#include <nw/private.h>
|
||||||
|
#else
|
||||||
|
#include <network/private.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dns_sd_internal.h"
|
#include "dns_sd_internal.h"
|
||||||
|
|
||||||
//Gets the DNSPolicy from NW PATH EVALUATOR
|
//Gets the DNSPolicy from NW PATH EVALUATOR
|
||||||
|
@ -155,7 +155,7 @@ mDNSlocal void RegisterService(mDNS *m, ServiceRecordSet *recordset,
|
|||||||
mDNS_RegisterService(m, recordset,
|
mDNS_RegisterService(m, recordset,
|
||||||
&n, &t, &d, // Name, type, domain
|
&n, &t, &d, // Name, type, domain
|
||||||
host, mDNSOpaque16fromIntVal(PortAsNumber),
|
host, mDNSOpaque16fromIntVal(PortAsNumber),
|
||||||
txtbuffer, bptr-txtbuffer, // TXT data, length
|
mDNSNULL, txtbuffer, bptr-txtbuffer, // TXT data, length
|
||||||
mDNSNULL, 0, // Subtypes
|
mDNSNULL, 0, // Subtypes
|
||||||
mDNSInterface_Any, // Interface ID
|
mDNSInterface_Any, // Interface ID
|
||||||
ServiceCallback, mDNSNULL, 0); // Callback, context, flags
|
ServiceCallback, mDNSNULL, 0); // Callback, context, flags
|
||||||
|
@ -439,7 +439,7 @@ static mStatus RegisterOneService(const char * richTextName,
|
|||||||
status = mDNS_RegisterService(&mDNSStorage, &thisServ->coreServ,
|
status = mDNS_RegisterService(&mDNSStorage, &thisServ->coreServ,
|
||||||
&name, &type, &domain, // Name, type, domain
|
&name, &type, &domain, // Name, type, domain
|
||||||
NULL, mDNSOpaque16fromIntVal(portNumber),
|
NULL, mDNSOpaque16fromIntVal(portNumber),
|
||||||
text, textLen, // TXT data, length
|
NULL, text, textLen, // TXT data, length
|
||||||
NULL, 0, // Subtypes
|
NULL, 0, // Subtypes
|
||||||
mDNSInterface_Any, // Interface ID
|
mDNSInterface_Any, // Interface ID
|
||||||
RegistrationCallback, thisServ, 0); // Callback, context, flags
|
RegistrationCallback, thisServ, 0); // Callback, context, flags
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -80,40 +80,56 @@ void plen_to_mask(int plen, char *addr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Gets IPv6 interface information from the /proc filesystem in linux*/
|
/* Gets IPv6 interface information from the /proc filesystem in linux*/
|
||||||
struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
|
struct ifi_info *get_ifi_info_linuxv6(int doaliases)
|
||||||
{
|
{
|
||||||
struct ifi_info *ifi, *ifihead, **ifipnext, *ifipold, **ifiptr;
|
struct ifi_info *ifi, *ifihead, **ifipnext, *ifipold, **ifiptr;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char addr[8][5];
|
int i, nitems, flags, index, plen, scope;
|
||||||
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 addrinfo hints, *res0;
|
||||||
int err;
|
int err;
|
||||||
int sockfd = -1;
|
int sockfd = -1;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
char ifnameFmt[16], addrStr[32 + 7 + 1], ifname[IFNAMSIZ], lastname[IFNAMSIZ];
|
||||||
|
|
||||||
res0=NULL;
|
res0=NULL;
|
||||||
ifihead = NULL;
|
ifihead = NULL;
|
||||||
ifipnext = &ifihead;
|
ifipnext = &ifihead;
|
||||||
lastname[0] = 0;
|
|
||||||
|
|
||||||
if ((fp = fopen(PROC_IFINET6_PATH, "r")) != NULL) {
|
if ((fp = fopen(PROC_IFINET6_PATH, "r")) != NULL) {
|
||||||
sockfd = socket(AF_INET6, SOCK_DGRAM, 0);
|
sockfd = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||||
if (sockfd < 0) {
|
if (sockfd < 0) {
|
||||||
goto gotError;
|
goto gotError;
|
||||||
}
|
}
|
||||||
while (fscanf(fp,
|
|
||||||
"%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %8s\n",
|
|
||||||
addr[0],addr[1],addr[2],addr[3],
|
|
||||||
addr[4],addr[5],addr[6],addr[7],
|
|
||||||
&index, &plen, &scope, &flags, ifname) != EOF) {
|
|
||||||
|
|
||||||
myflags = 0;
|
// Parse /proc/net/if_inet6 according to <https://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/ch11s04.html>.
|
||||||
if (strncmp(lastname, ifname, IFNAMSIZ) == 0) {
|
|
||||||
|
// Create a string specifier with a width of IFNAMSIZ - 1 ("%<IFNAMSIZ - 1>s") to scan the interface name. The
|
||||||
|
// reason why we don't just use the string-ified macro expansion of IFNAMSIZ for the width is because the width
|
||||||
|
// needs to be a decimal string and there's no guarantee that IFNAMSIZ will be defined as a decimal integer. For
|
||||||
|
// example, it could be defined in hexadecimal or as an arithmetic expression.
|
||||||
|
|
||||||
|
snprintf(ifnameFmt, sizeof(ifnameFmt), "%%%ds", IFNAMSIZ - 1);
|
||||||
|
|
||||||
|
// Write the seven IPv6 address string colons and NUL terminator, i.e., "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx".
|
||||||
|
// The remaining 32 IPv6 address characters come from /proc/net/if_inet6.
|
||||||
|
|
||||||
|
for (i = 4; i < 39; i += 5) addrStr[i] = ':';
|
||||||
|
addrStr[39] = '\0';
|
||||||
|
|
||||||
|
lastname[0] = '\0';
|
||||||
|
for (;;) {
|
||||||
|
nitems = fscanf(fp, " %4c%4c%4c%4c%4c%4c%4c%4c %x %x %x %x",
|
||||||
|
&addrStr[0], &addrStr[5], &addrStr[10], &addrStr[15],
|
||||||
|
&addrStr[20], &addrStr[25], &addrStr[30], &addrStr[35],
|
||||||
|
&index, &plen, &scope, &flags);
|
||||||
|
if (nitems != 12) break;
|
||||||
|
|
||||||
|
nitems = fscanf(fp, ifnameFmt, ifname);
|
||||||
|
if (nitems != 1) break;
|
||||||
|
|
||||||
|
if (strcmp(lastname, ifname) == 0) {
|
||||||
if (doaliases == 0)
|
if (doaliases == 0)
|
||||||
continue; /* already processed this interface */
|
continue; /* already processed this interface */
|
||||||
myflags = IFI_ALIAS;
|
|
||||||
}
|
}
|
||||||
memcpy(lastname, ifname, IFNAMSIZ);
|
memcpy(lastname, ifname, IFNAMSIZ);
|
||||||
ifi = (struct ifi_info*)calloc(1, sizeof(struct ifi_info));
|
ifi = (struct ifi_info*)calloc(1, sizeof(struct ifi_info));
|
||||||
@ -126,15 +142,11 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
|
|||||||
*ifipnext = ifi; /* prev points to this new one */
|
*ifipnext = ifi; /* prev points to this new one */
|
||||||
ifipnext = &ifi->ifi_next; /* pointer to next one goes here */
|
ifipnext = &ifi->ifi_next; /* pointer to next one goes here */
|
||||||
|
|
||||||
sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
|
|
||||||
addr[0],addr[1],addr[2],addr[3],
|
|
||||||
addr[4],addr[5],addr[6],addr[7]);
|
|
||||||
|
|
||||||
/* Add address of the interface */
|
/* Add address of the interface */
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = AF_INET6;
|
hints.ai_family = AF_INET6;
|
||||||
hints.ai_flags = AI_NUMERICHOST;
|
hints.ai_flags = AI_NUMERICHOST;
|
||||||
err = getaddrinfo(addr6, NULL, &hints, &res0);
|
err = getaddrinfo(addrStr, NULL, &hints, &res0);
|
||||||
if (err) {
|
if (err) {
|
||||||
goto gotError;
|
goto gotError;
|
||||||
}
|
}
|
||||||
@ -152,9 +164,9 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
|
|||||||
goto gotError;
|
goto gotError;
|
||||||
}
|
}
|
||||||
|
|
||||||
((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_family=family;
|
((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_family=AF_INET6;
|
||||||
((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_scope_id=scope;
|
((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_scope_id=scope;
|
||||||
inet_pton(family, ipv6addr, &((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_addr);
|
inet_pton(AF_INET6, ipv6addr, &((struct sockaddr_in6 *)ifi->ifi_netmask)->sin6_addr);
|
||||||
|
|
||||||
/* Add interface name */
|
/* Add interface name */
|
||||||
memcpy(ifi->ifi_name, ifname, IFI_NAME);
|
memcpy(ifi->ifi_name, ifname, IFI_NAME);
|
||||||
@ -228,7 +240,7 @@ struct ifi_info *get_ifi_info(int family, int doaliases)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
|
#if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
|
||||||
if (family == AF_INET6) return get_ifi_info_linuxv6(family, doaliases);
|
if (family == AF_INET6) return get_ifi_info_linuxv6(doaliases);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sockfd = -1;
|
sockfd = -1;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
|
* Copyright (c) 2002-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -62,7 +62,7 @@ typedef unsigned int socklen_t;
|
|||||||
#define GET_SA_LEN(X) (((struct sockaddr*)&(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr))
|
#define GET_SA_LEN(X) (((struct sockaddr*)&(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IFI_NAME 16 /* same as IFNAMSIZ in <net/if.h> */
|
#define IFI_NAME IFNAMSIZ /* same as IFNAMSIZ in <net/if.h> */
|
||||||
#define IFI_HADDR 8 /* allow for 64-bit EUI-64 in future */
|
#define IFI_HADDR 8 /* allow for 64-bit EUI-64 in future */
|
||||||
|
|
||||||
// Renamed from my_in_pktinfo because in_pktinfo is used by Linux.
|
// Renamed from my_in_pktinfo because in_pktinfo is used by Linux.
|
||||||
@ -98,7 +98,7 @@ struct ifi_info {
|
|||||||
|
|
||||||
#if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
|
#if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
|
||||||
#define PROC_IFINET6_PATH "/proc/net/if_inet6"
|
#define PROC_IFINET6_PATH "/proc/net/if_inet6"
|
||||||
extern struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases);
|
extern struct ifi_info *get_ifi_info_linuxv6(int doaliases);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AF_INET6) && HAVE_IPV6
|
#if defined(AF_INET6) && HAVE_IPV6
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003-2015 Apple Inc. All rights reserved.
|
* Copyright (c) 2003-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -66,7 +66,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DNS_SD_H
|
#ifndef _DNS_SD_H
|
||||||
#define _DNS_SD_H 8787002
|
#define _DNS_SD_H 8800035
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -75,9 +75,11 @@ extern "C" {
|
|||||||
/* Set to 1 if libdispatch is supported
|
/* Set to 1 if libdispatch is supported
|
||||||
* Note: May also be set by project and/or Makefile
|
* Note: May also be set by project and/or Makefile
|
||||||
*/
|
*/
|
||||||
#ifndef _DNS_SD_LIBDISPATCH
|
#if defined(__APPLE__)
|
||||||
|
#define _DNS_SD_LIBDISPATCH 1
|
||||||
|
#else
|
||||||
#define _DNS_SD_LIBDISPATCH 0
|
#define _DNS_SD_LIBDISPATCH 0
|
||||||
#endif /* ndef _DNS_SD_LIBDISPATCH */
|
#endif
|
||||||
|
|
||||||
/* standard calling convention under Win32 is __stdcall */
|
/* standard calling convention under Win32 is __stdcall */
|
||||||
/* Note: When compiling Intel EFI (Extensible Firmware Interface) under MS Visual Studio, the */
|
/* Note: When compiling Intel EFI (Extensible Firmware Interface) under MS Visual Studio, the */
|
||||||
@ -88,6 +90,12 @@ extern "C" {
|
|||||||
#define DNSSD_API
|
#define DNSSD_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (defined(__GNUC__) && (__GNUC__ >= 4))
|
||||||
|
#define DNSSD_EXPORT __attribute__((visibility("default")))
|
||||||
|
#else
|
||||||
|
#define DNSSD_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
typedef SOCKET dnssd_sock_t;
|
typedef SOCKET dnssd_sock_t;
|
||||||
@ -526,11 +534,25 @@ enum
|
|||||||
* This flag is private and should not be used.
|
* This flag is private and should not be used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
kDNSServiceFlagsPrivateFour = 0x40000000
|
kDNSServiceFlagsPrivateFour = 0x40000000,
|
||||||
/*
|
/*
|
||||||
* This flag is private and should not be used.
|
* This flag is private and should not be used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
kDNSServiceFlagsAllowExpiredAnswers = 0x80000000,
|
||||||
|
/*
|
||||||
|
* When kDNSServiceFlagsAllowExpiredAnswers is passed to DNSServiceQueryRecord or DNSServiceGetAddrInfo,
|
||||||
|
* if there are matching expired records still in the cache, then they are immediately returned to the
|
||||||
|
* client, and in parallel a network query for that name is issued. All returned records from the query will
|
||||||
|
* remain in the cache after expiration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
kDNSServiceFlagsExpiredAnswer = 0x80000000
|
||||||
|
/*
|
||||||
|
* When kDNSServiceFlagsAllowExpiredAnswers is passed to DNSServiceQueryRecord or DNSServiceGetAddrInfo,
|
||||||
|
* an expired answer will have this flag set.
|
||||||
|
*/
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define kDNSServiceOutputFlags (kDNSServiceFlagsValidate | kDNSServiceFlagsValidateOptional | kDNSServiceFlagsMoreComing | kDNSServiceFlagsAdd | kDNSServiceFlagsDefault)
|
#define kDNSServiceOutputFlags (kDNSServiceFlagsValidate | kDNSServiceFlagsValidateOptional | kDNSServiceFlagsMoreComing | kDNSServiceFlagsAdd | kDNSServiceFlagsDefault)
|
||||||
@ -871,6 +893,7 @@ typedef int32_t DNSServiceErrorType;
|
|||||||
* if the daemon (or "system service" on Windows) is not running.
|
* if the daemon (or "system service" on Windows) is not running.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceGetProperty
|
DNSServiceErrorType DNSSD_API DNSServiceGetProperty
|
||||||
(
|
(
|
||||||
const char *property, /* Requested property (i.e. kDNSServiceProperty_DaemonVersion) */
|
const char *property, /* Requested property (i.e. kDNSServiceProperty_DaemonVersion) */
|
||||||
@ -930,6 +953,7 @@ DNSServiceErrorType DNSSD_API DNSServiceGetProperty
|
|||||||
* error.
|
* error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
dnssd_sock_t DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdRef);
|
dnssd_sock_t DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdRef);
|
||||||
|
|
||||||
|
|
||||||
@ -951,6 +975,7 @@ dnssd_sock_t DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdRef);
|
|||||||
* an error code indicating the specific failure that occurred.
|
* an error code indicating the specific failure that occurred.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef);
|
DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef);
|
||||||
|
|
||||||
|
|
||||||
@ -978,6 +1003,7 @@ DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef);
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdRef);
|
void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdRef);
|
||||||
|
|
||||||
|
|
||||||
@ -1062,6 +1088,7 @@ typedef void (DNSSD_API *DNSServiceDomainEnumReply)
|
|||||||
* is not initialized).
|
* is not initialized).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains
|
DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains
|
||||||
(
|
(
|
||||||
DNSServiceRef *sdRef,
|
DNSServiceRef *sdRef,
|
||||||
@ -1252,6 +1279,7 @@ typedef void (DNSSD_API *DNSServiceRegisterReply)
|
|||||||
* is not initialized).
|
* is not initialized).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceRegister
|
DNSServiceErrorType DNSSD_API DNSServiceRegister
|
||||||
(
|
(
|
||||||
DNSServiceRef *sdRef,
|
DNSServiceRef *sdRef,
|
||||||
@ -1307,6 +1335,7 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister
|
|||||||
* error code indicating the error that occurred (the RecordRef is not initialized).
|
* error code indicating the error that occurred (the RecordRef is not initialized).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceAddRecord
|
DNSServiceErrorType DNSSD_API DNSServiceAddRecord
|
||||||
(
|
(
|
||||||
DNSServiceRef sdRef,
|
DNSServiceRef sdRef,
|
||||||
@ -1348,6 +1377,7 @@ DNSServiceErrorType DNSSD_API DNSServiceAddRecord
|
|||||||
* error code indicating the error that occurred.
|
* error code indicating the error that occurred.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord
|
DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord
|
||||||
(
|
(
|
||||||
DNSServiceRef sdRef,
|
DNSServiceRef sdRef,
|
||||||
@ -1380,6 +1410,7 @@ DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord
|
|||||||
* error code indicating the error that occurred.
|
* error code indicating the error that occurred.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord
|
DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord
|
||||||
(
|
(
|
||||||
DNSServiceRef sdRef,
|
DNSServiceRef sdRef,
|
||||||
@ -1485,6 +1516,7 @@ typedef void (DNSSD_API *DNSServiceBrowseReply)
|
|||||||
* is not initialized).
|
* is not initialized).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceBrowse
|
DNSServiceErrorType DNSSD_API DNSServiceBrowse
|
||||||
(
|
(
|
||||||
DNSServiceRef *sdRef,
|
DNSServiceRef *sdRef,
|
||||||
@ -1613,6 +1645,7 @@ typedef void (DNSSD_API *DNSServiceResolveReply)
|
|||||||
* is not initialized).
|
* is not initialized).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceResolve
|
DNSServiceErrorType DNSSD_API DNSServiceResolve
|
||||||
(
|
(
|
||||||
DNSServiceRef *sdRef,
|
DNSServiceRef *sdRef,
|
||||||
@ -1730,6 +1763,7 @@ typedef void (DNSSD_API *DNSServiceQueryRecordReply)
|
|||||||
* is not initialized).
|
* is not initialized).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceQueryRecord
|
DNSServiceErrorType DNSSD_API DNSServiceQueryRecord
|
||||||
(
|
(
|
||||||
DNSServiceRef *sdRef,
|
DNSServiceRef *sdRef,
|
||||||
@ -1834,6 +1868,7 @@ typedef void (DNSSD_API *DNSServiceGetAddrInfoReply)
|
|||||||
* the error that occurred.
|
* the error that occurred.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceGetAddrInfo
|
DNSServiceErrorType DNSSD_API DNSServiceGetAddrInfo
|
||||||
(
|
(
|
||||||
DNSServiceRef *sdRef,
|
DNSServiceRef *sdRef,
|
||||||
@ -1870,6 +1905,7 @@ DNSServiceErrorType DNSSD_API DNSServiceGetAddrInfo
|
|||||||
* case the DNSServiceRef is not initialized).
|
* case the DNSServiceRef is not initialized).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef *sdRef);
|
DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef *sdRef);
|
||||||
|
|
||||||
/* DNSServiceRegisterRecord
|
/* DNSServiceRegisterRecord
|
||||||
@ -1952,6 +1988,7 @@ typedef void (DNSSD_API *DNSServiceRegisterRecordReply)
|
|||||||
* not initialized).
|
* not initialized).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord
|
DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord
|
||||||
(
|
(
|
||||||
DNSServiceRef sdRef,
|
DNSServiceRef sdRef,
|
||||||
@ -2001,6 +2038,7 @@ DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
|
DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
|
||||||
(
|
(
|
||||||
DNSServiceFlags flags,
|
DNSServiceFlags flags,
|
||||||
@ -2184,6 +2222,7 @@ typedef void (DNSSD_API *DNSServiceNATPortMappingReply)
|
|||||||
* display) then pass zero for protocol, internalPort, externalPort and ttl.
|
* display) then pass zero for protocol, internalPort, externalPort and ttl.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceNATPortMappingCreate
|
DNSServiceErrorType DNSSD_API DNSServiceNATPortMappingCreate
|
||||||
(
|
(
|
||||||
DNSServiceRef *sdRef,
|
DNSServiceRef *sdRef,
|
||||||
@ -2230,6 +2269,7 @@ DNSServiceErrorType DNSSD_API DNSServiceNATPortMappingCreate
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceConstructFullName
|
DNSServiceErrorType DNSSD_API DNSServiceConstructFullName
|
||||||
(
|
(
|
||||||
char * const fullName,
|
char * const fullName,
|
||||||
@ -2310,6 +2350,7 @@ typedef union _TXTRecordRef_t { char PrivateData[16]; char *ForceNaturalAlignmen
|
|||||||
* the TXTRecordRef.
|
* the TXTRecordRef.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
void DNSSD_API TXTRecordCreate
|
void DNSSD_API TXTRecordCreate
|
||||||
(
|
(
|
||||||
TXTRecordRef *txtRecord,
|
TXTRecordRef *txtRecord,
|
||||||
@ -2328,6 +2369,7 @@ void DNSSD_API TXTRecordCreate
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
void DNSSD_API TXTRecordDeallocate
|
void DNSSD_API TXTRecordDeallocate
|
||||||
(
|
(
|
||||||
TXTRecordRef *txtRecord
|
TXTRecordRef *txtRecord
|
||||||
@ -2371,6 +2413,7 @@ void DNSSD_API TXTRecordDeallocate
|
|||||||
* exceed the available storage.
|
* exceed the available storage.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API TXTRecordSetValue
|
DNSServiceErrorType DNSSD_API TXTRecordSetValue
|
||||||
(
|
(
|
||||||
TXTRecordRef *txtRecord,
|
TXTRecordRef *txtRecord,
|
||||||
@ -2394,6 +2437,7 @@ DNSServiceErrorType DNSSD_API TXTRecordSetValue
|
|||||||
* exist in the TXTRecordRef.
|
* exist in the TXTRecordRef.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
|
DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
|
||||||
(
|
(
|
||||||
TXTRecordRef *txtRecord,
|
TXTRecordRef *txtRecord,
|
||||||
@ -2413,6 +2457,7 @@ DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
|
|||||||
* Returns 0 if the TXTRecordRef is empty.
|
* Returns 0 if the TXTRecordRef is empty.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
uint16_t DNSSD_API TXTRecordGetLength
|
uint16_t DNSSD_API TXTRecordGetLength
|
||||||
(
|
(
|
||||||
const TXTRecordRef *txtRecord
|
const TXTRecordRef *txtRecord
|
||||||
@ -2430,6 +2475,7 @@ uint16_t DNSSD_API TXTRecordGetLength
|
|||||||
* to DNSServiceUpdateRecord().
|
* to DNSServiceUpdateRecord().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
const void * DNSSD_API TXTRecordGetBytesPtr
|
const void * DNSSD_API TXTRecordGetBytesPtr
|
||||||
(
|
(
|
||||||
const TXTRecordRef *txtRecord
|
const TXTRecordRef *txtRecord
|
||||||
@ -2484,6 +2530,7 @@ const void * DNSSD_API TXTRecordGetBytesPtr
|
|||||||
* Otherwise, it returns 0.
|
* Otherwise, it returns 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
int DNSSD_API TXTRecordContainsKey
|
int DNSSD_API TXTRecordContainsKey
|
||||||
(
|
(
|
||||||
uint16_t txtLen,
|
uint16_t txtLen,
|
||||||
@ -2513,6 +2560,7 @@ int DNSSD_API TXTRecordContainsKey
|
|||||||
* For non-empty value, valueLen will be length of value data.
|
* For non-empty value, valueLen will be length of value data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
const void * DNSSD_API TXTRecordGetValuePtr
|
const void * DNSSD_API TXTRecordGetValuePtr
|
||||||
(
|
(
|
||||||
uint16_t txtLen,
|
uint16_t txtLen,
|
||||||
@ -2535,6 +2583,7 @@ const void * DNSSD_API TXTRecordGetValuePtr
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
uint16_t DNSSD_API TXTRecordGetCount
|
uint16_t DNSSD_API TXTRecordGetCount
|
||||||
(
|
(
|
||||||
uint16_t txtLen,
|
uint16_t txtLen,
|
||||||
@ -2580,6 +2629,7 @@ uint16_t DNSSD_API TXTRecordGetCount
|
|||||||
* TXTRecordGetCount()-1.
|
* TXTRecordGetCount()-1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex
|
DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex
|
||||||
(
|
(
|
||||||
uint16_t txtLen,
|
uint16_t txtLen,
|
||||||
@ -2632,6 +2682,7 @@ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex
|
|||||||
* queue param is invalid
|
* queue param is invalid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceSetDispatchQueue
|
DNSServiceErrorType DNSSD_API DNSServiceSetDispatchQueue
|
||||||
(
|
(
|
||||||
DNSServiceRef service,
|
DNSServiceRef service,
|
||||||
@ -2646,6 +2697,7 @@ typedef void (DNSSD_API *DNSServiceSleepKeepaliveReply)
|
|||||||
DNSServiceErrorType errorCode,
|
DNSServiceErrorType errorCode,
|
||||||
void *context
|
void *context
|
||||||
);
|
);
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceSleepKeepalive
|
DNSServiceErrorType DNSSD_API DNSServiceSleepKeepalive
|
||||||
(
|
(
|
||||||
DNSServiceRef *sdRef,
|
DNSServiceRef *sdRef,
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 Apple Inc. All rights reserved.
|
* Copyright (c) 2015-2018 Apple Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DNS_SD_PRIVATE_H
|
#ifndef _DNS_SD_PRIVATE_H
|
||||||
#define _DNS_SD_PRIVATE_H
|
#define _DNS_SD_PRIVATE_H
|
||||||
|
|
||||||
|
#include <dns_sd.h>
|
||||||
|
|
||||||
// Private flags (kDNSServiceFlagsPrivateOne, kDNSServiceFlagsPrivateTwo, kDNSServiceFlagsPrivateThree, kDNSServiceFlagsPrivateFour) from dns_sd.h
|
// Private flags (kDNSServiceFlagsPrivateOne, kDNSServiceFlagsPrivateTwo, kDNSServiceFlagsPrivateThree, kDNSServiceFlagsPrivateFour) from dns_sd.h
|
||||||
enum
|
enum
|
||||||
@ -58,6 +59,7 @@ enum
|
|||||||
* returned to indicate that the calling process does not have entitlements
|
* returned to indicate that the calling process does not have entitlements
|
||||||
* to use this API.
|
* to use this API.
|
||||||
*/
|
*/
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceCreateDelegateConnection(DNSServiceRef *sdRef, int32_t pid, uuid_t uuid);
|
DNSServiceErrorType DNSSD_API DNSServiceCreateDelegateConnection(DNSServiceRef *sdRef, int32_t pid, uuid_t uuid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -77,12 +79,16 @@ DNSServiceErrorType DNSSD_API DNSServiceCreateDelegateConnection(DNSServiceRef *
|
|||||||
* if the daemon is not running. The value of the pid is undefined if the return
|
* if the daemon is not running. The value of the pid is undefined if the return
|
||||||
* value has error.
|
* value has error.
|
||||||
*/
|
*/
|
||||||
|
DNSSD_EXPORT
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceGetPID
|
DNSServiceErrorType DNSSD_API DNSServiceGetPID
|
||||||
(
|
(
|
||||||
uint16_t srcport,
|
uint16_t srcport,
|
||||||
int32_t *pid
|
int32_t *pid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
DNSSD_EXPORT
|
||||||
|
DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser(DNSServiceFlags flags, const char *domain);
|
||||||
|
|
||||||
#define kDNSServiceCompPrivateDNS "PrivateDNS"
|
#define kDNSServiceCompPrivateDNS "PrivateDNS"
|
||||||
#define kDNSServiceCompMulticastDNS "MulticastDNS"
|
#define kDNSServiceCompMulticastDNS "MulticastDNS"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2004-2011 Apple Inc. All rights reserved.
|
* Copyright (c) 2004-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -31,10 +31,6 @@
|
|||||||
|
|
||||||
#include "dns_sd.h"
|
#include "dns_sd.h"
|
||||||
|
|
||||||
#if MDNS_BUILDINGSHAREDLIBRARY || MDNS_BUILDINGSTUBLIBRARY
|
|
||||||
#pragma export on
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// disable warning "conversion from <data> to uint16_t"
|
// disable warning "conversion from <data> to uint16_t"
|
||||||
#pragma warning(disable:4244)
|
#pragma warning(disable:4244)
|
||||||
@ -361,6 +357,14 @@ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex
|
|||||||
#define STRINGIFY_ARGUMENT_WITHOUT_EXPANSION(s) # s
|
#define STRINGIFY_ARGUMENT_WITHOUT_EXPANSION(s) # s
|
||||||
#define STRINGIFY(s) STRINGIFY_ARGUMENT_WITHOUT_EXPANSION(s)
|
#define STRINGIFY(s) STRINGIFY_ARGUMENT_WITHOUT_EXPANSION(s)
|
||||||
|
|
||||||
|
// The "used" variable attribute prevents a non-exported variable from being stripped, even if its visibility is hidden,
|
||||||
|
// e.g., when compiling with -fvisibility=hidden.
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define DNSSD_USED __attribute__((used))
|
||||||
|
#else
|
||||||
|
#define DNSSD_USED
|
||||||
|
#endif
|
||||||
|
|
||||||
// NOT static -- otherwise the compiler may optimize it out
|
// NOT static -- otherwise the compiler may optimize it out
|
||||||
// The "@(#) " pattern is a special prefix the "what" command looks for
|
// The "@(#) " pattern is a special prefix the "what" command looks for
|
||||||
const char VersionString_SCCS_libdnssd[] = "@(#) libdns_sd " STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")";
|
const char VersionString_SCCS_libdnssd[] DNSSD_USED = "@(#) libdns_sd " STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")";
|
||||||
|
@ -1584,7 +1584,6 @@ DNSServiceErrorType DNSSD_API DNSServiceBrowse
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser(DNSServiceFlags flags, const char *domain);
|
|
||||||
DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser(DNSServiceFlags flags, const char *domain)
|
DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser(DNSServiceFlags flags, const char *domain)
|
||||||
{
|
{
|
||||||
DNSServiceErrorType err;
|
DNSServiceErrorType err;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003-2015 Apple Inc. All rights reserved.
|
* Copyright (c) 2003-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -77,6 +77,7 @@ void LogMsg_(const char *format, ...) LOG_HELPER_BODY(MDNS_LOG_MSG)
|
|||||||
void LogOperation_(const char *format, ...) LOG_HELPER_BODY(MDNS_LOG_OPERATION)
|
void LogOperation_(const char *format, ...) LOG_HELPER_BODY(MDNS_LOG_OPERATION)
|
||||||
void LogSPS_(const char *format, ...) LOG_HELPER_BODY(MDNS_LOG_SPS)
|
void LogSPS_(const char *format, ...) LOG_HELPER_BODY(MDNS_LOG_SPS)
|
||||||
void LogInfo_(const char *format, ...) LOG_HELPER_BODY(MDNS_LOG_INFO)
|
void LogInfo_(const char *format, ...) LOG_HELPER_BODY(MDNS_LOG_INFO)
|
||||||
|
void LogDebug_(const char *format, ...) LOG_HELPER_BODY(MDNS_LOG_DEBUG)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MDNS_DEBUGMSGS
|
#if MDNS_DEBUGMSGS
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 4 -*-
|
/* -*- Mode: C; tab-width: 4 -*-
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003-2015 Apple Inc. All rights reserved.
|
* Copyright (c) 2003-2018 Apple Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -41,6 +41,9 @@
|
|||||||
// not fully qualified) with any number of labels e.g., moon, moon.cs, moon.cs.be, etc.
|
// not fully qualified) with any number of labels e.g., moon, moon.cs, moon.cs.be, etc.
|
||||||
mDNSBool AlwaysAppendSearchDomains = mDNSfalse;
|
mDNSBool AlwaysAppendSearchDomains = mDNSfalse;
|
||||||
|
|
||||||
|
// Control enabling ioptimistic DNS
|
||||||
|
mDNSBool EnableAllowExpired = mDNStrue;
|
||||||
|
|
||||||
// Apple-specific functionality, not required for other platforms
|
// Apple-specific functionality, not required for other platforms
|
||||||
#if APPLE_OSX_mDNSResponder
|
#if APPLE_OSX_mDNSResponder
|
||||||
#include <sys/ucred.h>
|
#include <sys/ucred.h>
|
||||||
@ -325,8 +328,8 @@ mDNSlocal void abort_request(request_state *req)
|
|||||||
// Now, if this request_state is not subordinate to some other primary, close file descriptor and discard replies
|
// Now, if this request_state is not subordinate to some other primary, close file descriptor and discard replies
|
||||||
if (!req->primary)
|
if (!req->primary)
|
||||||
{
|
{
|
||||||
if (req->errsd != req->sd) LogOperation("%3d: Removing FD and closing errsd %d", req->sd, req->errsd);
|
if (req->errsd != req->sd) LogDebug("%3d: Removing FD and closing errsd %d", req->sd, req->errsd);
|
||||||
else LogOperation("%3d: Removing FD", req->sd);
|
else LogDebug("%3d: Removing FD", req->sd);
|
||||||
udsSupportRemoveFDFromEventLoop(req->sd, req->platform_data); // Note: This also closes file descriptor req->sd for us
|
udsSupportRemoveFDFromEventLoop(req->sd, req->platform_data); // Note: This also closes file descriptor req->sd for us
|
||||||
if (req->errsd != req->sd) { dnssd_close(req->errsd); req->errsd = req->sd; }
|
if (req->errsd != req->sd) { dnssd_close(req->errsd); req->errsd = req->sd; }
|
||||||
|
|
||||||
@ -1077,7 +1080,7 @@ mDNSlocal void connection_termination(request_state *request)
|
|||||||
mDNSlocal void handle_cancel_request(request_state *request)
|
mDNSlocal void handle_cancel_request(request_state *request)
|
||||||
{
|
{
|
||||||
request_state **req = &all_requests;
|
request_state **req = &all_requests;
|
||||||
LogOperation("%3d: Cancel %08X %08X", request->sd, request->hdr.client_context.u32[1], request->hdr.client_context.u32[0]);
|
LogDebug("%3d: Cancel %08X %08X", request->sd, request->hdr.client_context.u32[1], request->hdr.client_context.u32[0]);
|
||||||
while (*req)
|
while (*req)
|
||||||
{
|
{
|
||||||
if ((*req)->primary == request &&
|
if ((*req)->primary == request &&
|
||||||
@ -1689,7 +1692,7 @@ mDNSlocal mStatus register_service_instance(request_state *request, const domain
|
|||||||
&request->u.servicereg.name, &request->u.servicereg.type, domain,
|
&request->u.servicereg.name, &request->u.servicereg.type, domain,
|
||||||
request->u.servicereg.host.c[0] ? &request->u.servicereg.host : NULL,
|
request->u.servicereg.host.c[0] ? &request->u.servicereg.host : NULL,
|
||||||
request->u.servicereg.port,
|
request->u.servicereg.port,
|
||||||
request->u.servicereg.txtdata, request->u.servicereg.txtlen,
|
mDNSNULL, request->u.servicereg.txtdata, request->u.servicereg.txtlen,
|
||||||
instance->subtypes, request->u.servicereg.num_subtypes,
|
instance->subtypes, request->u.servicereg.num_subtypes,
|
||||||
interfaceID, regservice_callback, instance, request->flags);
|
interfaceID, regservice_callback, instance, request->flags);
|
||||||
|
|
||||||
@ -2166,7 +2169,7 @@ mDNSlocal mStatus add_domain_to_browser(request_state *info, const domainname *d
|
|||||||
{
|
{
|
||||||
domainname tmp;
|
domainname tmp;
|
||||||
ConstructServiceName(&tmp, NULL, &info->u.browser.regtype, &b->domain);
|
ConstructServiceName(&tmp, NULL, &info->u.browser.regtype, &b->domain);
|
||||||
LogInfo("add_domain_to_browser: calling external_start_browsing_for_service()");
|
LogDebug("add_domain_to_browser: calling external_start_browsing_for_service()");
|
||||||
external_start_browsing_for_service(info->u.browser.interface_id, &tmp, kDNSType_PTR, info->flags);
|
external_start_browsing_for_service(info->u.browser.interface_id, &tmp, kDNSType_PTR, info->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3162,7 +3165,7 @@ mDNSlocal mDNSBool RetryQuestionWithSearchDomains(DNSQuestion *question, request
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogInfo("%3d: RetryQuestionWithSearchDomains: Not appending search domains - SuppressQuery %d, SearchListIndex %d, AppendSearchDomains %d", req->sd, AddRecord, question->SearchListIndex, question->AppendSearchDomains);
|
LogDebug("%3d: RetryQuestionWithSearchDomains: Not appending search domains - SuppressQuery %d, SearchListIndex %d, AppendSearchDomains %d", req->sd, AddRecord, question->SearchListIndex, question->AppendSearchDomains);
|
||||||
}
|
}
|
||||||
return mDNSfalse;
|
return mDNSfalse;
|
||||||
}
|
}
|
||||||
@ -3178,10 +3181,11 @@ mDNSlocal void queryrecord_result_reply(mDNS *const m, request_state *req, DNSQu
|
|||||||
|
|
||||||
ConvertDomainNameToCString(answer->name, name);
|
ConvertDomainNameToCString(answer->name, name);
|
||||||
|
|
||||||
LogOperation("%3d: %s(%##s, %s) RESULT %s interface %d: %s", req->sd,
|
LogOperation("%3d: %s(%##s, %s) RESULT %s interface %d: (%s)%s", req->sd,
|
||||||
req->hdr.op == query_request ? "DNSServiceQueryRecord" : "DNSServiceGetAddrInfo",
|
req->hdr.op == query_request ? "DNSServiceQueryRecord" : "DNSServiceGetAddrInfo",
|
||||||
question->qname.c, DNSTypeName(question->qtype), AddRecord ? "ADD" : "RMV",
|
question->qname.c, DNSTypeName(question->qtype), AddRecord ? "ADD" : "RMV",
|
||||||
mDNSPlatformInterfaceIndexfromInterfaceID(m, answer->InterfaceID, mDNSfalse), RRDisplayString(m, answer));
|
mDNSPlatformInterfaceIndexfromInterfaceID(m, answer->InterfaceID, mDNSfalse),
|
||||||
|
MortalityDisplayString(answer->mortality), RRDisplayString(m, answer));
|
||||||
|
|
||||||
len = sizeof(DNSServiceFlags); // calculate reply data length
|
len = sizeof(DNSServiceFlags); // calculate reply data length
|
||||||
len += sizeof(mDNSu32); // interface index
|
len += sizeof(mDNSu32); // interface index
|
||||||
@ -3195,6 +3199,8 @@ mDNSlocal void queryrecord_result_reply(mDNS *const m, request_state *req, DNSQu
|
|||||||
|
|
||||||
if (AddRecord)
|
if (AddRecord)
|
||||||
flags |= kDNSServiceFlagsAdd;
|
flags |= kDNSServiceFlagsAdd;
|
||||||
|
if (answer->mortality == Mortality_Ghost)
|
||||||
|
flags |= kDNSServiceFlagsExpiredAnswer;
|
||||||
if (question->ValidationStatus != 0)
|
if (question->ValidationStatus != 0)
|
||||||
{
|
{
|
||||||
error = kDNSServiceErr_NoError;
|
error = kDNSServiceErr_NoError;
|
||||||
@ -3452,7 +3458,7 @@ mDNSlocal void queryrecord_result_callback(mDNS *const m, DNSQuestion *question,
|
|||||||
// the "core" needs to temporarily turn off SuppressQuery to answer this query.
|
// the "core" needs to temporarily turn off SuppressQuery to answer this query.
|
||||||
if (AddRecord == QC_suppressed)
|
if (AddRecord == QC_suppressed)
|
||||||
{
|
{
|
||||||
LogInfo("queryrecord_result_callback: Suppressed question %##s (%s)", question->qname.c, DNSTypeName(question->qtype));
|
LogDebug("queryrecord_result_callback: Suppressed question %##s (%s)", question->qname.c, DNSTypeName(question->qtype));
|
||||||
queryrecord_result_reply(m, req, question, answer, AddRecord, kDNSServiceErr_NoSuchRecord);
|
queryrecord_result_reply(m, req, question, answer, AddRecord, kDNSServiceErr_NoSuchRecord);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3517,7 +3523,7 @@ mDNSlocal void queryrecord_result_callback(mDNS *const m, DNSQuestion *question,
|
|||||||
// appended .local, we need to see if we need to send an additional query. This should
|
// appended .local, we need to see if we need to send an additional query. This should
|
||||||
// normally happen just once because after we append .local, we ignore all negative
|
// normally happen just once because after we append .local, we ignore all negative
|
||||||
// responses for .local above.
|
// responses for .local above.
|
||||||
LogInfo("queryrecord_result_callback: Retrying question %##s (%s) after appending search domains", question->qname.c, DNSTypeName(question->qtype));
|
LogDebug("queryrecord_result_callback: Retrying question %##s (%s) after appending search domains", question->qname.c, DNSTypeName(question->qtype));
|
||||||
if (RetryQuestionWithSearchDomains(question, req, AddRecord))
|
if (RetryQuestionWithSearchDomains(question, req, AddRecord))
|
||||||
{
|
{
|
||||||
// Note: We need to call SendAdditionalQuery every time after appending a search domain as .local could
|
// Note: We need to call SendAdditionalQuery every time after appending a search domain as .local could
|
||||||
@ -3661,6 +3667,7 @@ mDNSlocal mStatus handle_queryrecord_request(request_state *request)
|
|||||||
q->ReturnIntermed = (flags & kDNSServiceFlagsReturnIntermediates) != 0;
|
q->ReturnIntermed = (flags & kDNSServiceFlagsReturnIntermediates) != 0;
|
||||||
q->SuppressUnusable = (flags & kDNSServiceFlagsSuppressUnusable ) != 0;
|
q->SuppressUnusable = (flags & kDNSServiceFlagsSuppressUnusable ) != 0;
|
||||||
q->TimeoutQuestion = (flags & kDNSServiceFlagsTimeout ) != 0;
|
q->TimeoutQuestion = (flags & kDNSServiceFlagsTimeout ) != 0;
|
||||||
|
q->allowExpired = (EnableAllowExpired && (flags & kDNSServiceFlagsAllowExpiredAnswers) != 0) ? AllowExpired_AllowExpiredAnswers : AllowExpired_None;
|
||||||
q->WakeOnResolve = 0;
|
q->WakeOnResolve = 0;
|
||||||
q->UseBackgroundTrafficClass = (flags & kDNSServiceFlagsBackgroundTrafficClass) != 0;
|
q->UseBackgroundTrafficClass = (flags & kDNSServiceFlagsBackgroundTrafficClass) != 0;
|
||||||
if ((flags & kDNSServiceFlagsValidate) != 0)
|
if ((flags & kDNSServiceFlagsValidate) != 0)
|
||||||
@ -3737,7 +3744,7 @@ mDNSlocal mStatus handle_queryrecord_request(request_state *request)
|
|||||||
LogMcastQ(q, request, q_start);
|
LogMcastQ(q, request, q_start);
|
||||||
if (callExternalHelpers(q->InterfaceID, &q->qname, q->flags))
|
if (callExternalHelpers(q->InterfaceID, &q->qname, q->flags))
|
||||||
{
|
{
|
||||||
LogInfo("handle_queryrecord_request: calling external_start_browsing_for_service()");
|
LogDebug("handle_queryrecord_request: calling external_start_browsing_for_service()");
|
||||||
external_start_browsing_for_service(q->InterfaceID, &q->qname, q->qtype, q->flags);
|
external_start_browsing_for_service(q->InterfaceID, &q->qname, q->qtype, q->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4258,7 +4265,7 @@ mDNSlocal void addrinfo_termination_callback(request_state *request)
|
|||||||
|
|
||||||
if (callExternalHelpers(request->u.addrinfo.interface_id, &request->u.addrinfo.q4.qname, request->flags))
|
if (callExternalHelpers(request->u.addrinfo.interface_id, &request->u.addrinfo.q4.qname, request->flags))
|
||||||
{
|
{
|
||||||
LogInfo("addrinfo_termination_callback: calling external_stop_browsing_for_service() for kDNSServiceType_A record");
|
LogInfo("addrinfo_termination_callback: calling external_stop_browsing_for_service() for A record");
|
||||||
external_stop_browsing_for_service(request->u.addrinfo.interface_id, &request->u.addrinfo.q4.qname, kDNSServiceType_A, request->flags);
|
external_stop_browsing_for_service(request->u.addrinfo.interface_id, &request->u.addrinfo.q4.qname, kDNSServiceType_A, request->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4293,7 +4300,7 @@ mDNSlocal void addrinfo_termination_callback(request_state *request)
|
|||||||
|
|
||||||
if (callExternalHelpers(request->u.addrinfo.interface_id, &request->u.addrinfo.q6.qname, request->flags))
|
if (callExternalHelpers(request->u.addrinfo.interface_id, &request->u.addrinfo.q6.qname, request->flags))
|
||||||
{
|
{
|
||||||
LogInfo("addrinfo_termination_callback: calling external_stop_browsing_for_service() for kDNSServiceType_AAAA record");
|
LogInfo("addrinfo_termination_callback: calling external_stop_browsing_for_service() for AAAA record");
|
||||||
external_stop_browsing_for_service(request->u.addrinfo.interface_id, &request->u.addrinfo.q6.qname, kDNSServiceType_AAAA, request->flags);
|
external_stop_browsing_for_service(request->u.addrinfo.interface_id, &request->u.addrinfo.q6.qname, kDNSServiceType_AAAA, request->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4435,6 +4442,7 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
|
|||||||
request->u.addrinfo.q4.ReturnIntermed = request->u.addrinfo.q6.ReturnIntermed = (flags & kDNSServiceFlagsReturnIntermediates) != 0;
|
request->u.addrinfo.q4.ReturnIntermed = request->u.addrinfo.q6.ReturnIntermed = (flags & kDNSServiceFlagsReturnIntermediates) != 0;
|
||||||
request->u.addrinfo.q4.SuppressUnusable = request->u.addrinfo.q6.SuppressUnusable = (flags & kDNSServiceFlagsSuppressUnusable ) != 0;
|
request->u.addrinfo.q4.SuppressUnusable = request->u.addrinfo.q6.SuppressUnusable = (flags & kDNSServiceFlagsSuppressUnusable ) != 0;
|
||||||
request->u.addrinfo.q4.TimeoutQuestion = request->u.addrinfo.q6.TimeoutQuestion = (flags & kDNSServiceFlagsTimeout ) != 0;
|
request->u.addrinfo.q4.TimeoutQuestion = request->u.addrinfo.q6.TimeoutQuestion = (flags & kDNSServiceFlagsTimeout ) != 0;
|
||||||
|
request->u.addrinfo.q4.allowExpired = request->u.addrinfo.q6.allowExpired = (EnableAllowExpired && (flags & kDNSServiceFlagsAllowExpiredAnswers) != 0) ? AllowExpired_AllowExpiredAnswers : AllowExpired_None;
|
||||||
request->u.addrinfo.q4.WakeOnResolve = request->u.addrinfo.q6.WakeOnResolve = 0;
|
request->u.addrinfo.q4.WakeOnResolve = request->u.addrinfo.q6.WakeOnResolve = 0;
|
||||||
request->u.addrinfo.q4.UseBackgroundTrafficClass = request->u.addrinfo.q6.UseBackgroundTrafficClass = (flags & kDNSServiceFlagsBackgroundTrafficClass) != 0;
|
request->u.addrinfo.q4.UseBackgroundTrafficClass = request->u.addrinfo.q6.UseBackgroundTrafficClass = (flags & kDNSServiceFlagsBackgroundTrafficClass) != 0;
|
||||||
if ((flags & kDNSServiceFlagsValidate) != 0)
|
if ((flags & kDNSServiceFlagsValidate) != 0)
|
||||||
@ -4497,7 +4505,7 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
|
|||||||
LogMcastQ(&request->u.addrinfo.q6, request, q_start);
|
LogMcastQ(&request->u.addrinfo.q6, request, q_start);
|
||||||
if (callExternalHelpers(InterfaceID, &d, flags))
|
if (callExternalHelpers(InterfaceID, &d, flags))
|
||||||
{
|
{
|
||||||
LogInfo("handle_addrinfo_request: calling external_start_browsing_for_service() for kDNSServiceType_AAAA record");
|
LogDebug("handle_addrinfo_request: calling external_start_browsing_for_service() for AAAA record");
|
||||||
external_start_browsing_for_service(InterfaceID, &d, kDNSServiceType_AAAA, flags);
|
external_start_browsing_for_service(InterfaceID, &d, kDNSServiceType_AAAA, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4539,7 +4547,7 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
|
|||||||
|
|
||||||
if (callExternalHelpers(InterfaceID, &d, flags))
|
if (callExternalHelpers(InterfaceID, &d, flags))
|
||||||
{
|
{
|
||||||
LogInfo("addrinfo_termination_callback: calling external_stop_browsing_for_service() for kDNSServiceType_AAAA record");
|
LogInfo("addrinfo_termination_callback: calling external_stop_browsing_for_service() for AAAA record");
|
||||||
external_stop_browsing_for_service(InterfaceID, &d, kDNSServiceType_AAAA, flags);
|
external_stop_browsing_for_service(InterfaceID, &d, kDNSServiceType_AAAA, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4553,7 +4561,7 @@ mDNSlocal mStatus handle_addrinfo_request(request_state *request)
|
|||||||
LogMcastQ(&request->u.addrinfo.q4, request, q_start);
|
LogMcastQ(&request->u.addrinfo.q4, request, q_start);
|
||||||
if (callExternalHelpers(InterfaceID, &d, flags))
|
if (callExternalHelpers(InterfaceID, &d, flags))
|
||||||
{
|
{
|
||||||
LogInfo("handle_addrinfo_request: calling external_start_browsing_for_service() for kDNSServiceType_A record");
|
LogDebug("handle_addrinfo_request: calling external_start_browsing_for_service() for A record");
|
||||||
external_start_browsing_for_service(InterfaceID, &d, kDNSServiceType_A, flags);
|
external_start_browsing_for_service(InterfaceID, &d, kDNSServiceType_A, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4753,7 +4761,7 @@ mDNSlocal void read_msg(request_state *req)
|
|||||||
#if !defined(USE_TCP_LOOPBACK)
|
#if !defined(USE_TCP_LOOPBACK)
|
||||||
got_errfd:
|
got_errfd:
|
||||||
#endif
|
#endif
|
||||||
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]);
|
LogDebug("%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 defined(_WIN32)
|
||||||
if (ioctlsocket(req->errsd, FIONBIO, &opt) != 0)
|
if (ioctlsocket(req->errsd, FIONBIO, &opt) != 0)
|
||||||
#else
|
#else
|
||||||
@ -4952,7 +4960,7 @@ mDNSlocal void request_callback(int fd, short filter, void *info)
|
|||||||
send_all(req->errsd, (const char *)&err_netorder, sizeof(err_netorder));
|
send_all(req->errsd, (const char *)&err_netorder, sizeof(err_netorder));
|
||||||
if (req->errsd != req->sd)
|
if (req->errsd != req->sd)
|
||||||
{
|
{
|
||||||
LogOperation("%3d: Result code socket %d closed %08X %08X (%d)",
|
LogDebug("%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);
|
req->sd, req->errsd, req->hdr.client_context.u32[1], req->hdr.client_context.u32[0], err);
|
||||||
dnssd_close(req->errsd);
|
dnssd_close(req->errsd);
|
||||||
req->errsd = req->sd;
|
req->errsd = req->sd;
|
||||||
@ -5024,7 +5032,7 @@ mDNSlocal void connect_callback(int fd, short filter, void *info)
|
|||||||
|
|
||||||
debugf("LOCAL_PEERCRED %d %u %u %d", xucredlen, x.cr_version, x.cr_uid, x.cr_ngroups);
|
debugf("LOCAL_PEERCRED %d %u %u %d", xucredlen, x.cr_version, x.cr_uid, x.cr_ngroups);
|
||||||
#endif // APPLE_OSX_mDNSResponder
|
#endif // APPLE_OSX_mDNSResponder
|
||||||
LogOperation("%3d: connect_callback: Adding FD for uid %u", request->sd, request->uid);
|
LogDebug("%3d: connect_callback: Adding FD for uid %u", request->sd, request->uid);
|
||||||
udsSupportAddFDToEventLoop(sd, request_callback, request, &request->platform_data);
|
udsSupportAddFDToEventLoop(sd, request_callback, request, &request->platform_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6254,10 +6262,10 @@ struct CompileTimeAssertionChecks_uds_daemon
|
|||||||
// Check our structures are reasonable sizes. Including overly-large buffers, or embedding
|
// Check our structures are reasonable sizes. Including overly-large buffers, or embedding
|
||||||
// other overly-large structures instead of having a pointer to them, can inadvertently
|
// other overly-large structures instead of having a pointer to them, can inadvertently
|
||||||
// cause structure sizes (and therefore memory usage) to balloon unreasonably.
|
// cause structure sizes (and therefore memory usage) to balloon unreasonably.
|
||||||
char sizecheck_request_state [(sizeof(request_state) <= 2954) ? 1 : -1];
|
char sizecheck_request_state [(sizeof(request_state) <= 3696) ? 1 : -1];
|
||||||
char sizecheck_registered_record_entry[(sizeof(registered_record_entry) <= 60) ? 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_service_instance [(sizeof(service_instance) <= 6552) ? 1 : -1];
|
||||||
char sizecheck_browser_t [(sizeof(browser_t) <= 1202) ? 1 : -1];
|
char sizecheck_browser_t [(sizeof(browser_t) <= 1432) ? 1 : -1];
|
||||||
char sizecheck_reply_hdr [(sizeof(reply_hdr) <= 12) ? 1 : -1];
|
char sizecheck_reply_hdr [(sizeof(reply_hdr) <= 12) ? 1 : -1];
|
||||||
char sizecheck_reply_state [(sizeof(reply_state) <= 64) ? 1 : -1];
|
char sizecheck_reply_state [(sizeof(reply_state) <= 64) ? 1 : -1];
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
int InitmDNSCoreReceiveTest(void);
|
int InitmDNSCoreReceiveTest(void);
|
||||||
int ValidQueryReqTest(void);
|
int ValidQueryReqTest(void);
|
||||||
int NullDstQueryReqTest(void);
|
int NullDstQueryReqTest(void);
|
||||||
int ReceiveArpLogMsgTest(void);
|
|
||||||
void InitmDNSStorage(mDNS *const m);
|
void InitmDNSStorage(mDNS *const m);
|
||||||
|
|
||||||
// This DNS message was gleaned from a uDNS query request packet that was captured with Wireshark.
|
// This DNS message was gleaned from a uDNS query request packet that was captured with Wireshark.
|
||||||
@ -46,7 +45,6 @@ UNITTEST_HEADER(mDNSCoreReceiveTest)
|
|||||||
UNITTEST_TEST(InitmDNSCoreReceiveTest)
|
UNITTEST_TEST(InitmDNSCoreReceiveTest)
|
||||||
UNITTEST_TEST(ValidQueryReqTest)
|
UNITTEST_TEST(ValidQueryReqTest)
|
||||||
UNITTEST_TEST(NullDstQueryReqTest)
|
UNITTEST_TEST(NullDstQueryReqTest)
|
||||||
UNITTEST_TEST(ReceiveArpLogMsgTest)
|
|
||||||
UNITTEST_FOOTER
|
UNITTEST_FOOTER
|
||||||
|
|
||||||
UNITTEST_HEADER(InitmDNSCoreReceiveTest)
|
UNITTEST_HEADER(InitmDNSCoreReceiveTest)
|
||||||
@ -56,16 +54,6 @@ UNITTEST_HEADER(InitmDNSCoreReceiveTest)
|
|||||||
mDNS_PacketLoggingEnabled = 0;
|
mDNS_PacketLoggingEnabled = 0;
|
||||||
UNITTEST_FOOTER
|
UNITTEST_FOOTER
|
||||||
|
|
||||||
UNITTEST_HEADER(ReceiveArpLogMsgTest)
|
|
||||||
// Init unit test environment and verify no error occurred.
|
|
||||||
mStatus result = init_mdns_environment(mDNStrue);
|
|
||||||
UNITTEST_ASSERT(result == mStatus_NoError);
|
|
||||||
|
|
||||||
UNITTEST_ASSERT(result == mStatus_NoError);
|
|
||||||
ArpLogMsgTest(&mDNSStorage, (const ARP_EthIP *) arp_request_packet, primary_interfaceID);
|
|
||||||
UNITTEST_ASSERT(result == mStatus_NoError);
|
|
||||||
UNITTEST_FOOTER
|
|
||||||
|
|
||||||
UNITTEST_HEADER(ValidQueryReqTest)
|
UNITTEST_HEADER(ValidQueryReqTest)
|
||||||
mDNS *const m = &mDNSStorage;
|
mDNS *const m = &mDNSStorage;
|
||||||
mDNSAddr srcaddr, dstaddr;
|
mDNSAddr srcaddr, dstaddr;
|
||||||
@ -73,9 +61,9 @@ UNITTEST_HEADER(ValidQueryReqTest)
|
|||||||
DNSMessage * msg;
|
DNSMessage * msg;
|
||||||
const mDNSu8 * end;
|
const mDNSu8 * end;
|
||||||
|
|
||||||
// This test case does not require setup of interfaces, the record's cache, or pending questions
|
// Init unit test environment and verify no error occurred.
|
||||||
// so m is initialized to all zeros.
|
mStatus result = init_mdns_environment(mDNStrue);
|
||||||
InitmDNSStorage(m);
|
UNITTEST_ASSERT(result == mStatus_NoError);
|
||||||
|
|
||||||
// Used random values for srcaddr and srcport
|
// Used random values for srcaddr and srcport
|
||||||
srcaddr.type = mDNSAddrType_IPv4;
|
srcaddr.type = mDNSAddrType_IPv4;
|
||||||
|
@ -6,12 +6,3 @@ mDNSexport mStatus mDNS_InitStorage_ut(mDNS *const m, mDNS_PlatformSupport *cons
|
|||||||
{
|
{
|
||||||
return mDNS_InitStorage(m, p, rrcachestorage, rrcachesize, AdvertiseLocalAddresses, Callback, Context);
|
return mDNS_InitStorage(m, p, rrcachestorage, rrcachesize, AdvertiseLocalAddresses, Callback, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDNSexport mStatus ArpLogMsgTest(mDNS *const m, const ARP_EthIP *const arp, const mDNSInterfaceID InterfaceID)
|
|
||||||
{
|
|
||||||
NetworkInterfaceInfo *intf = FirstInterfaceForID(m, InterfaceID);
|
|
||||||
static const char msg[] = "ARP Req message";
|
|
||||||
LogMsg("Arp %-7s %s %.6a %.4a for %.4a",
|
|
||||||
intf->ifname, msg, arp->sha.b, arp->spa.b, arp->tpa.b);
|
|
||||||
return mStatus_NoError;
|
|
||||||
}
|
|
||||||
|
@ -51,7 +51,5 @@ extern int LogEtcHosts_ut(mDNS *const m);
|
|||||||
extern mDNSBool mDNSMacOSXCreateEtcHostsEntry_ut(const domainname *domain, const struct sockaddr *sa,
|
extern mDNSBool mDNSMacOSXCreateEtcHostsEntry_ut(const domainname *domain, const struct sockaddr *sa,
|
||||||
const domainname *cname, char *ifname, AuthHash *auth);
|
const domainname *cname, char *ifname, AuthHash *auth);
|
||||||
extern void UpdateEtcHosts_ut(void *context);
|
extern void UpdateEtcHosts_ut(void *context);
|
||||||
extern mStatus ArpLogMsgTest(mDNS *const m, const ARP_EthIP *const arp, const mDNSInterfaceID InterfaceID);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* UNITTEST_COMMON_H */
|
#endif /* UNITTEST_COMMON_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user