]> git.saurik.com Git - apple/configd.git/commitdiff
configd-453.18.tar.gz mac-os-x-1082 v453.18
authorApple <opensource@apple.com>
Mon, 17 Sep 2012 18:16:19 +0000 (18:16 +0000)
committerApple <opensource@apple.com>
Mon, 17 Sep 2012 18:16:19 +0000 (18:16 +0000)
19 files changed:
Plugins/IPMonitor/Info.plist
Plugins/IPMonitor/dns-configuration.c
Plugins/InterfaceNamer/Info.plist
Plugins/KernelEventMonitor/Info.plist
Plugins/LinkConfiguration/Info.plist
Plugins/Logger/Info-Embedded.plist
Plugins/Logger/Info.plist
Plugins/PreferencesMonitor/Info.plist
Plugins/SCNetworkReachability/Info.plist
SCMonitor/Info.plist
SCMonitor/monitor.c
SystemConfiguration.fproj/Info-Embedded.plist
SystemConfiguration.fproj/Info.plist
SystemConfiguration.fproj/SCDNotifierInformViaCallback.c
SystemConfiguration.fproj/SCNetworkInterface.c
SystemConfiguration.fproj/SCNetworkReachability.c
SystemConfiguration.fproj/dy_framework.c
SystemConfiguration.fproj/dy_framework.h
SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_server.c

index 667418a8e4895f423917c74c02804cb98938ae03..09072ba96636eac58767c20203bd318e180bd6ee 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.IPConfiguration</string>
index ca9e7bae14ef2237a193653312cbb96517ea9978..bd20b75b326d984fadb6173c1aaddcfba4d6745e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2012 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -1075,6 +1075,9 @@ create_resolver(CFDictionaryRef dns)
                                                          0,
                                                          &kCFTypeDictionaryKeyCallBacks,
                                                          &kCFTypeDictionaryValueCallBacks);
+               CFDictionarySetValue(targetOptions,
+                                    kSCNetworkReachabilityOptionServerBypass,
+                                    kCFBooleanTrue);
                if (targetInterface != NULL) {
                        CFDictionarySetValue(targetOptions,
                                             kSCNetworkReachabilityOptionInterface,
index 5efd37216fabc42c2e8b7b18dda6dc42572d0e5c..bd0a96004c83f6cb0dce1ce82bdeb02b19bf54c1 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
 </dict>
 </plist>
index 5473f521c4fab51f3e16695796d00312a34b9ac2..dd4142696bb100a74efef3774347841ae718d3fd 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
index f3cbe7b6f27001cde514cf8b40314b925869c4dd..788c103b2e7c99cafc20a47b03c39198235d0f29 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
index 295de0b16ec08a4d153ff140ac9c84914a5fcb6d..55b61a52c98708076ca6d288932c2e83fcc2056f 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>Enabled</key>
        <false/>
        <key>Verbose</key>
index 440c296de1768146609827ff5bf32ff837a5d79c..be89fdead1181da0815ef118e94bf0aa4ce904ef 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>Enabled</key>
        <false/>
        <key>Verbose</key>
index 8cf44b4fbea44b006dd451391e0fabaebc3ff823..4648c9d2106631aac0de061bfe52fbb2a3d646eb 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>Builtin</key>
        <true/>
        <key>Requires</key>
index 172cd34dcafd8edd28d4186379983b46b2cb357f..6b407f5d515c5300a8cca9f4ee112382746dc679 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
 </dict>
 </plist>
index 153ad6ff45611817ab14f52cb707933396e42736..22482f249427be2fa4a95cee425a8ebf5b4b535f 100644 (file)
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFPlugInDynamicRegistration</key>
        <string>NO</string>
        <key>CFPlugInFactories</key>
index ca340286e9556bb48d89906566fdcc15de42ed67..27d67de5faaff14f8368af80b64d632384619d67 100644 (file)
@@ -699,7 +699,6 @@ static void
 watcher_add_lan(MyType *myInstance)
 {
        SCDynamicStoreContext   context = { 0, (void *)myInstance, NULL, NULL, NULL };
-       CFDictionaryRef         dict;
        CFStringRef             key;
        CFArrayRef              keys;
        SCDynamicStoreRef       store;
@@ -723,34 +722,43 @@ watcher_add_lan(MyType *myInstance)
                           myInstance->monitorRls,
                           kCFRunLoopDefaultMode);
 
-       // initialize the list of known interfaces
-       myInstance->interfaces_known = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
-       dict = SCDynamicStoreCopyValue(store, key);
-       if (dict != NULL) {
-               if (isA_CFDictionary(dict)) {
-                       CFIndex         i;
-                       CFArrayRef      interfaces;
-                       CFIndex         n;
-
-                       interfaces = CFDictionaryGetValue(dict, kSCPropNetInterfaces);
-                       n = isA_CFArray(interfaces) ? CFArrayGetCount(interfaces) : 0;
-                       for (i = 0; i < n; i++) {
-                               CFStringRef     bsdName;
-
-                               bsdName = CFArrayGetValueAtIndex(interfaces, i);
-                               if (isA_CFString(bsdName)) {
-                                       SCNetworkInterfaceRef   interface;
-
-                                       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, bsdName, kIncludeNoVirtualInterfaces);
-                                       if (interface != NULL) {
-                                               CFSetAddValue(myInstance->interfaces_known, interface);
-                                               CFRelease(interface);
+       // check if we already have the "admin" (kSCPreferencesWriteAuthorizationRight)
+       // right.  If so, we can automatically configure (without user intervention) any
+       // "new" network interfaces that are present at login (e.g. a USB ethernet
+       // dongle that was plugged in before login).
+       if (!hasAuthorization(myInstance)) {
+               CFDictionaryRef         dict;
+
+               // ... and if we don't have the right then we populate the list of
+               // known interfaces with those already named so that we avoid any
+               // login prompts (that the user might have no choice but to dismiss)
+               dict = SCDynamicStoreCopyValue(store, key);
+               if (dict != NULL) {
+                       if (isA_CFDictionary(dict)) {
+                               CFIndex         i;
+                               CFArrayRef      interfaces;
+                               CFIndex         n;
+
+                               interfaces = CFDictionaryGetValue(dict, kSCPropNetInterfaces);
+                               n = isA_CFArray(interfaces) ? CFArrayGetCount(interfaces) : 0;
+                               for (i = 0; i < n; i++) {
+                                       CFStringRef     bsdName;
+
+                                       bsdName = CFArrayGetValueAtIndex(interfaces, i);
+                                       if (isA_CFString(bsdName)) {
+                                               SCNetworkInterfaceRef   interface;
+
+                                               interface = _SCNetworkInterfaceCreateWithBSDName(NULL, bsdName, kIncludeNoVirtualInterfaces);
+                                               if (interface != NULL) {
+                                                       CFSetAddValue(myInstance->interfaces_known, interface);
+                                                       CFRelease(interface);
+                                               }
                                        }
                                }
                        }
-               }
 
-               CFRelease(dict);
+                       CFRelease(dict);
+               }
        }
 
        CFRelease(key);
@@ -768,11 +776,6 @@ watcher_remove_lan(MyType *myInstance)
                myInstance->monitorRls = NULL;
        }
 
-       if (myInstance->interfaces_known != NULL) {
-               CFRelease(myInstance->interfaces_known);
-               myInstance->interfaces_known = NULL;
-       }
-
        return;
 }
 
@@ -782,6 +785,7 @@ watcher_remove_lan(MyType *myInstance)
 
 typedef struct {
        io_registry_entry_t     interface;
+       io_registry_entry_t     interface_node;
        MyType                  *myInstance;
        io_object_t             notification;
 } MyNode;
@@ -843,9 +847,11 @@ update_node(void *refCon, io_service_t service, natural_t messageType, void *mes
        }
 
        // remove no-longer-needed notification
+       if (myNode->interface != myNode->interface_node) {
+               IOObjectRelease(myNode->interface_node);
+       }
        if (myNode->interface != MACH_PORT_NULL) {
                IOObjectRelease(myNode->interface);
-               myNode->interface = MACH_PORT_NULL;
        }
        IOObjectRelease(myNode->notification);
        i = CFArrayGetFirstIndexOfValue(myInstance->notifyNodes,
@@ -879,12 +885,16 @@ add_node_watcher(MyType *myInstance, io_registry_entry_t node, io_registry_entry
        myNode = (MyNode *)(void *)CFDataGetBytePtr(myData);
 
        bzero(myNode, sizeof(MyNode));
-       if (interface != MACH_PORT_NULL) {
-               IOObjectRetain(interface);
+       myNode->interface      = interface;
+       if (myNode->interface != MACH_PORT_NULL) {
+               IOObjectRetain(myNode->interface);
+       }
+       myNode->interface_node = (interface == MACH_PORT_NULL) ? node : interface;
+       if (myNode->interface != myNode->interface_node) {
+               IOObjectRetain(myNode->interface_node);
        }
-       myNode->interface    = interface;
-       myNode->myInstance   = myInstance;
-       myNode->notification = MACH_PORT_NULL;
+       myNode->myInstance     = myInstance;
+       myNode->notification   = MACH_PORT_NULL;
 
        kr = IOServiceAddInterestNotification(myInstance->notifyPort,   // IONotificationPortRef
                                              node,                     // io_service_t
@@ -983,11 +993,20 @@ update_serial(void *refcon, io_iterator_t iter)
                IOObjectRelease(obj);
        }
 
-       updateInterfaceList(myInstance);
        return;
 }
 
 
+static void
+update_serial_nodes(void *refcon, io_iterator_t iter)
+{
+       MyType  *myInstance     = (MyType *)refcon;
+
+       update_serial(refcon, iter);
+       updateInterfaceList(myInstance);
+}
+
+
 static void
 watcher_add_serial(MyType *myInstance)
 {
@@ -1004,7 +1023,7 @@ watcher_add_serial(MyType *myInstance)
        kr = IOServiceAddMatchingNotification(myInstance->notifyPort,
                                              kIOFirstMatchNotification,
                                              IOServiceMatching("IOSerialBSDClient"),
-                                             &update_serial,
+                                             &update_serial_nodes,
                                              (void *)myInstance,               // refCon
                                              &myInstance->notifyIterator);     // notification
        if (kr != KERN_SUCCESS) {
@@ -1020,6 +1039,40 @@ watcher_add_serial(MyType *myInstance)
        // future interface arrivals.
        update_serial((void *)myInstance, myInstance->notifyIterator);
 
+       if (myInstance->notifyNodes != NULL) {
+               // if we have any serial nodes, check if we already have the
+               // "admin" (kSCPreferencesWriteAuthorizationRight) right.  If
+               // so, we can automatically configure (without user intervention)
+               // any "new" network interfaces that are present at login (e.g. a
+               // USB modem that was plugged in before login).
+
+               if (!hasAuthorization(myInstance)) {
+                       CFIndex i;
+                       CFIndex n       = CFArrayGetCount(myInstance->notifyNodes);
+
+                       // ... and if we don't have the right then we populate the list of
+                       // known interfaces with those already named so that we avoid any
+                       // login prompts (that the user might have no choice but to dismiss)
+
+                       for (i = 0; i < n; i++) {
+                               SCNetworkInterfaceRef   interface;
+                               CFDataRef               myData;
+                               MyNode                  *myNode;
+
+                               myData = CFArrayGetValueAtIndex(myInstance->notifyNodes, i);
+
+                               /* ALIGN: CF aligns to at least >8 bytes */
+                               myNode = (MyNode *)(void *)CFDataGetBytePtr(myData);
+
+                               interface = _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(myNode->interface_node);
+                               if (interface != NULL) {
+                                       CFSetAddValue(myInstance->interfaces_known, interface);
+                                       CFRelease(interface);
+                               }
+                       }
+               }
+       }
+
        // and keep watching
        CFRunLoopAddSource(CFRunLoopGetCurrent(),
                           IONotificationPortGetRunLoopSource(myInstance->notifyPort),
@@ -1044,6 +1097,9 @@ watcher_remove_serial(MyType *myInstance)
                        /* ALIGN: CF aligns to at least >8 bytes */
                        myNode = (MyNode *)(void *)CFDataGetBytePtr(myData);
 
+                       if (myNode->interface != myNode->interface_node) {
+                               IOObjectRelease(myNode->interface_node);
+                       }
                        if (myNode->interface != MACH_PORT_NULL) {
                                IOObjectRelease(myNode->interface);
                        }
@@ -1109,8 +1165,18 @@ watcher_add(MyType *myInstance)
                }
        }
 
+       // initialize the list of known interfaces
+       myInstance->interfaces_known = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+
+       // add LAN interfaces
        watcher_add_lan(myInstance);
+
+       // add SERIAL interfaces
        watcher_add_serial(myInstance);
+
+       // auto-configure (as needed)
+       updateInterfaceList(myInstance);
+
        return;
 }
 
@@ -1121,6 +1187,11 @@ watcher_remove(MyType *myInstance)
        watcher_remove_lan(myInstance);
        watcher_remove_serial(myInstance);
 
+       if (myInstance->interfaces_known != NULL) {
+               CFRelease(myInstance->interfaces_known);
+               myInstance->interfaces_known = NULL;
+       }
+
        asl_free(myInstance->log_msg);
        myInstance->log_msg = NULL;
        return;
index f9008ac7aa79bcbfdd62c8300f4aa81d9894008a..87f9a94b8ba66d1bdc7fcd7089e08d42582bacf7 100644 (file)
@@ -7,7 +7,7 @@
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
 </dict>
 </plist>
index f9008ac7aa79bcbfdd62c8300f4aa81d9894008a..87f9a94b8ba66d1bdc7fcd7089e08d42582bacf7 100644 (file)
@@ -7,7 +7,7 @@
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.12</string>
+       <string>1.12.2</string>
 </dict>
 </plist>
index cf3ec8ec4c5db1084dba5f73a0238f4a097c2285..2652bc421619dab71e935d6e14d46323311105c9 100644 (file)
@@ -498,6 +498,7 @@ SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue)
 {
        dispatch_group_t                drainGroup      = NULL;
        dispatch_queue_t                drainQueue      = NULL;
+       dispatch_group_t                group           = NULL;
        mach_port_t                     mp;
        Boolean                         ok              = FALSE;
        dispatch_source_t               source;
@@ -562,7 +563,8 @@ SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue)
        // the group to empty and use the group's finalizer to release
        // our reference to the SCDynamicStore.
        //
-       storePrivate->dispatchGroup = dispatch_group_create();
+       group = dispatch_group_create();
+       storePrivate->dispatchGroup = group;
        CFRetain(store);
        dispatch_set_context(storePrivate->dispatchGroup, (void *)store);
        dispatch_set_finalizer_f(storePrivate->dispatchGroup, (dispatch_function_t)CFRelease);
@@ -602,7 +604,7 @@ SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue)
                msgid = notify_msg.msg.header.msgh_id;
 
                CFRetain(store);
-               dispatch_group_async(storePrivate->dispatchGroup, storePrivate->dispatchQueue, ^{
+               dispatch_group_async(group, queue, ^{
                        if (msgid == MACH_NOTIFY_NO_SENDERS) {
                                // re-establish notification and inform the client
                                (void)__SCDynamicStoreReconnectNotifications(store);
index a9cbfc0476d746597e02faa9739708baf6eb5a7d..bb681bd6faea74dafd56cc1aab479eb1b56f75d4 100644 (file)
@@ -2371,6 +2371,62 @@ processSerialInterface(SCNetworkInterfacePrivateRef      interfacePrivate,
 }
 
 
+static CFStringRef
+__SC_IORegistryEntryCopyPath(io_registry_entry_t entry, const io_name_t plane)
+{
+       /*
+        * Create a path for a registry entry.
+        */
+       io_string_t     path;
+       IOReturn        status;
+       CFStringRef     str     = NULL;
+
+       status = IORegistryEntryGetPath(entry, plane, path);
+       if (status == kIOReturnSuccess) {
+               str = CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8);
+       } else if (status == kIOReturnBadArgument) {
+               io_registry_entry_t     parent;
+
+               status = IORegistryEntryGetParentEntry(entry, plane, &parent);
+               if (status == kIOReturnSuccess) {
+                       CFStringRef     str_parent;
+
+                       str_parent = __SC_IORegistryEntryCopyPath(parent, plane);
+                       if (str_parent != NULL) {
+                               io_name_t       name;
+
+                               status = IORegistryEntryGetNameInPlane(entry, plane, name);
+                               if (status == kIOReturnSuccess) {
+                                       io_name_t       location;
+
+                                       status = IORegistryEntryGetLocationInPlane(entry, plane, location);
+                                       if (status == kIOReturnSuccess) {
+                                               str = CFStringCreateWithFormat(NULL,
+                                                                              NULL,
+                                                                              CFSTR("%@/%s@%s"),
+                                                                              str_parent,
+                                                                              name,
+                                                                              location);
+                                       } else {
+                                               str = CFStringCreateWithFormat(NULL,
+                                                                              NULL,
+                                                                              CFSTR("%@/%s"),
+                                                                              str_parent,
+                                                                              name);
+                                       }
+                               }
+
+                               CFRelease(str_parent);
+                       }
+
+                       IOObjectRelease(parent);
+               }
+       }
+
+       return str;
+}
+
+
 static SCNetworkInterfaceRef
 createInterface(io_registry_entry_t interface, processInterface func)
 {
@@ -2378,18 +2434,11 @@ createInterface(io_registry_entry_t interface, processInterface func)
        CFMutableDictionaryRef          bus_dict                = NULL;
        io_registry_entry_t             controller              = MACH_PORT_NULL;
        CFMutableDictionaryRef          controller_dict         = NULL;
+       uint64_t                        entryID                 = 0;
        SCNetworkInterfacePrivateRef    interfacePrivate        = NULL;
        CFMutableDictionaryRef          interface_dict          = NULL;
        kern_return_t                   kr;
-       io_string_t                     path;
        CFTypeRef                       val;
-       uint64_t                        entryID = 0;
-
-       kr = IORegistryEntryGetPath(interface, kIOServicePlane, path);
-       if (kr != kIOReturnSuccess) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("createInterface IORegistryEntryGetPath() failed, kr = 0x%x"), kr);
-               goto done;
-       }
 
        kr = IORegistryEntryCreateCFProperties(interface, &interface_dict, NULL, kNilOptions);
        if (kr != kIOReturnSuccess) {
@@ -2433,7 +2482,7 @@ createInterface(io_registry_entry_t interface, processInterface func)
        }
 
        interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL);
-       interfacePrivate->path    = (path != NULL) ? CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8) : NULL;
+       interfacePrivate->path = __SC_IORegistryEntryCopyPath(interface, kIOServicePlane);
        interfacePrivate->entryID = entryID;
 
        // configuration [PPP, Modem, DNS, IPv4, IPv6, Proxies, SMB] template overrides
index 2d0c04f90266aec187f421114e5b51d06ebf50f1..f13c2a713e4fe7e27bc87038b44a5ef44ebffc55 100644 (file)
@@ -1978,6 +1978,7 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
                }
        }
 
+
        // add flags
        if (targetPrivate->scheduled) {
                str = _SCNetworkReachabilityCopyTargetFlags(target);
@@ -2151,8 +2152,8 @@ __SCNetworkReachabilityPerformInlineNoLock(SCNetworkReachabilityRef target, Bool
                dispatch_sync(queue, ^{
                        reachPerform((void *)target);
                        dispatch_group_leave(group);
-                       dispatch_release(queue);
                });
+               dispatch_release(queue);
        } else {
                if (targetPrivate->rls != NULL) {
                        CFRunLoopSourceSignal(targetPrivate->rls);
@@ -2206,12 +2207,10 @@ __SCNetworkReachabilityPerformConcurrent(SCNetworkReachabilityRef target)
 
        queue = targetPrivate->dispatchQueue;
        if (queue != NULL) {
-               dispatch_retain(queue);
                CFRetain(target);
                dispatch_group_async(targetPrivate->dispatchGroup, queue, ^{
                        reachPerform((void *)target);
                        CFRelease(target);
-                       dispatch_release(queue);
                });
        } else {
                if (targetPrivate->rls != NULL) {
@@ -2247,8 +2246,8 @@ __SCNetworkReachabilityPerform(SCNetworkReachabilityRef target)
                        dispatch_sync(queue, ^{
                                reachPerform((void *)target);
                                CFRelease(target);
-                               dispatch_release(queue);
                        });
+                       dispatch_release(queue);
                });
        } else if (targetPrivate->rls != NULL) {
                CFRunLoopSourceSignal(targetPrivate->rls);
@@ -2328,6 +2327,10 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef      allocator)
        targetPrivate->onDemandServer                   = NULL;
        targetPrivate->onDemandServiceID                = NULL;
 
+#ifdef HAVE_REACHABILITY_SERVER
+       targetPrivate->serverBypass                     = D_serverBypass;
+#endif // HAVE_REACHABILITY_SERVER
+
 
        targetPrivate->llqActive                        = FALSE;
        targetPrivate->llqBypass                        = D_llqBypass;
@@ -2336,7 +2339,6 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef       allocator)
 
 #ifdef HAVE_REACHABILITY_SERVER
        targetPrivate->serverActive                     = FALSE;
-       targetPrivate->serverBypass                     = D_serverBypass;
        targetPrivate->serverScheduled                  = FALSE;
        targetPrivate->serverInfo                       = NOT_REACHABLE;
 
@@ -5441,8 +5443,6 @@ __SCNetworkReachabilityHandleChanges(SCDynamicStoreRef    store,
                                static Boolean  haveCPU_old     = TRUE;
                                Boolean         haveCPU_new;
 
-                               powerStatusChanged = TRUE;
-
                                haveCPU_new = (power_capabilities & kIOPMSystemPowerStateCapabilityCPU) != 0;
                                if ((haveCPU_old != haveCPU_new) && haveCPU_new) {
                                        /*
@@ -5456,10 +5456,16 @@ __SCNetworkReachabilityHandleChanges(SCDynamicStoreRef  store,
                                        dnsConfigChanged = TRUE;
                                }
                                haveCPU_old = haveCPU_new;
+                       } else {
+                               power_capabilities = kIOPMSytemPowerStateCapabilitiesMask;
                        }
 
                        CFRelease(num);
+               } else {
+                       power_capabilities = kIOPMSytemPowerStateCapabilitiesMask;
                }
+
+               powerStatusChanged = TRUE;
        }
        CFRelease(key);
 #endif // !TARGET_OS_IPHONE
index 4cb153accaba9ec10ae32fdff2ccf3c516e6d2fc..9366fe4f0d24b5ca5f51c1ed2fec6031cdb9e8c3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2008, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2008, 2010-2012 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -179,6 +179,19 @@ _IORegistryEntryCreateIterator(mach_port_t masterPort, const io_name_t plane, IO
 }
 
 
+__private_extern__ kern_return_t
+_IORegistryEntryGetLocationInPlane(io_registry_entry_t entry, const io_name_t plane, io_name_t location)
+{
+#undef IORegistryEntryGetLocationInPlane
+       static typeof (IORegistryEntryGetLocationInPlane) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadIOKit();
+               if (image) dyfunc = dlsym(image, "IORegistryEntryGetLocationInPlane");
+       }
+       return dyfunc ? dyfunc(entry, plane, location) : KERN_FAILURE;
+}
+
+
 __private_extern__ kern_return_t
 _IORegistryEntryGetName(io_registry_entry_t entry, io_name_t name)
 {
@@ -192,6 +205,19 @@ _IORegistryEntryGetName(io_registry_entry_t entry, io_name_t name)
 }
 
 
+__private_extern__ kern_return_t
+_IORegistryEntryGetNameInPlane(io_registry_entry_t entry, const io_name_t plane, io_name_t name)
+{
+       #undef IORegistryEntryGetNameInPlane
+       static typeof (IORegistryEntryGetNameInPlane) *dyfunc = NULL;
+       if (!dyfunc) {
+               void *image = __loadIOKit();
+               if (image) dyfunc = dlsym(image, "IORegistryEntryGetNameInPlane");
+       }
+       return dyfunc ? dyfunc(entry, plane, name) : KERN_FAILURE;
+}
+
+
 __private_extern__ kern_return_t
 _IORegistryEntryGetParentEntry(io_registry_entry_t entry, const io_name_t plane, io_registry_entry_t *parent)
 {
index 09d4f11a6adbb63cb19a51665506c5d6c6ed3918..3cd5bd89cb02940312771b501f9d6cbe84a97ceb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2008, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2008, 2010-2012 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -108,6 +108,14 @@ _IORegistryEntryCreateIterator             (
                                        );
 #define IORegistryEntryCreateIterator _IORegistryEntryCreateIterator
 
+kern_return_t
+_IORegistryEntryGetLocationInPlane     (
+                                       io_registry_entry_t     entry,
+                                       const io_name_t         plane,
+                                       io_name_t               location
+                                       );
+#define        IORegistryEntryGetLocationInPlane _IORegistryEntryGetLocationInPlane
+
 kern_return_t
 _IORegistryEntryGetName                        (
                                        io_registry_entry_t     entry,
@@ -115,6 +123,14 @@ _IORegistryEntryGetName                    (
                                        );
 #define        IORegistryEntryGetName _IORegistryEntryGetName
 
+kern_return_t
+_IORegistryEntryGetNameInPlane         (
+                                       io_registry_entry_t     entry,
+                                       const io_name_t         plane,
+                                       io_name_t               name
+                                       );
+#define        IORegistryEntryGetNameInPlane _IORegistryEntryGetNameInPlane
+
 kern_return_t
 _IORegistryEntryGetParentEntry         (
                                        io_registry_entry_t     entry,
index 27753afa3b60cb358e7c66880ecfcb0248c36938..d9dfe2cdd36cec6897980e2bd8b1796819e4d981 100644 (file)
@@ -912,6 +912,7 @@ target_add(reach_client_t *client, xpc_object_t request)
        int64_t                                 if_index;
        const char                              *if_name        = NULL;
        bool                                    onDemandBypass  = FALSE;
+       bool                                    resolverBypass  = FALSE;
        uint64_t                                target_id;
 
 
@@ -921,7 +922,6 @@ target_add(reach_client_t *client, xpc_object_t request)
        size_t                                  len;
        xpc_connection_t                        remote;
        xpc_object_t                            reply;
-       bool                                    resolverBypass  = FALSE;
        uint64_t                                status          = REACH_REQUEST_REPLY_FAILED;
 
        Boolean                                 added;
@@ -958,11 +958,13 @@ target_add(reach_client_t *client, xpc_object_t request)
 
        name = xpc_dictionary_get_string(request, REACH_TARGET_NAME);
        if (name != NULL) {
+               CC_SHA1_Update(&ctx, REACH_TARGET_NAME, sizeof(REACH_TARGET_NAME));
                CC_SHA1_Update(&ctx, name, strlen(name));
        }
 
        serv = xpc_dictionary_get_string(request, REACH_TARGET_SERV);
        if (serv != NULL) {
+               CC_SHA1_Update(&ctx, REACH_TARGET_SERV, sizeof(REACH_TARGET_SERV));
                CC_SHA1_Update(&ctx, serv, strlen(serv));
        }
 
@@ -970,6 +972,7 @@ target_add(reach_client_t *client, xpc_object_t request)
        if (localAddress != NULL) {
                if ((len == localAddress->sa_len) && (len <= sizeof(struct sockaddr_storage))) {
                        sanitize_address(localAddress, (struct sockaddr *)&localAddress0);
+                       CC_SHA1_Update(&ctx, REACH_TARGET_LOCAL_ADDR, sizeof(REACH_TARGET_LOCAL_ADDR));
                        CC_SHA1_Update(&ctx, &localAddress0, len);
                } else {
                        xpc_dictionary_set_string(reply,
@@ -983,6 +986,7 @@ target_add(reach_client_t *client, xpc_object_t request)
        if (remoteAddress != NULL) {
                if ((len == remoteAddress->sa_len) && (len <= sizeof(struct sockaddr_storage))) {
                        sanitize_address(remoteAddress, (struct sockaddr *)&remoteAddress0);
+                       CC_SHA1_Update(&ctx, REACH_TARGET_REMOTE_ADDR, sizeof(REACH_TARGET_REMOTE_ADDR));
                        CC_SHA1_Update(&ctx, &remoteAddress0, len);
                } else {
                        xpc_dictionary_set_string(reply,
@@ -995,6 +999,7 @@ target_add(reach_client_t *client, xpc_object_t request)
        hints = xpc_dictionary_get_data(request, REACH_TARGET_HINTS, &len);
        if (hints != NULL) {
                if (len == sizeof(struct addrinfo)) {
+                       CC_SHA1_Update(&ctx, REACH_TARGET_HINTS, sizeof(REACH_TARGET_HINTS));
                        CC_SHA1_Update(&ctx, hints, len);
                } else {
                        xpc_dictionary_set_string(reply,
@@ -1008,17 +1013,20 @@ target_add(reach_client_t *client, xpc_object_t request)
        if (if_index != 0) {
                if_name = xpc_dictionary_get_string(request, REACH_TARGET_IF_NAME);
                if (if_name != NULL) {
+                       CC_SHA1_Update(&ctx, REACH_TARGET_IF_NAME, sizeof(REACH_TARGET_IF_NAME));
                        CC_SHA1_Update(&ctx, if_name, strlen(if_name));
                }
        }
 
        onDemandBypass = xpc_dictionary_get_bool(request, REACH_TARGET_ONDEMAND_BYPASS);
        if (onDemandBypass) {
+               CC_SHA1_Update(&ctx, REACH_TARGET_ONDEMAND_BYPASS, sizeof(REACH_TARGET_ONDEMAND_BYPASS));
                CC_SHA1_Update(&ctx, &onDemandBypass, sizeof(onDemandBypass));
        }
 
        resolverBypass = xpc_dictionary_get_bool(request, REACH_TARGET_RESOLVER_BYPASS);
        if (resolverBypass) {
+               CC_SHA1_Update(&ctx, REACH_TARGET_RESOLVER_BYPASS, sizeof(REACH_TARGET_RESOLVER_BYPASS));
                CC_SHA1_Update(&ctx, &resolverBypass, sizeof(resolverBypass));
        }