From: Apple Date: Thu, 12 Nov 2009 17:56:48 +0000 (+0000) Subject: configd-289.2.tar.gz X-Git-Tag: mac-os-x-1062^0 X-Git-Url: https://git.saurik.com/apple/configd.git/commitdiff_plain/648d529ea8204abeb05f51ae6c637b7e301e2f2b configd-289.2.tar.gz --- diff --git a/Plugins/ATconfig/Info.plist b/Plugins/ATconfig/Info.plist index b00efea..0dd645a 100644 --- a/Plugins/ATconfig/Info.plist +++ b/Plugins/ATconfig/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 Builtin Requires diff --git a/Plugins/IPMonitor/Info.plist b/Plugins/IPMonitor/Info.plist index 58acde2..3af5857 100644 --- a/Plugins/IPMonitor/Info.plist +++ b/Plugins/IPMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 Requires com.apple.SystemConfiguration.IPConfiguration diff --git a/Plugins/InterfaceNamer/Info.plist b/Plugins/InterfaceNamer/Info.plist index 1fede74..c856a4d 100644 --- a/Plugins/InterfaceNamer/Info.plist +++ b/Plugins/InterfaceNamer/Info.plist @@ -17,10 +17,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 diff --git a/Plugins/KernelEventMonitor/Info.plist b/Plugins/KernelEventMonitor/Info.plist index 9bc200b..8c5c594 100644 --- a/Plugins/KernelEventMonitor/Info.plist +++ b/Plugins/KernelEventMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 Requires com.apple.SystemConfiguration.InterfaceNamer diff --git a/Plugins/Kicker/Info.plist b/Plugins/Kicker/Info.plist index 21cece0..bdbd2be 100644 --- a/Plugins/Kicker/Info.plist +++ b/Plugins/Kicker/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 Requires com.apple.SystemConfiguration.ATconfig diff --git a/Plugins/LinkConfiguration/Info.plist b/Plugins/LinkConfiguration/Info.plist index 3933e3c..35c4f29 100644 --- a/Plugins/LinkConfiguration/Info.plist +++ b/Plugins/LinkConfiguration/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 Requires com.apple.SystemConfiguration.InterfaceNamer diff --git a/Plugins/Logger/Info.plist b/Plugins/Logger/Info.plist index 83f8d68..6187ec8 100644 --- a/Plugins/Logger/Info.plist +++ b/Plugins/Logger/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 Enabled Verbose diff --git a/Plugins/NetworkIdentification/Info.plist b/Plugins/NetworkIdentification/Info.plist index 78e6222..2c86bd5 100644 --- a/Plugins/NetworkIdentification/Info.plist +++ b/Plugins/NetworkIdentification/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 Builtin diff --git a/Plugins/PreferencesMonitor/Info.plist b/Plugins/PreferencesMonitor/Info.plist index 722d017..20944c8 100644 --- a/Plugins/PreferencesMonitor/Info.plist +++ b/Plugins/PreferencesMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 Builtin Requires diff --git a/SCMonitor/Info.plist b/SCMonitor/Info.plist index ca396d1..4e173ba 100644 --- a/SCMonitor/Info.plist +++ b/SCMonitor/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 CFPlugInDynamicRegistration NO CFPlugInFactories diff --git a/SystemConfiguration.fproj/Info.plist b/SystemConfiguration.fproj/Info.plist index 8714e9f..c1ff999 100644 --- a/SystemConfiguration.fproj/Info.plist +++ b/SystemConfiguration.fproj/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable SystemConfiguration CFBundleGetInfoString - 1.10 + 1.10.1 CFBundleIdentifier com.apple.SystemConfiguration CFBundleInfoDictionaryVersion @@ -17,10 +17,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.10 + 1.10.1 CFBundleSignature ???? CFBundleVersion - 1.10 + 1.10.1 diff --git a/SystemConfiguration.fproj/SCNetworkConnection.c b/SystemConfiguration.fproj/SCNetworkConnection.c index c0b8e21..2ec298f 100644 --- a/SystemConfiguration.fproj/SCNetworkConnection.c +++ b/SystemConfiguration.fproj/SCNetworkConnection.c @@ -475,8 +475,10 @@ SCNetworkConnectionCopyAvailableServices(SCNetworkSetRef set) SCPreferencesRef prefs; prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkConnectionCopyAvailableServices"), NULL); - set = SCNetworkSetCopyCurrent(prefs); - CFRelease(prefs); + if (prefs != NULL) { + set = SCNetworkSetCopyCurrent(prefs); + CFRelease(prefs); + } tempSet = TRUE; } @@ -498,6 +500,10 @@ SCNetworkConnectionCopyAvailableServices(SCNetworkSetRef set) service = CFArrayGetValueAtIndex(services, i); interface = SCNetworkServiceGetInterface(service); + if (interface == NULL) { + continue; + } + interfaceType = SCNetworkInterfaceGetInterfaceType(interface); if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP) || CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) { diff --git a/SystemConfiguration.fproj/SCNetworkInterface.c b/SystemConfiguration.fproj/SCNetworkInterface.c index 4424aaa..3c687ba 100644 --- a/SystemConfiguration.fproj/SCNetworkInterface.c +++ b/SystemConfiguration.fproj/SCNetworkInterface.c @@ -503,8 +503,19 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2) return FALSE; // if not the same device } - if (!_SC_CFEqual(if1->entity_device_unique, if2->entity_device_unique)) { - return FALSE; // if not the same device unique identifier + if ((if1->entity_device_unique != NULL) && (if2->entity_device_unique != NULL)) { + if (!_SC_CFEqual(if1->entity_device_unique, if2->entity_device_unique)) { + return FALSE; // if not the same device unique identifier + } + } else if ((if1->entity_device_unique != NULL) || (if2->entity_device_unique != NULL)) { + CFStringRef name1; + CFStringRef name2; + + name1 = __SCNetworkInterfaceGetNonLocalizedDisplayName((SCNetworkInterfaceRef)if1); + name2 = __SCNetworkInterfaceGetNonLocalizedDisplayName((SCNetworkInterfaceRef)if2); + if ((name1 != NULL) && (name2 != NULL) && !_SC_CFEqual(name1, name2)) { + return FALSE; // if same device but not the same display name + } } #if !TARGET_OS_IPHONE @@ -2755,9 +2766,10 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, { SCNetworkInterfacePrivateRef interfacePrivate = NULL; CFStringRef ifDevice; - CFStringRef ifUnique; + CFStringRef ifName = NULL; CFStringRef ifSubType; CFStringRef ifType; + CFStringRef ifUnique; CFArrayRef matching_interfaces = NULL; /* initialize runtime (and kSCNetworkInterfaceIPv4) */ @@ -2838,6 +2850,42 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, // note: the "matching" dictionary will be consumed by the following matching_interfaces = findMatchingInterfaces(matching, processSerialInterface); + if (ifUnique == NULL) { + CFIndex n; + Boolean useDeviceName = TRUE; + + n = (matching_interfaces != NULL) ? CFArrayGetCount(matching_interfaces) : 0; + if (n > 0) { + CFIndex i; + + for (i = 0; i < n; i++) { + SCNetworkInterfacePrivateRef scanPrivate; + + scanPrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, i); + if (scanPrivate->entity_device_unique != NULL) { + useDeviceName = FALSE; + break; + } + } + } + + if (useDeviceName) { + if (matching_interfaces != NULL) { + CFRelease(matching_interfaces); + } + + match_keys[1] = CFSTR(kIOTTYDeviceKey); + matching = CFDictionaryCreate(NULL, + (const void **)match_keys, + (const void **)match_vals, + sizeof(match_keys)/sizeof(match_keys[0]), + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + // note: the "matching" dictionary will be consumed by the following + matching_interfaces = findMatchingInterfaces(matching, processSerialInterface); + } + } } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypeL2TP)) { interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4, kSCNetworkInterfaceTypeL2TP); @@ -2903,18 +2951,49 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, if (ifUnique != NULL) { CFIndex i; + // we are looking for an interface with a unique ID + // so let's try to focus our choices for (i = 0; i < n; i++) { - SCNetworkInterfacePrivateRef scan; + SCNetworkInterfacePrivateRef scanPrivate; - scan = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, i); - if (_SC_CFEqual(ifUnique, scan->entity_device_unique)) { + scanPrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, i); + if (_SC_CFEqual(ifUnique, scanPrivate->entity_device_unique)) { if (interfacePrivate != NULL) { // if we've matched more than one interface interfacePrivate = NULL; break; } - interfacePrivate = scan; + interfacePrivate = scanPrivate; + } + } + } else if (CFDictionaryGetValueIfPresent(interface_entity, + kSCPropUserDefinedName, + (const void **)&ifName)) { + CFIndex i; + + // we don't have a unique ID but do have an interface + // name. If the matching interfaces do have IDs than + // we can try to focus our choices using the name + for (i = 0; i < n; i++) { + SCNetworkInterfacePrivateRef scanPrivate; + + scanPrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, i); + if (scanPrivate->entity_device_unique != NULL) { + SCNetworkInterfaceRef scan = (SCNetworkInterfaceRef)scanPrivate; + CFStringRef scanName; + + scanName = __SCNetworkInterfaceGetNonLocalizedDisplayName(scan); + if ((scanName != NULL) && !_SC_CFEqual(ifName, scanName)) { + continue; // if not the same display name + } + } + + if (interfacePrivate != NULL) { + // if we've matched more than one interface + interfacePrivate = NULL; + break; } + interfacePrivate = scanPrivate; } } if (interfacePrivate == NULL) { diff --git a/scutil.tproj/net_service.c b/scutil.tproj/net_service.c index 507ccff..4b096a9 100644 --- a/scutil.tproj/net_service.c +++ b/scutil.tproj/net_service.c @@ -346,7 +346,9 @@ create_service(int argc, char **argv) if (net_interface != NULL) CFRelease(net_interface); net_interface = SCNetworkServiceGetInterface(net_service); - CFRetain(net_interface); + if (net_interface != NULL) { + CFRetain(net_interface); + } interfaceName = SCNetworkInterfaceGetLocalizedDisplayName(interface); if (interfaceName == NULL) {