From 81ded39a63a8f0ddaf4bbf927a0f437b76091566 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Mon, 10 Jan 2005 01:07:01 +0000 Subject: [PATCH] Synchronize mDNS to Apples 58.8 drop --- src/mDNS.c | 83 ++++++++++++++++++++++++----------- src/mDNSClientAPI.h | 87 +++++++++++++++++++++++++++---------- src/mDNSDebug.h | 7 +-- src/mDNSPlatformFunctions.h | 7 +-- src/mDNSPosix.c | 18 +++----- src/mDNSPosix.h | 7 +-- src/mDNSUNP.c | 7 +-- src/mDNSUNP.h | 12 ++--- 8 files changed, 138 insertions(+), 90 deletions(-) diff --git a/src/mDNS.c b/src/mDNS.c index aa85306b..5bec3377 100644 --- a/src/mDNS.c +++ b/src/mDNS.c @@ -44,11 +44,26 @@ Change History (most recent first): $Log$ -Revision 1.1 2004/03/29 17:55:17 rpedde -Flatten mdns stuff +Revision 1.2 2005/01/10 01:07:00 rpedde +Synchronize mDNS to Apples 58.8 drop -Revision 1.4 2004/03/02 00:14:26 rpedde -Update to mdns 58.3 +Revision 1.307.2.8 2004/04/03 05:18:19 bradley +Added cast to fix signed/unsigned warning due to int promotion. + +Revision 1.307.2.7 2004/03/30 06:46:24 cheshire +Compiler warning fixes from Don Woodward at Roku Labs + +Revision 1.307.2.6 2004/03/09 03:03:38 cheshire + Don't take lock until after mDNS_Update() has validated that the data is good + +Revision 1.307.2.5 2004/03/02 02:55:24 cheshire + Properly support "_services._dns-sd._udp" meta-queries + +Revision 1.307.2.4 2004/02/18 01:55:08 cheshire +: Increase delay to 400ms when answering queries with multi-packet KA lists + +Revision 1.307.2.3 2004/01/28 23:08:45 cheshire +: Hard code domain enumeration functions to return ".local" only Revision 1.307.2.2 2003/12/20 01:51:40 cheshire : Error putting additional records into packets @@ -1102,10 +1117,10 @@ static const mDNSOpaque16 ResponseFlags = { { kDNSFlag0_QR_Response | kDNSFlag0_ static const char *const mDNS_DomainTypeNames[] = { - "_browse._mdns._udp.local.", - "_default._browse._mdns._udp.local.", - "_register._mdns._udp.local.", - "_default._register._mdns._udp.local." + "_browse._dns-sd._udp.local.", + "_default._browse._dns-sd._udp.local.", + "_register._dns-sd._udp.local.", + "_default._register._dns-sd._udp.local." }; #define AssignDomainName(DST, SRC) mDNSPlatformMemCopy((SRC).c, (DST).c, DomainNameLength(&(SRC))) @@ -2195,13 +2210,13 @@ mDNSlocal mDNSu16 GetRDLength(const ResourceRecord *const rr, mDNSBool estimate) const domainname *const name = estimate ? &rr->name : mDNSNULL; switch (rr->rrtype) { - case kDNSType_A: return(sizeof(rd->ip)); break; + case kDNSType_A: return(sizeof(rd->ip)); case kDNSType_CNAME:// Same as PTR case kDNSType_PTR: return(CompressedDomainNameLength(&rd->name, name)); case kDNSType_HINFO:return(mDNSu16)(2 + (int)rd->data[0] + (int)rd->data[1 + (int)rd->data[0]]); case kDNSType_NULL: // Same as TXT -- not self-describing, so have to just trust rdlength case kDNSType_TXT: return(rr->rdlength); // TXT is not self-describing, so have to just trust rdlength - case kDNSType_AAAA: return(sizeof(rd->ipv6)); break; + case kDNSType_AAAA: return(sizeof(rd->ipv6)); case kDNSType_SRV: return(mDNSu16)(6 + CompressedDomainNameLength(&rd->srv.target, name)); default: debugf("Warning! Don't know how to get length of resource type %d", rr->rrtype); return(rr->rdlength); @@ -2775,7 +2790,7 @@ mDNSlocal const mDNSu8 *FindCompressionPointer(const mDNSu8 *const base, const m mDNSlocal mDNSu8 *putDomainNameAsLabels(const DNSMessage *const msg, mDNSu8 *ptr, const mDNSu8 *const limit, const domainname *const name) { - const mDNSu8 *const base = (const mDNSu8 *const)msg; + const mDNSu8 *const base = (const mDNSu8 *)msg; const mDNSu8 * np = name->c; const mDNSu8 *const max = name->c + MAX_DOMAIN_NAME; // Maximum that's valid const mDNSu8 * pointer = mDNSNULL; @@ -3780,7 +3795,7 @@ mDNSlocal mDNSBool AccelerateThisQuery(mDNS *const m, DNSQuestion *q) if (TimeToSendThisQuestion(q, m->timenow + q->ThisQInterval/2)) { // We forecast: qname (n) type (2) class (2) - mDNSu32 forecast = DomainNameLength(&q->qname) + 4; + mDNSu32 forecast = (mDNSu32)DomainNameLength(&q->qname) + 4; CacheRecord *rr; for (rr=m->rrcache_hash[HashSlot(&q->qname)]; rr; rr=rr->next) // If we have a resource record in our cache, if (rr->resrec.rdlength <= SmallRecordLimit && // which is small enough to sensibly fit in the packet @@ -4953,7 +4968,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con CacheRecord **eap = &ExpectedAnswers; DNSQuestion *DupQuestions = mDNSNULL; // Our questions that are identical to questions in this packet DNSQuestion **dqp = &DupQuestions; - mDNSBool delayresponse = mDNSfalse; + mDNSs32 delayresponse = 0; mDNSBool HaveUnicastAnswer = mDNSfalse; const mDNSu8 *ptr = query->data; mDNSu8 *responseptr = mDNSNULL; @@ -4961,7 +4976,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con int i; // If TC flag is set, it means we should expect that additional known answers may be coming in another packet. - if (query->h.flags.b[0] & kDNSFlag0_TC) delayresponse = mDNStrue; + if (query->h.flags.b[0] & kDNSFlag0_TC) delayresponse = mDNSPlatformOneSecond; // Divided by 50 = 20ms // *** // *** 1. Parse Question Section and mark potential answers @@ -5031,7 +5046,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con CacheRecord *rr; // If we couldn't answer this question, someone else might be able to, // so use random delay on response to reduce collisions - if (NumAnswersForThisQuestion == 0) delayresponse = mDNStrue; + if (NumAnswersForThisQuestion == 0) delayresponse = mDNSPlatformOneSecond; // Divided by 50 = 20ms // Make a list indicating which of our own cache records we expect to see updated as a result of this query // Note: Records larger than 1K are not habitually multicast, so don't expect those to be updated @@ -5071,10 +5086,7 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con // *** for (rr = m->ResourceRecords; rr; rr=rr->next) // Now build our list of potential answers if (rr->NR_AnswerTo) // If we marked the record... - { AddRecordToResponseList(&nrp, rr, mDNSNULL); // ... add it to the list - if (rr->resrec.RecordType == kDNSRecordTypeShared) delayresponse = mDNStrue; - } // *** // *** 3. Add additional records @@ -5217,6 +5229,11 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con } } } + if (rr->resrec.RecordType == kDNSRecordTypeShared) + { + if (query->h.flags.b[0] & kDNSFlag0_TC) delayresponse = mDNSPlatformOneSecond * 20; // Divided by 50 = 400ms + else delayresponse = mDNSPlatformOneSecond; // Divided by 50 = 20ms + } } else if (rr->NR_AdditionalTo && rr->NR_AdditionalTo->NR_AnswerTo == (mDNSu8*)~0) { @@ -5232,10 +5249,22 @@ mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, con // *** // *** 7. If we think other machines are likely to answer these questions, set our packet suppression timer // *** - if (delayresponse && !m->SuppressSending) + if (delayresponse && (!m->SuppressSending || (m->SuppressSending - m->timenow) < (delayresponse + 49) / 50)) { - // Pick a random delay between 20ms and 120ms. - m->SuppressSending = m->timenow + (mDNSPlatformOneSecond*2 + (mDNSs32)mDNSRandom((mDNSu32)mDNSPlatformOneSecond*10)) / 100; + // Pick a random delay: + // We start with the base delay chosen above (typically either 1 second or 20 seconds), + // and add a random value in the range 0-5 seconds (making 1-6 seconds or 20-25 seconds). + // This is an integer value, with resolution determined by the platform clock rate. + // We then divide that by 50 to get the delay value in ticks. We defer the division until last + // to get better results on platforms with coarse clock granularity (e.g. ten ticks per second). + // The +49 before dividing is to ensure we round up, not down, to ensure that even + // on platforms where the native clock rate is less than fifty ticks per second, + // we still guarantee that the final calculated delay is at least one platform tick. + // We want to make sure we don't ever allow the delay to be zero ticks, + // because if that happens we'll fail the Rendezvous Conformance Test. + // Our final computed delay is 20-120ms for normal delayed replies, + // or 400-500ms in the case of multi-packet known-answer lists. + m->SuppressSending = m->timenow + (delayresponse + (mDNSs32)mDNSRandom((mDNSu32)mDNSPlatformOneSecond*5) + 49) / 50; if (m->SuppressSending == 0) m->SuppressSending = 1; } @@ -6085,7 +6114,11 @@ mDNSexport mStatus mDNS_GetDomains(mDNS *const m, DNSQuestion *const question, m question->qclass = kDNSClass_IN; question->QuestionCallback = Callback; question->QuestionContext = Context; - return(mDNS_StartQuery(m, question)); + + // No sense doing this until we actually support unicast query/update + //return(mDNS_StartQuery(m, question)); + (void)m; // Unused + return(mStatus_NoError); } // *************************************************************************** @@ -6151,11 +6184,11 @@ mDNSexport mStatus mDNS_Update(mDNS *const m, AuthRecord *const rr, mDNSu32 newt const mDNSu16 newrdlength, RData *const newrdata, mDNSRecordUpdateCallback *Callback) { - mDNS_Lock(m); - if (!ValidateRData(rr->resrec.rrtype, newrdlength, newrdata)) { LogMsg("Attempt to update record with invalid rdata: %s", GetRRDisplayString_rdb(m, &rr->resrec, &newrdata->u)); return(mStatus_Invalid); } + mDNS_Lock(m); + // If TTL is unspecified, leave TTL unchanged if (newttl == 0) newttl = rr->resrec.rroriginalttl; @@ -6638,7 +6671,7 @@ mDNSexport mStatus mDNS_RegisterService(mDNS *const m, ServiceRecordSet *sr, // Set up the record names // For now we only create an advisory record for the main type, not for subtypes // We need to gain some operational experience before we decide if there's a need to create them for subtypes too - if (ConstructServiceName(&sr->RR_ADV.resrec.name, (domainlabel*)"\x09_services", (domainname*)"\x05_mdns\x04_udp", domain) == mDNSNULL) + if (ConstructServiceName(&sr->RR_ADV.resrec.name, (domainlabel*)"\x09_services", (domainname*)"\x07_dns-sd\x04_udp", domain) == mDNSNULL) return(mStatus_BadParamErr); if (ConstructServiceName(&sr->RR_PTR.resrec.name, mDNSNULL, type, domain) == mDNSNULL) return(mStatus_BadParamErr); if (ConstructServiceName(&sr->RR_SRV.resrec.name, name, type, domain) == mDNSNULL) return(mStatus_BadParamErr); diff --git a/src/mDNSClientAPI.h b/src/mDNSClientAPI.h index 10885e8b..151ce044 100644 --- a/src/mDNSClientAPI.h +++ b/src/mDNSClientAPI.h @@ -23,17 +23,28 @@ Change History (most recent first): $Log$ -Revision 1.3 2004/11/11 18:47:25 rpedde -fix typedefs for AMD64 +Revision 1.4 2005/01/10 01:07:01 rpedde +Synchronize mDNS to Apples 58.8 drop -Revision 1.2 2004/09/19 03:03:47 rpedde -Jim Buzbee's ARM patches for NSLU2 +Revision 1.114.2.9 2004/04/22 03:17:35 cheshire +Fix use of "struct __attribute__((__packed__))" so it only applies on GCC >= 2.9 -Revision 1.1 2004/03/29 17:55:17 rpedde -Flatten mdns stuff +Revision 1.114.2.8 2004/03/30 06:55:37 cheshire +Gave name to anonymous struct, to avoid errors on certain compilers. +(Thanks to ramaprasad.kr@hp.com for reporting this.) -Revision 1.2 2004/03/02 00:03:37 rpedde -Merge new rendezvous code +Revision 1.114.2.7 2004/03/09 02:31:27 cheshire +Remove erroneous underscore in 'packed_struct' (makes no difference now, but might in future) + +Revision 1.114.2.6 2004/03/02 02:55:25 cheshire + Properly support "_services._dns-sd._udp" meta-queries + +Revision 1.114.2.5 2004/02/18 23:35:17 cheshire +: Hard code domain enumeration functions to return ".local" only +Also make mDNS_StopGetDomains() a no-op too, so that we don't get warning messages in syslog + +Revision 1.114.2.4 2004/01/28 23:29:20 cheshire +Fix structure packing (only affects third-party Darwin developers) Revision 1.114.2.3 2003/12/05 00:03:34 cheshire Use buffer size MAX_ESCAPED_DOMAIN_NAME instead of 256 @@ -426,15 +437,35 @@ Merge in license terms from Quinn's copy, in preparation for Darwin release // *************************************************************************** // Function scope indicators -// If you see "mDNSlocal" before a function name, it means the function is not callable outside this file +// If you see "mDNSlocal" before a function name in a C file, it means the function is not callable outside this file #ifndef mDNSlocal #define mDNSlocal static #endif -// If you see "mDNSexport" before a symbol, it means the symbol is exported for use by clients +// If you see "mDNSexport" before a symbol in a C file, it means the symbol is exported for use by clients +// For every "mDNSexport" in a C file, there needs to be a corresponding "extern" declaration in some header file +// (When a C file #includes a header file, the "extern" declarations tell the compiler: +// "This symbol exists -- but not necessarily in this C file.") #ifndef mDNSexport #define mDNSexport #endif +// *************************************************************************** +// Structure packing macro + +// If we're not using GNUC, it's not fatal. +// Most compilers naturally pack the on-the-wire structures correctly anyway, so a plain "struct" is usually fine. +// In the event that structures are not packed correctly, mDNS_Init() will detect this and report an error, so the +// developer will know what's wrong, and can investigate what needs to be done on that compiler to provide proper packing. +#ifndef packedstruct + #if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9))) + #define packedstruct struct __attribute__((__packed__)) + #define packedunion union __attribute__((__packed__)) + #else + #define packedstruct struct + #define packedunion union + #endif +#endif + // *************************************************************************** #if 0 #pragma mark - DNS Resource Record class and type constants @@ -492,13 +523,18 @@ typedef signed char mDNSs8; typedef unsigned char mDNSu8; typedef signed short mDNSs16; typedef unsigned short mDNSu16; +#if _LP64 typedef signed int mDNSs32; typedef unsigned int mDNSu32; +#else +typedef signed long mDNSs32; +typedef unsigned long mDNSu32; +#endif // To enforce useful type checking, we make mDNSInterfaceID be a pointer to a dummy struct // This way, mDNSInterfaceIDs can be assigned, and compared with each other, but not with other types // Declaring the type to be the typical generic "void *" would lack this type checking -typedef struct { void *dummy; } *mDNSInterfaceID; +typedef struct mDNSInterfaceID_dummystruct { void *dummy; } *mDNSInterfaceID; // These types are for opaque two- and four-byte identifiers. // The "NotAnInteger" fields of the unions allow the value to be conveniently passed around in a @@ -507,9 +543,9 @@ typedef struct { void *dummy; } *mDNSInterfaceID; // less than, add, multiply, increment, decrement, etc., are undefined for opaque identifiers, // and if you make the mistake of trying to do those using the NotAnInteger field, then you'll // find you get code that doesn't work consistently on big-endian and little-endian machines. -typedef union { mDNSu8 b[2]; mDNSu16 NotAnInteger; } __attribute__ ((packed)) mDNSOpaque16; -typedef union { mDNSu8 b[4]; mDNSu32 NotAnInteger; } __attribute__ ((packed)) mDNSOpaque32; -typedef union { mDNSu8 b[16]; mDNSu16 w[8]; mDNSu32 l[4]; } __attribute__ ((packed)) mDNSOpaque128; +typedef packedunion { mDNSu8 b[2]; mDNSu16 NotAnInteger; } mDNSOpaque16; +typedef packedunion { mDNSu8 b[4]; mDNSu32 NotAnInteger; } mDNSOpaque32; +typedef packedunion { mDNSu8 b[16]; mDNSu16 w[8]; mDNSu32 l[4]; } mDNSOpaque128; typedef mDNSOpaque16 mDNSIPPort; // An IP port is a two-byte opaque identifier (not an integer) typedef mDNSOpaque32 mDNSv4Addr; // An IP address is a four-byte opaque identifier (not an integer) @@ -527,7 +563,7 @@ typedef struct { mDNSs32 type; union { mDNSv6Addr v6; mDNSv4Addr v4; } ip; - } __attribute__ ((packed)) mDNSAddr; + } mDNSAddr; enum { mDNSfalse = 0, mDNStrue = 1 }; @@ -677,8 +713,8 @@ enum kDNSRecordTypePacketUniqueMask = 0x20 // True for PacketAddUnique and PacketAnsUnique }; -typedef struct { mDNSu16 priority; mDNSu16 weight; mDNSIPPort port; domainname target; } __attribute__ ((packed)) rdataSRV; -typedef struct { mDNSu16 preference; domainname exchange; } __attribute__ ((packed)) rdataMX; +typedef packedstruct { mDNSu16 priority; mDNSu16 weight; mDNSIPPort port; domainname target; } rdataSRV; +typedef packedstruct { mDNSu16 preference; domainname exchange; } rdataMX; // StandardAuthRDSize is 264 (256+8), which is large enough to hold a maximum-sized SRV record // MaximumRDSize is 8K the absolute maximum we support (at least for now) @@ -881,7 +917,7 @@ struct ServiceRecordSet_struct AuthRecord *SubTypes; mDNSBool Conflict; // Set if this record set was forcibly deregistered because of a conflict domainname Host; // Set if this service record does not use the standard target host name - AuthRecord RR_ADV; // e.g. _services._mdns._udp.local. PTR _printer._tcp.local. + AuthRecord RR_ADV; // e.g. _services._dns-sd._udp.local. PTR _printer._tcp.local. AuthRecord RR_PTR; // e.g. _printer._tcp.local. PTR Name._printer._tcp.local. AuthRecord RR_SRV; // e.g. Name._printer._tcp.local. SRV 0 0 port target AuthRecord RR_TXT; // e.g. Name._printer._tcp.local. TXT PrintQueueName @@ -914,8 +950,8 @@ struct DNSQuestion_struct // Internal state fields. These are used internally by mDNSCore; the client layer needn't be concerned with them. DNSQuestion *next; mDNSu32 qnamehash; - mDNSs32 LastQTime; // Last scheduled tranmission of this Q on *all* applicable interfaces - mDNSs32 ThisQInterval; // LastQTime + ThisQInterval is the next scheduled tranmission of this Q + mDNSs32 LastQTime; // Last scheduled transmission of this Q on *all* applicable interfaces + mDNSs32 ThisQInterval; // LastQTime + ThisQInterval is the next scheduled transmission of this Q // ThisQInterval > 0 for an active question; // ThisQInterval = 0 for a suspended question that's still in the list // ThisQInterval = -1 for a cancelled question that's been removed from the list @@ -1097,6 +1133,7 @@ extern const mDNSAddr AllDNSLinkGroup_v6; // the appropriate steps to manually create the correct address records for those other machines. // In principle, a proxy-like registration service could manually create address records for its own machine too, // but this would be pointless extra effort when using mDNS_Init_AdvertiseLocalAddresses does that for you. +// // When mDNS has finished setting up the client's callback is called // A client can also spin and poll the mDNSPlatformStatus field to see when it changes from mStatus_Waiting to mStatus_NoError // @@ -1122,6 +1159,7 @@ extern mStatus mDNS_Init (mDNS *const m, mDNS_PlatformSupport *const p, CacheRecord *rrcachestorage, mDNSu32 rrcachesize, mDNSBool AdvertiseLocalAddresses, mDNSCallback *Callback, void *Context); +// See notes above on use of NoCache/ZeroCacheSize #define mDNS_Init_NoCache mDNSNULL #define mDNS_Init_ZeroCacheSize 0 // See notes above on use of Advertise/DontAdvertiseLocalAddresses @@ -1211,7 +1249,10 @@ typedef enum } mDNS_DomainType; extern mStatus mDNS_GetDomains(mDNS *const m, DNSQuestion *const question, mDNS_DomainType DomainType, const mDNSInterfaceID InterfaceID, mDNSQuestionCallback *Callback, void *Context); -#define mDNS_StopGetDomains mDNS_StopQuery +// In the Panther mDNSResponder we don't do unicast queries yet, so there's no point trying to do domain enumeration +// mDNS_GetDomains() and mDNS_StopGetDomains() are set to be no-ops so that clients don't try to do browse/register operations that will fail +//#define mDNS_StopGetDomains mDNS_StopQuery +#define mDNS_StopGetDomains(m,q) ((void)(m),(void)(q)) extern mStatus mDNS_AdvertiseDomains(mDNS *const m, AuthRecord *rr, mDNS_DomainType DomainType, const mDNSInterfaceID InterfaceID, char *domname); #define mDNS_StopAdvertiseDomains mDNS_Deregister @@ -1310,7 +1351,7 @@ extern void IncrementLabelSuffix(domainlabel *name, mDNSBool RichText); // The definitions are placed here because sometimes clients do use these calls indirectly, via other supported client operations. // For example, AssignDomainName is a macro defined using mDNSPlatformMemCopy() -typedef struct +typedef packedstruct { mDNSOpaque16 id; mDNSOpaque16 flags; @@ -1325,7 +1366,7 @@ typedef struct // 40 (IPv6 header) + 8 (UDP header) + 12 (DNS message header) + 1440 (DNS message body) = 1500 total #define AbsoluteMaxDNSMessageData 8940 #define NormalMaxDNSMessageData 1440 -typedef struct +typedef packedstruct { DNSMessageHeader h; // Note: Size 12 bytes mDNSu8 data[AbsoluteMaxDNSMessageData]; // 40 (IPv6) + 8 (UDP) + 12 (DNS header) + 8940 (data) = 9000 diff --git a/src/mDNSDebug.h b/src/mDNSDebug.h index 452d1a9e..ae31d0c3 100644 --- a/src/mDNSDebug.h +++ b/src/mDNSDebug.h @@ -23,11 +23,8 @@ Change History (most recent first): $Log$ -Revision 1.1 2004/03/29 17:55:17 rpedde -Flatten mdns stuff - -Revision 1.2 2004/03/02 00:03:37 rpedde -Merge new rendezvous code +Revision 1.2 2005/01/10 01:07:01 rpedde +Synchronize mDNS to Apples 58.8 drop Revision 1.14 2003/08/12 19:56:24 cheshire Update to APSL 2.0 diff --git a/src/mDNSPlatformFunctions.h b/src/mDNSPlatformFunctions.h index 1364ee16..6fff2006 100644 --- a/src/mDNSPlatformFunctions.h +++ b/src/mDNSPlatformFunctions.h @@ -23,11 +23,8 @@ Change History (most recent first): $Log$ -Revision 1.1 2004/03/29 17:55:17 rpedde -Flatten mdns stuff - -Revision 1.2 2004/03/02 00:03:37 rpedde -Merge new rendezvous code +Revision 1.2 2005/01/10 01:07:01 rpedde +Synchronize mDNS to Apples 58.8 drop Revision 1.22.2.1 2003/12/05 00:03:34 cheshire Use buffer size MAX_ESCAPED_DOMAIN_NAME instead of 256 diff --git a/src/mDNSPosix.c b/src/mDNSPosix.c index d1d795b5..9e4a9af7 100644 --- a/src/mDNSPosix.c +++ b/src/mDNSPosix.c @@ -36,20 +36,11 @@ Change History (most recent first): $Log$ -Revision 1.4 2004/11/29 05:55:45 rpedde -Fix for OpenBSD +Revision 1.5 2005/01/10 01:07:01 rpedde +Synchronize mDNS to Apples 58.8 drop -Revision 1.3 2004/11/13 07:14:26 rpedde -modularize debugging statements - -Revision 1.2 2004/10/25 04:51:54 rpedde -tune down some of the logging - -Revision 1.1 2004/03/29 17:55:17 rpedde -Flatten mdns stuff - -Revision 1.4 2004/03/02 00:03:37 rpedde -Merge new rendezvous code +Revision 1.25.2.1 2004/04/09 17:57:31 cheshire +Make sure to set the TxAndRx field so that duplicate suppression works correctly Revision 1.25 2003/10/30 19:25:49 cheshire Fix signed/unsigned warning on certain compilers @@ -710,6 +701,7 @@ static int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, const cha // Set up the fields required by the mDNS core. SockAddrTomDNSAddr(intfAddr, &intf->coreIntf.ip, NULL); intf->coreIntf.Advertise = m->AdvertiseLocalAddresses; + intf->coreIntf.TxAndRx = mDNStrue; // Set up the extra fields in PosixNetworkInterface. assert(intf->intfName != NULL); // intf->intfName already set up above diff --git a/src/mDNSPosix.h b/src/mDNSPosix.h index 6a3407e4..7c56c8d4 100644 --- a/src/mDNSPosix.h +++ b/src/mDNSPosix.h @@ -23,11 +23,8 @@ Change History (most recent first): $Log$ -Revision 1.1 2004/03/29 17:55:17 rpedde -Flatten mdns stuff - -Revision 1.2 2004/03/02 00:03:37 rpedde -Merge new rendezvous code +Revision 1.2 2005/01/10 01:07:01 rpedde +Synchronize mDNS to Apples 58.8 drop Revision 1.9 2003/10/30 19:25:19 cheshire Fix warning on certain compilers diff --git a/src/mDNSUNP.c b/src/mDNSUNP.c index 24107049..bb57380f 100644 --- a/src/mDNSUNP.c +++ b/src/mDNSUNP.c @@ -23,11 +23,8 @@ Change History (most recent first): $Log$ -Revision 1.1 2004/03/29 17:55:17 rpedde -Flatten mdns stuff - -Revision 1.3 2004/03/02 00:03:37 rpedde -Merge new rendezvous code +Revision 1.2 2005/01/10 01:07:01 rpedde +Synchronize mDNS to Apples 58.8 drop Revision 1.12 2003/09/02 20:47:13 cheshire Fix signed/unsigned warning diff --git a/src/mDNSUNP.h b/src/mDNSUNP.h index e35e7867..0b9d5f01 100644 --- a/src/mDNSUNP.h +++ b/src/mDNSUNP.h @@ -23,14 +23,8 @@ Change History (most recent first): $Log$ -Revision 1.1 2004/03/29 17:55:17 rpedde -Flatten mdns stuff - -Revision 1.3 2004/03/16 05:11:18 rpedde -Fix obvious typecast bug - -Revision 1.2 2004/03/02 00:03:37 rpedde -Merge new rendezvous code +Revision 1.2 2005/01/10 01:07:01 rpedde +Synchronize mDNS to Apples 58.8 drop Revision 1.8 2003/08/12 19:56:26 cheshire Update to APSL 2.0 @@ -87,7 +81,7 @@ First checkin #define GET_SA_LEN(X) (((struct sockaddr*)&(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : \ ((struct sockaddr*)&(X))->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr)) #else -#define GET_SA_LEN(X) (((struct sockaddr*)&(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr)) +#define GET_SA_LEN(X) ((X).sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr)) #endif #define IFI_NAME 16 /* same as IFNAMSIZ in */