+ 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);
+ }
+ }