Fixed compile error on OS X: Need to initialize OwnerOptData owner using "zeroOwner...
authorcheshire@apple.com <cheshire@apple.com@214c2c4a-bf3b-4dcf-9390-e4dd3010487d>
Fri, 28 Aug 2009 00:32:41 +0000 (00:32 +0000)
committercheshire@apple.com <cheshire@apple.com@214c2c4a-bf3b-4dcf-9390-e4dd3010487d>
Fri, 28 Aug 2009 00:32:41 +0000 (00:32 +0000)
git-svn-id: http://svn.macosforge.org/repository/mdnsresponder/trunk@6623 214c2c4a-bf3b-4dcf-9390-e4dd3010487d

Clients/dns-sd.c
mDNSCore/mDNS.c
mDNSCore/mDNSDebug.h
mDNSCore/mDNSEmbeddedAPI.h
mDNSMacOSX/mDNSMacOSX.c
mDNSMacOSX/mDNSResponder.xcodeproj/project.pbxproj

index 8995eb0..667670a 100644 (file)
@@ -68,7 +68,7 @@ cl dns-sd.c -I../mDNSShared -DNOT_HAVE_GETOPT ws2_32.lib ..\mDNSWindows\DLL\Rele
 // This also useful to work around link errors when you're working on an older version of Mac OS X,
 // and trying to build a newer version of the "dns-sd" command which uses new API entry points that
 // aren't in the system's /usr/lib/libSystem.dylib.
-//#define TEST_NEW_CLIENTSTUB 1
+#define TEST_NEW_CLIENTSTUB 1
 
 #include <ctype.h>
 #include <stdio.h>                     // For stdout, stderr
@@ -616,6 +616,7 @@ static void DNSSD_API reg_reply(DNSServiceRef sdref, const DNSServiceFlags flags
                printf("Error %d\n", errorCode);
 
        if (!(flags & kDNSServiceFlagsMoreComing)) fflush(stdout);
+       //usleep(260000); stopNow = 1;  // Allow 250ms for service to announce PTR record, then exit
        }
 
 // Output the wire-format domainname pointed to by rd
@@ -939,6 +940,10 @@ static char *gettype(char *buffer, char *typ)
        return(typ);
        }
 
+typedef struct { char i; void *ptr; } atest;
+
+atest *atestp = NULL;
+
 int main(int argc, char **argv)
        {
        DNSServiceErrorType err;
@@ -960,6 +965,10 @@ int main(int argc, char **argv)
        if (sizeof(argv) == 8) printf("Running in 64-bit mode\n");
 #endif
 
+       printf("CMSG_DATA %d\n", (int)CMSG_DATA(0));
+       printf("atestp->ptr %d\n", (int)&atestp->ptr);
+       printf("ALIGN(1) %d\n", (int)ALIGN(1));
+
        // Test code for TXTRecord functions
        //TXTRecordRef txtRecord;
        //TXTRecordCreate(&txtRecord, 0, NULL);
@@ -1063,7 +1072,8 @@ int main(int argc, char **argv)
                                        if (argc < opi+1) goto Fail;
                                        rrtype = (argc <= opi+1) ? kDNSServiceType_A  : GetRRType(argv[opi+1]);
                                        rrclass = (argc <= opi+2) ? kDNSServiceClass_IN : atoi(argv[opi+2]);
-                                       if (rrtype == kDNSServiceType_TXT || rrtype == kDNSServiceType_PTR) flags |= kDNSServiceFlagsLongLivedQuery;
+                                       //if (rrtype == kDNSServiceType_TXT || rrtype == kDNSServiceType_PTR) flags |= kDNSServiceFlagsLongLivedQuery;
+                                       printf("Query %s %d %d not using kDNSServiceFlagsLongLivedQuery\n", argv[opi+0], rrtype, rrclass);
                                        err = DNSServiceQueryRecord(&client, flags, opinterface, argv[opi+0], rrtype, rrclass, qr_reply, NULL);
                                        break;
                                        }
@@ -1189,6 +1199,7 @@ int main(int argc, char **argv)
        // Be sure to deallocate the DNSServiceRef when you're finished
        if (client   ) DNSServiceRefDeallocate(client   );
        if (client_pa) DNSServiceRefDeallocate(client_pa);
+       //usleep(150000);
        return 0;
 
 Fail:
index a6ce307..d9ba660 100755 (executable)
@@ -5416,7 +5416,7 @@ mDNSlocal void mDNSCoreReceiveUpdate(mDNS *const m,
        int i;
        AuthRecord opt;
        mDNSu8 *p = m->omsg.data;
-       OwnerOptData owner = { 0 };
+       OwnerOptData owner = zeroOwner;         // Need to zero this, so we'll know if this Update packet was missing its Owner option
        mDNSu32 updatelease = 0;
        const mDNSu8 *ptr;
 
index 4c8ada9..8bfd982 100755 (executable)
@@ -50,10 +50,10 @@ typedef enum
 
 // Set this symbol to 1 to do extra debug checks on malloc() and free()
 // Set this symbol to 2 to write a log message for every malloc() and free()
-//#define MACOSX_MDNS_MALLOC_DEBUGGING 1
+#define MACOSX_MDNS_MALLOC_DEBUGGING 1
 
-//#define ForceAlerts 1
-//#define LogTimeStamps 1
+#define ForceAlerts 1
+#define LogTimeStamps 1
 
 #define USE_SEPARATE_UDNS_SERVICE_LIST 1
 
index ebe6b28..3ac93f3 100755 (executable)
@@ -1799,7 +1799,7 @@ extern const mDNSOpaque64 zeroOpaque64;
 
 #define localdomain           (*(const domainname *)"\x5" "local")
 #define DeviceInfoName        (*(const domainname *)"\xC" "_device-info" "\x4" "_tcp")
-#define SleepProxyServiceType (*(const domainname *)"\xC" "_sleep-proxy" "\x4" "_udp")
+#define SleepProxyServiceType (*(const domainname *)"\xC" "_xleep-proxy" "\x4" "_udp")
 
 // ***************************************************************************
 #if 0
index d4420d5..6ef2af1 100644 (file)
 // If OfferSleepProxyService is set non-zero (typically via command-line switch),
 // then we'll offer sleep proxy service on desktop Macs that are set to never sleep.
 // We currently do not offer sleep proxy service on laptops, or on machines that are set to go to sleep.
-mDNSexport int OfferSleepProxyService = 0;
+mDNSexport int OfferSleepProxyService = 95;
 
 mDNSexport int OSXVers;
 mDNSexport int KQueueFD;
@@ -2617,7 +2617,6 @@ mDNSexport void AutoTunnelCallback(mDNS *const m, DNSQuestion *question, const R
                }
        else if (question->qtype == kDNSType_A)
                {
-               ClientTunnel *old = mDNSNULL;
                LogInfo("AutoTunnelCallback: SRV target addr %.4a", &answer->rdata->u.ipv4);
                question->ThisQInterval = -1;           // So we know this tunnel setup has completed
                tun->rmt_outer = answer->rdata->u.ipv4;
@@ -2636,9 +2635,9 @@ mDNSexport void AutoTunnelCallback(mDNS *const m, DNSQuestion *question, const R
                        if (!mDNSSameClientTunnel(&(*p)->rmt_inner, &tun->rmt_inner)) p = &(*p)->next;
                        else
                                {
-                               LogInfo("Found existing AutoTunnel for %##s %.16a", tun->dstname.c, &tun->rmt_inner);
-                               old = *p;
+                               ClientTunnel *old = *p;
                                *p = old->next;
+                               LogInfo("Found existing AutoTunnel for %##s %.16a", tun->dstname.c, &tun->rmt_inner);
                                if (old->q.ThisQInterval >= 0) mDNS_StopQuery(m, &old->q);
                                else if (!mDNSSameIPv6Address(old->loc_inner, tun->loc_inner) ||
                                                 !mDNSSameIPv4Address(old->loc_outer, tun->loc_outer) ||
index 193dfa6..471270e 100644 (file)
                08FB7793FE84155DC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = D284BE2B0ADD78180027CCDF /* Build configuration list for PBXProject "mDNSResponder" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        mainGroup = 08FB7794FE84155DC02AAC07 /* mDNSResponder */;
                        projectDirPath = "";
                D284BE2C0ADD78180027CCDF /* Development */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               ARCHS = (
+                                       ppc,
+                                       i386,
+                               );
                                CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
                                DEAD_CODE_STRIPPING = YES;
                                GCC_PREPROCESSOR_DEFINITIONS = (
                                GCC_ENABLE_FIX_AND_CONTINUE = NO;
                                GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
                                INSTALL_PATH = "/Library/Application Support/Bonjour";
-                               MACOSX_DEPLOYMENT_TARGET = "";
+                               MACOSX_DEPLOYMENT_TARGET = 10.4;
                                OTHER_CFLAGS = "";
                                OTHER_LDFLAGS = "";
                                OTHER_REZFLAGS = "";
                                GCC_SYMBOLS_PRIVATE_EXTERN = NO;
                                INFOPLIST_FILE = "PreferencePane/Info-PreferencePane.plist";
                                INSTALL_PATH = /AppleInternal/Library/PreferencePanes;
-                               MACOSX_DEPLOYMENT_TARGET = "";
+                               MACOSX_DEPLOYMENT_TARGET = 10.4;
                                OTHER_CFLAGS = "";
                                OTHER_LDFLAGS = "-twolevel_namespace";
                                OTHER_REZFLAGS = "";