]> git.saurik.com Git - apple/mdnsresponder.git/commitdiff
mDNSResponder-1096.60.2.tar.gz macos-10152 macos-10153 v1096.60.2
authorApple <opensource@apple.com>
Thu, 2 Apr 2020 23:40:12 +0000 (23:40 +0000)
committerApple <opensource@apple.com>
Thu, 2 Apr 2020 23:40:12 +0000 (23:40 +0000)
13 files changed:
Clients/dnssdutil/TestUtils.h [new file with mode: 0644]
Clients/dnssdutil/TestUtils.m [new file with mode: 0644]
Clients/dnssdutil/dnssdutil-entitlements.plist
Clients/dnssdutil/dnssdutil.c
Makefile
mDNSMacOSX/Bonjour Safari Extension/CNServiceBrowserView.m
mDNSMacOSX/Tests/Unit Tests/PathEvaluationTest.m [new file with mode: 0644]
mDNSMacOSX/Tests/mDNSResponder.plist
mDNSMacOSX/mDNSResponder.xcodeproj/project.pbxproj
mDNSMacOSX/uDNSPathEvalulation.c
mDNSShared/dns_sd.h
unittests/mdns_macosx_ut.c
unittests/unittest_common.h

diff --git a/Clients/dnssdutil/TestUtils.h b/Clients/dnssdutil/TestUtils.h
new file mode 100644 (file)
index 0000000..c263164
--- /dev/null
@@ -0,0 +1,26 @@
+//
+//  TestUtils.h
+//  mDNSResponder
+//
+//  Copyright (c) 2019 Apple Inc. All rights reserved.
+//
+
+#ifndef    __TestUtils_h
+#define    __TestUtils_h
+
+#include <TargetConditionals.h>
+#include <MacTypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DNSSDUTIL_XCTEST "DNSSDUTIL_XCTEST"
+
+Boolean TestUtilsRunXCTestNamed(const char * classname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TestUtils_h
diff --git a/Clients/dnssdutil/TestUtils.m b/Clients/dnssdutil/TestUtils.m
new file mode 100644 (file)
index 0000000..00b3c4c
--- /dev/null
@@ -0,0 +1,65 @@
+//
+//  TestUtils.m
+//  mDNSResponder
+//
+//  Copyright (c) 2019 Apple Inc. All rights reserved.
+//
+
+#import "TestUtils.h"
+
+#import <Foundation/Foundation.h>
+#import <CoreUtils/CoreUtils.h>
+#import <XCTest/XCTest.h>
+
+#if TARGET_OS_OSX
+#define XCTest_Framework_Runtime_Path       "/AppleInternal/Developer/Library/Frameworks/XCTest.framework"
+#else
+#define XCTest_Framework_Runtime_Path       "/Developer/Library/Frameworks/XCTest.framework"
+#endif
+
+//===========================================================================================================================
+//    XCTest Utils
+//===========================================================================================================================
+static NSBundle * LoadXCTestFramework()
+{
+    NSBundle * result = nil;
+    Boolean loaded = (NSClassFromString(@"XCTestSuite") != nil);
+
+    if(!result) {
+        result = [NSBundle bundleWithPath: @ XCTest_Framework_Runtime_Path];
+        [result load];
+        loaded = (NSClassFromString(@"XCTestSuite") != nil);
+        if( !loaded ) {
+            FPrintF( stdout, "Failed to load XCTest framework from: %s\n", XCTest_Framework_Runtime_Path );
+        }
+    }
+
+    return( result );
+}
+
+//===========================================================================================================================
+//    Main Test Running
+//===========================================================================================================================
+
+Boolean TestUtilsRunXCTestNamed(const char * classname)
+{
+    Boolean     result = false;
+    NSBundle *  xctestFramework = LoadXCTestFramework();
+
+    if(xctestFramework) {
+        NSString *  name = [NSString stringWithUTF8String: classname];
+        NSBundle *  testBundle = [NSBundle bundleWithPath: @"/AppleInternal/XCTests/com.apple.mDNSResponder/Tests.xctest"];
+        [testBundle load];
+
+        XCTestSuite *   compiledSuite = [NSClassFromString(@"XCTestSuite") testSuiteForTestCaseWithName: name];
+        if(compiledSuite.tests.count) {
+            [compiledSuite runTest];
+            XCTestRun *testRun = compiledSuite.testRun;
+            result = (testRun.hasSucceeded != NO);
+        } else {
+            FPrintF( stdout, "Test class %s not found\n", classname );
+        }
+    }
+
+    return( result );
+}
index 8be57049d245b3b8e140f2e43bfa020ead55dc26..47eba9692c3bce6d9eb0557dcacf11b04ac2217d 100644 (file)
@@ -16,5 +16,9 @@
        <array>
                <string>preferences.plist</string>
        </array>
        <array>
                <string>preferences.plist</string>
        </array>
+       <key>com.apple.private.nehelper.privileged</key>
+       <true/>
+       <key>com.apple.networkd_privileged</key>
+       <true/>
 </dict>
 </plist>
 </dict>
 </plist>
index 5ab85965956168a1ddfa3470b3dae39c14af9484..9852be0f80ca071d2d76b3425d078345c3f8d6e9 100644 (file)
@@ -44,6 +44,7 @@
 #if( MDNSRESPONDER_PROJECT )
        #include <dns_services.h>
        #include "mdns_private.h"
 #if( MDNSRESPONDER_PROJECT )
        #include <dns_services.h>
        #include "mdns_private.h"
+    #include "TestUtils.h"
 #endif
 
 //===========================================================================================================================
 #endif
 
 //===========================================================================================================================
@@ -1777,6 +1778,18 @@ static CLIOption        kExpensiveConstrainedTestOpts[] =
     CLI_OPTION_END()
 };
 
     CLI_OPTION_END()
 };
 
+#if( MDNSRESPONDER_PROJECT )
+static void XCTestCmd( void );
+
+static const char *     gXCTest_Classname        = NULL;
+
+static CLIOption        kXCTestOpts[] =
+{
+    StringOption(      'c', "class", &gXCTest_Classname, "classname", "The classname of the XCTest to run (from /AppleInternal/XCTests/com.apple.mDNSResponder/Tests.xctest)", true ),
+    CLI_OPTION_END()
+};
+#endif
+
 static CLIOption               kTestOpts[] =
 {
        Command( "gaiperf",        GAIPerfCmd,           kGAIPerfOpts,            "Runs DNSServiceGetAddrInfo() performance tests.", false ),
 static CLIOption               kTestOpts[] =
 {
        Command( "gaiperf",        GAIPerfCmd,           kGAIPerfOpts,            "Runs DNSServiceGetAddrInfo() performance tests.", false ),
@@ -1785,7 +1798,10 @@ static CLIOption         kTestOpts[] =
        Command( "probeconflicts", ProbeConflictTestCmd, kProbeConflictTestOpts,  "Tests various probing conflict scenarios.", false ),
        Command( "registration",   RegistrationTestCmd,  kRegistrationTestOpts,   "Tests service registrations.", false ),
     Command( "expensive_constrained_updates", ExpensiveConstrainedTestCmd, kExpensiveConstrainedTestOpts, "Tests if the mDNSResponder can handle expensive and constrained property change correctly", false),
        Command( "probeconflicts", ProbeConflictTestCmd, kProbeConflictTestOpts,  "Tests various probing conflict scenarios.", false ),
        Command( "registration",   RegistrationTestCmd,  kRegistrationTestOpts,   "Tests service registrations.", false ),
     Command( "expensive_constrained_updates", ExpensiveConstrainedTestCmd, kExpensiveConstrainedTestOpts, "Tests if the mDNSResponder can handle expensive and constrained property change correctly", false),
-       CLI_OPTION_END()
+#if( MDNSRESPONDER_PROJECT )
+    Command( "xctest",         XCTestCmd,            kXCTestOpts,              "Run a XCTest from /AppleInternal/XCTests/com.apple.mDNSResponder/Tests.xctest.", true ),
+#endif
+    CLI_OPTION_END()
 };
 
 //===========================================================================================================================
 };
 
 //===========================================================================================================================
@@ -18190,6 +18206,21 @@ static void    _DNSProxyCmdSignalHandler( void *inContext )
        exit( 0 );
 }
 
        exit( 0 );
 }
 
+//===========================================================================================================================
+//    XCTestCmd
+//===========================================================================================================================
+
+static void    XCTestCmd( void )
+{
+    int result = 0;
+    setenv(DNSSDUTIL_XCTEST, DNSSDUTIL_XCTEST, 0);
+    if(!TestUtilsRunXCTestNamed(gXCTest_Classname)) {
+        result = 1;
+    }
+    unsetenv(DNSSDUTIL_XCTEST);
+    exit( result );
+}
+
 #endif // MDNSRESPONDER_PROJECT
 
 //===========================================================================================================================
 #endif // MDNSRESPONDER_PROJECT
 
 //===========================================================================================================================
index 88f994207d164425c31c2ac794a2b9cb5811e637..f2d76458aed8fc82b4f8f3ef94a74fe39b72e5ee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
 
 include $(MAKEFILEPATH)/pb_makefiles/platform.make
 
 
 include $(MAKEFILEPATH)/pb_makefiles/platform.make
 
-MVERS = "mDNSResponder-1096.40.7"
+MVERS = "mDNSResponder-1096.60.2"
 
 VER =
 ifneq ($(strip $(GCC_VERSION)),)
 
 VER =
 ifneq ($(strip $(GCC_VERSION)),)
index 3adc6246cc9db7527a0c2b9b197804e4d0c8b3eb..452caf8af8c3b00df37330e4338ee74ed6e2f09d 100644 (file)
@@ -578,7 +578,7 @@ static void resolveReply( DNSServiceRef sdRef,
             const u_char *  valuePtr = TXTRecordGetValuePtr( txtLen, txtRecord, "path", &valueLen );
             urlComponents.path = (__bridge_transfer NSString *)CFStringCreateWithBytes( kCFAllocatorDefault, valuePtr, valueLen, kCFStringEncodingUTF8, false );
         }
             const u_char *  valuePtr = TXTRecordGetValuePtr( txtLen, txtRecord, "path", &valueLen );
             urlComponents.path = (__bridge_transfer NSString *)CFStringCreateWithBytes( kCFAllocatorDefault, valuePtr, valueLen, kCFStringEncodingUTF8, false );
         }
-        if( port ) urlComponents.port = [NSNumber numberWithShort: NTOHS( port )];
+        if( port ) urlComponents.port = [NSNumber numberWithUnsignedShort: ntohs( port )];
         record[_CNInstanceKey_resolveUrl] = urlComponents.URL;
     }
 }
         record[_CNInstanceKey_resolveUrl] = urlComponents.URL;
     }
 }
diff --git a/mDNSMacOSX/Tests/Unit Tests/PathEvaluationTest.m b/mDNSMacOSX/Tests/Unit Tests/PathEvaluationTest.m
new file mode 100644 (file)
index 0000000..0371086
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2019 Apple Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "unittest_common.h"
+#import <XCTest/XCTest.h>
+
+#import <NetworkExtension/NEPolicySession.h>
+
+@interface PathEvaluationTest : XCTestCase
+{
+}
+@end
+
+@implementation PathEvaluationTest
+
+- (void)setUp
+{
+    mDNSPlatformMemZero(&mDNSStorage, sizeof(mDNS));
+    init_mdns_environment(mDNStrue);
+}
+
+- (void)tearDown
+{
+}
+
+- (void)testPathDeny
+{
+    if(!getenv("DNSSDUTIL_XCTEST")) return;   //   Don't run without this environment variable
+    mDNSBool        isBlocked;
+    DNSQuestion     q;
+    mDNSInterfaceID routableIndex;
+
+    mDNSPlatformMemZero(&q, sizeof(DNSQuestion));
+    q.TargetQID.NotAnInteger = 1;
+    q.pid = getpid();
+    q.InterfaceID = if_nametoindex( "pdp_ip0" );
+    fprintf(stdout, "%s %s with cellular index %d named pdp_ip0\n", q.InterfaceID ? "Starting" : "Exiting (no cellular interface)", __FUNCTION__, q.InterfaceID);
+    if (!q.InterfaceID) return;
+
+    routableIndex = IndexForInterfaceByName_ut( "pdp_ip0" );
+    fprintf(stdout, "Testing blocked by (%s)\n", routableIndex ? "policy" : "no route");
+
+    mDNSPlatformGetDNSRoutePolicy(&q, &isBlocked);
+    XCTAssertFalse(isBlocked);
+
+    // Now block it
+    NSMutableArray *routeRules = [NSMutableArray array];
+    NEPolicyRouteRule *routeRule = [NEPolicyRouteRule routeRuleWithAction:NEPolicyRouteRuleActionDeny forType:NEPolicyRouteRuleTypeCellular];
+    [routeRules addObject:routeRule];
+    routeRule = [NEPolicyRouteRule routeRuleWithAction:NEPolicyRouteRuleActionDeny forType:NEPolicyRouteRuleTypeWiFi];
+    [routeRules addObject:routeRule];
+    routeRule = [NEPolicyRouteRule routeRuleWithAction:NEPolicyRouteRuleActionDeny forType:NEPolicyRouteRuleTypeWired];
+    [routeRules addObject:routeRule];
+
+    NEPolicyResult *result = [NEPolicyResult routeRules:routeRules];
+    NEPolicy *policy = [[NEPolicy alloc] initWithOrder:1 result:result  conditions:@[ [NEPolicyCondition effectivePID:q.pid], [NEPolicyCondition allInterfaces] ]];
+
+    NEPolicySession  *policySession = [[NEPolicySession alloc] init];
+    XCTAssertNotNil(policySession, "Check entitlemnts");
+    [policySession addPolicy:policy];
+    [policySession apply];
+
+    mDNSPlatformGetDNSRoutePolicy(&q, &isBlocked);
+    //  Either if these asserts indicate a regression in mDNSPlatformGetDNSRoutePolicy
+    if (routableIndex)  XCTAssertTrue(isBlocked, "blocked by (policy) test failure");
+    else                XCTAssertFalse(isBlocked, "blocked by (no route) test failure");
+
+    [policySession removeAllPolicies];
+    [policySession apply];
+    fprintf(stdout, "Completed %s\n", __FUNCTION__);
+}
+
+@end
index 7c6d64854b8ebd5b93ccec9febc87e604ea4734d..5007abf5bff1e99daa9999a4a98f8994ca00ef57 100644 (file)
                                <string>mDNSResponder</string>
                        </array>
                </dict>
                                <string>mDNSResponder</string>
                        </array>
                </dict>
-               <dict>
-                       <key>TestName</key>
-                       <string>XCTests</string>
-                       <key>Description</key>
-                       <string>mDNSResponder XCTests</string>
-                       <key>WorkingDirectory</key>
-                       <string>/AppleInternal/XCTests/com.apple.mDNSResponder/</string>
-                       <key>AsRoot</key>
-                       <false/>
-                       <key>RequiresWiFi</key>
-                       <true/>
-                       <key>Timeout</key>
-                       <integer>20</integer>
-                       <key>ShowSubtestResults</key>
-                       <true/>
-                       <key>Command</key>
-                       <array>
-                               <string>BATS_XCTEST_CMD</string>
-                               <string>-NSTreatUnknownArgumentsAsOpen</string>
-                               <string>NO</string>
-                               <string>-ApplePersistenceIgnoreState</string>
-                               <string>YES</string>
-                               <string>-XCTest</string>
-                               <string>Self</string>
-                               <string>Tests.xctest</string>
-                       </array>
-               </dict>
                <dict>
                        <key>TestName</key>
                        <string>Fix Verification #1</string>
                <dict>
                        <key>TestName</key>
                        <string>Fix Verification #1</string>
                                <string>mDNSResponder</string>
                        </array>
                </dict>
                                <string>mDNSResponder</string>
                        </array>
                </dict>
+               <dict>
+                       <key>TestName</key>
+                       <string>XCTests</string>
+                       <key>Description</key>
+                       <string>mDNSResponder XCTests</string>
+                       <key>WorkingDirectory</key>
+                       <string>/AppleInternal/XCTests/com.apple.mDNSResponder/</string>
+                       <key>AsRoot</key>
+                       <false/>
+                       <key>RequiresWiFi</key>
+                       <true/>
+                       <key>Timeout</key>
+                       <integer>20</integer>
+                       <key>ShowSubtestResults</key>
+                       <true/>
+                       <key>Command</key>
+                       <array>
+                               <string>BATS_XCTEST_CMD</string>
+                               <string>-NSTreatUnknownArgumentsAsOpen</string>
+                               <string>NO</string>
+                               <string>-ApplePersistenceIgnoreState</string>
+                               <string>YES</string>
+                               <string>-XCTest</string>
+                               <string>Self</string>
+                               <string>Tests.xctest</string>
+                       </array>
+               </dict>
+               <dict>
+                       <key>TestName</key>
+                       <string>PathEvaluationTest</string>
+                       <key>Description</key>
+                       <string>PathEvaluationTest from Tests.xctest</string>
+                       <key>AsRoot</key>
+                       <false/>
+                       <key>RequiresWiFi</key>
+                       <false/>
+                       <key>Timeout</key>
+                       <integer>5</integer>
+                       <key>IgnoreOutput</key>
+                       <false/>
+                       <key>Command</key>
+                       <array>
+                               <string>/usr/local/bin/dnssdutil</string>
+                               <string>test</string>
+                               <string>xctest</string>
+                               <string>-c</string>
+                               <string>PathEvaluationTest</string>
+                       </array>
+               </dict>
        </array>
 </dict>
 </plist>
        </array>
 </dict>
 </plist>
index 8423ab63e8df8d6afd125386ec67ca1a34735a03..5f23f0b4139a0493aa7586f2e38fb9cee3927e5f 100644 (file)
                B7706AAF1DBA9C1800593FD5 /* CNDomainBrowserPathUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = B799209E1DA6BA8E00C6E02B /* CNDomainBrowserPathUtils.m */; };
                B778EE4D1D51113800C814A2 /* HostnameController.m in Sources */ = {isa = PBXBuildFile; fileRef = B778EE4B1D51113800C814A2 /* HostnameController.m */; };
                B778EE501D51287100C814A2 /* BonjourSettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = B778EE4F1D51287100C814A2 /* BonjourSettingsController.m */; };
                B7706AAF1DBA9C1800593FD5 /* CNDomainBrowserPathUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = B799209E1DA6BA8E00C6E02B /* CNDomainBrowserPathUtils.m */; };
                B778EE4D1D51113800C814A2 /* HostnameController.m in Sources */ = {isa = PBXBuildFile; fileRef = B778EE4B1D51113800C814A2 /* HostnameController.m */; };
                B778EE501D51287100C814A2 /* BonjourSettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = B778EE4F1D51287100C814A2 /* BonjourSettingsController.m */; };
+               B77CAFCE234EADE5006706B4 /* PathEvaluationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B77CAFCD234EADE5006706B4 /* PathEvaluationTest.m */; };
+               B77CAFD0234EAE72006706B4 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B77CAFCF234EAE72006706B4 /* NetworkExtension.framework */; };
                B78A9C30223941A900BFB0C6 /* DNSServiceDiscoveryPref.xib in Resources */ = {isa = PBXBuildFile; fileRef = B78A9C2E223941A900BFB0C6 /* DNSServiceDiscoveryPref.xib */; };
                B79568351D53F693005E3BED /* DomainBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = B74EC12B1D494C7200A1D155 /* DomainBrowser.h */; settings = {ATTRIBUTES = (Public, ); }; };
                B79568361D53F69B005E3BED /* CNDomainBrowserView.h in Headers */ = {isa = PBXBuildFile; fileRef = B7D6CA681D1076C6005E24CF /* CNDomainBrowserView.h */; settings = {ATTRIBUTES = (Public, ); }; };
                B78A9C30223941A900BFB0C6 /* DNSServiceDiscoveryPref.xib in Resources */ = {isa = PBXBuildFile; fileRef = B78A9C2E223941A900BFB0C6 /* DNSServiceDiscoveryPref.xib */; };
                B79568351D53F693005E3BED /* DomainBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = B74EC12B1D494C7200A1D155 /* DomainBrowser.h */; settings = {ATTRIBUTES = (Public, ); }; };
                B79568361D53F69B005E3BED /* CNDomainBrowserView.h in Headers */ = {isa = PBXBuildFile; fileRef = B7D6CA681D1076C6005E24CF /* CNDomainBrowserView.h */; settings = {ATTRIBUTES = (Public, ); }; };
                B7EEF7EA212613260093828F /* uds_daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = F525E72804AA167501F1CF4D /* uds_daemon.c */; };
                B7EEF7EC212613D10093828F /* dnsproxy.c in Sources */ = {isa = PBXBuildFile; fileRef = 218E8E4F156D8C0300720DA0 /* dnsproxy.c */; };
                B7EEF7ED212613D50093828F /* DNSProxySupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 21DED43415702C0F0060B6B9 /* DNSProxySupport.c */; };
                B7EEF7EA212613260093828F /* uds_daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = F525E72804AA167501F1CF4D /* uds_daemon.c */; };
                B7EEF7EC212613D10093828F /* dnsproxy.c in Sources */ = {isa = PBXBuildFile; fileRef = 218E8E4F156D8C0300720DA0 /* dnsproxy.c */; };
                B7EEF7ED212613D50093828F /* DNSProxySupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 21DED43415702C0F0060B6B9 /* DNSProxySupport.c */; };
+               B7F1FEDE234F89C50081159C /* TestUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B7F1FEDC234F89C50081159C /* TestUtils.h */; };
+               B7F1FEDF234F89C50081159C /* TestUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = B7F1FEDD234F89C50081159C /* TestUtils.m */; };
                BD03E88D1AD31278005E8A81 /* SymptomReporter.c in Sources */ = {isa = PBXBuildFile; fileRef = BD03E88C1AD31278005E8A81 /* SymptomReporter.c */; };
                BD11267121DB1B25006115E6 /* dnssd_server.h in Headers */ = {isa = PBXBuildFile; fileRef = BD11267021DB1AFE006115E6 /* dnssd_server.h */; };
                BD11267221DB1B29006115E6 /* dnssd_xpc.h in Headers */ = {isa = PBXBuildFile; fileRef = BD11266D21DB1AFE006115E6 /* dnssd_xpc.h */; };
                BD03E88D1AD31278005E8A81 /* SymptomReporter.c in Sources */ = {isa = PBXBuildFile; fileRef = BD03E88C1AD31278005E8A81 /* SymptomReporter.c */; };
                BD11267121DB1B25006115E6 /* dnssd_server.h in Headers */ = {isa = PBXBuildFile; fileRef = BD11267021DB1AFE006115E6 /* dnssd_server.h */; };
                BD11267221DB1B29006115E6 /* dnssd_xpc.h in Headers */ = {isa = PBXBuildFile; fileRef = BD11266D21DB1AFE006115E6 /* dnssd_xpc.h */; };
                B778EE4B1D51113800C814A2 /* HostnameController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HostnameController.m; path = ../SettingsBundle/HostnameController.m; sourceTree = "<group>"; };
                B778EE4E1D51287100C814A2 /* BonjourSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BonjourSettingsController.h; path = ../SettingsBundle/BonjourSettingsController.h; sourceTree = "<group>"; };
                B778EE4F1D51287100C814A2 /* BonjourSettingsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BonjourSettingsController.m; path = ../SettingsBundle/BonjourSettingsController.m; sourceTree = "<group>"; };
                B778EE4B1D51113800C814A2 /* HostnameController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HostnameController.m; path = ../SettingsBundle/HostnameController.m; sourceTree = "<group>"; };
                B778EE4E1D51287100C814A2 /* BonjourSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BonjourSettingsController.h; path = ../SettingsBundle/BonjourSettingsController.h; sourceTree = "<group>"; };
                B778EE4F1D51287100C814A2 /* BonjourSettingsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BonjourSettingsController.m; path = ../SettingsBundle/BonjourSettingsController.m; sourceTree = "<group>"; };
+               B77CAFCD234EADE5006706B4 /* PathEvaluationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PathEvaluationTest.m; sourceTree = "<group>"; };
+               B77CAFCF234EAE72006706B4 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; };
                B78A9C2F223941A900BFB0C6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/DNSServiceDiscoveryPref.xib; sourceTree = "<group>"; };
                B78A9C322239485E00BFB0C6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
                B799209D1DA6BA8E00C6E02B /* CNDomainBrowserPathUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNDomainBrowserPathUtils.h; sourceTree = "<group>"; };
                B78A9C2F223941A900BFB0C6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/DNSServiceDiscoveryPref.xib; sourceTree = "<group>"; };
                B78A9C322239485E00BFB0C6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
                B799209D1DA6BA8E00C6E02B /* CNDomainBrowserPathUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNDomainBrowserPathUtils.h; sourceTree = "<group>"; };
                B7D6CA691D1076C6005E24CF /* CNDomainBrowserView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNDomainBrowserView.m; sourceTree = "<group>"; };
                B7D6CA701D1076F3005E24CF /* DomainBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DomainBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                B7E06CDF2329AA7B0021401F /* LocalOnlyWithInterfacesTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalOnlyWithInterfacesTest.m; sourceTree = "<group>"; };
                B7D6CA691D1076C6005E24CF /* CNDomainBrowserView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNDomainBrowserView.m; sourceTree = "<group>"; };
                B7D6CA701D1076F3005E24CF /* DomainBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DomainBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                B7E06CDF2329AA7B0021401F /* LocalOnlyWithInterfacesTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalOnlyWithInterfacesTest.m; sourceTree = "<group>"; };
+               B7F1FEDC234F89C50081159C /* TestUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestUtils.h; sourceTree = "<group>"; };
+               B7F1FEDD234F89C50081159C /* TestUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestUtils.m; sourceTree = "<group>"; };
+               B7F1FEEA234FAF0F0081159C /* dnssdutil-entitlements.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "dnssdutil-entitlements.plist"; sourceTree = "<group>"; };
                BD03E88C1AD31278005E8A81 /* SymptomReporter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SymptomReporter.c; sourceTree = "<group>"; };
                BD11266D21DB1AFE006115E6 /* dnssd_xpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dnssd_xpc.h; sourceTree = "<group>"; };
                BD11266E21DB1AFE006115E6 /* dnssd_xpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dnssd_xpc.c; sourceTree = "<group>"; };
                BD03E88C1AD31278005E8A81 /* SymptomReporter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SymptomReporter.c; sourceTree = "<group>"; };
                BD11266D21DB1AFE006115E6 /* dnssd_xpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dnssd_xpc.h; sourceTree = "<group>"; };
                BD11266E21DB1AFE006115E6 /* dnssd_xpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dnssd_xpc.c; sourceTree = "<group>"; };
                                B7A861A2212B408D00E81CC3 /* Security.framework in Frameworks */,
                                B7EEF7C4212603B20093828F /* SystemConfiguration.framework in Frameworks */,
                                B7A861A9212B411600E81CC3 /* Network.framework in Frameworks */,
                                B7A861A2212B408D00E81CC3 /* Security.framework in Frameworks */,
                                B7EEF7C4212603B20093828F /* SystemConfiguration.framework in Frameworks */,
                                B7A861A9212B411600E81CC3 /* Network.framework in Frameworks */,
+                               B77CAFD0234EAE72006706B4 /* NetworkExtension.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                B74BF92D2322E97400E35354 /* SuspiciousReplyTest.m */,
                                B74BF930232701F600E35354 /* CacheOrderTest.m */,
                                B7E06CDF2329AA7B0021401F /* LocalOnlyWithInterfacesTest.m */,
                                B74BF92D2322E97400E35354 /* SuspiciousReplyTest.m */,
                                B74BF930232701F600E35354 /* CacheOrderTest.m */,
                                B7E06CDF2329AA7B0021401F /* LocalOnlyWithInterfacesTest.m */,
+                               B77CAFCD234EADE5006706B4 /* PathEvaluationTest.m */,
                        );
                        path = "Unit Tests";
                        sourceTree = "<group>";
                        );
                        path = "Unit Tests";
                        sourceTree = "<group>";
                BD97754A221D643500F68FFC /* dnssdutil */ = {
                        isa = PBXGroup;
                        children = (
                BD97754A221D643500F68FFC /* dnssdutil */ = {
                        isa = PBXGroup;
                        children = (
+                               B7F1FEEA234FAF0F0081159C /* dnssdutil-entitlements.plist */,
                                BD97754D221D64BF00F68FFC /* DNSMessage.c */,
                                BD97754E221D64BF00F68FFC /* DNSMessage.h */,
                                BD97754D221D64BF00F68FFC /* DNSMessage.c */,
                                BD97754E221D64BF00F68FFC /* DNSMessage.h */,
+                               B7F1FEDC234F89C50081159C /* TestUtils.h */,
+                               B7F1FEDD234F89C50081159C /* TestUtils.m */,
                                BD97754B221D643500F68FFC /* dnssdutil.c */,
                        );
                        name = dnssdutil;
                                BD97754B221D643500F68FFC /* dnssdutil.c */,
                        );
                        name = dnssdutil;
                BD9BA7561EAF929C00658CCF /* Frameworks */ = {
                        isa = PBXGroup;
                        children = (
                BD9BA7561EAF929C00658CCF /* Frameworks */ = {
                        isa = PBXGroup;
                        children = (
+                               B77CAFCF234EAE72006706B4 /* NetworkExtension.framework */,
                                BDA82B8922BF8A7000A31CBE /* libdns_services.tbd */,
                                D448F7AD222DCC0A0069E1D2 /* CoreFoundation.framework */,
                                D448F7AB222DCB5B0069E1D2 /* libarchive.tbd */,
                                BDA82B8922BF8A7000A31CBE /* libdns_services.tbd */,
                                D448F7AD222DCC0A0069E1D2 /* CoreFoundation.framework */,
                                D448F7AB222DCB5B0069E1D2 /* libarchive.tbd */,
                        files = (
                                BD977550221D64BF00F68FFC /* DNSMessage.h in Headers */,
                                D4A9F60521FA797F0079D0C6 /* dns_sd_private.h in Headers */,
                        files = (
                                BD977550221D64BF00F68FFC /* DNSMessage.h in Headers */,
                                D4A9F60521FA797F0079D0C6 /* dns_sd_private.h in Headers */,
+                               B7F1FEDE234F89C50081159C /* TestUtils.h in Headers */,
                                BD2A15B9225ED30C00BEA50A /* mdns_private.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                BD2A15B9225ED30C00BEA50A /* mdns_private.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                D40123922272B7A7006C9BBE /* mdns.c in Sources */,
                                B7EEF7CA2126046A0093828F /* uDNS.c in Sources */,
                                D4F2BB2822CD21CB00234A38 /* posix_utilities.c in Sources */,
                                D40123922272B7A7006C9BBE /* mdns.c in Sources */,
                                B7EEF7CA2126046A0093828F /* uDNS.c in Sources */,
                                D4F2BB2822CD21CB00234A38 /* posix_utilities.c in Sources */,
+                               B77CAFCE234EADE5006706B4 /* PathEvaluationTest.m in Sources */,
                                B7EEF7D82126076F0093828F /* dnssec.c in Sources */,
                                B7EEF7E021260A1F0093828F /* helper-stubs.c in Sources */,
                                B79FA14B211CE8CA00B7861E /* DNSCommon.c in Sources */,
                                B7EEF7D82126076F0093828F /* dnssec.c in Sources */,
                                B7EEF7E021260A1F0093828F /* helper-stubs.c in Sources */,
                                B79FA14B211CE8CA00B7861E /* DNSCommon.c in Sources */,
                                BD97754F221D64BF00F68FFC /* DNSMessage.c in Sources */,
                                BD2A15BA225ED31C00BEA50A /* mdns.c in Sources */,
                                BD2A15BB225ED33C00BEA50A /* mdns_object.m in Sources */,
                                BD97754F221D64BF00F68FFC /* DNSMessage.c in Sources */,
                                BD2A15BA225ED31C00BEA50A /* mdns.c in Sources */,
                                BD2A15BB225ED33C00BEA50A /* mdns_object.m in Sources */,
+                               B7F1FEDF234F89C50081159C /* TestUtils.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                );
                                INFOPLIST_FILE = "Tests/Unit Tests/Info.plist";
                                INSTALL_PATH = /AppleInternal/XCTests/com.apple.mDNSResponder/;
                                );
                                INFOPLIST_FILE = "Tests/Unit Tests/Info.plist";
                                INSTALL_PATH = /AppleInternal/XCTests/com.apple.mDNSResponder/;
-                               LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
+                               LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks /AppleInternal/Developer/Library/Frameworks";
                                MTL_FAST_MATH = YES;
                                OTHER_CFLAGS = (
                                        "-DUSE_SYSTEMCONFIGURATION_PRIVATE_HEADERS",
                                MTL_FAST_MATH = YES;
                                OTHER_CFLAGS = (
                                        "-DUSE_SYSTEMCONFIGURATION_PRIVATE_HEADERS",
                                        WebFilterDNS,
                                        "-weak_framework",
                                        DeviceToDeviceManager,
                                        WebFilterDNS,
                                        "-weak_framework",
                                        DeviceToDeviceManager,
+                                       "-weak_framework",
+                                       XCTest,
                                );
                                "OTHER_LDFLAGS[sdk=iphoneos*]" = (
                                        "-weak_framework",
                                );
                                "OTHER_LDFLAGS[sdk=iphoneos*]" = (
                                        "-weak_framework",
                                );
                                INFOPLIST_FILE = "Tests/Unit Tests/Info.plist";
                                INSTALL_PATH = /AppleInternal/XCTests/com.apple.mDNSResponder/;
                                );
                                INFOPLIST_FILE = "Tests/Unit Tests/Info.plist";
                                INSTALL_PATH = /AppleInternal/XCTests/com.apple.mDNSResponder/;
-                               LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
+                               LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks /AppleInternal/Developer/Library/Frameworks";
                                MTL_FAST_MATH = YES;
                                ONLY_ACTIVE_ARCH = YES;
                                OTHER_CFLAGS = (
                                MTL_FAST_MATH = YES;
                                ONLY_ACTIVE_ARCH = YES;
                                OTHER_CFLAGS = (
                                        WebFilterDNS,
                                        "-weak_framework",
                                        DeviceToDeviceManager,
                                        WebFilterDNS,
                                        "-weak_framework",
                                        DeviceToDeviceManager,
+                                       "-weak_framework",
+                                       XCTest,
                                );
                                "OTHER_LDFLAGS[sdk=iphoneos*]" = (
                                        "-weak_framework",
                                );
                                "OTHER_LDFLAGS[sdk=iphoneos*]" = (
                                        "-weak_framework",
                                HEADER_SEARCH_PATHS = "$(SDKROOT)${SYSTEM_LIBRARY_DIR}/Frameworks/System.framework/PrivateHeaders";
                                INSTALL_PATH = /usr/local/bin;
                                PRODUCT_NAME = "$(TARGET_NAME)";
                                HEADER_SEARCH_PATHS = "$(SDKROOT)${SYSTEM_LIBRARY_DIR}/Frameworks/System.framework/PrivateHeaders";
                                INSTALL_PATH = /usr/local/bin;
                                PRODUCT_NAME = "$(TARGET_NAME)";
+                               SYSTEM_FRAMEWORK_SEARCH_PATHS = "$(inherited) $(SDKROOT)/System/Library/PrivateFrameworks $(PLATFORM_DIR)/Developer/Library/Frameworks $(PLATFORM_DIR)/Developer/AppleInternal/Library/Frameworks";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Warc-repeated-use-of-weak",
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Warc-repeated-use-of-weak",
                                HEADER_SEARCH_PATHS = "$(SDKROOT)${SYSTEM_LIBRARY_DIR}/Frameworks/System.framework/PrivateHeaders";
                                INSTALL_PATH = /usr/local/bin;
                                PRODUCT_NAME = "$(TARGET_NAME)";
                                HEADER_SEARCH_PATHS = "$(SDKROOT)${SYSTEM_LIBRARY_DIR}/Frameworks/System.framework/PrivateHeaders";
                                INSTALL_PATH = /usr/local/bin;
                                PRODUCT_NAME = "$(TARGET_NAME)";
+                               SYSTEM_FRAMEWORK_SEARCH_PATHS = "$(inherited) $(SDKROOT)/System/Library/PrivateFrameworks $(PLATFORM_DIR)/Developer/Library/Frameworks $(PLATFORM_DIR)/Developer/AppleInternal/Library/Frameworks";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Warc-repeated-use-of-weak",
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Warc-repeated-use-of-weak",
index c78e3ca541be136c1d2df16ec62ceb1536cd8e10..99234460bebe9e3f7411d04a8af55b3cff2f70a4 100644 (file)
@@ -155,7 +155,7 @@ mDNSexport void mDNSPlatformGetDNSRoutePolicy(DNSQuestion *q, mDNSBool *isBlocke
             }
         }
         
             }
         }
         
-        if (isUUIDSet && path && (nw_path_get_status(path) == nw_path_status_unsatisfied) && (nw_path_get_reason(path) == nw_path_reason_policy_drop))
+        if (isUUIDSet && path && (nw_path_get_status(path) == nw_path_status_unsatisfied) && (nw_path_get_reason(path) != nw_path_reason_no_route))
             *isBlocked = mDNStrue;
         else
             *isBlocked = mDNSfalse;
             *isBlocked = mDNStrue;
         else
             *isBlocked = mDNSfalse;
index f208d28781c4a18e425eadce7936947a67b4cbd3..d44a949d6902048689437454d1de788fef2cb353 100644 (file)
@@ -66,7 +66,7 @@
  */
 
 #ifndef _DNS_SD_H
  */
 
 #ifndef _DNS_SD_H
-#define _DNS_SD_H 10964007
+#define _DNS_SD_H 10966002
 
 #ifdef  __cplusplus
 extern "C" {
 
 #ifdef  __cplusplus
 extern "C" {
index 163ccc429da36c307a5902abac87cb295d18007e..18b7611831154ecc5a424a271134dd6402993f5d 100644 (file)
@@ -1,5 +1,6 @@
 #include "DNSCommon.h"                  // Defines general DNS utility routines
 #include "unittest_common.h"
 #include "DNSCommon.h"                  // Defines general DNS utility routines
 #include "unittest_common.h"
+#include "mDNSMacOSX.h"
 
 // To match *either* a v4 or v6 instance of this interface
 mDNSlocal mDNSInterfaceID SearchForInterfaceByAddr(mDNSAddr* addr)
 
 // To match *either* a v4 or v6 instance of this interface
 mDNSlocal mDNSInterfaceID SearchForInterfaceByAddr(mDNSAddr* addr)
@@ -70,3 +71,9 @@ mDNSexport void mDNSDomainLabelFromCFString_ut(CFStringRef cfs, domainlabel *con
 {
     mDNSDomainLabelFromCFString(cfs, namelabel);
 }
 {
     mDNSDomainLabelFromCFString(cfs, namelabel);
 }
+
+mDNSexport mDNSu32 IndexForInterfaceByName_ut(const char *ifname)
+{
+    NetworkInterfaceInfoOSX * i = SearchForInterfaceByName(ifname, AF_UNSPEC);
+    return (i ? i->scope_id : 0);
+}
index 3ab4b4f3b1d4a4f2f82460bd40d4c364c7dc969a..5755a7527f2d306441f6d1945047fda30c323544 100644 (file)
@@ -60,5 +60,6 @@ extern mStatus  verify_cache_addr_order_for_domain_ut(mDNS *const m, mDNSu8* oct
 
 // HelperFunctionTest
 extern void mDNSDomainLabelFromCFString_ut(CFStringRef cfs, domainlabel *const namelabel);
 
 // HelperFunctionTest
 extern void mDNSDomainLabelFromCFString_ut(CFStringRef cfs, domainlabel *const namelabel);
+mDNSexport mDNSu32 IndexForInterfaceByName_ut(const char *ifname);
 
 #endif /* UNITTEST_COMMON_H */
 
 #endif /* UNITTEST_COMMON_H */