From: Apple Date: Mon, 17 Sep 2012 18:16:19 +0000 (+0000) Subject: configd-453.18.tar.gz X-Git-Tag: mac-os-x-1082^0 X-Git-Url: https://git.saurik.com/apple/configd.git/commitdiff_plain/e812fdb871f10f5cf5da36a6ef93e546c3f7c19f configd-453.18.tar.gz --- diff --git a/Plugins/IPMonitor/Info.plist b/Plugins/IPMonitor/Info.plist index 667418a..09072ba 100644 --- a/Plugins/IPMonitor/Info.plist +++ b/Plugins/IPMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 Requires com.apple.SystemConfiguration.IPConfiguration diff --git a/Plugins/IPMonitor/dns-configuration.c b/Plugins/IPMonitor/dns-configuration.c index ca9e7ba..bd20b75 100644 --- a/Plugins/IPMonitor/dns-configuration.c +++ b/Plugins/IPMonitor/dns-configuration.c @@ -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, diff --git a/Plugins/InterfaceNamer/Info.plist b/Plugins/InterfaceNamer/Info.plist index 5efd372..bd0a960 100644 --- a/Plugins/InterfaceNamer/Info.plist +++ b/Plugins/InterfaceNamer/Info.plist @@ -17,10 +17,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 diff --git a/Plugins/KernelEventMonitor/Info.plist b/Plugins/KernelEventMonitor/Info.plist index 5473f52..dd41426 100644 --- a/Plugins/KernelEventMonitor/Info.plist +++ b/Plugins/KernelEventMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 Requires com.apple.SystemConfiguration.InterfaceNamer diff --git a/Plugins/LinkConfiguration/Info.plist b/Plugins/LinkConfiguration/Info.plist index f3cbe7b..788c103 100644 --- a/Plugins/LinkConfiguration/Info.plist +++ b/Plugins/LinkConfiguration/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 Requires com.apple.SystemConfiguration.InterfaceNamer diff --git a/Plugins/Logger/Info-Embedded.plist b/Plugins/Logger/Info-Embedded.plist index 295de0b..55b61a5 100644 --- a/Plugins/Logger/Info-Embedded.plist +++ b/Plugins/Logger/Info-Embedded.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 Enabled Verbose diff --git a/Plugins/Logger/Info.plist b/Plugins/Logger/Info.plist index 440c296..be89fde 100644 --- a/Plugins/Logger/Info.plist +++ b/Plugins/Logger/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 Enabled Verbose diff --git a/Plugins/PreferencesMonitor/Info.plist b/Plugins/PreferencesMonitor/Info.plist index 8cf44b4..4648c9d 100644 --- a/Plugins/PreferencesMonitor/Info.plist +++ b/Plugins/PreferencesMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 Builtin Requires diff --git a/Plugins/SCNetworkReachability/Info.plist b/Plugins/SCNetworkReachability/Info.plist index 172cd34..6b407f5 100644 --- a/Plugins/SCNetworkReachability/Info.plist +++ b/Plugins/SCNetworkReachability/Info.plist @@ -17,10 +17,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 diff --git a/SCMonitor/Info.plist b/SCMonitor/Info.plist index 153ad6f..22482f2 100644 --- a/SCMonitor/Info.plist +++ b/SCMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 CFPlugInDynamicRegistration NO CFPlugInFactories diff --git a/SCMonitor/monitor.c b/SCMonitor/monitor.c index ca34028..27d67de 100644 --- a/SCMonitor/monitor.c +++ b/SCMonitor/monitor.c @@ -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; diff --git a/SystemConfiguration.fproj/Info-Embedded.plist b/SystemConfiguration.fproj/Info-Embedded.plist index f9008ac..87f9a94 100644 --- a/SystemConfiguration.fproj/Info-Embedded.plist +++ b/SystemConfiguration.fproj/Info-Embedded.plist @@ -7,7 +7,7 @@ CFBundleExecutable SystemConfiguration CFBundleGetInfoString - 1.12 + 1.12.2 CFBundleIdentifier com.apple.SystemConfiguration CFBundleInfoDictionaryVersion @@ -17,10 +17,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 diff --git a/SystemConfiguration.fproj/Info.plist b/SystemConfiguration.fproj/Info.plist index f9008ac..87f9a94 100644 --- a/SystemConfiguration.fproj/Info.plist +++ b/SystemConfiguration.fproj/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable SystemConfiguration CFBundleGetInfoString - 1.12 + 1.12.2 CFBundleIdentifier com.apple.SystemConfiguration CFBundleInfoDictionaryVersion @@ -17,10 +17,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.12 + 1.12.2 CFBundleSignature ???? CFBundleVersion - 1.12 + 1.12.2 diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c b/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c index cf3ec8e..2652bc4 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c @@ -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); diff --git a/SystemConfiguration.fproj/SCNetworkInterface.c b/SystemConfiguration.fproj/SCNetworkInterface.c index a9cbfc0..bb681bd 100644 --- a/SystemConfiguration.fproj/SCNetworkInterface.c +++ b/SystemConfiguration.fproj/SCNetworkInterface.c @@ -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 diff --git a/SystemConfiguration.fproj/SCNetworkReachability.c b/SystemConfiguration.fproj/SCNetworkReachability.c index 2d0c04f..f13c2a7 100644 --- a/SystemConfiguration.fproj/SCNetworkReachability.c +++ b/SystemConfiguration.fproj/SCNetworkReachability.c @@ -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 diff --git a/SystemConfiguration.fproj/dy_framework.c b/SystemConfiguration.fproj/dy_framework.c index 4cb153a..9366fe4 100644 --- a/SystemConfiguration.fproj/dy_framework.c +++ b/SystemConfiguration.fproj/dy_framework.c @@ -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) { diff --git a/SystemConfiguration.fproj/dy_framework.h b/SystemConfiguration.fproj/dy_framework.h index 09d4f11..3cd5bd8 100644 --- a/SystemConfiguration.fproj/dy_framework.h +++ b/SystemConfiguration.fproj/dy_framework.h @@ -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, diff --git a/SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_server.c b/SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_server.c index 27753af..d9dfe2c 100644 --- a/SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_server.c +++ b/SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_server.c @@ -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)); }