From a40a14f8bcc57d8bed0203ddee43e8d64db39796 Mon Sep 17 00:00:00 2001 From: Apple Date: Tue, 25 Aug 2009 00:03:45 +0000 Subject: [PATCH] configd-289.tar.gz --- Plugins/ATconfig/Info.plist | 6 +- Plugins/IPMonitor/Info.plist | 10 +- Plugins/IPMonitor/Makefile | 24 + Plugins/IPMonitor/Resolvers.plist | 21 - Plugins/IPMonitor/dns-configuration.c | 292 +- Plugins/IPMonitor/dns-configuration.h | 10 +- Plugins/IPMonitor/ip_plugin.c | 3773 ++++++++++--- Plugins/IPMonitor/set-hostname.c | 111 +- Plugins/IPMonitor/smb-configuration.c | 307 +- .../IPMonitor/test_ipv4_routelist_filter.sh | 2 + .../test_ipv4_routelist_reference.txt | 768 +++ Plugins/IPMonitor/test_reference.sh | 87 + Plugins/InterfaceNamer/Info.plist | 10 +- Plugins/InterfaceNamer/ifnamer.c | 53 +- Plugins/KernelEventMonitor/Info.plist | 6 +- Plugins/KernelEventMonitor/ev_dlil.c | 5 +- Plugins/KernelEventMonitor/ev_ipv4.c | 18 +- Plugins/KernelEventMonitor/ev_ipv4.h | 6 +- Plugins/KernelEventMonitor/eventmon.c | 59 +- Plugins/Kicker/Info.plist | 6 +- Plugins/LinkConfiguration/Info.plist | 6 +- Plugins/Logger/Info-Embedded.plist | 48 + Plugins/Logger/Info.plist | 60 + Plugins/Logger/Makefile | 6 + Plugins/Logger/logger.c | 1832 +++++++ Plugins/NetworkIdentification/Info.plist | 6 +- .../NetworkIdentification.c | 14 +- Plugins/PreferencesMonitor/Info.plist | 6 +- Plugins/PreferencesMonitor/prefsmon.c | 143 +- SCMonitor/English.lproj/Localizable.strings | Bin 964 -> 1608 bytes SCMonitor/Info.plist | 8 +- SCMonitor/monitor.c | 710 ++- SystemConfiguration.fproj/BondConfiguration.c | 1592 +----- SystemConfiguration.fproj/BondConfiguration.h | 127 - .../BondConfigurationPrivate.h | 42 - .../DHCPClientPreferences.h | 19 +- .../English.lproj/Localizable.strings | Bin 598 -> 1298 bytes .../English.lproj/NetworkInterface.strings | Bin 3552 -> 4274 bytes SystemConfiguration.fproj/Info-Embedded.plist | 26 + SystemConfiguration.fproj/Info.plist | 6 +- SystemConfiguration.fproj/LinkConfiguration.h | 11 +- .../NetworkConfiguration.plist | 58 +- SystemConfiguration.fproj/SCD.c | 337 +- SystemConfiguration.fproj/SCDAdd.c | 27 +- SystemConfiguration.fproj/SCDConsoleUser.c | 14 +- SystemConfiguration.fproj/SCDGet.c | 42 +- SystemConfiguration.fproj/SCDHostName.c | 8 +- SystemConfiguration.fproj/SCDList.c | 22 +- SystemConfiguration.fproj/SCDLock.c | 14 +- SystemConfiguration.fproj/SCDNotifierAdd.c | 14 +- SystemConfiguration.fproj/SCDNotifierCancel.c | 35 +- .../SCDNotifierGetChanges.c | 22 +- .../SCDNotifierInformViaCallback.c | 370 +- .../SCDNotifierInformViaFD.c | 47 +- .../SCDNotifierInformViaMachPort.c | 48 +- .../SCDNotifierInformViaSignal.c | 14 +- SystemConfiguration.fproj/SCDNotifierRemove.c | 14 +- .../SCDNotifierSetKeys.c | 14 +- SystemConfiguration.fproj/SCDNotifierWait.c | 63 +- SystemConfiguration.fproj/SCDNotify.c | 14 +- SystemConfiguration.fproj/SCDOpen.c | 180 +- SystemConfiguration.fproj/SCDPrivate.c | 369 +- SystemConfiguration.fproj/SCDRemove.c | 14 +- SystemConfiguration.fproj/SCDSet.c | 26 +- SystemConfiguration.fproj/SCDSnapshot.c | 14 +- SystemConfiguration.fproj/SCDTouch.c | 14 +- SystemConfiguration.fproj/SCDUnlock.c | 14 +- SystemConfiguration.fproj/SCDynamicStore.h | 69 +- .../SCDynamicStoreCopyDHCPInfo.h | 17 +- .../SCDynamicStoreCopySpecific.h | 19 +- .../SCDynamicStoreCopySpecificPrivate.h | 29 +- .../SCDynamicStoreInternal.h | 23 +- SystemConfiguration.fproj/SCDynamicStoreKey.h | 29 +- .../SCDynamicStoreSetSpecificPrivate.h | 7 +- SystemConfiguration.fproj/SCNetwork.h | 41 +- .../SCNetworkConfiguration.h | 277 +- .../SCNetworkConfigurationInternal.c | 58 +- .../SCNetworkConfigurationInternal.h | 42 +- .../SCNetworkConfigurationPrivate.h | 154 +- .../SCNetworkConnection.c | 938 +++- .../SCNetworkConnection.h | 92 +- .../SCNetworkConnectionPrivate.c | 388 +- .../SCNetworkConnectionPrivate.h | 135 +- .../SCNetworkInterface.c | 1485 +++++- SystemConfiguration.fproj/SCNetworkProtocol.c | 12 +- .../SCNetworkReachability.c | 2472 ++++++--- .../SCNetworkReachability.h | 137 +- SystemConfiguration.fproj/SCNetworkService.c | 392 +- SystemConfiguration.fproj/SCNetworkSet.c | 181 +- .../SCNetworkSignature.c | 18 +- .../SCNetworkSignature.h | 14 +- SystemConfiguration.fproj/SCP.c | 5 +- SystemConfiguration.fproj/SCPCommit.c | 8 +- SystemConfiguration.fproj/SCPLock.c | 74 +- SystemConfiguration.fproj/SCPOpen.c | 333 +- SystemConfiguration.fproj/SCPPath.c | 4 +- SystemConfiguration.fproj/SCPUnlock.c | 41 +- SystemConfiguration.fproj/SCPreferences.h | 145 +- .../SCPreferencesInternal.h | 19 +- .../SCPreferencesKeychainPrivate.c | 65 +- .../SCPreferencesKeychainPrivate.h | 30 +- SystemConfiguration.fproj/SCPreferencesPath.h | 19 +- .../SCPreferencesPathKey.h | 26 +- .../SCPreferencesPrivate.h | 6 +- .../SCPreferencesSetSpecific.h | 11 +- SystemConfiguration.fproj/SCPrivate.h | 114 +- SystemConfiguration.fproj/SCProxies.c | 49 +- .../SCSchemaDefinitions.c | 72 +- .../SCSchemaDefinitions.h | 1969 +++---- .../SCSchemaDefinitionsPrivate.h | 366 +- .../SystemConfiguration.h | 20 +- SystemConfiguration.fproj/VLANConfiguration.c | 1171 +--- SystemConfiguration.fproj/VLANConfiguration.h | 106 - SystemConfiguration.fproj/config_types.h | 5 +- SystemConfiguration.fproj/dy_framework.c | 5 +- SystemConfiguration.fproj/dy_framework.h | 13 +- SystemConfiguration.fproj/genSCPreferences.c | 390 +- .../helper/SCHelper_client.c | 206 +- .../helper/SCHelper_client.h | 6 +- .../helper/SCHelper_server.c | 886 +++- .../helper/com.apple.SCHelper-embedded.plist | 22 + .../helper/com.apple.SCHelper.plist | 22 + SystemConfiguration.fproj/update-headers | 130 + configd.tproj/_SCD.c | 71 +- configd.tproj/_SCD.h | 6 +- configd.tproj/_configadd.c | 8 +- configd.tproj/_configclose.c | 25 +- configd.tproj/_configget.c | 8 +- configd.tproj/_configlist.c | 5 +- configd.tproj/_configlock.c | 4 +- configd.tproj/_confignotify.c | 5 +- configd.tproj/_configopen.c | 31 +- configd.tproj/_configremove.c | 5 +- configd.tproj/_configset.c | 8 +- configd.tproj/_configtouch.c | 9 +- configd.tproj/_notifyadd.c | 8 +- configd.tproj/_notifycancel.c | 11 +- configd.tproj/_notifyremove.c | 5 +- configd.tproj/_notifyviafd.c | 50 +- configd.tproj/_notifyviaport.c | 43 +- configd.tproj/_notifyviasignal.c | 88 +- configd.tproj/_snapshot.c | 5 +- configd.tproj/com.apple.configd.plist | 10 +- configd.tproj/configd.8 | 4 +- configd.tproj/configd.h | 3 +- configd.tproj/configd.m | 107 +- configd.tproj/configd_server.c | 199 +- configd.tproj/configd_server.h | 7 +- configd.tproj/entitlements.plist | 16 + configd.tproj/notify_server.c | 3 +- configd.tproj/pattern.c | 10 +- configd.tproj/plugin_support.c | 221 +- configd.tproj/session.c | 225 +- configd.tproj/session.h | 28 +- configd.xcodeproj/project.pbxproj | 4722 ++++++++++++----- dnsinfo/dnsinfo.h | 19 +- dnsinfo/dnsinfo_copy.c | 80 +- dnsinfo/dnsinfo_create.c | 16 +- dnsinfo/dnsinfo_create.h | 106 +- dnsinfo/dnsinfo_flatfile.c | 475 ++ dnsinfo/dnsinfo_private.c | 2 +- dnsinfo/dnsinfo_private.h | 22 +- dnsinfo/dnsinfo_server.c | 8 +- dnsinfo/dnsinfo_server.h | 4 +- dnsinfo/shared_dns_info.defs | 6 +- dnsinfo/shared_dns_info_types.h | 5 +- get-mobility-info | 172 +- preferences.xml | 135 - scselect.tproj/scselect.c | 30 +- scutil.tproj/commands.c | 28 +- scutil.tproj/dictionary.c | 46 +- scutil.tproj/net.c | 20 +- scutil.tproj/net_interface.c | 825 ++- scutil.tproj/net_interface.h | 2 +- scutil.tproj/net_protocol.c | 75 +- scutil.tproj/net_service.c | 100 +- scutil.tproj/net_set.c | 15 +- scutil.tproj/notifications.c | 16 +- scutil.tproj/prefs.c | 24 +- scutil.tproj/scutil.8 | 22 +- scutil.tproj/scutil.c | 38 +- scutil.tproj/tests.c | 388 +- scutil.tproj/tests.h | 3 +- 183 files changed, 23059 insertions(+), 10984 deletions(-) create mode 100644 Plugins/IPMonitor/Makefile delete mode 100644 Plugins/IPMonitor/Resolvers.plist create mode 100644 Plugins/IPMonitor/test_ipv4_routelist_filter.sh create mode 100644 Plugins/IPMonitor/test_ipv4_routelist_reference.txt create mode 100644 Plugins/IPMonitor/test_reference.sh create mode 100644 Plugins/Logger/Info-Embedded.plist create mode 100644 Plugins/Logger/Info.plist create mode 100644 Plugins/Logger/Makefile create mode 100644 Plugins/Logger/logger.c delete mode 100644 SystemConfiguration.fproj/BondConfiguration.h delete mode 100644 SystemConfiguration.fproj/BondConfigurationPrivate.h create mode 100644 SystemConfiguration.fproj/Info-Embedded.plist delete mode 100644 SystemConfiguration.fproj/VLANConfiguration.h create mode 100644 SystemConfiguration.fproj/helper/com.apple.SCHelper-embedded.plist create mode 100644 SystemConfiguration.fproj/helper/com.apple.SCHelper.plist create mode 100755 SystemConfiguration.fproj/update-headers create mode 100644 configd.tproj/entitlements.plist create mode 100644 dnsinfo/dnsinfo_flatfile.c delete mode 100644 preferences.xml diff --git a/Plugins/ATconfig/Info.plist b/Plugins/ATconfig/Info.plist index 83b7060..b00efea 100644 --- a/Plugins/ATconfig/Info.plist +++ b/Plugins/ATconfig/Info.plist @@ -11,15 +11,15 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - SystemConfiguration + com.apple.SystemConfiguration.ATconfig CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 + 1.10 Builtin Requires diff --git a/Plugins/IPMonitor/Info.plist b/Plugins/IPMonitor/Info.plist index 71a500e..58acde2 100644 --- a/Plugins/IPMonitor/Info.plist +++ b/Plugins/IPMonitor/Info.plist @@ -11,15 +11,15 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - SystemConfiguration + com.apple.SystemConfiguration.IPMonitor CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 + 1.10 Requires com.apple.SystemConfiguration.IPConfiguration @@ -27,7 +27,11 @@ Builtin + mdns_timeout + 2 pdns_timeout 5 + AppendStateArrayToSetupArray + diff --git a/Plugins/IPMonitor/Makefile b/Plugins/IPMonitor/Makefile new file mode 100644 index 0000000..80077c8 --- /dev/null +++ b/Plugins/IPMonitor/Makefile @@ -0,0 +1,24 @@ +test_dns: Makefile dns-configuration.h dns-configuration.c + cc -Wall -g -o test_dns -DMAIN dns-configuration.c -framework SystemConfiguration -framework CoreFoundation -ldnsinfo + +test_smb: Makefile smb-configuration.h smb-configuration.c + cc -Wall -g -o test_smb -DMAIN -DDEBUG smb-configuration.c -framework SystemConfiguration -framework CoreFoundation + +test_ipv4_routelist: ip_plugin.c + cc -Wall -g -o test_ipv4_routelist -DTEST_IPV4_ROUTELIST smb-configuration.c ip_plugin.c -framework SystemConfiguration -framework CoreFoundation -ldnsinfo + +IPMonitor: ip_plugin.c + cc -Wall -g -o IPMonitor -DTEST_IPMONITOR smb-configuration.c ip_plugin.c -framework SystemConfiguration -framework CoreFoundation -ldnsinfo + +test_ipv4_routelist_reference.txt: test_ipv4_routelist + sh test_reference.sh create test_ipv4_routelist test_ipv4_routelist_reference.txt test_ipv4_routelist_filter.sh + +test_ipv4_routelist_test: test_ipv4_routelist + sh test_reference.sh test test_ipv4_routelist test_ipv4_routelist_reference.txt test_ipv4_routelist_filter.sh + + +clean: + rm -rf test_dns test_dns.dSYM \ + test_smb test_smb.dSYM \ + test_ipv4_routelist test_ipv4_routelist.dSYM \ + IPMonitor IPMonitor.dSYM diff --git a/Plugins/IPMonitor/Resolvers.plist b/Plugins/IPMonitor/Resolvers.plist deleted file mode 100644 index f7fcd96..0000000 --- a/Plugins/IPMonitor/Resolvers.plist +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - Options - mdns - ServerTimeout - 2 - SupplementalMatchDomains - - local - 254.169.in-addr.arpa - 8.e.f.ip6.arpa - 9.e.f.ip6.arpa - a.e.f.ip6.arpa - b.e.f.ip6.arpa - - - - diff --git a/Plugins/IPMonitor/dns-configuration.c b/Plugins/IPMonitor/dns-configuration.c index 8db8038..e5b860a 100644 --- a/Plugins/IPMonitor/dns-configuration.c +++ b/Plugins/IPMonitor/dns-configuration.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -28,6 +28,7 @@ * - initial revision */ +#include #include #include #include @@ -40,6 +41,10 @@ #include #include #include +#if !TARGET_OS_IPHONE +#include +extern uint32_t notify_monitor_file(int token, const char *name, int flags); +#endif // !TARGET_OS_IPHONE #include #include @@ -50,12 +55,15 @@ #include #include +#ifndef kDNSServiceCompMulticastDNS +#define kDNSServiceCompMulticastDNS "MulticastDNS" +#endif #ifndef kDNSServiceCompPrivateDNS #define kDNSServiceCompPrivateDNS "PrivateDNS" #endif -/* pre-defined (supplemental) resolver configurations */ -static CFArrayRef S_predefined = NULL; +/* multicast DNS resolver configurations */ +static CFNumberRef S_mdns_timeout = NULL; /* private DNS resolver configurations */ static CFNumberRef S_pdns_timeout = NULL; @@ -196,36 +204,6 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d } -static void -add_predefined_resolvers(CFMutableArrayRef supplemental) -{ - CFIndex i; - CFIndex n; - - if (S_predefined == NULL) { - return; - } - - n = CFArrayGetCount(S_predefined); - for (i = 0; i < n; i++) { - uint32_t defaultOrder; - CFDictionaryRef dns; - - dns = CFArrayGetValueAtIndex(S_predefined, i); - if (!isA_CFDictionary(dns)) { - continue; - } - - defaultOrder = DEFAULT_SEARCH_ORDER - + (DEFAULT_SEARCH_ORDER / 2) - + ((DEFAULT_SEARCH_ORDER / 1000) * i); - add_supplemental(supplemental, dns, defaultOrder); - } - - return; -} - - #define N_QUICK 32 @@ -288,6 +266,48 @@ add_supplemental_resolvers(CFMutableArrayRef supplemental, CFDictionaryRef servi } +static void +add_multicast_resolvers(CFMutableArrayRef supplemental, CFArrayRef multicastResolvers) +{ + CFIndex i; + CFIndex n; + + n = isA_CFArray(multicastResolvers) ? CFArrayGetCount(multicastResolvers) : 0; + for (i = 0; i < n; i++) { + uint32_t defaultOrder; + CFStringRef domain; + CFNumberRef num; + CFMutableDictionaryRef resolver; + + domain = CFArrayGetValueAtIndex(multicastResolvers, i); + if (!isA_CFString(domain) || (CFStringGetLength(domain) == 0)) { + continue; + } + + defaultOrder = DEFAULT_SEARCH_ORDER + + (DEFAULT_SEARCH_ORDER / 2) + + ((DEFAULT_SEARCH_ORDER / 1000) * i); + + resolver = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFDictionarySetValue(resolver, kSCPropNetDNSDomainName, domain); + CFDictionarySetValue(resolver, kSCPropNetDNSOptions, CFSTR("mdns")); + num = CFNumberCreate(NULL, kCFNumberIntType, &defaultOrder); + CFDictionarySetValue(resolver, kSCPropNetDNSSearchOrder, num); + CFRelease(num); + if (S_mdns_timeout != NULL) { + CFDictionarySetValue(resolver, kSCPropNetDNSServerTimeout, S_mdns_timeout); + } + add_resolver(supplemental, resolver); + CFRelease(resolver); + } + + return; +} + + static void add_private_resolvers(CFMutableArrayRef supplemental, CFArrayRef privateResolvers) { @@ -424,7 +444,7 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme CFIndex defaultSearchIndex = 0; CFIndex i; CFMutableArrayRef mySearchDomains; - CFMutableArrayRef mySupplemental = (CFMutableArrayRef)supplemental; + CFMutableArrayRef mySupplemental = NULL; CFIndex n_supplemental; Boolean searchDomainAdded = FALSE; @@ -506,6 +526,7 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme CFRangeMake(0, n_supplemental), compareBySearchOrder, NULL); + supplemental = mySupplemental; } for (i = 0; i < n_supplemental; i++) { @@ -516,12 +537,22 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme CFStringRef supplementalDomain; uint32_t supplementalOrder; - dns = CFArrayGetValueAtIndex(mySupplemental, i); + dns = CFArrayGetValueAtIndex(supplemental, i); options = CFDictionaryGetValue(dns, kSCPropNetDNSOptions); - if (isA_CFString(options) && CFEqual(options, CFSTR("pdns"))) { - // don't add private resolver domains to the search list - continue; + if (isA_CFString(options)) { + CFRange range; + + if (CFEqual(options, CFSTR("pdns"))) { + // don't add private resolver domains to the search list + continue; + } + + range = CFStringFind(options, CFSTR("interface="), 0); + if (range.location != kCFNotFound) { + // don't add scoped resolver domains to the search list + continue; + } } supplementalDomain = CFDictionaryGetValue(dns, kSCPropNetDNSDomainName); @@ -581,7 +612,7 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme } CFRelease(mySearchDomains); - if (mySupplemental != supplemental) CFRelease(mySupplemental); + if (mySupplemental != NULL) CFRelease(mySupplemental); return; } @@ -682,6 +713,64 @@ create_resolver(CFDictionaryRef dns) } } + // process sortlist + list = CFDictionaryGetValue(dns, kSCPropNetDNSSortList); + if (isA_CFArray(list)) { + CFIndex i; + CFIndex n = CFArrayGetCount(list); + + for (i = 0; i < n; i++) { + char buf[128]; + char *slash; + dns_sortaddr_t sortaddr; + + str = CFArrayGetValueAtIndex(list, i); + if (!isA_CFString(str)) { + continue; + } + + if (_SC_cfstring_to_cstring(str, buf, sizeof(buf), kCFStringEncodingASCII) == NULL) { + continue; + } + + slash = strchr(buf, '/'); + if (slash != NULL) { + *slash = '\0'; + } + + bzero(&sortaddr, sizeof(sortaddr)); + if (inet_aton(buf, &sortaddr.address) != 1) { + /* if address not valid */ + continue; + } + + if (slash != NULL) { + if (inet_aton(slash + 1, &sortaddr.mask) != 1) { + /* if subnet mask not valid */ + continue; + } + } else { + in_addr_t a; + in_addr_t m; + + a = ntohl(sortaddr.address.s_addr); + if (IN_CLASSA(a)) { + m = IN_CLASSA_NET; + } else if (IN_CLASSB(a)) { + m = IN_CLASSB_NET; + } else if (IN_CLASSC(a)) { + m = IN_CLASSC_NET; + } else { + continue; + } + + sortaddr.mask.s_addr = htonl(m); + } + + _dns_resolver_add_sortaddr(&_resolver, &sortaddr); + } + } + // process port num = CFDictionaryGetValue(dns, kSCPropNetDNSServerPort); if (isA_CFNumber(num)) { @@ -723,19 +812,23 @@ void dns_configuration_set(CFDictionaryRef defaultResolver, CFDictionaryRef services, CFArrayRef serviceOrder, + CFArrayRef multicastResolvers, CFArrayRef privateResolvers) { CFIndex i; CFMutableDictionaryRef myDefault; - CFStringRef myDomain = NULL; uint32_t myOrder = DEFAULT_SEARCH_ORDER; Boolean myOrderAdded = FALSE; CFIndex n_supplemental; CFNumberRef order; dns_create_resolver_t resolver; - CFArrayRef search; CFMutableArrayRef supplemental; +#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN + CFStringRef myDomain = NULL; + CFArrayRef search; +#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN + if (defaultResolver == NULL) { myDefault = CFDictionaryCreateMutable(NULL, 0, @@ -763,6 +856,7 @@ dns_configuration_set(CFDictionaryRef defaultResolver, // identify search[] list and/or domain name +#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN search = CFDictionaryGetValue(myDefault, kSCPropNetDNSSearchDomains); if (isA_CFArray(search) && (CFArrayGetCount(search) > 0)) { myDomain = CFArrayGetValueAtIndex(search, 0); @@ -787,6 +881,7 @@ dns_configuration_set(CFDictionaryRef defaultResolver, add_resolver(supplemental, mySupplemental); CFRelease(mySupplemental); } +#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN // collect (and add) any supplemental resolver configurations @@ -800,12 +895,13 @@ dns_configuration_set(CFDictionaryRef defaultResolver, update_search_domains(&myDefault, supplemental); - // add any pre-defined resolver configurations + // collect (and add) any "multicast" resolver configurations - add_predefined_resolvers(supplemental); + add_multicast_resolvers(supplemental, multicastResolvers); // check if the "match for default domain" (above) is really needed +#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN if (myDomain != NULL) { Boolean sharedDomain = FALSE; @@ -844,6 +940,7 @@ dns_configuration_set(CFDictionaryRef defaultResolver, CFArrayRemoveValueAtIndex(supplemental, 0); } } +#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN // establish resolver configuration @@ -883,6 +980,12 @@ dns_configuration_set(CFDictionaryRef defaultResolver, _dns_resolver_free(&resolver); } +#if !TARGET_OS_IPHONE + // add flatfile resolvers + + _dnsinfo_flatfile_add_resolvers(&_config); +#endif // !TARGET_OS_IPHONE + // save configuration if (!_dns_configuration_store(&_config)) { @@ -899,44 +1002,85 @@ dns_configuration_set(CFDictionaryRef defaultResolver, } +#if !TARGET_OS_IPHONE +static SCDynamicStoreRef dns_configuration_store; +static SCDynamicStoreCallBack dns_configuration_callout; + static void -load_predefined_resolvers(CFBundleRef bundle) +dns_configuration_changed(CFMachPortRef port, void *msg, CFIndex size, void *info) { - Boolean ok; - CFURLRef url; - CFStringRef xmlError = NULL; - CFDataRef xmlResolvers = NULL; + CFStringRef key = CFSTR(_PATH_RESOLVER_DIR); + CFArrayRef keys; + Boolean resolvers_now; + static Boolean resolvers_save = FALSE; + struct stat statbuf; + + resolvers_now = (stat(_PATH_RESOLVER_DIR, &statbuf) == 0); + if (!resolvers_save && (resolvers_save == resolvers_now)) { + // if we did not (and still do not) have an "/etc/resolvers" + // directory than this notification is the result of a change + // to the "/etc" directory. + return; + } + resolvers_save = resolvers_now; + + SCLog(TRUE, LOG_DEBUG, CFSTR(_PATH_RESOLVER_DIR " changed")); - url = CFBundleCopyResourceURL(bundle, CFSTR("Resolvers"), CFSTR("plist"), NULL); - if (url == NULL) { + // fake a "DNS" change + keys = CFArrayCreate(NULL, (const void **)&key, 1, &kCFTypeArrayCallBacks); + (*dns_configuration_callout)(dns_configuration_store, keys, NULL); + CFRelease(keys); + return; +} + + +__private_extern__ +void +dns_configuration_monitor(SCDynamicStoreRef store, SCDynamicStoreCallBack callout) +{ + CFMachPortRef mp; + mach_port_t notify_port; + int notify_token; + CFRunLoopSourceRef rls; + uint32_t status; + + dns_configuration_store = store; + dns_configuration_callout = callout; + + status = notify_register_mach_port(_PATH_RESOLVER_DIR, ¬ify_port, 0, ¬ify_token); + if (status != NOTIFY_STATUS_OK) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed")); return; } - ok = CFURLCreateDataAndPropertiesFromResource(NULL, url, &xmlResolvers, NULL, NULL, NULL); - CFRelease(url); - if (!ok || (xmlResolvers == NULL)) { + status = notify_monitor_file(notify_token, "/private" _PATH_RESOLVER_DIR, 0); + if (status != NOTIFY_STATUS_OK) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_monitor_file() failed")); + (void)notify_cancel(notify_token); return; } - /* convert the XML data into a property list */ - S_predefined = CFPropertyListCreateFromXMLData(NULL, xmlResolvers, kCFPropertyListImmutable, &xmlError); - CFRelease(xmlResolvers); - if (S_predefined == NULL) { - if (xmlError != NULL) { - SCLog(TRUE, LOG_DEBUG, CFSTR("add_predefined_resolvers: %@"), xmlError); - CFRelease(xmlError); - } + mp = CFMachPortCreateWithPort(NULL, notify_port, dns_configuration_changed, NULL, NULL); + if (mp == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed")); + (void)notify_cancel(notify_token); return; } - if (!isA_CFArray(S_predefined)) { - CFRelease(S_predefined); - S_predefined = NULL; + rls = CFMachPortCreateRunLoopSource(NULL, mp, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(mp); + (void)notify_cancel(notify_token); return; } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + CFRelease(mp); return; } +#endif // !TARGET_OS_IPHONE __private_extern__ @@ -947,11 +1091,13 @@ dns_configuration_init(CFBundleRef bundle) dict = CFBundleGetInfoDictionary(bundle); if (isA_CFDictionary(dict)) { + S_mdns_timeout = CFDictionaryGetValue(dict, CFSTR("mdns_timeout")); + S_mdns_timeout = isA_CFNumber(S_mdns_timeout); + S_pdns_timeout = CFDictionaryGetValue(dict, CFSTR("pdns_timeout")); S_pdns_timeout = isA_CFNumber(S_pdns_timeout); } - load_predefined_resolvers(bundle); return; } @@ -987,6 +1133,7 @@ main(int argc, char **argv) { CFDictionaryRef entities; CFStringRef key; + CFArrayRef multicast_resolvers; CFStringRef pattern; CFMutableArrayRef patterns; CFStringRef primary = NULL; @@ -1050,6 +1197,14 @@ main(int argc, char **argv) service_order = CFDictionaryGetValue(setup_global_ipv4, kSCPropNetServiceOrder); } + // get multicast resolvers + key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"), + kSCDynamicStoreDomainState, + kSCCompNetwork, + CFSTR(kDNSServiceCompMulticastDNS)); + multicast_resolvers = SCDynamicStoreCopyValue(store, key); + CFRelease(key); + // get private resolvers key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"), kSCDynamicStoreDomainState, @@ -1060,11 +1215,16 @@ main(int argc, char **argv) // update DNS configuration dns_configuration_init(CFBundleGetMainBundle()); - dns_configuration_set(primaryDNS, service_state_dict, service_order, private_resolvers); + dns_configuration_set(primaryDNS, + service_state_dict, + service_order, + multicast_resolvers, + private_resolvers); // cleanup if (setup_global_ipv4 != NULL) CFRelease(setup_global_ipv4); if (state_global_ipv4 != NULL) CFRelease(state_global_ipv4); + if (multicast_resolvers != NULL) CFRelease(multicast_resolvers); if (private_resolvers != NULL) CFRelease(private_resolvers); CFRelease(service_state_dict); CFRelease(store); diff --git a/Plugins/IPMonitor/dns-configuration.h b/Plugins/IPMonitor/dns-configuration.h index 7c45f53..51062b0 100644 --- a/Plugins/IPMonitor/dns-configuration.h +++ b/Plugins/IPMonitor/dns-configuration.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,6 +24,7 @@ #ifndef _DNS_CONFIGURATION_H #define _DNS_CONFIGURATION_H +#include #include #include @@ -31,9 +32,16 @@ __BEGIN_DECLS void dns_configuration_init (CFBundleRef bundle); + +#if !TARGET_OS_IPHONE +void dns_configuration_monitor (SCDynamicStoreRef store, + SCDynamicStoreCallBack callout); +#endif // !TARGET_OS_IPHONE + void dns_configuration_set (CFDictionaryRef defaultResolver, CFDictionaryRef services, CFArrayRef serviceOrder, + CFArrayRef multicastResolvers, CFArrayRef privateResolvers); __END_DECLS diff --git a/Plugins/IPMonitor/ip_plugin.c b/Plugins/IPMonitor/ip_plugin.c index 4999309..e5c7b14 100644 --- a/Plugins/IPMonitor/ip_plugin.c +++ b/Plugins/IPMonitor/ip_plugin.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All Rights Reserved. + * Copyright (c) 2000-2009 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -63,6 +63,9 @@ * * June 20, 2006 Allan Nathanson (ajn@apple.com) * - add SMB configuration + * + * December 5, 2007 Dieter Siegmund (dieter@apple.com) + * - added support for multiple scoped routes */ #include @@ -82,31 +85,125 @@ #include #include +#include #include #include /* for SCLog() */ #include +#if !TARGET_OS_IPHONE +#include +#endif /* !TARGET_OS_IPHONE */ #include +#ifndef kDNSServiceCompMulticastDNS +#define kDNSServiceCompMulticastDNS "MulticastDNS" +#endif #ifndef kDNSServiceCompPrivateDNS #define kDNSServiceCompPrivateDNS "PrivateDNS" #endif +enum { + kProtocolFlagsNone = 0x0, + kProtocolFlagsIPv4 = 0x1, + kProtocolFlagsIPv6 = 0x2 +}; +typedef uint8_t ProtocolFlags; + +enum { + kDebugFlag1 = 0x00000001, + kDebugFlag2 = 0x00000002, + kDebugFlag4 = 0x00000004, + kDebugFlag8 = 0x00000008, + kDebugFlagDefault = kDebugFlag1, + kDebugFlagAll = 0xffffffff +}; + +#ifdef TEST_IPV4_ROUTELIST +#define ROUTELIST_DEBUG(a, f) { if ((S_IPMonitor_debug & (f)) != 0) printf a ;} +#else +#define ROUTELIST_DEBUG(a, f) +#endif + #include "set-hostname.h" #include "dns-configuration.h" +#if !TARGET_OS_IPHONE #include "smb-configuration.h" +#endif /* !TARGET_OS_IPHONE */ + +#define PPP_PREFIX "ppp" #define IP_FORMAT "%d.%d.%d.%d" #define IP_CH(ip) ((u_char *)(ip)) #define IP_LIST(ip) IP_CH(ip)[0],IP_CH(ip)[1],IP_CH(ip)[2],IP_CH(ip)[3] -/* debug output on/off */ -static boolean_t S_IPMonitor_debug = FALSE; +typedef uint32_t Rank; + +enum { + kRankFirst = 0, + kRankLast = UINT_MAX +}; + +/* + * IPv4 Route management + */ + +typedef uint32_t RouteFlags; + +enum { + kRouteIsDirectToInterfaceFlag = 0x00000001, + kRouteIsNotSubnetLocalFlag = 0x00000002, + kRouteChooseFirstFlag = 0x00000004, + kRouteChooseLastFlag = 0x00000008, + kRouteChooseNeverFlag = 0x00000010, + kRouteIsScopedFlag = 0x00000020, + kRouteWantScopedFlag = (kRouteChooseNeverFlag|kRouteIsScopedFlag), +}; + +typedef struct { + struct in_addr dest; + struct in_addr mask; + struct in_addr gateway; + char ifname[IFNAMSIZ]; + unsigned int ifindex; + struct in_addr ifa; + Rank rank; + RouteFlags flags; +} IPv4Route, *IPv4RouteRef; + +typedef struct { + int count; + int size; + IPv4Route list[1]; /* variable length */ +} IPv4RouteList, *IPv4RouteListRef; + +enum { + kIPv4RouteListAddRouteCommand, + kIPv4RouteListRemoveRouteCommand +}; + +typedef uint32_t IPv4RouteListApplyCommand; + +typedef void IPv4RouteListApplyCallBackFunc(IPv4RouteListApplyCommand cmd, + IPv4RouteRef route, void * arg); +typedef IPv4RouteListApplyCallBackFunc * IPv4RouteListApplyCallBackFuncPtr; + +/* SCDynamicStore session */ +static SCDynamicStoreRef S_session = NULL; + +/* debug output flags */ +static uint32_t S_IPMonitor_debug = 0; /* are we netbooted? If so, don't touch the default route */ static boolean_t S_netboot = FALSE; +/* is scoped routing enabled? */ +#ifdef RTF_IFSCOPE +static boolean_t S_scopedroute = FALSE; +#endif /* RTF_IFSCOPE */ + /* dictionary to hold per-service state: key is the serviceID */ static CFMutableDictionaryRef S_service_state_dict = NULL; +static CFMutableDictionaryRef S_ipv4_service_rank_dict = NULL; +static CFMutableDictionaryRef S_ipv6_service_rank_dict = NULL; /* if set, a PPP interface overrides the primary */ static boolean_t S_ppp_override_primary = FALSE; @@ -116,32 +213,35 @@ static CFStringRef S_primary_ipv4 = NULL; static CFStringRef S_primary_ipv6 = NULL; static CFStringRef S_primary_dns = NULL; static CFStringRef S_primary_proxies = NULL; -static CFStringRef S_primary_smb = NULL; static CFStringRef S_state_global_ipv4 = NULL; static CFStringRef S_state_global_ipv6 = NULL; static CFStringRef S_state_global_dns = NULL; static CFStringRef S_state_global_proxies = NULL; -static CFStringRef S_state_global_smb = NULL; static CFStringRef S_state_service_prefix = NULL; static CFStringRef S_setup_global_ipv4 = NULL; static CFStringRef S_setup_global_proxies = NULL; -static CFStringRef S_setup_global_smb = NULL; static CFStringRef S_setup_service_prefix = NULL; +static CFStringRef S_multicast_resolvers = NULL; static CFStringRef S_private_resolvers = NULL; -static struct in_addr S_router_subnet = { 0 }; -static struct in_addr S_router_subnet_mask = { 0 }; +static IPv4RouteListRef S_ipv4_routelist = NULL; static const struct in_addr S_ip_zeros = { 0 }; static const struct in6_addr S_ip6_zeros = IN6ADDR_ANY_INIT; +static boolean_t S_append_state = FALSE; -#define kRouterNeedsLocalIP CFSTR("com.apple.IPMonitor.RouterNeedsLocalIP") -#define kRouterIsDirect CFSTR("com.apple.IPMonitor.IsDirect") +#if !TARGET_OS_IPHONE +static CFStringRef S_primary_smb = NULL; +static CFStringRef S_state_global_smb = NULL; +static CFStringRef S_setup_global_smb = NULL; +#endif /* !TARGET_OS_IPHONE */ +#if !TARGET_OS_IPHONE #define VAR_RUN_RESOLV_CONF "/var/run/resolv.conf" +#endif /* !TARGET_OS_IPHONE */ #ifndef KERN_NETBOOT #define KERN_NETBOOT 40 /* int: are we netbooted? 1=yes,0=no */ @@ -151,29 +251,42 @@ static const struct in6_addr S_ip6_zeros = IN6ADDR_ANY_INIT; ** entityType*, GetEntityChanges* ** - definitions for the entity types we handle **/ -#define ENTITY_TYPES_COUNT 5 enum { kEntityTypeIPv4 = 0, - kEntityTypeIPv6 = 1, - kEntityTypeDNS = 2, - kEntityTypeProxies = 3, - kEntityTypeSMB = 4, + kEntityTypeIPv6, + kEntityTypeDNS, + kEntityTypeProxies, +#if !TARGET_OS_IPHONE + kEntityTypeSMB, +#endif /* !TARGET_OS_IPHONE */ + ENTITY_TYPES_COUNT, + kEntityTypeServiceOptions = 31 }; typedef uint32_t EntityType; -static CFStringRef entityTypeNames[ENTITY_TYPES_COUNT]; +static const CFStringRef *entityTypeNames[ENTITY_TYPES_COUNT] = { + &kSCEntNetIPv4, /* 0 */ + &kSCEntNetIPv6, /* 1 */ + &kSCEntNetDNS, /* 2 */ + &kSCEntNetProxies, /* 3 */ +#if !TARGET_OS_IPHONE + &kSCEntNetSMB, /* 4 */ +#endif /* !TARGET_OS_IPHONE */ +}; -typedef boolean_t (GetEntityChangesFunc)(CFStringRef serviceID, - CFDictionaryRef state_dict, - CFDictionaryRef setup_dict, - CFDictionaryRef info); +typedef boolean_t GetEntityChangesFunc(CFStringRef serviceID, + CFDictionaryRef state_dict, + CFDictionaryRef setup_dict, + CFDictionaryRef info); typedef GetEntityChangesFunc * GetEntityChangesFuncRef; static GetEntityChangesFunc get_ipv4_changes; static GetEntityChangesFunc get_ipv6_changes; static GetEntityChangesFunc get_dns_changes; static GetEntityChangesFunc get_proxies_changes; +#if !TARGET_OS_IPHONE static GetEntityChangesFunc get_smb_changes; +#endif /* !TARGET_OS_IPHONE */ static void my_CFRelease(void * t); @@ -189,7 +302,9 @@ static const GetEntityChangesFuncRef entityChangeFunc[ENTITY_TYPES_COUNT] = { get_ipv6_changes, /* 1 */ get_dns_changes, /* 2 */ get_proxies_changes,/* 3 */ +#if !TARGET_OS_IPHONE get_smb_changes, /* 4 */ +#endif /* !TARGET_OS_IPHONE */ }; /** @@ -266,24 +381,27 @@ keyChangeListApplyToStore(keyChangeListRef keys, SCDynamicStoreRef session) if (set == NULL && remove == NULL && notify == NULL) { return; } - if (S_IPMonitor_debug) { + if (S_IPMonitor_debug & kDebugFlag1) { if (set != NULL) { - SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: Setting:\n%@\n"), set); + SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: Setting:\n%@"), + set); } if (remove != NULL) { - SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: Removing:\n%@\n"), remove); + SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: Removing:\n%@"), + remove); } if (notify != NULL) { - SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: Notifying:\n%@\n"), notify); + SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: Notifying:\n%@"), + notify); } } (void)SCDynamicStoreSetMultiple(session, set, remove, notify); status = notify_post("com.apple.system.config.network_change"); if (status == NOTIFY_STATUS_OK) { - SCLog(TRUE, LOG_INFO, CFSTR("network configuration changed.")); + SCLog(TRUE, LOG_NOTICE, CFSTR("network configuration changed.")); } else { - SCLog(TRUE, LOG_INFO, + SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: notify_post() failed: error=%ld"), status); } @@ -291,7 +409,7 @@ keyChangeListApplyToStore(keyChangeListRef keys, SCDynamicStoreRef session) } static boolean_t -S_netboot_root() +S_is_network_boot() { int mib[2]; size_t len; @@ -304,6 +422,23 @@ S_netboot_root() return (netboot); } +#ifdef RTF_IFSCOPE +static boolean_t +S_is_scoped_routing_enabled() +{ + int scopedroute = 0; + size_t len = sizeof(scopedroute); + + if ((sysctlbyname("net.inet.ip.scopedroute", + &scopedroute, &len, + NULL, 0) == -1) + && (errno != ENOENT)) { + SCLog(TRUE, LOG_ERR, CFSTR("sysctlbyname() failed: %s"), strerror(errno)); + } + return (scopedroute); +} +#endif /* RTF_IFSCOPE */ + static void my_CFArrayAppendUniqueValue(CFMutableArrayRef arr, CFTypeRef new) { @@ -351,6 +486,15 @@ my_CFDictionaryGetDictionary(CFDictionaryRef dict, CFStringRef key) return (isA_CFDictionary(CFDictionaryGetValue(dict, key))); } +static CFArrayRef +my_CFDictionaryGetArray(CFDictionaryRef dict, CFStringRef key) +{ + if (isA_CFDictionary(dict) == NULL) { + return (NULL); + } + return (isA_CFArray(CFDictionaryGetValue(dict, key))); +} + static boolean_t cfstring_to_ipvx(int family, CFStringRef str, void * addr, int addr_size) { @@ -395,186 +539,953 @@ cfstring_to_ip6(CFStringRef str, struct in6_addr * ip6_p) return (cfstring_to_ipvx(AF_INET6, str, ip6_p, sizeof(*ip6_p))); } -/* - * Function: parse_component - * Purpose: - * Given a string 'key' and a string prefix 'prefix', - * return the next component in the slash '/' separated - * key. - * - * Examples: - * 1. key = "a/b/c" prefix = "a/" - * returns "b" - * 2. key = "a/b/c" prefix = "a/b/" - * returns "c" - */ static CFStringRef -parse_component(CFStringRef key, CFStringRef prefix) +setup_service_key(CFStringRef serviceID, CFStringRef entity) { - CFMutableStringRef comp; - CFRange range; + return (SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainSetup, + serviceID, + entity)); +} - if (CFStringHasPrefix(key, prefix) == FALSE) { - return (NULL); - } - comp = CFStringCreateMutableCopy(NULL, 0, key); - if (comp == NULL) { - return (NULL); - } - CFStringDelete(comp, CFRangeMake(0, CFStringGetLength(prefix))); - range = CFStringFind(comp, CFSTR("/"), 0); - if (range.location == kCFNotFound) { - return (comp); - } - range.length = CFStringGetLength(comp) - range.location; - CFStringDelete(comp, range); - return (comp); +static CFStringRef +state_service_key(CFStringRef serviceID, CFStringRef entity) +{ + return (SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainState, + serviceID, + entity)); } -static CFMutableDictionaryRef -service_dict_copy(CFStringRef serviceID) +static CFDictionaryRef +get_service_setup_entity(CFDictionaryRef service_info, CFStringRef serviceID, + CFStringRef entity) { - CFDictionaryRef d = NULL; - CFMutableDictionaryRef service_dict; + CFStringRef setup_key; + CFDictionaryRef setup_dict; - /* create a modifyable dictionary, a copy or a new one */ - d = CFDictionaryGetValue(S_service_state_dict, serviceID); - if (d == NULL) { - service_dict - = CFDictionaryCreateMutable(NULL, 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - } - else { - service_dict = CFDictionaryCreateMutableCopy(NULL, 0, d); + setup_key = setup_service_key(serviceID, entity); + setup_dict = my_CFDictionaryGetDictionary(service_info, setup_key); + my_CFRelease(&setup_key); + return (setup_dict); +} + +static CFDictionaryRef +get_service_state_entity(CFDictionaryRef service_info, CFStringRef serviceID, + CFStringRef entity) +{ + CFStringRef state_key; + CFDictionaryRef state_dict; + + state_key = state_service_key(serviceID, entity); + state_dict = my_CFDictionaryGetDictionary(service_info, state_key); + my_CFRelease(&state_key); + return (state_dict); +} + +static boolean_t +dict_get_first_ip(CFDictionaryRef dict, CFStringRef prop, struct in_addr * ip_p) +{ + CFArrayRef ip_list; + + ip_list = CFDictionaryGetValue(dict, prop); + if (isA_CFArray(ip_list) != NULL + && CFArrayGetCount(ip_list) > 0 + && cfstring_to_ip(CFArrayGetValueAtIndex(ip_list, 0), ip_p)) { + return (TRUE); } - return (service_dict); + return (FALSE); } static boolean_t -service_dict_set(CFStringRef serviceID, CFStringRef entity, - CFDictionaryRef new_dict) +get_override_primary(CFDictionaryRef dict) { - boolean_t changed = FALSE; - CFDictionaryRef old; - CFMutableDictionaryRef service_dict; + CFTypeRef override; - service_dict = service_dict_copy(serviceID); - old = CFDictionaryGetValue(service_dict, entity); - if (new_dict == NULL) { - if (old != NULL) { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: serviceID %@ removed %@ dictionary = %@"), - serviceID, entity, old); - CFDictionaryRemoveValue(service_dict, entity); - changed = TRUE; + override = CFDictionaryGetValue(dict, kSCPropNetOverridePrimary); + if (isA_CFNumber(override) != NULL) { + int val = 0; + + CFNumberGetValue((CFNumberRef)override, kCFNumberIntType, &val); + if (val != 0) { + return (TRUE); } } - else { - if (old == NULL || CFEqual(new_dict, old) == FALSE) { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: serviceID %@ changed %@" - " dictionary\nold %@\nnew %@"), serviceID, entity, - (old != NULL) ? (CFTypeRef)old : (CFTypeRef)CFSTR(""), - new_dict); - CFDictionarySetValue(service_dict, entity, new_dict); - changed = TRUE; + else if (isA_CFBoolean(override) != NULL) { + if (CFBooleanGetValue(override)) { + return (TRUE); } } - if (CFDictionaryGetCount(service_dict) == 0) { - CFDictionaryRemoveValue(S_service_state_dict, serviceID); - } - else { - CFDictionarySetValue(S_service_state_dict, serviceID, service_dict); - } - my_CFRelease(&service_dict); - return (changed); + return (FALSE); } -static CFDictionaryRef -service_dict_get(CFStringRef serviceID, CFStringRef entity) +/** + ** IPv4Route* + **/ + +static __inline__ struct in_addr +subnet_addr(struct in_addr addr, struct in_addr mask) { - CFDictionaryRef service_dict; + struct in_addr net; - service_dict = CFDictionaryGetValue(S_service_state_dict, serviceID); - if (service_dict == NULL) { - return (NULL); - } - return (CFDictionaryGetValue(service_dict, entity)); + net.s_addr = addr.s_addr & mask.s_addr; + return (net); } -#define ALLOW_EMTPY_STRING 1<<0 - -static CFTypeRef -sanitize_prop(CFTypeRef val, uint32_t flags) +static __inline__ int +uint32_cmp(uint32_t a, uint32_t b) { - if (val != NULL) { - if (isA_CFString(val)) { - CFMutableStringRef str; + int ret; - str = CFStringCreateMutableCopy(NULL, 0, (CFStringRef)val); - CFStringTrimWhitespace(str); - if (!(flags & ALLOW_EMTPY_STRING) && (CFStringGetLength(str) == 0)) { - CFRelease(str); - str = NULL; - } - val = str; - } else { - CFRetain(val); - } + if (a == b) { + ret = 0; + } + else if (a < b) { + ret = -1; + } + else { + ret = 1; } + return (ret); +} - return val; +static __inline__ int +in_addr_cmp(struct in_addr a, struct in_addr b) +{ + return (uint32_cmp(ntohl(a.s_addr), ntohl(b.s_addr))); } -static void -merge_array_prop(CFMutableDictionaryRef dict, - CFStringRef key, - CFDictionaryRef state_dict, - CFDictionaryRef setup_dict, - uint32_t flags, - Boolean append) +static __inline__ int +RankCompare(Rank a, Rank b) { - CFMutableArrayRef merge_prop; - CFArrayRef setup_prop = NULL; - CFArrayRef state_prop = NULL; + return (uint32_cmp(a, b)); +} - if (setup_dict != NULL) { - setup_prop = isA_CFArray(CFDictionaryGetValue(setup_dict, key)); +static __inline__ int +RouteFlagsCompare(RouteFlags a, RouteFlags b) +{ + return (uint32_cmp(a, b)); +} + +static void +IPv4RouteCopyDescriptionWithString(IPv4RouteRef r, CFMutableStringRef str) +{ + CFStringAppendFormat(str, NULL, + CFSTR("Dest " IP_FORMAT + " Mask " IP_FORMAT + " Gate " IP_FORMAT + " Ifp %s Ifa " IP_FORMAT), + IP_LIST(&r->dest), + IP_LIST(&r->mask), + IP_LIST(&r->gateway), + (r->ifname[0] != '\0') ? r->ifname : "", + IP_LIST(&r->ifa)); + if ((r->flags & kRouteIsNotSubnetLocalFlag) != 0) { + CFStringAppend(str, CFSTR(" [non-local]")); } - if (state_dict != NULL) { - state_prop = isA_CFArray(CFDictionaryGetValue(state_dict, key)); + else if ((r->flags & kRouteIsDirectToInterfaceFlag) != 0) { + CFStringAppend(str, CFSTR(" [direct]")); } - - if ((setup_prop == NULL) && (state_prop == NULL)) { - return; + if ((r->flags & kRouteChooseFirstFlag) != 0) { + CFStringAppend(str, CFSTR(" [first]")); } + if ((r->flags & kRouteChooseLastFlag) != 0) { + CFStringAppend(str, CFSTR(" [last]")); + } + if ((r->flags & kRouteChooseNeverFlag) != 0) { + CFStringAppend(str, CFSTR(" [never]")); + } + if ((r->flags & kRouteIsScopedFlag) != 0) { + CFStringAppend(str, CFSTR(" [SCOPED]")); + } + else if ((r->flags & kRouteWantScopedFlag) != 0) { + CFStringAppend(str, CFSTR(" [SCOPED*]")); + } + return; +} - merge_prop = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); - if (setup_prop != NULL) { - CFIndex i; - CFIndex n; - - n = CFArrayGetCount(setup_prop); - for (i = 0; i < n; i++) { - CFTypeRef val; +static CFStringRef +IPv4RouteCopyDescription(IPv4RouteRef r) +{ + CFMutableStringRef str; - val = CFArrayGetValueAtIndex(setup_prop, i); - val = sanitize_prop(val, flags); - if (val != NULL) { - CFArrayAppendValue(merge_prop, val); - CFRelease(val); - } - } - } - if (state_prop != NULL) { - CFIndex i; - CFIndex n; - CFRange setup_range = CFRangeMake(0, CFArrayGetCount(merge_prop)); + str = CFStringCreateMutable(NULL, 0); + IPv4RouteCopyDescriptionWithString(r, str); + return (str); +} - n = CFArrayGetCount(state_prop); - for (i = 0; i < n; i++) { - CFTypeRef val; +static __inline__ void +IPv4RoutePrint(IPv4RouteRef route) +{ + CFStringRef str = IPv4RouteCopyDescription(route); + + SCPrint(TRUE, stdout, CFSTR("%@"), str); + CFRelease(str); + return; +} + +static __inline__ void +IPv4RouteLog(IPv4RouteRef route) +{ + CFStringRef str = IPv4RouteCopyDescription(route); + + SCLog(TRUE, LOG_NOTICE, CFSTR("%@"), str); + CFRelease(str); + return; +} + +static int +IPv4RouteCompare(IPv4RouteRef a, Rank a_rank, + IPv4RouteRef b, Rank b_rank, boolean_t * same_dest) +{ + int cmp; + + *same_dest = FALSE; + cmp = in_addr_cmp(a->dest, b->dest); + if (cmp == 0) { + cmp = in_addr_cmp(a->mask, b->mask); + if (cmp == 0) { + int name_cmp = strcmp(a->ifname, b->ifname); + + if (name_cmp == 0) { + cmp = 0; + } + else { + boolean_t a_never = (a->flags & kRouteChooseNeverFlag) != 0; + boolean_t b_never = (b->flags & kRouteChooseNeverFlag) != 0; + *same_dest = TRUE; + + if (a_never != b_never) { + if (a_never) { + cmp = 1; + } + else { + cmp = -1; + } + } + else { + boolean_t a_last = (a->flags & kRouteChooseLastFlag) != 0; + boolean_t b_last = (b->flags & kRouteChooseLastFlag) != 0; + + if (a_last != b_last) { + if (a_last) { + cmp = 1; + } + else { + cmp = -1; + } + } + else { + boolean_t a_first = (a->flags & kRouteChooseFirstFlag) != 0; + boolean_t b_first = (b->flags & kRouteChooseFirstFlag) != 0; + + if (a_first != b_first) { + if (a_first) { + cmp = -1; + } + else { + cmp = 1; + } + } + else { + cmp = RankCompare(a_rank, b_rank); + if (cmp == 0) { + cmp = name_cmp; + } + } + } + } + } + } + } + if ((S_IPMonitor_debug & kDebugFlag8) != 0) { + CFStringRef a_str; + CFStringRef b_str; + char ch; + + if (cmp < 0) { + ch = '<'; + } + else if (cmp == 0) { + ch = '='; + } + else { + ch = '>'; + } + a_str = IPv4RouteCopyDescription(a); + b_str = IPv4RouteCopyDescription(b); + SCLog(TRUE, LOG_NOTICE, CFSTR("%@ rank %u %c %@ rank %u"), + a_str, a_rank, ch, b_str, b_rank); + CFRelease(a_str); + CFRelease(b_str); + } + return (cmp); +} + +static CFStringRef +IPv4RouteListCopyDescription(IPv4RouteListRef routes) +{ + int i; + IPv4RouteRef r; + CFMutableStringRef str; + + str = CFStringCreateMutable(NULL, 0); + CFStringAppendFormat(str, NULL, CFSTR(" = {"), + routes->count); + for (i = 0, r = routes->list; i < routes->count; i++, r++) { + CFStringAppendFormat(str, NULL, CFSTR("\n%2d. "), i); + IPv4RouteCopyDescriptionWithString(r, str); + } + CFStringAppend(str, CFSTR("\n}\n")); + return (str); +} + +static __inline__ void +IPv4RouteListPrint(IPv4RouteListRef routes) +{ + CFStringRef str = IPv4RouteListCopyDescription(routes); + + SCPrint(TRUE, stdout, CFSTR("%@"), str); + CFRelease(str); + return; +} + +static __inline__ void +IPv4RouteListLog(IPv4RouteListRef routes) +{ + CFStringRef str = IPv4RouteListCopyDescription(routes); + + SCLog(TRUE, LOG_NOTICE, CFSTR("%@"), str); + CFRelease(str); + return; +} + +static __inline__ unsigned int +IPv4RouteListComputeSize(unsigned int n) +{ + return (offsetof(IPv4RouteList, list[n])); +} + +static IPv4RouteRef +IPv4RouteListFindRoute(IPv4RouteListRef routes, IPv4RouteRef route) +{ + int i; + IPv4RouteRef scan_result = NULL; + IPv4RouteRef scan; + + for (i = 0, scan = routes->list; i < routes->count; i++, scan++) { + if ((scan->dest.s_addr == route->dest.s_addr) + && (scan->mask.s_addr == route->mask.s_addr) + && (strcmp(scan->ifname, route->ifname) == 0) + && (scan->ifa.s_addr == route->ifa.s_addr) + && (scan->gateway.s_addr == route->gateway.s_addr)) { + /* + * So far, the routes look the same. If the flags + * are also equiv than we've found a match. + */ + RouteFlags r_flags; + RouteFlags s_flags; + + s_flags = scan->flags; + if ((s_flags & kRouteWantScopedFlag) != 0) { + s_flags |= kRouteWantScopedFlag; + } + r_flags = route->flags; + if ((r_flags & kRouteWantScopedFlag) != 0) { + r_flags |= kRouteWantScopedFlag; + } + if (s_flags == r_flags) { + scan_result = scan; + break; + } + } + } + return (scan_result); +} + +static void +IPv4RouteListApply(IPv4RouteListRef old_routes, IPv4RouteListRef new_routes, + IPv4RouteListApplyCallBackFuncPtr func, void * arg) +{ + int i; + IPv4RouteRef scan; + + if (old_routes == new_routes && old_routes == NULL) { + /* both old and new are NULL, so there's nothing to do */ + return; + } + if (old_routes != NULL) { + for (i = 0, scan = old_routes->list; + i < old_routes->count; + i++, scan++) { + IPv4RouteRef new_route = NULL; + + if (new_routes != NULL) { + new_route = IPv4RouteListFindRoute(new_routes, scan); + } + if (new_route == NULL) { + if (func != NULL) { + (*func)(kIPv4RouteListRemoveRouteCommand, scan, arg); + } + } + } + } + if (new_routes != NULL) { + for (i = 0, scan = new_routes->list; + i < new_routes->count; + i++, scan++) { + IPv4RouteRef old_route = NULL; + + if (old_routes != NULL) { + old_route = IPv4RouteListFindRoute(old_routes, scan); + } + if (old_route == NULL) { + if (func != NULL) { + (*func)(kIPv4RouteListAddRouteCommand, scan, arg); + } + } + } + } + return; +} + +/* + * Function: IPv4RouteListAddRoute + * + * Purpose: + * Add the given IPv4Route to the list of routes, eliminating lower-ranked + * duplicates on the same interface, and marking any lower ranked duplicates + * on other interfaces with kRouteIsScopedFlag. + * + * This routine assumes that if routes is not NULL, it is malloc'd memory. + * + * Returns: + * Route list updated with the given route, possibly a different pointer, + * due to using realloc'd memory. + */ + +enum { + kScopeNone = 0, + kScopeThis = 1, + kScopeNext = 2 +}; + +static IPv4RouteListRef +IPv4RouteListAddRoute(IPv4RouteListRef routes, int init_size, + IPv4RouteRef this_route, Rank this_rank) +{ + int i; + int scope_which = kScopeNone; + IPv4RouteRef scan; + int where = -1; + + if (routes == NULL) { + routes = (IPv4RouteListRef)malloc(IPv4RouteListComputeSize(init_size)); + routes->size = init_size; + routes->count = 0; + } + for (i = 0, scan = routes->list; i < routes->count; + i++, scan++) { + int cmp; + boolean_t same_dest; + + cmp = IPv4RouteCompare(this_route, this_rank, scan, scan->rank, &same_dest); + if (cmp < 0) { + if (where == -1) { + if (same_dest == TRUE) { + if ((scan->flags & kRouteIsScopedFlag) != 0) { + ROUTELIST_DEBUG(("Hit 1: set scope on self\n"), + kDebugFlag8); + scope_which = kScopeThis; + } + else { + ROUTELIST_DEBUG(("Hit 2: set scope on next\n"), + kDebugFlag8); + scope_which = kScopeNext; + } + } + /* remember our insertion point, but keep going to find a dup */ + where = i; + } + } + else if (cmp == 0) { + /* exact match */ + if (where != -1) { + /* this route is a duplicate */ + ROUTELIST_DEBUG(("Hit 3: removing [%d]\n", i), kDebugFlag8); + routes->count--; + if (i == routes->count) { + /* last slot, decrementing gets rid of it */ + } + else { + bcopy(routes->list + i + 1, + routes->list + i, + sizeof(routes->list[0]) * (routes->count - i)); + } + break; + } + /* resolve conflict using rank */ + if (this_rank < scan->rank) { + boolean_t is_scoped = FALSE; + + if (scan->flags & kRouteIsScopedFlag) { + is_scoped = TRUE; + } + ROUTELIST_DEBUG(("Hit 4:replacing [%d] rank %u < %u\n", i, + this_rank, + scan->rank), kDebugFlag8); + *scan = *this_route; + scan->rank = this_rank; + if (is_scoped) { + /* preserve whether route was scoped */ + ROUTELIST_DEBUG(("Hit 5: preserved scope\n"), kDebugFlag8); + scan->flags |= kRouteIsScopedFlag; + } + } + /* we're done */ + goto done; + } + else { + if (same_dest == TRUE) { + if (scope_which == kScopeNone) { + ROUTELIST_DEBUG(("Hit 10: set scope on self\n"), + kDebugFlag8); + scope_which = kScopeThis; + } + } +#ifdef TEST_IPV4_ROUTELIST + else if (where != -1) { + /* not possible because we maintain a sorted list */ + ROUTELIST_DEBUG(("Hit 11: moved past routes - can't happen\n"), + kDebugFlag8); + break; + } +#endif /* TEST_IPV4_ROUTELIST */ + } + } + if (routes->size == routes->count) { + int how_many; + IPv4RouteListRef new_routes; + int old_size; + + /* double the size */ + old_size = routes->size; + how_many = old_size * 2; + new_routes = (IPv4RouteListRef) + realloc(routes, IPv4RouteListComputeSize(how_many)); + if (new_routes == NULL) { + /* no memory */ + goto done; + } + ROUTELIST_DEBUG(("increasing size from %d to %d\n", old_size, + how_many), kDebugFlag8); + new_routes->size = how_many; + routes = new_routes; + } + if (where == -1) { + /* add it to the end */ + where = routes->count; + } + else { + /* insert it at [where] */ + bcopy(routes->list + where, + routes->list + where + 1, + sizeof(routes->list[0]) * (routes->count - where)); + } + /* copy the route */ + routes->list[where] = *this_route; + routes->list[where].rank = this_rank; + + /* set the scope */ + switch (scope_which) { + case kScopeThis: + routes->list[where].flags |= kRouteIsScopedFlag; + break; + case kScopeNext: + routes->list[where + 1].flags |= kRouteIsScopedFlag; + break; + default: + case kScopeNone: + break; + } + routes->count++; + done: + return (routes); +} + +/* + * Function: IPv4RouteListAddRouteList + * + * Purpose: + * Invoke IPv4RouteListAddRoute for each route in the given list. + * + * Returns: + * See IPv4RouteListAddRoute for more information. + */ +static IPv4RouteListRef +IPv4RouteListAddRouteList(IPv4RouteListRef routes, int init_size, + IPv4RouteListRef service_routes, Rank rank) +{ + int i; + IPv4RouteRef scan; + + for (i = 0, scan = service_routes->list; + i < service_routes->count; i++, scan++) { + routes = IPv4RouteListAddRoute(routes, init_size, scan, rank); + } + return (routes); +} + +static boolean_t +plist_get_cstring(CFDictionaryRef dict, CFStringRef prop_name, + char * buf, int buf_size) +{ + CFStringRef val; + + val = CFDictionaryGetValue(dict, prop_name); + if (isA_CFString(val) == NULL) { + return (FALSE); + } + if (CFStringGetCString(val, buf, buf_size, kCFStringEncodingASCII) + == FALSE) { + return (FALSE); + } + return (TRUE); +} + +/* + * Function: IPv4RouteListCreateWithDictionary + * + * Purpose: + * Given the service ipv4 entity dictionary, generate the list of routes. + * Currently, this includes just the default route and subnet route, + * if the service has a subnet mask. + * + * Returns: + * If the passed in route_list is NULL or too small, this routine + * allocates malloc'd memory to hold the routes. + */ +static IPv4RouteListRef +IPv4RouteListCreateWithDictionary(IPv4RouteListRef routes, + CFDictionaryRef dict, + CFStringRef primaryRank) +{ + struct in_addr addr = { 0 }; + RouteFlags flags = 0; + unsigned int ifindex; + char ifn[IFNAMSIZ]; + struct in_addr mask = { 0 }; + int n; + IPv4RouteRef r; + struct in_addr subnet = { 0 }; + struct in_addr router = { 0 }; + + if (dict == NULL) { + return (NULL); + } + if (plist_get_cstring(dict, kSCPropInterfaceName, ifn, sizeof(ifn)) + == FALSE) { + return (NULL); + } +#ifdef TEST_IPV4_ROUTELIST + ifindex = 0; +#else /* TEST_IPV4_ROUTELIST */ + ifindex = if_nametoindex(ifn); + if (ifindex == 0) { + /* interface doesn't exist */ + return (NULL); + } +#endif /* TEST_IPV4_ROUTELIST */ + if (cfstring_to_ip(CFDictionaryGetValue(dict, kSCPropNetIPv4Router), + &router) == 0) { + (void)dict_get_first_ip(dict, kSCPropNetIPv4DestAddresses, &router); + } + n = 1; + if (dict_get_first_ip(dict, kSCPropNetIPv4Addresses, &addr) + && dict_get_first_ip(dict, kSCPropNetIPv4SubnetMasks, &mask)) { + /* subnet route */ + subnet = subnet_addr(addr, mask); + /* ignore link-local subnets, let IPConfiguration handle them for now */ + if (ntohl(subnet.s_addr) != IN_LINKLOCALNETNUM) { + n++; + } + } + if (addr.s_addr == 0) { + /* thanks for playing */ + return (NULL); + } + if (router.s_addr == 0) { + flags |= kRouteIsDirectToInterfaceFlag | kRouteChooseLastFlag; + } + else { + /* + * If the router address is our address and the subnet mask is + * not 255.255.255.255, assume all routes are local to the interface. + */ + if (addr.s_addr == router.s_addr + && ifn[0] != '\0' && mask.s_addr != INADDR_BROADCAST) { + flags |= kRouteIsDirectToInterfaceFlag; + } + if (primaryRank != NULL) { + if (CFEqual(primaryRank, kSCValNetServicePrimaryRankNever)) { + flags |= kRouteChooseNeverFlag; + } else if (CFEqual(primaryRank, kSCValNetServicePrimaryRankFirst)) { + flags |= kRouteChooseFirstFlag; + } else if (CFEqual(primaryRank, kSCValNetServicePrimaryRankLast)) { + flags |= kRouteChooseLastFlag; + } + } else if (get_override_primary(dict)) { + flags |= kRouteChooseFirstFlag; + } + } + if (n > 1 && (flags & kRouteIsDirectToInterfaceFlag) == 0 + && subnet.s_addr != subnet_addr(router, mask).s_addr) { + flags |= kRouteIsNotSubnetLocalFlag; + } + + if (routes == NULL || routes->size < n) { + routes = (IPv4RouteListRef)malloc(IPv4RouteListComputeSize(n)); + routes->size = n; + } + bzero(routes, IPv4RouteListComputeSize(n)); + routes->count = n; + + /* start at the beginning */ + r = routes->list; + + /* add the default route */ + r->ifindex = ifindex; + strlcpy(r->ifname, ifn, sizeof(r->ifname)); + r->ifa = addr; + r->flags = flags; + if ((flags & kRouteIsDirectToInterfaceFlag) == 0) { + r->gateway = router; + } + else { + r->gateway = addr; + } + r++; + n--; + + /* add the subnet route */ + if (n > 0) { + r->ifindex = ifindex; + r->gateway = addr; + r->dest = subnet; + r->mask = mask; + strlcpy(r->ifname, ifn, sizeof(r->ifname)); + r->ifa = addr; + r->flags = flags & (kRouteChooseFirstFlag|kRouteChooseLastFlag|kRouteChooseNeverFlag); + } + + return (routes); +} + +/* + * Function: parse_component + * Purpose: + * Given a string 'key' and a string prefix 'prefix', + * return the next component in the slash '/' separated + * key. + * + * Examples: + * 1. key = "a/b/c" prefix = "a/" + * returns "b" + * 2. key = "a/b/c" prefix = "a/b/" + * returns "c" + */ +static CFStringRef +parse_component(CFStringRef key, CFStringRef prefix) +{ + CFMutableStringRef comp; + CFRange range; + + if (CFStringHasPrefix(key, prefix) == FALSE) { + return (NULL); + } + comp = CFStringCreateMutableCopy(NULL, 0, key); + if (comp == NULL) { + return (NULL); + } + CFStringDelete(comp, CFRangeMake(0, CFStringGetLength(prefix))); + range = CFStringFind(comp, CFSTR("/"), 0); + if (range.location == kCFNotFound) { + return (comp); + } + range.length = CFStringGetLength(comp) - range.location; + CFStringDelete(comp, range); + return (comp); +} + +static CFMutableDictionaryRef +service_dict_copy(CFStringRef serviceID) +{ + CFDictionaryRef d = NULL; + CFMutableDictionaryRef service_dict; + + /* create a modifyable dictionary, a copy or a new one */ + d = CFDictionaryGetValue(S_service_state_dict, serviceID); + if (d == NULL) { + service_dict + = CFDictionaryCreateMutable(NULL, 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } + else { + service_dict = CFDictionaryCreateMutableCopy(NULL, 0, d); + } + return (service_dict); +} + +static void +dump_service_entity(CFStringRef serviceID, CFStringRef entity, + CFStringRef operation, CFTypeRef val) +{ + CFStringRef this_val = NULL; + + if (isA_CFData(val) && CFEqual(entity, kSCEntNetIPv4)) { + this_val = IPv4RouteListCopyDescription((IPv4RouteListRef) + CFDataGetBytePtr(val)); + if (this_val != NULL) { + val = this_val; + } + } + if (val == NULL) { + val = CFSTR(""); + } + SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: serviceID %@ %@ %@ value = %@"), + serviceID, operation, entity, val); + my_CFRelease(&this_val); + return; +} + +static boolean_t +service_dict_set(CFStringRef serviceID, CFStringRef entity, + CFTypeRef new_val) +{ + boolean_t changed = FALSE; + CFTypeRef old_val; + CFMutableDictionaryRef service_dict; + + service_dict = service_dict_copy(serviceID); + old_val = CFDictionaryGetValue(service_dict, entity); + if (new_val == NULL) { + if (old_val != NULL) { + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + dump_service_entity(serviceID, entity, CFSTR("Removed:"), + old_val); + } + CFDictionaryRemoveValue(service_dict, entity); + changed = TRUE; + } + } + else { + if (old_val == NULL || CFEqual(new_val, old_val) == FALSE) { + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + dump_service_entity(serviceID, entity, + CFSTR("Changed: old"), old_val); + dump_service_entity(serviceID, entity, + CFSTR("Changed: new"), new_val); + } + CFDictionarySetValue(service_dict, entity, new_val); + changed = TRUE; + } + } + if (CFDictionaryGetCount(service_dict) == 0) { + CFDictionaryRemoveValue(S_service_state_dict, serviceID); + } + else { + CFDictionarySetValue(S_service_state_dict, serviceID, service_dict); + } + my_CFRelease(&service_dict); + return (changed); +} + +static CFDictionaryRef +service_dict_get(CFStringRef serviceID, CFStringRef entity) +{ + CFDictionaryRef service_dict; + + service_dict = CFDictionaryGetValue(S_service_state_dict, serviceID); + if (service_dict == NULL) { + return (NULL); + } + return (CFDictionaryGetValue(service_dict, entity)); +} + +#define ALLOW_EMPTY_STRING 0x1 + +static CFTypeRef +sanitize_prop(CFTypeRef val, uint32_t flags) +{ + if (val != NULL) { + if (isA_CFString(val)) { + CFMutableStringRef str; + + str = CFStringCreateMutableCopy(NULL, 0, (CFStringRef)val); + CFStringTrimWhitespace(str); + if (!(flags & ALLOW_EMPTY_STRING) && (CFStringGetLength(str) == 0)) { + CFRelease(str); + str = NULL; + } + val = str; + } else { + CFRetain(val); + } + } + + return val; +} + +static void +merge_array_prop(CFMutableDictionaryRef dict, + CFStringRef key, + CFDictionaryRef state_dict, + CFDictionaryRef setup_dict, + uint32_t flags, + Boolean append) +{ + CFMutableArrayRef merge_prop; + CFArrayRef setup_prop = NULL; + CFArrayRef state_prop = NULL; + + if (setup_dict != NULL) { + setup_prop = isA_CFArray(CFDictionaryGetValue(setup_dict, key)); + } + if (state_dict != NULL) { + state_prop = isA_CFArray(CFDictionaryGetValue(state_dict, key)); + } + + if ((setup_prop == NULL) && (state_prop == NULL)) { + return; + } + + merge_prop = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + if (setup_prop != NULL) { + CFIndex i; + CFIndex n; + + n = CFArrayGetCount(setup_prop); + for (i = 0; i < n; i++) { + CFTypeRef val; + + val = CFArrayGetValueAtIndex(setup_prop, i); + val = sanitize_prop(val, flags); + if (val != NULL) { + CFArrayAppendValue(merge_prop, val); + CFRelease(val); + } + } + } + if (state_prop != NULL + && (setup_prop == NULL || S_append_state)) { + CFIndex i; + CFIndex n; + CFRange setup_range = CFRangeMake(0, CFArrayGetCount(merge_prop)); + + n = CFArrayGetCount(state_prop); + for (i = 0; i < n; i++) { + CFTypeRef val; val = CFArrayGetValueAtIndex(state_prop, i); val = sanitize_prop(val, flags); @@ -615,91 +1526,73 @@ pick_prop(CFMutableDictionaryRef dict, CFRelease(val); } - return; -} - -/** - ** GetEntityChangesFunc functions - **/ -static __inline__ struct in_addr -subnet_addr(struct in_addr addr, struct in_addr mask) -{ - struct in_addr net; - - net.s_addr = htonl((uint32_t)ntohl(addr.s_addr) - & (uint32_t)ntohl(mask.s_addr)); - return (net); + return; } +/** + ** GetEntityChangesFunc functions + **/ static boolean_t get_ipv4_changes(CFStringRef serviceID, CFDictionaryRef state_dict, CFDictionaryRef setup_dict, CFDictionaryRef info) { - struct in_addr addr = { 0 }; - CFArrayRef addrs; - boolean_t changed = FALSE; - CFMutableDictionaryRef dict = NULL; - struct in_addr mask = { 0 }; - CFArrayRef masks; - CFDictionaryRef new_dict = NULL; - CFStringRef router = NULL; - boolean_t valid_ip = FALSE; - boolean_t valid_mask = FALSE; + boolean_t changed = FALSE; + CFMutableDictionaryRef dict = NULL; + CFStringRef primaryRank = NULL; + IPv4RouteListRef r; +#define R_STATIC 3 + IPv4RouteListRef routes; + char routes_buf[IPv4RouteListComputeSize(R_STATIC)]; + CFDataRef routes_data = NULL; + CFDictionaryRef service_options; if (state_dict == NULL) { goto done; } - addrs = isA_CFArray(CFDictionaryGetValue(state_dict, - kSCPropNetIPv4Addresses)); - if (addrs != NULL && CFArrayGetCount(addrs) > 0) { - valid_ip = cfstring_to_ip(CFArrayGetValueAtIndex(addrs, 0), &addr); - } - masks = isA_CFArray(CFDictionaryGetValue(state_dict, - kSCPropNetIPv4SubnetMasks)); - if (masks != NULL && CFArrayGetCount(masks) > 0) { - valid_mask = cfstring_to_ip(CFArrayGetValueAtIndex(masks, 0), &mask); - } - if (valid_ip == FALSE) { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: %@ has no valid IP address, ignoring"), - serviceID); - goto done; + service_options = service_dict_get(serviceID, kSCEntNetService); + if (service_options != NULL) { + primaryRank = CFDictionaryGetValue(service_options, kSCPropNetServicePrimaryRank); } dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict); if (setup_dict != NULL) { + CFStringRef router; + struct in_addr router_ip; + router = CFDictionaryGetValue(setup_dict, kSCPropNetIPv4Router); - if (router != NULL) { + if (router != NULL + && cfstring_to_ip(router, &router_ip)) { CFDictionarySetValue(dict, kSCPropNetIPv4Router, router); } } - - /* check whether the router is direct, or non-local */ - router = CFDictionaryGetValue(dict, kSCPropNetIPv4Router); - if (router != NULL) { - struct in_addr router_ip; - - if (cfstring_to_ip(router, &router_ip)) { - if (router_ip.s_addr == addr.s_addr) { - /* default route routes directly to the interface */ - CFDictionarySetValue(dict, kRouterIsDirect, kCFBooleanTrue); - } - else if (valid_mask - && subnet_addr(addr, mask).s_addr - != subnet_addr(router_ip, mask).s_addr) { - /* router is not on the same subnet */ - CFDictionarySetValue(dict, kRouterNeedsLocalIP, - kCFBooleanTrue); - } + routes = (IPv4RouteListRef)routes_buf; + routes->size = R_STATIC; + routes->count = 0; + r = IPv4RouteListCreateWithDictionary(routes, dict, primaryRank); + if (r != NULL) { + routes_data = CFDataCreate(NULL, + (const void *)r, + IPv4RouteListComputeSize(r->count)); + if (r != routes) { + free(r); } } - new_dict = dict; - - done: - changed = service_dict_set(serviceID, kSCEntNetIPv4, new_dict); - my_CFRelease(&new_dict); + else { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: %@ invalid IPv4 dictionary = %@"), + serviceID, + dict); + } + done: + changed = service_dict_set(serviceID, kSCEntNetIPv4, routes_data); + if (routes_data == NULL) { + /* clean up the rank too */ + CFDictionaryRemoveValue(S_ipv4_service_rank_dict, serviceID); + } + my_CFRelease(&dict); + my_CFRelease(&routes_data); return (changed); } @@ -713,6 +1606,7 @@ get_ipv6_changes(CFStringRef serviceID, CFDictionaryRef state_dict, CFMutableDictionaryRef dict = NULL; CFDictionaryRef new_dict = NULL; CFStringRef router = NULL; + struct in6_addr router_ip; boolean_t valid_ip = FALSE; if (state_dict == NULL) { @@ -724,24 +1618,38 @@ get_ipv6_changes(CFStringRef serviceID, CFDictionaryRef state_dict, valid_ip = cfstring_to_ip6(CFArrayGetValueAtIndex(addrs, 0), &addr); } if (valid_ip == FALSE) { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: %@ has no valid IPv6 address, ignoring"), - serviceID); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: %@ has no valid IPv6 address, ignoring"), + serviceID); + } goto done; } dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict); if (setup_dict != NULL) { router = CFDictionaryGetValue(setup_dict, kSCPropNetIPv6Router); - if (router != NULL) { + if (router != NULL && cfstring_to_ip6(router, &router_ip)) { CFDictionarySetValue(dict, kSCPropNetIPv6Router, router); } } + else { + router = CFDictionaryGetValue(dict, + kSCPropNetIPv6Router); + if (router != NULL + && cfstring_to_ip6(router, &router_ip) == FALSE) { + CFDictionaryRemoveValue(dict, kSCPropNetIPv6Router); + } + } new_dict = dict; done: changed = service_dict_set(serviceID, kSCEntNetIPv6, new_dict); + if (new_dict == NULL) { + /* clean up the rank too */ + CFDictionaryRemoveValue(S_ipv6_service_rank_dict, serviceID); + } my_CFRelease(&new_dict); return (changed); } @@ -765,10 +1673,99 @@ dns_has_supplemental(CFStringRef serviceID) return CFDictionaryContainsKey(dns_dict, kSCPropNetDNSSupplementalMatchDomains); } +static void +accumulate_dns_servers(CFArrayRef in_servers, ProtocolFlags active_protos, + CFMutableArrayRef out_servers) +{ + int count; + int i; + + count = CFArrayGetCount(in_servers); + for (i = 0; i < count; i++) { + CFStringRef addr = CFArrayGetValueAtIndex(in_servers, i); + struct in6_addr ipv6_addr; + struct in_addr ip_addr; + + if (cfstring_to_ip(addr, &ip_addr)) { + /* IPv4 address */ + if ((active_protos & kProtocolFlagsIPv4) == 0 + && ntohl(ip_addr.s_addr) != INADDR_LOOPBACK) { + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + syslog(LOG_NOTICE, + "IPMonitor: no IPv4 connectivity, " + "ignoring DNS server address " IP_FORMAT, + IP_LIST(&ip_addr)); + } + continue; + } + } + else if (cfstring_to_ip6(addr, &ipv6_addr)) { + /* IPv6 address */ + if ((active_protos & kProtocolFlagsIPv6) == 0 + && !IN6_IS_ADDR_LOOPBACK(&ipv6_addr)) { + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + char str[128]; + + str[0] = '\0'; + inet_ntop(AF_INET6, &ipv6_addr, str, sizeof(str)); + syslog(LOG_NOTICE, + "IPMonitor: no IPv6 connectivity, " + "ignoring DNS server address %s", + str); + } + continue; + } + } + else { + /* bad IP address */ + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: ignoring bad DNS server address '%@'"), + addr); + continue; + } + /* DNS server is valid and one we want */ + CFArrayAppendValue(out_servers, addr); + } + return; +} + +static void +merge_dns_servers(CFMutableDictionaryRef new_dict, + CFArrayRef state_servers, + CFArrayRef setup_servers, + ProtocolFlags active_protos) +{ + CFMutableArrayRef dns_servers; + + if (state_servers == NULL && setup_servers == NULL) { + /* no DNS servers */ + return; + } + dns_servers = CFArrayCreateMutable(NULL, 0, + &kCFTypeArrayCallBacks); + if (setup_servers != NULL) { + accumulate_dns_servers(setup_servers, active_protos, + dns_servers); + } + if ((CFArrayGetCount(dns_servers) == 0 || S_append_state) + && state_servers != NULL) { + accumulate_dns_servers(state_servers, active_protos, + dns_servers); + } + if (CFArrayGetCount(dns_servers) != 0) { + CFDictionarySetValue(new_dict, + kSCPropNetDNSServerAddresses, dns_servers); + } + my_CFRelease(&dns_servers); + return; +} + + static boolean_t get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict, CFDictionaryRef setup_dict, CFDictionaryRef info) { + ProtocolFlags active_protos = kProtocolFlagsNone; boolean_t changed = FALSE; CFStringRef domain; int i; @@ -778,9 +1775,8 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict, Boolean append; } merge_list[] = { { kSCPropNetDNSSearchDomains, 0, FALSE }, - { kSCPropNetDNSServerAddresses, 0, FALSE }, { kSCPropNetDNSSortList, 0, FALSE }, - { kSCPropNetDNSSupplementalMatchDomains, ALLOW_EMTPY_STRING, TRUE }, + { kSCPropNetDNSSupplementalMatchDomains, ALLOW_EMPTY_STRING, TRUE }, { kSCPropNetDNSSupplementalMatchOrders, 0, TRUE }, }; CFMutableDictionaryRef new_dict = NULL; @@ -797,16 +1793,37 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict, goto done; } - if ((service_dict_get(serviceID, kSCEntNetIPv4) == NULL) && - (service_dict_get(serviceID, kSCEntNetIPv6) == NULL)) { - /* there is no IPv4 nor IPv6 */ - goto done; + if (service_dict_get(serviceID, kSCEntNetIPv4) != NULL) { + active_protos |= kProtocolFlagsIPv4; } - - // merge DNS configuration + if (service_dict_get(serviceID, kSCEntNetIPv6) != NULL) { + active_protos |= kProtocolFlagsIPv6; + } + /* merge DNS configuration */ new_dict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + if (active_protos == kProtocolFlagsNone) { + /* there is no IPv4 nor IPv6 */ + if (state_dict == NULL) { + /* no DNS information at all */ + goto done; + } + merge_dns_servers(new_dict, + my_CFDictionaryGetArray(state_dict, + kSCPropNetDNSServerAddresses), + NULL, + kProtocolFlagsIPv4 | kProtocolFlagsIPv6); + setup_dict = NULL; + } + else { + merge_dns_servers(new_dict, + my_CFDictionaryGetArray(state_dict, + kSCPropNetDNSServerAddresses), + my_CFDictionaryGetArray(setup_dict, + kSCPropNetDNSServerAddresses), + active_protos); + } for (i = 0; i < sizeof(merge_list)/sizeof(merge_list[0]); i++) { merge_array_prop(new_dict, @@ -824,28 +1841,43 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict, 0); } + if (active_protos == kProtocolFlagsNone) { + /* there is no IPv4 nor IPv6, only supplemental DNS */ + if (CFDictionaryContainsKey(new_dict, + kSCPropNetDNSSupplementalMatchDomains)) { + /* only keep State: supplemental */ + CFDictionaryRemoveValue(new_dict, kSCPropNetDNSDomainName); + CFDictionaryRemoveValue(new_dict, kSCPropNetDNSSearchDomains); + CFDictionaryRemoveValue(new_dict, kSCPropNetDNSSearchOrder); + CFDictionaryRemoveValue(new_dict, kSCPropNetDNSSortList); + } else { + goto done; + } + } if (CFDictionaryGetCount(new_dict) == 0) { my_CFRelease(&new_dict); goto done; } - /* - * ensure any specified domain name (e.g. the domain returned by - * a DHCP server) is in the search list. - */ - domain = CFDictionaryGetValue(new_dict, kSCPropNetDNSDomainName); - if (isA_CFString(domain)) { - CFArrayRef search; - - search = CFDictionaryGetValue(new_dict, kSCPropNetDNSSearchDomains); - if (isA_CFArray(search) && - !CFArrayContainsValue(search, CFRangeMake(0, CFArrayGetCount(search)), domain)) { - CFMutableArrayRef new_search; - - new_search = CFArrayCreateMutableCopy(NULL, 0, search); - CFArrayAppendValue(new_search, domain); - CFDictionarySetValue(new_dict, kSCPropNetDNSSearchDomains, new_search); - my_CFRelease(&new_search); + if (S_append_state) { + /* + * ensure any specified domain name (e.g. the domain returned by + * a DHCP server) is in the search list. + */ + domain = CFDictionaryGetValue(new_dict, kSCPropNetDNSDomainName); + if (isA_CFString(domain)) { + CFArrayRef search; + + search = CFDictionaryGetValue(new_dict, kSCPropNetDNSSearchDomains); + if (isA_CFArray(search) && + !CFArrayContainsValue(search, CFRangeMake(0, CFArrayGetCount(search)), domain)) { + CFMutableArrayRef new_search; + + new_search = CFArrayCreateMutableCopy(NULL, 0, search); + CFArrayAppendValue(new_search, domain); + CFDictionarySetValue(new_dict, kSCPropNetDNSSearchDomains, new_search); + my_CFRelease(&new_search); + } } } @@ -855,29 +1887,249 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict, return (changed); } +static void +merge_dict(const void *key, const void *value, void *context) +{ + CFMutableDictionaryRef dict = (CFMutableDictionaryRef)context; + + CFDictionarySetValue(dict, key, value); + return; +} + +#define PROXY_AUTO_DISCOVERY_URL 252 + +static CFStringRef +wpadURL_dhcp(CFDictionaryRef dhcp_options) +{ + CFStringRef urlString = NULL; + + if (isA_CFDictionary(dhcp_options)) { + CFDataRef data; + + data = DHCPInfoGetOptionData(dhcp_options, PROXY_AUTO_DISCOVERY_URL); + if (data != NULL) { + CFURLRef url; + + url = CFURLCreateWithBytes(NULL, + CFDataGetBytePtr(data), + CFDataGetLength(data), + kCFStringEncodingUTF8, + NULL); + if (url != NULL) { + urlString = CFURLGetString(url); + if (urlString != NULL) { + CFRetain(urlString); + } + CFRelease(url); + } + } + } + + return urlString; +} + +static CFStringRef +wpadURL_dns(void) +{ + CFURLRef url; + CFStringRef urlString = NULL; + + url = CFURLCreateWithString(NULL, CFSTR("http://wpad/wpad.dat"), NULL); + if (url != NULL) { + urlString = CFURLGetString(url); + if (urlString != NULL) { + CFRetain(urlString); + } + CFRelease(url); + } + + return urlString; +} + static boolean_t get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict, CFDictionaryRef setup_dict, CFDictionaryRef info) { boolean_t changed = FALSE; - CFDictionaryRef new_dict = NULL; + CFMutableDictionaryRef new_dict = NULL; + struct { + CFStringRef key1; /* an "enable" key */ + CFStringRef key2; + CFStringRef key3; + } pick_list[] = { + { kSCPropNetProxiesFTPEnable, kSCPropNetProxiesFTPProxy, kSCPropNetProxiesFTPPort }, + { kSCPropNetProxiesGopherEnable, kSCPropNetProxiesGopherProxy, kSCPropNetProxiesGopherPort }, + { kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort }, + { kSCPropNetProxiesHTTPSEnable, kSCPropNetProxiesHTTPSProxy, kSCPropNetProxiesHTTPSPort }, + { kSCPropNetProxiesRTSPEnable, kSCPropNetProxiesRTSPProxy, kSCPropNetProxiesRTSPPort }, + { kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort }, + { kSCPropNetProxiesProxyAutoConfigEnable, + kSCPropNetProxiesProxyAutoConfigURLString, + NULL, }, + { kSCPropNetProxiesProxyAutoDiscoveryEnable, + NULL, + NULL, } + }; if ((service_dict_get(serviceID, kSCEntNetIPv4) == NULL) && (service_dict_get(serviceID, kSCEntNetIPv6) == NULL)) { /* there is no IPv4 nor IPv6 */ goto done; } - if (setup_dict != NULL) { - new_dict = setup_dict; + + if ((setup_dict != NULL) && (state_dict != NULL)) { + CFIndex i; + CFMutableDictionaryRef setup_copy; + + /* + * Merge the per-service "Setup:" and "State:" proxy information with + * the "Setup:" information always taking precedence. Additionally, + * ensure that if any group of "Setup:" values (e.g. Enabled, Proxy, + * Port) is defined than all of the values for that group will be + * used. That is, we don't allow mixing some of the values from + * the "Setup:" keys and others from the "State:" keys. + */ + new_dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict); + setup_copy = CFDictionaryCreateMutableCopy(NULL, 0, setup_dict); + for (i = 0; i < sizeof(pick_list)/sizeof(pick_list[0]); i++) { + if (CFDictionaryContainsKey(setup_copy, pick_list[i].key1)) { + /* + * if a "Setup:" enabled key has been provided than we want to + * ignore all of the "State:" keys + */ + CFDictionaryRemoveValue(new_dict, pick_list[i].key1); + if (pick_list[i].key2 != NULL) { + CFDictionaryRemoveValue(new_dict, pick_list[i].key2); + } + if (pick_list[i].key3 != NULL) { + CFDictionaryRemoveValue(new_dict, pick_list[i].key3); + } + } else if (CFDictionaryContainsKey(state_dict, pick_list[i].key1) || + ((pick_list[i].key2 != NULL) && CFDictionaryContainsKey(state_dict, pick_list[i].key2)) || + ((pick_list[i].key3 != NULL) && CFDictionaryContainsKey(state_dict, pick_list[i].key3))) { + /* + * if a "Setup:" enabled key has not been provided and we have + * some" "State:" keys than we remove all of of "Setup:" keys + */ + CFDictionaryRemoveValue(setup_copy, pick_list[i].key1); + if (pick_list[i].key2 != NULL) { + CFDictionaryRemoveValue(setup_copy, pick_list[i].key2); + } + if (pick_list[i].key3 != NULL) { + CFDictionaryRemoveValue(setup_copy, pick_list[i].key3); + } + } + } + + /* merge the "Setup:" keys */ + CFDictionaryApplyFunction(setup_copy, merge_dict, new_dict); + CFRelease(setup_copy); + + if (CFDictionaryGetCount(new_dict) == 0) { + CFRelease(new_dict); + new_dict = NULL; + } } - else { - new_dict = state_dict; + else if (setup_dict != NULL) { + new_dict = CFDictionaryCreateMutableCopy(NULL, 0, setup_dict); + } + else if (state_dict != NULL) { + new_dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict); + } + + /* process WPAD */ + if (new_dict != NULL) { + CFDictionaryRef dhcp_options; + CFNumberRef num; + CFNumberRef wpad = NULL; + int wpadEnabled = 0; + CFStringRef wpadURL = NULL; + + if (CFDictionaryGetValueIfPresent(new_dict, + kSCPropNetProxiesProxyAutoDiscoveryEnable, + (const void **)&num) && + isA_CFNumber(num)) { + /* if we have a WPAD key */ + wpad = num; + if (!CFNumberGetValue(num, kCFNumberIntType, &wpadEnabled)) { + /* if we don't like the enabled key/value */ + wpadEnabled = 0; + } + } + + if (wpadEnabled) { + int pacEnabled = 0; + + num = CFDictionaryGetValue(new_dict, kSCPropNetProxiesProxyAutoConfigEnable); + if (!isA_CFNumber(num) || + !CFNumberGetValue(num, kCFNumberIntType, &pacEnabled)) { + /* if we don't like the enabled key/value */ + pacEnabled = 0; + } + + if (pacEnabled) { + CFStringRef pacURL; + + pacURL = CFDictionaryGetValue(new_dict, kSCPropNetProxiesProxyAutoConfigURLString); + if (!isA_CFString(pacURL)) { + /* if we don't like the PAC URL */ + pacEnabled = 0; + } + } + + if (pacEnabled) { + /* + * we already have a PAC URL so disable WPAD. + */ + wpadEnabled = 0; + goto setWPAD; + } + + /* + * if WPAD is enabled and we don't already have a PAC URL then + * we check for a DHCP provided URL. If not available, we use + * a PAC URL pointing to a well-known file (wpad.dat) on a + * well-known host (wpad.). + */ + dhcp_options = get_service_state_entity(info, serviceID, kSCEntNetDHCP); + wpadURL = wpadURL_dhcp(dhcp_options); + if (wpadURL == NULL) { + wpadURL = wpadURL_dns(); + } + if (wpadURL == NULL) { + wpadEnabled = 0; /* if we don't have a WPAD URL */ + goto setWPAD; + } + + pacEnabled = 1; + num = CFNumberCreate(NULL, kCFNumberIntType, &pacEnabled); + CFDictionarySetValue(new_dict, + kSCPropNetProxiesProxyAutoConfigEnable, + num); + CFRelease(num); + CFDictionarySetValue(new_dict, + kSCPropNetProxiesProxyAutoConfigURLString, + wpadURL); + CFRelease(wpadURL); + } + + setWPAD: + if (wpad != NULL) { + num = CFNumberCreate(NULL, kCFNumberIntType, &wpadEnabled); + CFDictionarySetValue(new_dict, + kSCPropNetProxiesProxyAutoDiscoveryEnable, + num); + CFRelease(num); + } } + done: changed = service_dict_set(serviceID, kSCEntNetProxies, new_dict); + if (new_dict != NULL) CFRelease(new_dict); return (changed); } +#if !TARGET_OS_IPHONE static boolean_t get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict, CFDictionaryRef setup_dict, CFDictionaryRef info) @@ -902,7 +2154,7 @@ get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict, goto done; } - // merge SMB configuration + /* merge SMB configuration */ new_dict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); @@ -931,23 +2183,90 @@ get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict, my_CFRelease(&new_dict); return (changed); } +#endif /* !TARGET_OS_IPHONE */ -static CFStringRef -state_service_key(CFStringRef serviceID, CFStringRef entity) +static boolean_t +get_rank_changes(CFStringRef serviceID, CFDictionaryRef state_options, + CFDictionaryRef setup_options, CFDictionaryRef info) { - return (SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, - kSCDynamicStoreDomainState, - serviceID, - entity)); + boolean_t changed = FALSE; + CFMutableDictionaryRef new_dict = NULL; + CFStringRef new_rank = NULL; + CFStringRef setup_rank = NULL; + CFStringRef state_rank = NULL; + + + /* + * Check "PrimaryRank" setting + * + * Note: Rank Never > Rank Last > Rank First > Rank None + */ + if (isA_CFDictionary(setup_options)) { + setup_rank = CFDictionaryGetValue(setup_options, kSCPropNetServicePrimaryRank); + setup_rank = isA_CFString(setup_rank); + } + if (isA_CFDictionary(state_options)) { + state_rank = CFDictionaryGetValue(state_options, kSCPropNetServicePrimaryRank); + state_rank = isA_CFString(state_rank); + } + + if (((setup_rank != NULL) && CFEqual(setup_rank, kSCValNetServicePrimaryRankNever)) || + ((state_rank != NULL) && CFEqual(state_rank, kSCValNetServicePrimaryRankNever))) { + new_rank = kSCValNetServicePrimaryRankNever; + } + else if (((setup_rank != NULL) && CFEqual(setup_rank, kSCValNetServicePrimaryRankLast)) || + ((state_rank != NULL) && CFEqual(state_rank, kSCValNetServicePrimaryRankLast))) { + new_rank = kSCValNetServicePrimaryRankLast; + } + else if (((setup_rank != NULL) && CFEqual(setup_rank, kSCValNetServicePrimaryRankFirst)) || + ((state_rank != NULL) && CFEqual(state_rank, kSCValNetServicePrimaryRankFirst))) { + new_rank = kSCValNetServicePrimaryRankFirst; + } + + if (new_rank != NULL) { + new_dict = CFDictionaryCreateMutable(NULL, 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFDictionarySetValue(new_dict, kSCPropNetServicePrimaryRank, new_rank); + } + + changed = service_dict_set(serviceID, kSCEntNetService, new_dict); + my_CFRelease(&new_dict); + return (changed); } -static CFStringRef -setup_service_key(CFStringRef serviceID, CFStringRef entity) +static void +add_service_keys(CFStringRef serviceID, CFMutableArrayRef keys, CFMutableArrayRef patterns) { - return (SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, - kSCDynamicStoreDomainSetup, - serviceID, - entity)); + int i; + CFStringRef key; + + if (CFEqual(serviceID, kSCCompAnyRegex)) { + keys = patterns; + } + + for (i = 0; i < ENTITY_TYPES_COUNT; i++) { + key = setup_service_key(serviceID, *entityTypeNames[i]); + CFArrayAppendValue(keys, key); + CFRelease(key); + key = state_service_key(serviceID, *entityTypeNames[i]); + CFArrayAppendValue(keys, key); + CFRelease(key); + } + + key = state_service_key(serviceID, kSCEntNetDHCP); + CFArrayAppendValue(patterns, key); + CFRelease(key); + + key = setup_service_key(serviceID, NULL); + CFArrayAppendValue(patterns, key); + CFRelease(key); + key = state_service_key(serviceID, NULL); + CFArrayAppendValue(patterns, key); + CFRelease(key); + + + return; } static CFDictionaryRef @@ -955,157 +2274,172 @@ services_info_copy(SCDynamicStoreRef session, CFArrayRef service_list) { int count; CFMutableArrayRef get_keys; - int i; - int s; + CFMutableArrayRef get_patterns; CFDictionaryRef info; + int s; count = CFArrayGetCount(service_list); get_keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + get_patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); CFArrayAppendValue(get_keys, S_setup_global_ipv4); CFArrayAppendValue(get_keys, S_setup_global_proxies); +#if !TARGET_OS_IPHONE CFArrayAppendValue(get_keys, S_setup_global_smb); +#endif /* !TARGET_OS_IPHONE */ + CFArrayAppendValue(get_keys, S_multicast_resolvers); CFArrayAppendValue(get_keys, S_private_resolvers); for (s = 0; s < count; s++) { CFStringRef serviceID = CFArrayGetValueAtIndex(service_list, s); - for (i = 0; i < ENTITY_TYPES_COUNT; i++) { - CFStringRef setup_key; - CFStringRef state_key; - - setup_key = setup_service_key(serviceID, entityTypeNames[i]); - state_key = state_service_key(serviceID, entityTypeNames[i]); - CFArrayAppendValue(get_keys, setup_key); - CFArrayAppendValue(get_keys, state_key); - my_CFRelease(&setup_key); - my_CFRelease(&state_key); - } + add_service_keys(serviceID, get_keys, get_patterns); } - info = SCDynamicStoreCopyMultiple(session, get_keys, NULL); + info = SCDynamicStoreCopyMultiple(session, get_keys, get_patterns); my_CFRelease(&get_keys); + my_CFRelease(&get_patterns); return (info); } -static CFDictionaryRef -get_service_setup_entity(CFDictionaryRef service_info, CFStringRef serviceID, - CFStringRef entity) -{ - CFStringRef setup_key; - CFDictionaryRef setup_dict; - - setup_key = setup_service_key(serviceID, entity); - setup_dict = my_CFDictionaryGetDictionary(service_info, setup_key); - my_CFRelease(&setup_key); - return (setup_dict); -} - -static CFDictionaryRef -get_service_state_entity(CFDictionaryRef service_info, CFStringRef serviceID, - CFStringRef entity) -{ - CFStringRef state_key; - CFDictionaryRef state_dict; - - state_key = state_service_key(serviceID, entity); - state_dict = my_CFDictionaryGetDictionary(service_info, state_key); - my_CFRelease(&state_key); - return (state_dict); -} - static int rtm_seq = 0; -static boolean_t -ipv4_route(int cmd, struct in_addr gateway, struct in_addr netaddr, - struct in_addr netmask, char * ifname, struct in_addr ifa, - boolean_t is_direct) +static int +ipv4_route_open_socket(void) { - boolean_t default_route = (netaddr.s_addr == 0); - int len; - boolean_t ret = TRUE; - struct { - struct rt_msghdr hdr; - struct sockaddr_in dst; - struct sockaddr_in gway; - struct sockaddr_in mask; - struct sockaddr_dl ifp; - struct sockaddr_in ifa; - } rtmsg; - int sockfd = -1; - - if (default_route && S_netboot) { - return (TRUE); - } + int sockfd; if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) { - SCLog(TRUE, LOG_INFO, - CFSTR("IPMonitor: ipv4_route: open routing socket failed, %s"), + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: ipv4_route_open_socket: socket failed, %s"), strerror(errno)); - return (FALSE); } + return (sockfd); +} - memset(&rtmsg, 0, sizeof(rtmsg)); - rtmsg.hdr.rtm_type = cmd; - if (default_route) { - if (is_direct) { - /* if router is directly reachable, don't set the gateway flag */ - rtmsg.hdr.rtm_flags = RTF_UP | RTF_STATIC; - } - else { - rtmsg.hdr.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC; - } +/* + * Define: ROUTE_MSG_ADDRS_SPACE + * Purpose: + * Since sizeof(sockaddr_dl) > sizeof(sockaddr_in), we need space for + * 3 sockaddr_in's and 2 sockaddr_dl's, but pad it just in case + * someone changes the code and doesn't think to modify this. + */ +#define ROUTE_MSG_ADDRS_SPACE (3 * sizeof(struct sockaddr_in) \ + + 2 * sizeof(struct sockaddr_dl) \ + + 128) +typedef struct { + struct rt_msghdr hdr; + char addrs[ROUTE_MSG_ADDRS_SPACE]; +} route_msg; + +static int +ipv4_route(int sockfd, + int cmd, struct in_addr gateway, struct in_addr netaddr, + struct in_addr netmask, char * ifname, unsigned int ifindex, + struct in_addr ifa, RouteFlags flags) +{ + boolean_t default_route = (netaddr.s_addr == 0); + int len; + int ret = 0; + route_msg rtmsg; + union { + struct sockaddr_in * in_p; + struct sockaddr_dl * dl_p; + void * ptr; + } rtaddr; + + if (default_route && S_netboot) { + return (0); } - else { - rtmsg.hdr.rtm_flags = RTF_UP | RTF_CLONING | RTF_STATIC; + + if (ifname == NULL) { + /* this should not happen, but rather than crash, return an error */ + syslog(LOG_NOTICE, + "IPMonitor: ipv4_route ifname is NULL on network address %s", + inet_ntoa(netaddr)); + return (EBADF); } + memset(&rtmsg, 0, sizeof(rtmsg)); + rtmsg.hdr.rtm_type = cmd; rtmsg.hdr.rtm_version = RTM_VERSION; rtmsg.hdr.rtm_seq = ++rtm_seq; - rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; - rtmsg.dst.sin_len = sizeof(rtmsg.dst); - rtmsg.dst.sin_family = AF_INET; - rtmsg.dst.sin_addr = netaddr; - rtmsg.gway.sin_len = sizeof(rtmsg.gway); - rtmsg.gway.sin_family = AF_INET; - rtmsg.gway.sin_addr = gateway; - rtmsg.mask.sin_len = sizeof(rtmsg.mask); - rtmsg.mask.sin_family = AF_INET; - rtmsg.mask.sin_addr = netmask; - - len = sizeof(rtmsg); - if (ifname) { - rtmsg.hdr.rtm_addrs |= RTA_IFP | RTA_IFA; - /* copy the interface name */ - rtmsg.ifp.sdl_len = sizeof(rtmsg.ifp); - rtmsg.ifp.sdl_family = AF_LINK; - rtmsg.ifp.sdl_nlen = strlen(ifname); - bcopy(ifname, rtmsg.ifp.sdl_data, rtmsg.ifp.sdl_nlen); - /* and the interface address */ - rtmsg.ifa.sin_len = sizeof(rtmsg.ifa); - rtmsg.ifa.sin_family = AF_INET; - rtmsg.ifa.sin_addr = ifa; + rtmsg.hdr.rtm_addrs + = RTA_DST | RTA_GATEWAY | RTA_NETMASK | RTA_IFP | RTA_IFA; + if (default_route + && (flags & kRouteIsDirectToInterfaceFlag) == 0) { + rtmsg.hdr.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC; } else { - /* no ifp/ifa information */ - len -= sizeof(rtmsg.ifp) + sizeof(rtmsg.ifa); + rtmsg.hdr.rtm_flags = RTF_UP | RTF_CLONING | RTF_STATIC; } - rtmsg.hdr.rtm_msglen = len; - if (write(sockfd, &rtmsg, len) == -1) { - if ((cmd == RTM_ADD) && (errno == EEXIST)) { - /* no sense complaining about a route that already exists */ - } - else if ((cmd == RTM_DELETE) && (errno == ESRCH)) { - /* no sense complaining about a route that isn't there */ + if ((flags & kRouteWantScopedFlag) != 0) { +#ifdef RTF_IFSCOPE + if (!S_scopedroute) { + return (0); } - else { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor ipv4_route: " - "write routing socket failed, %s"), strerror(errno)); - ret = FALSE; + if (ifindex == 0) { + /* specifically asked for a scoped route, yet no index supplied */ + syslog(LOG_NOTICE, + "IPMonitor: ipv4_route index is 0 on %s-scoped route %s", + ifname, inet_ntoa(netaddr)); + return (EBADF); } + rtmsg.hdr.rtm_index = ifindex; + rtmsg.hdr.rtm_flags |= RTF_IFSCOPE; +#else /* RTF_IFSCOPE */ + return (0); +#endif /* RTF_IFSCOPE */ } - close(sockfd); + rtaddr.ptr = rtmsg.addrs; + + /* dest */ + rtaddr.in_p->sin_len = sizeof(*rtaddr.in_p); + rtaddr.in_p->sin_family = AF_INET; + rtaddr.in_p->sin_addr = netaddr; + rtaddr.ptr += sizeof(*rtaddr.in_p); + + /* gateway */ + if ((rtmsg.hdr.rtm_flags & RTF_GATEWAY) != 0) { + /* gateway is an IP address */ + rtaddr.in_p->sin_len = sizeof(*rtaddr.in_p); + rtaddr.in_p->sin_family = AF_INET; + rtaddr.in_p->sin_addr = gateway; + rtaddr.ptr += sizeof(*rtaddr.in_p); + } + else { + /* gateway is the interface itself */ + rtaddr.dl_p->sdl_len = sizeof(*rtaddr.dl_p); + rtaddr.dl_p->sdl_family = AF_LINK; + rtaddr.dl_p->sdl_nlen = strlen(ifname); + bcopy(ifname, rtaddr.dl_p->sdl_data, rtaddr.dl_p->sdl_nlen); + rtaddr.ptr += sizeof(*rtaddr.dl_p); + } + + /* mask */ + rtaddr.in_p->sin_len = sizeof(*rtaddr.in_p); + rtaddr.in_p->sin_family = AF_INET; + rtaddr.in_p->sin_addr = netmask; + rtaddr.ptr += sizeof(*rtaddr.in_p); + + /* interface name */ + rtaddr.dl_p->sdl_len = sizeof(*rtaddr.dl_p); + rtaddr.dl_p->sdl_family = AF_LINK; + rtaddr.dl_p->sdl_nlen = strlen(ifname); + bcopy(ifname, rtaddr.dl_p->sdl_data, rtaddr.dl_p->sdl_nlen); + rtaddr.ptr += sizeof(*rtaddr.dl_p); + + /* interface address */ + rtaddr.in_p->sin_len = sizeof(*rtaddr.in_p); + rtaddr.in_p->sin_family = AF_INET; + rtaddr.in_p->sin_addr = ifa; + rtaddr.ptr += sizeof(*rtaddr.in_p); + + len = sizeof(rtmsg.hdr) + (rtaddr.ptr - (void *)rtmsg.addrs); + rtmsg.hdr.rtm_msglen = len; + if (write(sockfd, &rtmsg, len) == -1) { + ret = errno; + } return (ret); } @@ -1135,7 +2469,7 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr, gateway.__u6_addr.__u6_addr16[1] = (uint16_t)htons(index); } if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) { - SCLog(TRUE, LOG_INFO, + SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor ipv6_route: open routing socket failed, %s"), strerror(errno)); return (FALSE); @@ -1188,9 +2522,11 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr, /* no sense complaining about a route that isn't there */ } else { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor ipv6_route: write routing" - " socket failed, %s"), strerror(errno)); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor ipv6_route: write routing" + " socket failed, %s"), strerror(errno)); + } ret = FALSE; } } @@ -1199,144 +2535,56 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr, return (ret); } -static boolean_t -ipv4_subnet_route_add(struct in_addr local_ip, - struct in_addr subnet, struct in_addr mask, char * ifname) -{ - if (S_IPMonitor_debug) { - SCLog(TRUE, LOG_INFO, - CFSTR("IPMonitor: IPv4 route add -net " - IP_FORMAT " -netmask %s interface %s"), - IP_LIST(&subnet), inet_ntoa(mask), ifname); - } - return (ipv4_route(RTM_ADD, local_ip, subnet, mask, ifname, local_ip, - FALSE)); -} - -static boolean_t -ipv4_subnet_route_delete(struct in_addr subnet, struct in_addr mask) -{ - if (S_IPMonitor_debug) { - SCLog(TRUE, LOG_INFO, - CFSTR("IPMonitor: IPv4 route delete -net " - IP_FORMAT " %s"), - IP_LIST(&subnet), inet_ntoa(mask)); - } - return (ipv4_route(RTM_DELETE, S_ip_zeros, subnet, mask, NULL, - S_ip_zeros, FALSE)); -} - - -static boolean_t -ipv4_default_route_delete(void) -{ - if (S_IPMonitor_debug) { - SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: IPv4 route delete default")); - } - return (ipv4_route(RTM_DELETE, S_ip_zeros, S_ip_zeros, S_ip_zeros, NULL, - S_ip_zeros, FALSE)); -} - -static boolean_t -ipv4_default_route_add(struct in_addr router, char * ifname, - struct in_addr local_ip, boolean_t is_direct) -{ - if (S_IPMonitor_debug) { - SCLog(TRUE, LOG_INFO, - CFSTR("IPMonitor: IPv4 route add default" - " %s interface %s direct %d"), - inet_ntoa(router), ifname, is_direct); - } - return (ipv4_route(RTM_ADD, router, S_ip_zeros, S_ip_zeros, ifname, - local_ip, is_direct)); -} - -static boolean_t -ipv4_default_route_change(struct in_addr router, char * ifname, - struct in_addr local_ip, boolean_t is_direct) -{ - if (S_IPMonitor_debug) { - SCLog(TRUE, LOG_INFO, - CFSTR("IPMonitor: IPv4 route change default" - " %s interface %s direct %d"), - inet_ntoa(router), ifname, is_direct); - } - return (ipv4_route(RTM_CHANGE, router, S_ip_zeros, S_ip_zeros, ifname, - local_ip, is_direct)); -} - static boolean_t ipv6_default_route_delete(void) { - if (S_IPMonitor_debug) { - SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: IPv6 route delete default")); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: IPv6 route delete default")); } - return (ipv6_route(RTM_DELETE, S_ip6_zeros, S_ip6_zeros, S_ip6_zeros, NULL, FALSE)); + return (ipv6_route(RTM_DELETE, S_ip6_zeros, S_ip6_zeros, S_ip6_zeros, + NULL, FALSE)); } static boolean_t ipv6_default_route_add(struct in6_addr router, char * ifname, boolean_t is_direct) { - if (S_IPMonitor_debug) { + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { char str[128]; str[0] = '\0'; inet_ntop(AF_INET6, &router, str, sizeof(str)); - SCLog(TRUE,LOG_INFO, + SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: IPv6 route add default" " %s interface %s direct %d"), str, ifname, is_direct); } - return (ipv6_route(RTM_ADD, router, S_ip6_zeros, S_ip6_zeros, ifname, is_direct)); + return (ipv6_route(RTM_ADD, router, S_ip6_zeros, S_ip6_zeros, + ifname, is_direct)); } -static boolean_t -multicast_route_delete() +static int +multicast_route_delete(int sockfd) { struct in_addr gateway = { htonl(INADDR_LOOPBACK) }; struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) }; struct in_addr netmask = { htonl(IN_CLASSD_NET) }; - return (ipv4_route(RTM_DELETE, gateway, netaddr, netmask, "lo0", - gateway, FALSE)); + return (ipv4_route(sockfd, RTM_DELETE, gateway, netaddr, netmask, "lo0", 0, + gateway, 0)); } -static boolean_t -multicast_route_add() +static int +multicast_route_add(int sockfd) { struct in_addr gateway = { htonl(INADDR_LOOPBACK) }; struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) }; struct in_addr netmask = { htonl(IN_CLASSD_NET) }; - return (ipv4_route(RTM_ADD, gateway, netaddr, netmask, "lo0", - gateway, FALSE)); -} - -static void -set_ipv4_router(struct in_addr * router, char * ifname, - struct in_addr * local_ip, boolean_t is_direct) -{ - if (S_router_subnet.s_addr != 0) { - ipv4_subnet_route_delete(S_router_subnet, S_router_subnet_mask); - S_router_subnet.s_addr = S_router_subnet_mask.s_addr = 0; - } - /* assign the new default route, ensure local multicast route available */ - (void)ipv4_default_route_delete(); - if (router != NULL) { - (void)ipv4_default_route_add(*router, ifname, - (local_ip != NULL) - ? *local_ip : S_ip_zeros, - is_direct); - (void)multicast_route_delete(); - } - else { - (void)multicast_route_add(); - } - - return; + return (ipv4_route(sockfd, RTM_ADD, gateway, netaddr, netmask, "lo0", 0, + gateway, 0)); } static void @@ -1350,6 +2598,7 @@ set_ipv6_router(struct in6_addr * router, char * ifname, boolean_t is_direct) return; } +#if !TARGET_OS_IPHONE static __inline__ void empty_dns() { @@ -1369,6 +2618,16 @@ set_dns(CFArrayRef val_search_domains, CFIndex i; CFIndex n; + SCPrint(TRUE, f, CFSTR("#\n")); + SCPrint(TRUE, f, CFSTR("# Mac OS X Notice\n")); + SCPrint(TRUE, f, CFSTR("#\n")); + SCPrint(TRUE, f, CFSTR("# This file is not used by the host name and address resolution\n")); + SCPrint(TRUE, f, CFSTR("# or the DNS query routing mechanisms used by most processes on\n")); + SCPrint(TRUE, f, CFSTR("# this Mac OS X system.\n")); + SCPrint(TRUE, f, CFSTR("#\n")); + SCPrint(TRUE, f, CFSTR("# This file is automatically generated.\n")); + SCPrint(TRUE, f, CFSTR("#\n")); + if (isA_CFString(val_domain_name)) { SCPrint(TRUE, f, CFSTR("domain %@\n"), val_domain_name); } @@ -1418,6 +2677,7 @@ set_dns(CFArrayRef val_search_domains, } return; } +#endif /* !TARGET_OS_IPHONE */ static boolean_t router_is_our_ipv6_address(CFStringRef router, CFArrayRef addr_list) @@ -1438,90 +2698,243 @@ router_is_our_ipv6_address(CFStringRef router, CFArrayRef addr_list) return (FALSE); } -static void -update_ipv4(CFDictionaryRef service_info, - CFStringRef primary, - keyChangeListRef keys) +static IPv4RouteListRef +service_dict_get_ipv4_routelist(CFDictionaryRef service_dict) { - CFDictionaryRef ipv4_dict = NULL; + CFDataRef data; + IPv4RouteListRef routes = NULL; - if (primary != NULL) { - CFDictionaryRef service_dict; + data = (CFDataRef)CFDictionaryGetValue(service_dict, kSCEntNetIPv4); + if (data != NULL) { + routes = (IPv4RouteListRef)CFDataGetBytePtr(data); + } + return (routes); +} - service_dict = CFDictionaryGetValue(S_service_state_dict, primary); - if (service_dict != NULL) { - ipv4_dict = CFDictionaryGetValue(service_dict, kSCEntNetIPv4); +typedef struct apply_ipv4_route_context { + IPv4RouteListRef old; + IPv4RouteListRef new; + int sockfd; +} apply_ipv4_route_context_t; + +/* add/remove a router/32 subnet */ +static int +ipv4_route_gateway(int sockfd, int cmd, char * ifn_p, + IPv4RouteRef def_route) +{ + struct in_addr mask; + + mask.s_addr = htonl(INADDR_BROADCAST); + return (ipv4_route(sockfd, cmd, def_route->ifa, + def_route->gateway, mask, ifn_p, def_route->ifindex, + def_route->ifa, + (def_route->flags & kRouteWantScopedFlag))); +} + +/* + * Function: apply_ipv4_route + * Purpose: + * Callback function that adds/removes the specified route. + */ +static void +apply_ipv4_route(IPv4RouteListApplyCommand cmd, IPv4RouteRef route, void * arg) +{ + apply_ipv4_route_context_t *context = (apply_ipv4_route_context_t *)arg; + char * ifn_p; + int retval; + + ifn_p = route->ifname; + switch (cmd) { + case kIPv4RouteListAddRouteCommand: + if ((route->flags & kRouteIsNotSubnetLocalFlag) != 0) { + retval = ipv4_route_gateway(context->sockfd, RTM_ADD, + ifn_p, route); + if (retval == EEXIST) { + /* delete and add again */ + (void)ipv4_route_gateway(context->sockfd, RTM_DELETE, + ifn_p, route); + retval = ipv4_route_gateway(context->sockfd, RTM_ADD, + ifn_p, route); + } + if (retval != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor apply_ipv4_route failed to add" + " %s/32 route, %s"), + inet_ntoa(route->gateway), strerror(retval)); + } + else if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, CFSTR("Added IPv4 Route %s/32"), + inet_ntoa(route->gateway)); + } + } + retval = ipv4_route(context->sockfd, + RTM_ADD, route->gateway, + route->dest, route->mask, ifn_p, route->ifindex, + route->ifa, route->flags); + if (retval == EEXIST) { + /* delete and add again */ + (void)ipv4_route(context->sockfd, + RTM_DELETE, route->gateway, + route->dest, route->mask, ifn_p, route->ifindex, + route->ifa, route->flags); + retval = ipv4_route(context->sockfd, + RTM_ADD, route->gateway, + route->dest, route->mask, + ifn_p, route->ifindex, + route->ifa, route->flags); + } + if (retval != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor apply_ipv4_route failed to add" + " route, %s:"), strerror(retval)); + IPv4RouteLog(route); + } + else if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("Added IPv4 route new[%d] = "), + route - context->new->list); + IPv4RouteLog(route); } + break; + case kIPv4RouteListRemoveRouteCommand: + retval = ipv4_route(context->sockfd, + RTM_DELETE, route->gateway, + route->dest, route->mask, ifn_p, route->ifindex, + route->ifa, route->flags); + if (retval != 0) { + if (retval != ESRCH) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor apply_ipv4_route failed to remove" + " route, %s: "), strerror(retval)); + IPv4RouteLog(route); + } + } + else if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("Removed IPv4 route old[%d] = "), + route - context->old->list); + IPv4RouteLog(route); + } + if ((route->flags & kRouteIsNotSubnetLocalFlag) != 0) { + retval = ipv4_route_gateway(context->sockfd, RTM_DELETE, + ifn_p, route); + if (retval != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor apply_ipv4_route failed to remove" + " %s/32 route, %s: "), + inet_ntoa(route->gateway), strerror(retval)); + } + else if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, CFSTR("Removed IPv4 Route %s/32"), + inet_ntoa(route->gateway)); + } + } + break; + default: + break; } - if (ipv4_dict != NULL) { - CFMutableDictionaryRef dict = NULL; - CFStringRef if_name = NULL; - char ifn[IFNAMSIZ + 1] = { '\0' }; - char * ifn_p = NULL; - boolean_t is_direct = FALSE; - struct in_addr local_ip = { 0 }; - CFStringRef local_ip_cf; - CFArrayRef local_ip_list; - boolean_t needs_local_ip = FALSE; - struct in_addr router = { 0 }; - CFStringRef val_router = NULL; + return; +} - dict = CFDictionaryCreateMutable(NULL, 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - local_ip_list = CFDictionaryGetValue(ipv4_dict, - kSCPropNetIPv4Addresses); - local_ip_cf = CFArrayGetValueAtIndex(local_ip_list, 0); - cfstring_to_ip(local_ip_cf, &local_ip); - val_router = CFDictionaryGetValue(ipv4_dict, kSCPropNetIPv4Router); - if (val_router != NULL) { - cfstring_to_ip(val_router, &router); - CFDictionarySetValue(dict, kSCPropNetIPv4Router, val_router); - if (CFDictionaryContainsKey(ipv4_dict, kRouterIsDirect)) { - is_direct = TRUE; +/* + * Function: update_ipv4 + * + * Purpose: + * Update the IPv4 configuration based on the latest information. + * Publish the State:/Network/Global/IPv4 information, and update the + * IPv4 routing table. IPv4RouteListApply() invokes our callback, + * apply_ipv4_route(), to install/remove the routes. + */ +static void +update_ipv4(CFStringRef primary, + IPv4RouteListRef new_routelist, + keyChangeListRef keys) +{ + apply_ipv4_route_context_t context; + + if (keys != NULL) { + if (new_routelist != NULL && primary != NULL) { + char * ifn_p = NULL; + IPv4RouteRef r; + CFMutableDictionaryRef dict = NULL; + + dict = CFDictionaryCreateMutable(NULL, 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + /* the first entry is the default route */ + r = new_routelist->list; + if (r->gateway.s_addr != 0) { + CFStringRef router; + + router = CFStringCreateWithCString(NULL, + inet_ntoa(r->gateway), + kCFStringEncodingASCII); + if (router != NULL) { + CFDictionarySetValue(dict, kSCPropNetIPv4Router, router); + CFRelease(router); + } } - else if (CFDictionaryContainsKey(ipv4_dict, kRouterNeedsLocalIP)) { - needs_local_ip = TRUE; + if (r->ifname[0] != '\0') { + ifn_p = r->ifname; + } + if (ifn_p != NULL) { + CFStringRef ifname_cf; + + ifname_cf = CFStringCreateWithCString(NULL, + ifn_p, + kCFStringEncodingASCII); + if (ifname_cf != NULL) { + CFDictionarySetValue(dict, + kSCDynamicStorePropNetPrimaryInterface, + ifname_cf); + CFRelease(ifname_cf); + } } + CFDictionarySetValue(dict, kSCDynamicStorePropNetPrimaryService, + primary); + keyChangeListSetValue(keys, S_state_global_ipv4, dict); + CFRelease(dict); } else { - is_direct = TRUE; - router = local_ip; + keyChangeListRemoveValue(keys, S_state_global_ipv4); } - if_name = CFDictionaryGetValue(ipv4_dict, kSCPropInterfaceName); - if (if_name) { - CFDictionarySetValue(dict, - kSCDynamicStorePropNetPrimaryInterface, - if_name); - if (CFStringGetCString(if_name, ifn, sizeof(ifn), - kCFStringEncodingASCII)) { - ifn_p = ifn; + } + + bzero(&context, sizeof(context)); + context.sockfd = ipv4_route_open_socket(); + if (context.sockfd != -1) { + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + if (S_ipv4_routelist == NULL) { + SCLog(TRUE, LOG_NOTICE, CFSTR("Old Routes = ")); + } + else { + SCLog(TRUE, LOG_NOTICE, CFSTR("Old Routes = ")); + IPv4RouteListLog(S_ipv4_routelist); + } + if (new_routelist == NULL) { + SCLog(TRUE, LOG_NOTICE, CFSTR("New Routes = ")); + } + else { + SCLog(TRUE, LOG_NOTICE, CFSTR("New Routes = ")); + IPv4RouteListLog(new_routelist); } } - CFDictionarySetValue(dict, kSCDynamicStorePropNetPrimaryService, - primary); - keyChangeListSetValue(keys, S_state_global_ipv4, dict); - CFRelease(dict); - - /* route add default ... */ - if (needs_local_ip) { - struct in_addr m; - - m.s_addr = htonl(INADDR_BROADCAST); - ipv4_subnet_route_add(local_ip, router, m, ifn_p); - set_ipv4_router(&local_ip, ifn_p, &local_ip, FALSE); - ipv4_default_route_change(router, ifn_p, local_ip, FALSE); - S_router_subnet = router; - S_router_subnet_mask = m; + context.old = S_ipv4_routelist; + context.new = new_routelist; + IPv4RouteListApply(S_ipv4_routelist, new_routelist, + &apply_ipv4_route, (void *)&context); + if (new_routelist != NULL) { + (void)multicast_route_delete(context.sockfd); } else { - set_ipv4_router(&router, ifn_p, &local_ip, is_direct); + (void)multicast_route_add(context.sockfd); } + close(context.sockfd); } - else { - keyChangeListRemoveValue(keys, S_state_global_ipv4); - set_ipv4_router(NULL, NULL, NULL, FALSE); + if (S_ipv4_routelist != NULL) { + free(S_ipv4_routelist); } + S_ipv4_routelist = new_routelist; return; } @@ -1544,7 +2957,7 @@ update_ipv6(CFDictionaryRef service_info, CFArrayRef addrs; CFMutableDictionaryRef dict = NULL; CFStringRef if_name = NULL; - char ifn[IFNAMSIZ + 1] = { '\0' }; + char ifn[IFNAMSIZ] = { '\0' }; char * ifn_p = NULL; boolean_t is_direct = FALSE; CFStringRef val_router = NULL; @@ -1610,14 +3023,18 @@ update_dns(CFDictionaryRef service_info, } } if (dict == NULL) { +#if !TARGET_OS_IPHONE empty_dns(); +#endif /* !TARGET_OS_IPHONE */ keyChangeListRemoveValue(keys, S_state_global_dns); } else { +#if !TARGET_OS_IPHONE set_dns(CFDictionaryGetValue(dict, kSCPropNetDNSSearchDomains), CFDictionaryGetValue(dict, kSCPropNetDNSDomainName), CFDictionaryGetValue(dict, kSCPropNetDNSServerAddresses), CFDictionaryGetValue(dict, kSCPropNetDNSSortList)); +#endif /* !TARGET_OS_IPHONE */ keyChangeListSetValue(keys, S_state_global_dns, dict); } return; @@ -1629,23 +3046,27 @@ update_dnsinfo(CFDictionaryRef service_info, keyChangeListRef keys, CFArrayRef service_order) { - CFArrayRef privateResolvers; + CFDictionaryRef dict = NULL; + CFArrayRef multicastResolvers; + CFArrayRef privateResolvers; - privateResolvers = CFDictionaryGetValue(service_info, S_private_resolvers); + multicastResolvers = CFDictionaryGetValue(service_info, S_multicast_resolvers); + privateResolvers = CFDictionaryGetValue(service_info, S_private_resolvers); - if (primary == NULL) { - dns_configuration_set(NULL, NULL, NULL, privateResolvers); - } else { - CFDictionaryRef dict = NULL; + if (primary != NULL) { CFDictionaryRef service_dict; service_dict = CFDictionaryGetValue(S_service_state_dict, primary); if (service_dict != NULL) { dict = CFDictionaryGetValue(service_dict, kSCEntNetDNS); } - - dns_configuration_set(dict, S_service_state_dict, service_order, privateResolvers); } + + dns_configuration_set(dict, + S_service_state_dict, + service_order, + multicastResolvers, + privateResolvers); keyChangeListNotifyKey(keys, S_state_global_dns); return; } @@ -1655,7 +3076,7 @@ update_proxies(CFDictionaryRef service_info, CFStringRef primary, keyChangeListRef keys) { - CFDictionaryRef dict = NULL; + CFDictionaryRef dict = NULL; if (primary != NULL) { CFDictionaryRef service_dict; @@ -1678,6 +3099,7 @@ update_proxies(CFDictionaryRef service_info, return; } +#if !TARGET_OS_IPHONE static void update_smb(CFDictionaryRef service_info, CFStringRef primary, @@ -1706,154 +3128,254 @@ update_smb(CFDictionaryRef service_info, return; } +#endif /* !TARGET_OS_IPHONE */ -static unsigned int -get_service_rank(CFStringRef proto_key, CFArrayRef order, CFStringRef serviceID) +static Rank +get_service_rank(CFArrayRef order, int n_order, CFStringRef serviceID) { - CFDictionaryRef d; CFIndex i; - CFDictionaryRef proto_dict; - - if (serviceID == NULL) { - goto done; - } - d = CFDictionaryGetValue(S_service_state_dict, serviceID); - if (d == NULL) { - goto done; - } - - proto_dict = CFDictionaryGetValue(d, proto_key); - if (proto_dict) { - CFStringRef if_name; - CFNumberRef override = NULL; - - if_name = CFDictionaryGetValue(proto_dict, kSCPropInterfaceName); - if (S_ppp_override_primary == TRUE - && if_name != NULL - && CFStringHasPrefix(if_name, CFSTR("ppp"))) { - /* PPP override: make ppp* look the best */ - /* Hack: should use interface type, not interface name */ - return (0); - } - /* check for the "OverridePrimary" property */ - override = CFDictionaryGetValue(proto_dict, kSCPropNetOverridePrimary); - if (isA_CFNumber(override) != NULL) { - int val = 0; - - CFNumberGetValue(override, kCFNumberIntType, &val); - if (val != 0) { - return (0); - } - } - } - - if (serviceID != NULL && order != NULL) { - CFIndex n = CFArrayGetCount(order); + Rank rank = kRankLast; - for (i = 0; i < n; i++) { + if (serviceID != NULL && order != NULL && n_order > 0) { + for (i = 0; i < n_order; i++) { CFStringRef s = isA_CFString(CFArrayGetValueAtIndex(order, i)); if (s == NULL) { continue; } if (CFEqual(serviceID, s)) { - return (i + 1); + rank = i + 1; + break; } } } - - done: - return (UINT_MAX); + return (rank); } /** ** Service election: **/ -typedef boolean_t (*routerCheckFunc)(CFStringRef str); +/* + * Function: rank_dict_get_service_rank + * Purpose: + * Retrieve the service rank in the given dictionary. + */ +static Rank +rank_dict_get_service_rank(CFDictionaryRef rank_dict, CFStringRef serviceID) +{ + CFNumberRef rank; + Rank rank_val = kRankLast; -static boolean_t -check_ipv4_router(CFStringRef router) + rank = CFDictionaryGetValue(rank_dict, serviceID); + if (rank != NULL) { + CFNumberGetValue(rank, kCFNumberSInt32Type, &rank_val); + } + return (rank_val); +} + +/* + * Function: rank_dict_set_service_rank + * Purpose: + * Save the results of ranking the service so we can look it up later without + * repeating all of the ranking code. + */ +static void +rank_dict_set_service_rank(CFMutableDictionaryRef rank_dict, + CFStringRef serviceID, Rank rank_val) { - struct in_addr ip; + CFNumberRef rank; - return (cfstring_to_ip(router, &ip)); + rank = CFNumberCreate(NULL, kCFNumberSInt32Type, (const void *)&rank_val); + if (rank != NULL) { + CFDictionarySetValue(rank_dict, serviceID, rank); + CFRelease(rank); + } + return; } +typedef struct election_info { + int n_services; + CFArrayRef order; + int n_order; + CFStringRef serviceID; + CFDictionaryRef service_dict; + Rank service_rank; + boolean_t choose_last; +} election_info_t; + +typedef boolean_t election_func_t(void * context, election_info_t * info); + +/* + * Function: elect_ipv4 + * Purpose: + * This function builds the list of IPv4 routes that should be active. + * As elect_new_primary() invokes us with each service, we build up the + * result in the passed in context, a pointer to an IPv4RouteListRef. + */ static boolean_t -check_ipv6_router(CFStringRef router) +elect_ipv4(void * context, election_info_t * info) { - struct in6_addr ip6; + IPv4RouteListRef * routes_p = (IPv4RouteListRef *)context; + IPv4RouteListRef service_routes; - return (cfstring_to_ip6(router, &ip6)); + service_routes = service_dict_get_ipv4_routelist(info->service_dict); + if (service_routes == NULL) { + return (FALSE); + } + if ((service_routes->list->flags & kRouteChooseFirstFlag) != 0) { + info->service_rank = kRankFirst; + } + else if (S_ppp_override_primary + && (strncmp(PPP_PREFIX, service_routes->list->ifname, + sizeof(PPP_PREFIX) - 1) == 0)) { + /* PPP override: make ppp* look the best */ + /* Hack: should use interface type, not interface name */ + info->service_rank = kRankFirst; + } + else { + info->service_rank = get_service_rank(info->order, info->n_order, + info->serviceID); + if ((service_routes->list->flags & kRouteChooseLastFlag) != 0) { + info->choose_last = TRUE; + } + } + if (routes_p != NULL) { + *routes_p = IPv4RouteListAddRouteList(*routes_p, + info->n_services * 3, + service_routes, + info->service_rank); + } + if ((service_routes->list->flags & kRouteChooseNeverFlag) != 0) { + /* never elect as primary */ + return (FALSE); + } + rank_dict_set_service_rank(S_ipv4_service_rank_dict, + info->serviceID, info->service_rank); + return (TRUE); } -struct election_state { - routerCheckFunc router_check; - CFStringRef proto_key; /* e.g. kSCEntNetIPv4 */ - CFStringRef router_key;/* e.g. kSCPropNetIPv4Router */ - CFArrayRef order; - CFStringRef new_primary; - boolean_t new_has_router; - unsigned int new_primary_index; -}; - -static void -elect_protocol(const void * key, const void * value, void * context) +static boolean_t +elect_ipv6(void * context, election_info_t * info) { - struct election_state * elect_p = (struct election_state *)context; - CFDictionaryRef proto_dict = NULL; - CFStringRef router; - boolean_t router_valid = FALSE; - CFStringRef serviceID = (CFStringRef)key; - CFDictionaryRef service_dict = (CFDictionaryRef)value; - unsigned int service_index; + CFStringRef if_name; + CFStringRef primaryRank = NULL; + CFDictionaryRef proto_dict; + CFStringRef router; + CFDictionaryRef service_options; - proto_dict = CFDictionaryGetValue(service_dict, elect_p->proto_key); + proto_dict = CFDictionaryGetValue(info->service_dict, kSCEntNetIPv6); if (proto_dict == NULL) { - return; + return (FALSE); } - router = CFDictionaryGetValue(proto_dict, elect_p->router_key); - router_valid = (*elect_p->router_check)(router); - if (router_valid == FALSE && elect_p->new_has_router == TRUE) { - /* skip it */ - return; + service_options = service_dict_get(info->serviceID, kSCEntNetService); + if (service_options != NULL) { + primaryRank = CFDictionaryGetValue(service_options, kSCPropNetServicePrimaryRank); + if ((primaryRank != NULL) + && CFEqual(primaryRank, kSCValNetServicePrimaryRankNever)) { + return (FALSE); + } } - service_index - = get_service_rank(elect_p->proto_key, elect_p->order, serviceID); - if (elect_p->new_primary == NULL - || service_index < elect_p->new_primary_index - || (router_valid && elect_p->new_has_router == FALSE)) { - my_CFRelease(&elect_p->new_primary); - elect_p->new_primary = CFRetain(serviceID); - elect_p->new_primary_index = service_index; - elect_p->new_has_router = router_valid; + router = CFDictionaryGetValue(proto_dict, + kSCPropNetIPv6Router); + if (router == NULL) { + info->choose_last = TRUE; + info->service_rank = kRankLast; } - return; + else if ((primaryRank != NULL) + && CFEqual(primaryRank, kSCValNetServicePrimaryRankFirst)) { + info->service_rank = kRankFirst; + } + else if (get_override_primary(proto_dict)) { + info->service_rank = kRankFirst; + } + else if (S_ppp_override_primary + && CFDictionaryGetValueIfPresent(proto_dict, + kSCPropInterfaceName, + (const void **)&if_name) + && CFStringHasPrefix(if_name, CFSTR(PPP_PREFIX))) { + /* PPP override: make ppp* look the best */ + /* Hack: should use interface type, not interface name */ + info->service_rank = kRankFirst; + } + else { + info->service_rank = get_service_rank(info->order, info->n_order, + info->serviceID); + } + rank_dict_set_service_rank(S_ipv6_service_rank_dict, + info->serviceID, info->service_rank); + return (TRUE); } +/* + * Function: elect_new_primary + * Purpose: + * Walk the list of services, passing each service dictionary to "elect_func". + * "elect_func" returns rank information about the service that let us + * determine the new primary. + */ static CFStringRef -elect_new_primary(CFArrayRef order, CFStringRef proto_key, - CFStringRef router_key) +elect_new_primary(election_func_t * elect_func, void * context, + CFArrayRef order, int n_order) { - struct election_state elect; + int count; + int i; + election_info_t info; + void * * keys; +#define N_KEYS_VALUES_STATIC 10 + void * keys_values_buf[N_KEYS_VALUES_STATIC * 2]; + CFStringRef new_primary = NULL; + Rank new_primary_rank = kRankLast; + boolean_t new_primary_choose_last = FALSE; + void * * values; + + count = CFDictionaryGetCount(S_service_state_dict); + if (count <= N_KEYS_VALUES_STATIC) { + keys = keys_values_buf; + } + else { + keys = (void * *)malloc(sizeof(*keys) * count * 2); + } + values = keys + count; + CFDictionaryGetKeysAndValues(S_service_state_dict, + (const void * *)keys, + (const void * *)values); - if (CFEqual(proto_key, kSCEntNetIPv4)) { - elect.router_check = check_ipv4_router; + info.n_services = count; + info.order = order; + info.n_order = n_order; + for (i = 0; i < count; i++) { + boolean_t found_new_primary = FALSE; + + info.serviceID = (CFStringRef)keys[i]; + info.service_dict = (CFDictionaryRef)values[i]; + info.service_rank = kRankLast; + info.choose_last = FALSE; + + if ((*elect_func)(context, &info) == FALSE) { + continue; + } + if (new_primary == NULL) { + found_new_primary = TRUE; + } + else if (info.choose_last == new_primary_choose_last) { + found_new_primary = (info.service_rank < new_primary_rank); + } + else if (new_primary_choose_last) { + found_new_primary = TRUE; + } + if (found_new_primary) { + new_primary = info.serviceID; + new_primary_rank = info.service_rank; + new_primary_choose_last = info.choose_last; + } } - else if (CFEqual(proto_key, kSCEntNetIPv6)) { - elect.router_check = check_ipv6_router; + if (new_primary != NULL) { + CFRetain(new_primary); } - else { - return (NULL); + if (keys != keys_values_buf) { + free(keys); } - elect.order = order; - elect.new_primary = NULL; - elect.new_primary_index = 0; - elect.new_has_router = FALSE; - elect.proto_key = proto_key; - elect.router_key = router_key; - CFDictionaryApplyFunction(S_service_state_dict, elect_protocol, &elect); - return (elect.new_primary); + return (new_primary); } static uint32_t @@ -1862,13 +3384,23 @@ service_changed(CFDictionaryRef services_info, CFStringRef serviceID) uint32_t changed = 0; int i; + /* update service options first (e.g. rank) */ + if (get_rank_changes(serviceID, + get_service_state_entity(services_info, serviceID, + NULL), + get_service_setup_entity(services_info, serviceID, + NULL), + services_info)) { + changed |= (1 << kEntityTypeServiceOptions); + } + /* update IPv4, IPv6, DNS, Proxies, SMB, ... */ for (i = 0; i < ENTITY_TYPES_COUNT; i++) { GetEntityChangesFuncRef func = entityChangeFunc[i]; if ((*func)(serviceID, get_service_state_entity(services_info, serviceID, - entityTypeNames[i]), + *entityTypeNames[i]), get_service_setup_entity(services_info, serviceID, - entityTypeNames[i]), + *entityTypeNames[i]), services_info)) { changed |= (1 << i); } @@ -1915,38 +3447,43 @@ set_new_primary(CFStringRef * primary_p, CFStringRef new_primary, if (new_primary != NULL) { if (primary != NULL && CFEqual(new_primary, primary)) { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: %@ is still primary %s"), - new_primary, entity); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: %@ is still primary %s"), + new_primary, entity); + } } else { my_CFRelease(primary_p); *primary_p = CFRetain(new_primary); - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: %@ is the new primary %s"), - new_primary, entity); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: %@ is the new primary %s"), + new_primary, entity); + } changed = TRUE; } } else if (primary != NULL) { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: %@ is no longer primary %s"), primary, entity); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: %@ is no longer primary %s"), + primary, entity); + } my_CFRelease(primary_p); changed = TRUE; } return (changed); } -static unsigned int -rank_service_entity(CFArrayRef order, CFStringRef primary, - CFStringRef proto_key, CFStringRef entity) +static Rank +rank_service_entity(CFDictionaryRef rank_dict, CFStringRef serviceID, + CFStringRef entity) { - CFDictionaryRef dict; - dict = service_dict_get(primary, entity); - if (dict == NULL) { - return (UINT_MAX); + if (service_dict_get(serviceID, entity) == NULL) { + return (kRankLast); } - return (get_service_rank(proto_key, order, primary)); + return (rank_dict_get_service_rank(rank_dict, serviceID)); } static void @@ -1957,9 +3494,10 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, boolean_t dnsinfo_changed = FALSE; boolean_t global_ipv4_changed = FALSE; boolean_t global_ipv6_changed = FALSE; - keyChangeList keys; int i; + keyChangeList keys; CFIndex n; + int n_service_order = 0; CFArrayRef service_order; CFMutableArrayRef service_changes = NULL; CFDictionaryRef services_info = NULL; @@ -1969,8 +3507,10 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, return; } - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: changes %@ (%d)"), changed_keys, count); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: changes %@ (%d)"), changed_keys, count); + } keyChangeListInit(&keys); service_changes = CFArrayCreateMutable(NULL, 0, @@ -1986,14 +3526,24 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, my_CFArrayAppendUniqueValue(service_changes, S_primary_proxies); } } +#if !TARGET_OS_IPHONE else if (CFEqual(change, S_setup_global_smb)) { if (S_primary_smb != NULL) { my_CFArrayAppendUniqueValue(service_changes, S_primary_smb); } } +#endif /* !TARGET_OS_IPHONE */ + else if (CFEqual(change, S_multicast_resolvers)) { + dnsinfo_changed = TRUE; + } else if (CFEqual(change, S_private_resolvers)) { dnsinfo_changed = TRUE; } +#if !TARGET_OS_IPHONE + else if (CFEqual(change, CFSTR(_PATH_RESOLVER_DIR))) { + dnsinfo_changed = TRUE; + } +#endif /* !TARGET_OS_IPHONE */ else if (CFStringHasPrefix(change, S_state_service_prefix)) { CFStringRef serviceID = parse_component(change, S_state_service_prefix); @@ -2016,8 +3566,11 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, services_info = services_info_copy(session, service_changes); service_order = service_order_get(services_info); if (service_order != NULL) { - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: service_order %@ "), service_order); + n_service_order = CFArrayGetCount(service_order); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: service_order %@ "), service_order); + } } n = CFArrayGetCount(service_changes); for (i = 0; i < n; i++) { @@ -2028,10 +3581,14 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, serviceID = CFArrayGetValueAtIndex(service_changes, i); wasSupplemental = dns_has_supplemental(serviceID); changes = service_changed(services_info, serviceID); - - if (S_primary_ipv4 != NULL && CFEqual(S_primary_ipv4, serviceID)) { + if ((changes & (1 << kEntityTypeServiceOptions)) != 0) { + /* if __Service__ (e.g. PrimaryRank) changed */ + global_ipv4_changed = TRUE; + } + else if (S_primary_ipv4 != NULL && CFEqual(S_primary_ipv4, serviceID)) { + // if we are looking at the primary [IPv4] service if ((changes & (1 << kEntityTypeIPv4)) != 0) { - update_ipv4(services_info, serviceID, &keys); + // and something changed for THIS service global_ipv4_changed = TRUE; } } @@ -2039,9 +3596,11 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, global_ipv4_changed = TRUE; } if ((changes & (1 << kEntityTypeIPv6)) != 0) { + // if we are looking at the primary [IPv6] service if (S_primary_ipv6 != NULL && CFEqual(S_primary_ipv6, serviceID)) { update_ipv6(services_info, serviceID, &keys); } + // and something changed for THIS service global_ipv6_changed = TRUE; } if ((changes & (1 << kEntityTypeDNS)) != 0) { @@ -2058,87 +3617,96 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, update_proxies(services_info, serviceID, &keys); } } +#if !TARGET_OS_IPHONE if ((changes & (1 << kEntityTypeSMB)) != 0) { if (S_primary_smb != NULL && CFEqual(S_primary_smb, serviceID)) { update_smb(services_info, serviceID, &keys); } } +#endif /* !TARGET_OS_IPHONE */ } if (global_ipv4_changed) { - CFStringRef new_primary; + IPv4RouteListRef new_routelist = NULL; + CFStringRef new_primary; - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: IPv4 service election")); - new_primary = elect_new_primary(service_order, - kSCEntNetIPv4, kSCPropNetIPv4Router); - if (set_new_primary(&S_primary_ipv4, new_primary, "IPv4")) { - update_ipv4(services_info, S_primary_ipv4, &keys); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: IPv4 service election")); } + new_primary = elect_new_primary(&elect_ipv4, &new_routelist, + service_order, n_service_order); + (void)set_new_primary(&S_primary_ipv4, new_primary, "IPv4"); + update_ipv4(S_primary_ipv4, new_routelist, &keys); my_CFRelease(&new_primary); } if (global_ipv6_changed) { CFStringRef new_primary; - SCLog(S_IPMonitor_debug, LOG_INFO, - CFSTR("IPMonitor: IPv6 service election")); - new_primary = elect_new_primary(service_order, - kSCEntNetIPv6, kSCPropNetIPv6Router); + if ((S_IPMonitor_debug & kDebugFlag1) != 0) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("IPMonitor: IPv6 service election")); + } + new_primary = elect_new_primary(&elect_ipv6, NULL, + service_order, n_service_order); if (set_new_primary(&S_primary_ipv6, new_primary, "IPv6")) { update_ipv6(services_info, S_primary_ipv6, &keys); } my_CFRelease(&new_primary); } if (global_ipv4_changed || global_ipv6_changed) { - CFStringRef new_primary_dns; - CFStringRef new_primary_proxies; - CFStringRef new_primary_smb; + CFStringRef new_primary_dns = NULL; + CFStringRef new_primary_proxies = NULL; +#if !TARGET_OS_IPHONE + CFStringRef new_primary_smb = NULL; +#endif /* !TARGET_OS_IPHONE */ if (S_primary_ipv4 != NULL && S_primary_ipv6 != NULL) { /* decide between IPv4 and IPv6 */ - if (rank_service_entity(service_order, S_primary_ipv4, - kSCEntNetIPv4, kSCEntNetDNS) - <= rank_service_entity(service_order, S_primary_ipv6, - kSCEntNetIPv6, kSCEntNetDNS)) { + if (rank_service_entity(S_ipv4_service_rank_dict, + S_primary_ipv4, kSCEntNetDNS) + <= rank_service_entity(S_ipv6_service_rank_dict, + S_primary_ipv6, kSCEntNetDNS)) { new_primary_dns = S_primary_ipv4; } else { new_primary_dns = S_primary_ipv6; } - if (rank_service_entity(service_order, S_primary_ipv4, - kSCEntNetIPv4, kSCEntNetProxies) - <= rank_service_entity(service_order, S_primary_ipv6, - kSCEntNetIPv6, kSCEntNetProxies)) { + if (rank_service_entity(S_ipv4_service_rank_dict, + S_primary_ipv4, kSCEntNetProxies) + <= rank_service_entity(S_ipv6_service_rank_dict, + S_primary_ipv6, kSCEntNetProxies)) { new_primary_proxies = S_primary_ipv4; } else { new_primary_proxies = S_primary_ipv6; } - if (rank_service_entity(service_order, S_primary_ipv4, - kSCEntNetIPv4, kSCEntNetSMB) - <= rank_service_entity(service_order, S_primary_ipv6, - kSCEntNetIPv6, kSCEntNetSMB)) { +#if !TARGET_OS_IPHONE + if (rank_service_entity(S_ipv4_service_rank_dict, + S_primary_ipv4, kSCEntNetSMB) + <= rank_service_entity(S_ipv6_service_rank_dict, + S_primary_ipv6, kSCEntNetSMB)) { new_primary_smb = S_primary_ipv4; } else { new_primary_smb = S_primary_ipv6; } +#endif /* !TARGET_OS_IPHONE */ } else if (S_primary_ipv6 != NULL) { new_primary_dns = S_primary_ipv6; new_primary_proxies = S_primary_ipv6; +#if !TARGET_OS_IPHONE new_primary_smb = S_primary_ipv6; +#endif /* !TARGET_OS_IPHONE */ } else if (S_primary_ipv4 != NULL) { new_primary_dns = S_primary_ipv4; new_primary_proxies = S_primary_ipv4; +#if !TARGET_OS_IPHONE new_primary_smb = S_primary_ipv4; - } - else { - new_primary_dns = NULL; - new_primary_proxies = NULL; - new_primary_smb = NULL; +#endif /* !TARGET_OS_IPHONE */ } if (set_new_primary(&S_primary_dns, new_primary_dns, "DNS")) { @@ -2148,9 +3716,11 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, if (set_new_primary(&S_primary_proxies, new_primary_proxies, "Proxies")) { update_proxies(services_info, S_primary_proxies, &keys); } +#if !TARGET_OS_IPHONE if (set_new_primary(&S_primary_smb, new_primary_smb, "SMB")) { update_smb(services_info, S_primary_smb, &keys); } +#endif /* !TARGET_OS_IPHONE */ } if (dnsinfo_changed) { update_dnsinfo(services_info, S_primary_dns, &keys, service_order); @@ -2162,34 +3732,26 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys, return; } -static void -initEntityNames(void) -{ - entityTypeNames[0] = kSCEntNetIPv4; /* 0 */ - entityTypeNames[1] = kSCEntNetIPv6; /* 1 */ - entityTypeNames[2] = kSCEntNetDNS; /* 2 */ - entityTypeNames[3] = kSCEntNetProxies; /* 3 */ - entityTypeNames[4] = kSCEntNetSMB; /* 4 */ - return; -} - static void ip_plugin_init() { - int i; - CFStringRef key; CFMutableArrayRef keys = NULL; CFMutableArrayRef patterns = NULL; CFRunLoopSourceRef rls = NULL; - SCDynamicStoreRef session = NULL; - initEntityNames(); - if (S_netboot_root() != 0) { + if (S_is_network_boot() != 0) { S_netboot = TRUE; } - session = SCDynamicStoreCreate(NULL, CFSTR("IPMonitor"), + +#ifdef RTF_IFSCOPE + if (S_is_scoped_routing_enabled() != 0) { + S_scopedroute = TRUE; + } +#endif /* RTF_IFSCOPE */ + + S_session = SCDynamicStoreCreate(NULL, CFSTR("IPMonitor"), IPMonitorNotify, NULL); - if (session == NULL) { + if (S_session == NULL) { SCLog(TRUE, LOG_ERR, CFSTR("IPMonitor ip_plugin_init SCDynamicStoreCreate failed: %s"), SCErrorString(SCError())); @@ -2211,10 +3773,12 @@ ip_plugin_init() = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetProxies); +#if !TARGET_OS_IPHONE S_state_global_smb = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetSMB); +#endif /* !TARGET_OS_IPHONE */ S_setup_global_ipv4 = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainSetup, @@ -2223,10 +3787,12 @@ ip_plugin_init() = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainSetup, kSCEntNetProxies); +#if !TARGET_OS_IPHONE S_setup_global_smb = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainSetup, kSCEntNetSMB); +#endif /* !TARGET_OS_IPHONE */ S_state_service_prefix = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@/"), kSCDynamicStoreDomainState, @@ -2242,34 +3808,40 @@ ip_plugin_init() &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + S_ipv4_service_rank_dict + = CFDictionaryCreateMutable(NULL, 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + S_ipv6_service_rank_dict + = CFDictionaryCreateMutable(NULL, 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); /* register for State: and Setup: per-service notifications */ - for (i = 0; i < ENTITY_TYPES_COUNT; i++) { - key = state_service_key(kSCCompAnyRegex, entityTypeNames[i]); - CFArrayAppendValue(patterns, key); - CFRelease(key); - key = setup_service_key(kSCCompAnyRegex, entityTypeNames[i]); - CFArrayAppendValue(patterns, key); - CFRelease(key); - } + add_service_keys(kSCCompAnyRegex, keys, patterns); /* add notifier for ServiceOrder/PPPOverridePrimary changes for IPv4 */ - key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, - kSCDynamicStoreDomainSetup, - kSCEntNetIPv4); - CFArrayAppendValue(keys, key); - CFRelease(key); + CFArrayAppendValue(keys, S_setup_global_ipv4); - /* add notifier for Private DNS configuration */ + /* add notifier for multicast DNS configuration (Bonjour/.local) */ + S_multicast_resolvers = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"), + kSCDynamicStoreDomainState, + kSCCompNetwork, + CFSTR(kDNSServiceCompMulticastDNS)); + CFArrayAppendValue(keys, S_multicast_resolvers); + + /* add notifier for private DNS configuration (Back to My Mac) */ S_private_resolvers = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"), kSCDynamicStoreDomainState, kSCCompNetwork, CFSTR(kDNSServiceCompPrivateDNS)); CFArrayAppendValue(keys, S_private_resolvers); - if (!SCDynamicStoreSetNotificationKeys(session, keys, patterns)) { + if (!SCDynamicStoreSetNotificationKeys(S_session, keys, patterns)) { SCLog(TRUE, LOG_ERR, CFSTR("IPMonitor ip_plugin_init " "SCDynamicStoreSetNotificationKeys failed: %s"), @@ -2277,7 +3849,7 @@ ip_plugin_init() goto done; } - rls = SCDynamicStoreCreateRunLoopSource(NULL, session, 0); + rls = SCDynamicStoreCreateRunLoopSource(NULL, S_session, 0); if (rls == NULL) { SCLog(TRUE, LOG_ERR, CFSTR("IPMonitor ip_plugin_init " @@ -2290,17 +3862,20 @@ ip_plugin_init() CFRelease(rls); /* initialize dns configuration */ - dns_configuration_set(NULL, NULL, NULL, NULL); + dns_configuration_set(NULL, NULL, NULL, NULL, NULL); +#if !TARGET_OS_IPHONE empty_dns(); - (void)SCDynamicStoreRemoveValue(session, S_state_global_dns); +#endif /* !TARGET_OS_IPHONE */ + (void)SCDynamicStoreRemoveValue(S_session, S_state_global_dns); +#if !TARGET_OS_IPHONE /* initialize SMB configuration */ - (void)SCDynamicStoreRemoveValue(session, S_state_global_smb); + (void)SCDynamicStoreRemoveValue(S_session, S_state_global_smb); +#endif /* !TARGET_OS_IPHONE */ done: my_CFRelease(&keys); my_CFRelease(&patterns); - my_CFRelease(&session); return; } @@ -2309,29 +3884,60 @@ void prime_IPMonitor() { /* initialize multicast route */ - set_ipv4_router(NULL, NULL, NULL, FALSE); + update_ipv4(NULL, NULL, NULL); + return; +} + +static boolean_t +S_get_plist_boolean(CFDictionaryRef plist, CFStringRef key, + boolean_t def) +{ + CFBooleanRef b; + boolean_t ret = def; + + b = isA_CFBoolean(CFDictionaryGetValue(plist, key)); + if (b != NULL) { + ret = CFBooleanGetValue(b); + } + return (ret); } __private_extern__ void load_IPMonitor(CFBundleRef bundle, Boolean bundleVerbose) { + CFDictionaryRef info_dict; + + info_dict = CFBundleGetInfoDictionary(bundle); + if (info_dict != NULL) { + S_append_state + = S_get_plist_boolean(info_dict, + CFSTR("AppendStateArrayToSetupArray"), + FALSE); + } if (bundleVerbose) { - S_IPMonitor_debug = 1; + S_IPMonitor_debug = kDebugFlagDefault; } dns_configuration_init(bundle); ip_plugin_init(); - load_hostname(S_IPMonitor_debug); - load_smb_configuration(S_IPMonitor_debug); +#if !TARGET_OS_IPHONE + if (S_session != NULL) { + dns_configuration_monitor(S_session, IPMonitorNotify); + } +#endif /* !TARGET_OS_IPHONE */ + + load_hostname((S_IPMonitor_debug & kDebugFlag1) != 0); +#if !TARGET_OS_IPHONE + load_smb_configuration((S_IPMonitor_debug & kDebugFlag1) != 0); +#endif /* !TARGET_OS_IPHONE */ return; } -#ifdef MAIN -#undef MAIN +#ifdef TEST_IPMONITOR #include "dns-configuration.c" #include "set-hostname.c" @@ -2339,14 +3945,607 @@ int main(int argc, char **argv) { _sc_log = FALSE; - _sc_verbose = (argc > 1) ? TRUE : FALSE; - load_IPMonitor(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE); + S_IPMonitor_debug = kDebugFlag1; + if (argc > 1) { + S_IPMonitor_debug = strtoul(argv[1], NULL, 0); + } + + load_IPMonitor(CFBundleGetMainBundle(), FALSE); prime_IPMonitor(); CFRunLoopRun(); /* not reached */ exit(0); return 0; } -#endif +#endif /* TEST_IPMONITOR */ + +#ifdef TEST_IPV4_ROUTELIST +#include "dns-configuration.c" +#include "set-hostname.c" + +struct ipv4_service_contents { + const char * addr; + const char * mask; + const char * dest; + const char * router; + const char * ifname; + Rank rank; + const CFStringRef *primaryRank; +}; + +/* + * addr mask dest router ifname pri primaryRank + */ +struct ipv4_service_contents en0_10 = { + "10.0.0.10", "255.255.255.0", NULL, "10.0.0.1", "en0", 10, NULL +}; + +struct ipv4_service_contents en0_15 = { + "10.0.0.19", "255.255.255.0", NULL, "10.0.0.1", "en0", 15, NULL +}; + +struct ipv4_service_contents en0_30 = { + "10.0.0.11", "255.255.255.0", NULL, "10.0.0.1", "en0", 30, NULL +}; + +struct ipv4_service_contents en0_40 = { + "10.0.0.12", "255.255.255.0", NULL, "10.0.0.1", "en0", 40, NULL +}; + +struct ipv4_service_contents en0_50 = { + "10.0.0.13", "255.255.255.0", NULL, "10.0.0.1", "en0", 50, NULL +}; + +struct ipv4_service_contents en0_110 = { + "192.168.2.10", "255.255.255.0", NULL, "192.168.2.1", "en0", 110, NULL +}; + +struct ipv4_service_contents en0_1 = { + "17.202.40.191", "255.255.252.0", NULL, "17.202.20.1", "en0", 1, NULL +}; + +struct ipv4_service_contents en1_20 = { + "10.0.0.20", "255.255.255.0", NULL, "10.0.0.1", "en1", 20, NULL +}; + +struct ipv4_service_contents en1_2 = { + "17.202.42.24", "255.255.252.0", NULL, "17.202.20.1", "en1", 2, NULL +}; + +struct ipv4_service_contents en1_125 = { + "192.168.2.20", "255.255.255.0", NULL, "192.168.2.1", "en1", 125, NULL +}; + +struct ipv4_service_contents fw0_25 = { + "192.168.2.30", "255.255.255.0", NULL, "192.168.2.1", "fw0", 25, NULL +}; + +struct ipv4_service_contents fw0_21 = { + "192.168.3.30", "255.255.255.0", NULL, "192.168.3.1", "fw0", 21, NULL +}; + +struct ipv4_service_contents ppp0_0_1 = { + "17.219.156.22", NULL, "17.219.156.1", "17.219.156.1", "ppp0", 0, NULL +}; + +struct ipv4_service_contents en0_test6 = { + "17.202.42.113", "255.255.252.0", NULL, "17.202.40.1", "en0", 2, NULL +}; +struct ipv4_service_contents en1_test6 = { + "17.202.42.111", "255.255.252.0", NULL, "17.202.40.1", "en1", 3, NULL +}; +struct ipv4_service_contents en2_test6 = { + "17.255.98.164", "255.255.240.0", NULL, "17.255.96.1", "en2", 1, NULL +}; + +struct ipv4_service_contents en0_test7 = { + "17.202.42.113", "255.255.252.0", NULL, "17.202.40.1", "en0", 3, NULL +}; +struct ipv4_service_contents en1_test7 = { + "17.202.42.111", "255.255.252.0", NULL, "17.202.40.1", "en1", 2, NULL +}; +struct ipv4_service_contents en2_test7 = { + "17.255.98.164", "255.255.240.0", NULL, "17.255.96.1", "en2", 1, NULL +}; +struct ipv4_service_contents fw0_test6_and_7 = { + "169.254.11.33", "255.255.0.0", NULL, NULL, "fw0", UINT_MAX, NULL +}; + +struct ipv4_service_contents en0_10_last = { + "10.0.0.10", "255.255.255.0", NULL, "10.0.0.1", "en0", 10, &kSCValNetServicePrimaryRankLast +}; + +struct ipv4_service_contents en0_10_never = { + "10.0.0.10", "255.255.255.0", NULL, "10.0.0.1", "en0", 10, &kSCValNetServicePrimaryRankNever +}; + +struct ipv4_service_contents en1_20_first = { + "10.0.0.20", "255.255.255.0", NULL, "10.0.0.1", "en1", 20, &kSCValNetServicePrimaryRankFirst +}; + +struct ipv4_service_contents en1_20_never = { + "10.0.0.20", "255.255.255.0", NULL, "10.0.0.1", "en1", 20, &kSCValNetServicePrimaryRankNever +}; + +struct ipv4_service_contents * test1[] = { + &en0_40, + &en0_15, + &fw0_25, + &en0_30, + &en1_20, + &en0_50, + &en0_10, + NULL +}; + +struct ipv4_service_contents * test2[] = { + &en0_40, + &fw0_25, + &en0_30, + &en1_20, + &en0_50, + &en0_10, + NULL +}; + +struct ipv4_service_contents * test3[] = { + &en0_40, + &en1_20, + &en0_50, + &en0_10, + &en0_110, + &en1_125, + &fw0_25, + &fw0_21, + &en0_40, + &en0_30, + NULL +}; + +struct ipv4_service_contents * test4[] = { + &en0_1, + &en0_40, + &en0_30, + &en1_20, + &en1_2, + NULL +}; + +struct ipv4_service_contents * test5[] = { + &ppp0_0_1, + &en0_1, + &en0_40, + &en0_30, + &en1_20, + &en1_2, + NULL +}; + +struct ipv4_service_contents * test6[] = { + &en0_test6, + &en1_test6, + &en2_test6, + &fw0_test6_and_7, + NULL +}; + +struct ipv4_service_contents * test7[] = { + &en0_test7, + &en1_test7, + &en2_test7, + &fw0_test6_and_7, + NULL +}; + +struct ipv4_service_contents * test8[] = { + &en0_10, + &en1_20, + NULL +}; + +struct ipv4_service_contents * test9[] = { + &en0_10, + &en1_20_first, + &fw0_25, + NULL +}; + +struct ipv4_service_contents * test10[] = { + &en0_10_last, + &en1_20, + &fw0_25, + NULL +}; + +struct ipv4_service_contents * test11[] = { + &en0_10_never, + &en1_20, + &fw0_25, + NULL +}; + +struct ipv4_service_contents * test12[] = { + &en0_10, + &en1_20, + NULL +}; + +struct ipv4_service_contents * test13[] = { + &en0_10, + &en1_20_never, + NULL +}; + +struct ipv4_service_contents * test14[] = { + &en1_20_never, + NULL +}; + +static void +dict_add_string(CFMutableDictionaryRef dict, CFStringRef prop_name, + const char * str) +{ + CFStringRef prop_val; + + if (str == NULL) { + return; + } + prop_val = CFStringCreateWithCString(NULL, + str, + kCFStringEncodingASCII); + CFDictionarySetValue(dict, prop_name, prop_val); + CFRelease(prop_val); + return; +} + +static void +dict_add_string_as_array(CFMutableDictionaryRef dict, CFStringRef prop_name, + const char * str) +{ + CFArrayRef array; + CFStringRef prop_val; + + if (str == NULL) { + return; + } + prop_val = CFStringCreateWithCString(NULL, + str, + kCFStringEncodingASCII); + array = CFArrayCreate(NULL, + (const void **)&prop_val, 1, + &kCFTypeArrayCallBacks); + CFRelease(prop_val); + CFDictionarySetValue(dict, prop_name, array); + CFRelease(array); + return; +} + +static CFDictionaryRef +make_IPv4_dict(struct ipv4_service_contents * t) +{ + CFMutableDictionaryRef dict; + + dict = CFDictionaryCreateMutable(NULL, 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + dict_add_string_as_array(dict, kSCPropNetIPv4Addresses, t->addr); + dict_add_string_as_array(dict, kSCPropNetIPv4SubnetMasks, t->mask); + dict_add_string_as_array(dict, kSCPropNetIPv4DestAddresses, t->dest); + dict_add_string(dict, kSCPropNetIPv4Router, t->router); + dict_add_string(dict, kSCPropInterfaceName, t->ifname); + return (dict); +} + +static IPv4RouteListRef +make_IPv4RouteList(struct ipv4_service_contents * * this_test) +{ + IPv4RouteListRef r; + IPv4RouteListRef routes; + char routes_buf[IPv4RouteListComputeSize(R_STATIC)]; + IPv4RouteListRef ret = NULL; + struct ipv4_service_contents * * scan_test; + + for (scan_test = this_test; *scan_test != NULL; scan_test++) { + CFDictionaryRef dict; + + dict = make_IPv4_dict(*scan_test); + if (dict == NULL) { + fprintf(stderr, "make_IPv4_dict failed\n"); + exit(1); + } + routes = (IPv4RouteListRef)routes_buf; + routes->size = R_STATIC; + routes->count = 0; + r = IPv4RouteListCreateWithDictionary(routes, dict, + (*scan_test)->primaryRank ? *(*scan_test)->primaryRank : NULL); + if (r == NULL) { + fprintf(stderr, "IPv4RouteListCreateWithDictionary failed\n"); + exit(1); + } + ret = IPv4RouteListAddRouteList(ret, 1, r, (*scan_test)->rank); + if (r != routes) { + free(r); + } + CFRelease(dict); + } + return (ret); +} + +/* + * Function: run_test + * Purpose: + * Runs through the given set of routes first in the forward direction, + * then again backwards. We should end up with exactly the same set of + * routes at the end. + */ +static boolean_t +run_test(const char * name, struct ipv4_service_contents * * this_test) +{ + CFStringRef descr; + boolean_t ret = FALSE; + IPv4RouteListRef r; + IPv4RouteListRef routes; + char routes_buf[IPv4RouteListComputeSize(R_STATIC)]; + IPv4RouteListRef routes1 = NULL, routes2 = NULL; + struct ipv4_service_contents * * scan_test; + + printf("\nStarting test %s\n", name); + for (scan_test = this_test; *scan_test != NULL; scan_test++) { + CFDictionaryRef dict; + + dict = make_IPv4_dict(*scan_test); + if (dict == NULL) { + fprintf(stderr, "make_IPv4_dict failed\n"); + exit(1); + } + routes = (IPv4RouteListRef)routes_buf; + routes->size = R_STATIC; + routes->count = 0; + r = IPv4RouteListCreateWithDictionary(routes, dict, + (*scan_test)->primaryRank ? *(*scan_test)->primaryRank : NULL); + if (r == NULL) { + fprintf(stderr, "IPv4RouteListCreateWithDictionary failed\n"); + exit(1); + } + if ((S_IPMonitor_debug & kDebugFlag4) != 0) { + descr = IPv4RouteListCopyDescription(r); + SCLog(TRUE, LOG_NOTICE, CFSTR("test: Adding %@"), descr); + CFRelease(descr); + } + + routes1 = IPv4RouteListAddRouteList(routes1, 1, r, (*scan_test)->rank); + if (r != routes) { + free(r); + } + CFRelease(dict); + } + if ((S_IPMonitor_debug & kDebugFlag4) != 0) { + if (routes1 != NULL) { + descr = IPv4RouteListCopyDescription(routes1); + SCLog(TRUE, LOG_NOTICE, CFSTR("Routes are %@"), descr); + CFRelease(descr); + } + } + for (scan_test--; scan_test >= this_test; scan_test--) { + CFDictionaryRef dict; + + dict = make_IPv4_dict(*scan_test); + if (dict == NULL) { + fprintf(stderr, "make_IPv4_dict failed\n"); + exit(1); + } + routes = (IPv4RouteListRef)routes_buf; + routes->size = R_STATIC; + routes->count = 0; + r = IPv4RouteListCreateWithDictionary(routes, dict, + (*scan_test)->primaryRank ? *(*scan_test)->primaryRank : NULL); + if (r == NULL) { + fprintf(stderr, "IPv4RouteListCreateWithDictionary failed\n"); + exit(1); + } + if ((S_IPMonitor_debug & kDebugFlag4) != 0) { + descr = IPv4RouteListCopyDescription(r); + SCLog(TRUE, LOG_NOTICE, CFSTR("test: Adding %@"), descr); + CFRelease(descr); + } + routes2 = IPv4RouteListAddRouteList(routes2, 1, r, (*scan_test)->rank); + if (r != routes) { + free(r); + } + CFRelease(dict); + } + if ((S_IPMonitor_debug & kDebugFlag4) != 0) { + if (routes2 != NULL) { + descr = IPv4RouteListCopyDescription(routes2); + SCLog(TRUE, LOG_NOTICE, CFSTR("Routes are %@"), descr); + CFRelease(descr); + } + } + if ((routes1 != NULL && routes2 == NULL) + || (routes1 == NULL && routes2 != NULL)) { + fprintf(stderr, "routes1 is %sNULL but routes2 is %sNULL\n", + (routes1 != NULL) ? "not " : "", + (routes2 != NULL) ? "not " : ""); + } + else if (routes1 != NULL && routes2 != NULL) { + /* check if they are different */ + if (routes1->count != routes2->count) { + fprintf(stderr, "routes1 count %d != routes 2 count %d\n", + routes1->count, routes2->count); + } + else if (bcmp(routes1, routes2, + IPv4RouteListComputeSize(routes1->count)) != 0) { + fprintf(stderr, "routes1 and routes2 are different\n"); + } + else { + printf("routes1 and routes2 are the same\n"); + ret = TRUE; + } + } + if (routes1 != NULL) { + free(routes1); + } + if (routes2 != NULL) { + free(routes2); + } + return (ret); +} + +typedef struct compare_context { + IPv4RouteListRef old; + IPv4RouteListRef new; +} compare_context_t; + +static void +compare_callback(IPv4RouteListApplyCommand cmd, IPv4RouteRef route, void * arg) +{ + compare_context_t * context = (compare_context_t *)arg; + + switch (cmd) { + case kIPv4RouteListAddRouteCommand: + printf("Add new[%d] = ", route - context->new->list); + IPv4RoutePrint(route); + printf("\n"); + break; + case kIPv4RouteListRemoveRouteCommand: + printf("Remove old[%d] = ", route - context->old->list); + IPv4RoutePrint(route); + printf("\n"); + break; + default: + break; + } + return; +} + +static void +compare_tests(struct ipv4_service_contents * * old_test, + struct ipv4_service_contents * * new_test) +{ + IPv4RouteListRef new_routes; + IPv4RouteListRef old_routes; + compare_context_t context; + + old_routes = make_IPv4RouteList(old_test); + new_routes = make_IPv4RouteList(new_test); + + if (old_routes == NULL) { + printf("No Old Routes\n"); + } + else { + printf("Old Routes = "); + IPv4RouteListPrint(old_routes); + } + if (new_routes == NULL) { + printf("No New Routes\n"); + } + else { + printf("New Routes = "); + IPv4RouteListPrint(new_routes); + } + context.old = old_routes; + context.new = new_routes; + IPv4RouteListApply(old_routes, new_routes, compare_callback, &context); + if (old_routes != NULL) { + free(old_routes); + } + if (new_routes != NULL) { + free(new_routes); + } + + return; +} + +int +main(int argc, char **argv) +{ + _sc_log = FALSE; + _sc_verbose = (argc > 1) ? TRUE : FALSE; + + S_IPMonitor_debug = kDebugFlag1 | kDebugFlag2 | kDebugFlag4; + if (argc > 1) { + S_IPMonitor_debug = strtoul(argv[1], NULL, 0); + } + + if (run_test("test1", test1) == FALSE) { + fprintf(stderr, "test1 failed\n"); + exit(1); + } + if (run_test("test2", test2) == FALSE) { + fprintf(stderr, "test2 failed\n"); + exit(1); + } + if (run_test("test3", test4) == FALSE) { + fprintf(stderr, "test3 failed\n"); + exit(1); + } + if (run_test("test4", test4) == FALSE) { + fprintf(stderr, "test4 failed\n"); + exit(1); + } + if (run_test("test5", test5) == FALSE) { + fprintf(stderr, "test5 failed\n"); + exit(1); + } + + printf("\nCompare 1 to 2:\n"); + compare_tests(test1, test2); + + printf("\nCompare 2 to 1:\n"); + compare_tests(test2, test1); + + printf("\nCompare 1 to 1:\n"); + compare_tests(test1, test1); + + printf("\nCompare 1 to 3:\n"); + compare_tests(test1, test3); + + printf("\nCompare 3 to 1:\n"); + compare_tests(test3, test1); + + printf("\nCompare 2 to 3:\n"); + compare_tests(test2, test3); + + printf("\nCompare 3 to 2:\n"); + compare_tests(test3, test2); + + printf("\nCompare 3 to 4:\n"); + compare_tests(test3, test4); + + printf("\nCompare 5 to 4:\n"); + compare_tests(test5, test4); + + printf("\nCompare 6 to 7:\n"); + compare_tests(test6, test7); + + printf("\nCompare 7 to 6:\n"); + compare_tests(test7, test6); + + printf("\nCompare 8 to 9:\n"); + compare_tests(test8, test9); + + printf("\nCompare 8 to 10:\n"); + compare_tests(test8, test10); + + printf("\nCompare 8 to 11:\n"); + compare_tests(test8, test11); + + printf("\nCompare 12 to 13:\n"); + compare_tests(test12, test13); + + printf("\nCompare 13 to 14:\n"); + compare_tests(test13, test14); + + printf("\nChecking for leaks\n"); + char cmd[128]; + sprintf(cmd, "leaks %d 2>&1", getpid()); + fflush(stdout); + (void)system(cmd); + + exit(0); + return (0); +} + +#endif /* TEST_IPV4_ROUTELIST */ diff --git a/Plugins/IPMonitor/set-hostname.c b/Plugins/IPMonitor/set-hostname.c index ec381ad..41b0a0c 100644 --- a/Plugins/IPMonitor/set-hostname.c +++ b/Plugins/IPMonitor/set-hostname.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -41,26 +41,16 @@ #include - static SCDynamicStoreRef store = NULL; static CFRunLoopSourceRef rls = NULL; static Boolean dnsActive = FALSE; static CFMachPortRef dnsPort = NULL; -static CFRunLoopSourceRef dnsRLS = NULL; static struct timeval dnsQueryStart; static Boolean _verbose = FALSE; -/* SPI (from SCNetworkReachability.c) */ -Boolean -_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef *storeP, - SCNetworkConnectionFlags *flags, - Boolean *haveDNS, - struct sockaddr *sa); - - #define HOSTNAME_NOTIFY_KEY "com.apple.system.hostname" @@ -421,29 +411,6 @@ reverseDNSComplete(int32_t status, char *host, char *serv, void *context) } -static void -getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info) -{ - int32_t status; - - status = getnameinfo_async_handle_reply(msg); - if ((status == 0) && dnsActive) { - // if request has been re-queued - return; - } - - if (port == dnsPort) { - CFRunLoopSourceInvalidate(dnsRLS); - CFRelease(dnsRLS); - dnsRLS = NULL; - CFRelease(dnsPort); - dnsPort = NULL; - } - - return; -} - - static CFStringRef replyMPCopyDescription(const void *info) { @@ -456,11 +423,58 @@ replyMPCopyDescription(const void *info) } +static void +getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info) +{ + mach_port_t mp = MACH_PORT_NULL; + int32_t status; + + if (port != dnsPort) { + // we've received a callback on the async DNS port but since the + // associated CFMachPort doesn't match than the request must have + // already been cancelled. + SCLog(TRUE, LOG_ERR, CFSTR("getnameinfo_async_handleCFReply(): port != dnsPort")); + return; + } + + mp = CFMachPortGetPort(port); + CFMachPortInvalidate(dnsPort); + CFRelease(dnsPort); + dnsPort = NULL; + __MACH_PORT_DEBUG(mp != NULL, "*** set-hostname (after unscheduling)", mp); + + status = getnameinfo_async_handle_reply(msg); + __MACH_PORT_DEBUG(mp != NULL, "*** set-hostname (after getnameinfo_async_handle_reply)", mp); + if ((status == 0) && dnsActive && (mp != MACH_PORT_NULL)) { + CFMachPortContext context = { 0 + , (void *)store + , CFRetain + , CFRelease + , replyMPCopyDescription + }; + CFRunLoopSourceRef rls; + + // if request has been re-queued + dnsPort = CFMachPortCreateWithPort(NULL, + mp, + getnameinfo_async_handleCFReply, + &context, + NULL); + rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0); + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + __MACH_PORT_DEBUG(mp != NULL, "*** set-hostname (after rescheduling)", mp); + } + + return; +} + + static void start_dns_query(SCDynamicStoreRef store, CFStringRef address) { char addr[64]; - SCNetworkConnectionFlags flags; + SCNetworkReachabilityFlags flags; Boolean haveDNS; Boolean ok; struct sockaddr *sa; @@ -504,8 +518,8 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address) ok = _SC_checkResolverReachabilityByAddress(&store, &flags, &haveDNS, sa); if (ok) { - if (!(flags & kSCNetworkFlagsReachable) || - (flags & kSCNetworkFlagsConnectionRequired)) { + if (!(flags & kSCNetworkReachabilityFlagsReachable) || + (flags & kSCNetworkReachabilityFlagsConnectionRequired)) { // if not reachable *OR* connection required ok = FALSE; } @@ -518,12 +532,13 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address) , CFRelease , replyMPCopyDescription }; - mach_port_t port; int32_t error; + mach_port_t mp; + CFRunLoopSourceRef rls; (void) gettimeofday(&dnsQueryStart, NULL); - error = getnameinfo_async_start(&port, + error = getnameinfo_async_start(&mp, sa, sa->sa_len, NI_NAMEREQD, // flags @@ -532,15 +547,18 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address) if (error != 0) { goto done; } + __MACH_PORT_DEBUG(TRUE, "*** set-hostname (after getnameinfo_async_start)", mp); dnsActive = TRUE; dnsPort = CFMachPortCreateWithPort(NULL, - port, + mp, getnameinfo_async_handleCFReply, &context, NULL); - dnsRLS = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0); - CFRunLoopAddSource(CFRunLoopGetCurrent(), dnsRLS, kCFRunLoopDefaultMode); + rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0); + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + __MACH_PORT_DEBUG(TRUE, "*** set-hostname (after scheduling)", mp); } done : @@ -559,13 +577,14 @@ update_hostname(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info) // if active, cancel any in-progress attempt to resolve the primary IP address if (dnsPort != NULL) { + mach_port_t mp = CFMachPortGetPort(dnsPort); + /* cancel the outstanding DNS query */ - getnameinfo_async_cancel(CFMachPortGetPort(dnsPort)); - CFRunLoopSourceInvalidate(dnsRLS); - CFRelease(dnsRLS); - dnsRLS = NULL; + CFMachPortInvalidate(dnsPort); CFRelease(dnsPort); dnsPort = NULL; + + getnameinfo_async_cancel(mp); } // get static hostname, if available diff --git a/Plugins/IPMonitor/smb-configuration.c b/Plugins/IPMonitor/smb-configuration.c index ef120a0..795dd43 100644 --- a/Plugins/IPMonitor/smb-configuration.c +++ b/Plugins/IPMonitor/smb-configuration.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2006-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -50,23 +51,18 @@ #include #include // for SCLog(), SCPrint() -#define SMB_STARTUP_DELAY 60.0 -#define SMB_DEBOUNCE_DELAY 5.0 +#define HW_MODEL_LEN 64 // Note: must be >= NETBIOS_NAME_LEN (below) -/* SPI (from SCNetworkReachability.c) */ -Boolean -_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef *storeP, - SCNetworkConnectionFlags *flags, - Boolean *haveDNS, - struct sockaddr *sa); +#define NETBIOS_NAME_LEN 16 +#define SMB_STARTUP_DELAY 60.0 +#define SMB_DEBOUNCE_DELAY 5.0 static SCDynamicStoreRef store = NULL; static CFRunLoopSourceRef rls = NULL; static Boolean dnsActive = FALSE; static CFMachPortRef dnsPort = NULL; -static CFRunLoopSourceRef dnsRLS = NULL; static struct timeval dnsQueryStart; static CFRunLoopTimerRef timer = NULL; @@ -74,6 +70,23 @@ static CFRunLoopTimerRef timer = NULL; static Boolean _verbose = FALSE; +static Boolean +isMacOSXServer() +{ + static enum { Unknown, Client, Server } isServer = Unknown; + + if (isServer == Unknown) { + int ret; + struct stat statbuf; + + ret = stat("/System/Library/CoreServices/ServerVersion.plist", &statbuf); + isServer = (ret == 0) ? Server : Client; + } + + return (isServer == Server) ? TRUE : FALSE; +} + + static CFAbsoluteTime boottime(void) { @@ -101,34 +114,102 @@ boottime(void) static CFStringRef copy_default_name(void) { - CFStringRef address; - SCNetworkInterfaceRef interface; - CFMutableStringRef name = NULL; + char *cp; + char hwModel[HW_MODEL_LEN]; + int mib[] = { CTL_HW, HW_MODEL }; + size_t n = sizeof(hwModel); + int ret; + CFMutableStringRef str; + + // get HW model name + bzero(&hwModel, sizeof(hwModel)); + ret = sysctl(mib, sizeof(mib) / sizeof(mib[0]), &hwModel, &n, NULL, 0); + if (ret != 0) { + SCLog(TRUE, LOG_ERR, CFSTR("sysctl() CTL_HW/HW_MODEL failed: %s"), strerror(errno)); + return NULL; + } - interface = _SCNetworkInterfaceCreateWithBSDName(NULL, CFSTR("en0"), - kIncludeNoVirtualInterfaces); - if (interface == NULL) { - goto done; + // truncate name + hwModel[NETBIOS_NAME_LEN - 1] = '\0'; + + // trim everything after (and including) a comma + cp = index(hwModel, ','); + if (cp != NULL) { + *cp = '\0'; } - address = SCNetworkInterfaceGetHardwareAddressString(interface); - if (address == NULL) { - goto done; + // trim any trailing digits + n = strlen(hwModel); + while (n > 0) { + if (!isdigit(hwModel[n - 1])) { + break; + } + hwModel[--n] = '\0'; } - name = CFStringCreateMutableCopy(NULL, 0, address); - CFStringFindAndReplace(name, - CFSTR(":"), - CFSTR(""), - CFRangeMake(0, CFStringGetLength(name)), - 0); - CFStringInsert(name, 0, CFSTR("MAC")); - CFStringUppercase(name, NULL); + // start off with the [trunated] HW model + str = CFStringCreateMutable(NULL, 0); + CFStringAppendFormat(str, NULL, CFSTR("%s"), hwModel); + + // + // if there is room for at least one byte (two hex characters) + // of the MAC address than append that to the NetBIOS name. + // + // NETBIOS_NAME_LEN max length + // -1 the last byte is reserved + // -3 "-XX" + // + if (n < (NETBIOS_NAME_LEN - 1 - 3)) { + SCNetworkInterfaceRef interface; + + interface = _SCNetworkInterfaceCreateWithBSDName(NULL, CFSTR("en0"), + kIncludeNoVirtualInterfaces); + if (interface != NULL) { + CFMutableStringRef en0_MAC; + + en0_MAC = (CFMutableStringRef)SCNetworkInterfaceGetHardwareAddressString(interface); + if (en0_MAC != NULL) { + CFIndex en0_MAC_len; + + // remove ":" characters from MAC address string + en0_MAC = CFStringCreateMutableCopy(NULL, 0, en0_MAC); + CFStringFindAndReplace(en0_MAC, + CFSTR(":"), + CFSTR(""), + CFRangeMake(0, CFStringGetLength(en0_MAC)), + 0); + + // + // compute how may bytes (characters) to append + // ... and limit that number to 6 + // + // NETBIOS_NAME_LEN max length + // -1 the last byte is reserved + // -n "iMac" + // -1 "-" + // + n = ((NETBIOS_NAME_LEN - 1 - n - 1) / 2) * 2; + if (n > 6) { + n = 6; + } - done : + // remove what we don't want + en0_MAC_len = CFStringGetLength(en0_MAC); + if (en0_MAC_len > n) { + CFStringDelete(en0_MAC, CFRangeMake(0, en0_MAC_len - n)); + } + + // append + CFStringAppendFormat(str, NULL, CFSTR("-%@"), en0_MAC); + CFRelease(en0_MAC); + } - if (interface != NULL) CFRelease(interface); - return name; + CFRelease(interface); + } + } + + CFStringUppercase(str, NULL); + return str; } @@ -211,45 +292,47 @@ smb_set_configuration(SCDynamicStoreRef store, CFDictionaryRef dict) goto done; } - // Server description - str = SCDynamicStoreCopyComputerName(store, &macEncoding); - update_pref(prefs, CFSTR(kSMBPrefServerDescription), str, &changed); - - // DOS code page - if (str != NULL) { - if (macEncoding == kCFStringEncodingMacRoman) { - CFStringRef key; - CFDictionaryRef dict; - - // get region - key = SCDynamicStoreKeyCreateComputerName(NULL); - dict = SCDynamicStoreCopyValue(store, key); - CFRelease(key); - if (dict != NULL) { - if (isA_CFDictionary(dict)) { - CFNumberRef num; - SInt32 val; - - num = CFDictionaryGetValue(dict, kSCPropSystemComputerNameRegion); - if (isA_CFNumber(num) && - CFNumberGetValue(num, kCFNumberSInt32Type, &val)) { - macRegion = (uint32_t)val; + if (!isMacOSXServer()) { + // Server description + str = SCDynamicStoreCopyComputerName(store, &macEncoding); + update_pref(prefs, CFSTR(kSMBPrefServerDescription), str, &changed); + + // DOS code page + if (str != NULL) { + if (macEncoding == kCFStringEncodingMacRoman) { + CFStringRef key; + CFDictionaryRef dict; + + // get region + key = SCDynamicStoreKeyCreateComputerName(NULL); + dict = SCDynamicStoreCopyValue(store, key); + CFRelease(key); + if (dict != NULL) { + if (isA_CFDictionary(dict)) { + CFNumberRef num; + SInt32 val; + + num = CFDictionaryGetValue(dict, kSCPropSystemComputerNameRegion); + if (isA_CFNumber(num) && + CFNumberGetValue(num, kCFNumberSInt32Type, &val)) { + macRegion = (uint32_t)val; + } } - } - CFRelease(dict); + CFRelease(dict); + } } - } + CFRelease(str); + } else { + // Important: must have root acccess (eUID==0) to access the config file! + __CFStringGetInstallationEncodingAndRegion((uint32_t *)&macEncoding, &macRegion); + } + _SC_dos_encoding_and_codepage(macEncoding, macRegion, &dosEncoding, &dosCodepage); + str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), dosCodepage); + update_pref(prefs, CFSTR(kSMBPrefDOSCodePage), str, &changed); CFRelease(str); - } else { - // Important: must have root acccess (eUID==0) to access the config file! - __CFStringGetInstallationEncodingAndRegion((uint32_t *)&macEncoding, &macRegion); } - _SC_dos_encoding_and_codepage(macEncoding, macRegion, &dosEncoding, &dosCodepage); - str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), dosCodepage); - update_pref(prefs, CFSTR(kSMBPrefDOSCodePage), str, &changed); - CFRelease(str); // NetBIOS name str = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSName); @@ -502,29 +585,6 @@ reverseDNSComplete(int32_t status, char *host, char *serv, void *context) } -static void -getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info) -{ - int32_t status; - - status = getnameinfo_async_handle_reply(msg); - if ((status == 0) && dnsActive) { - // if request has been re-queued - return; - } - - if (port == dnsPort) { - CFRunLoopSourceInvalidate(dnsRLS); - CFRelease(dnsRLS); - dnsRLS = NULL; - CFRelease(dnsPort); - dnsPort = NULL; - } - - return; -} - - static CFStringRef replyMPCopyDescription(const void *info) { @@ -537,11 +597,55 @@ replyMPCopyDescription(const void *info) } +static void +getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info) +{ + mach_port_t mp = MACH_PORT_NULL; + int32_t status; + + if (port != dnsPort) { + // we've received a callback on the async DNS port but since the + // associated CFMachPort doesn't match than the request must have + // already been cancelled. + SCLog(TRUE, LOG_ERR, CFSTR("getnameinfo_async_handleCFReply(): port != dnsPort")); + return; + } + + mp = CFMachPortGetPort(port); + CFMachPortInvalidate(dnsPort); + CFRelease(dnsPort); + dnsPort = NULL; + + status = getnameinfo_async_handle_reply(msg); + if ((status == 0) && dnsActive && (mp != MACH_PORT_NULL)) { + CFMachPortContext context = { 0 + , (void *)store + , CFRetain + , CFRelease + , replyMPCopyDescription + }; + CFRunLoopSourceRef rls; + + // if request has been re-queued + dnsPort = CFMachPortCreateWithPort(NULL, + mp, + getnameinfo_async_handleCFReply, + &context, + NULL); + rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0); + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + } + + return; +} + + static Boolean start_dns_query(SCDynamicStoreRef store, CFStringRef address) { char addr[64]; - SCNetworkConnectionFlags flags; + SCNetworkReachabilityFlags flags; Boolean haveDNS; Boolean ok = FALSE; struct sockaddr *sa; @@ -584,8 +688,8 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address) ok = _SC_checkResolverReachabilityByAddress(&store, &flags, &haveDNS, sa); if (ok) { - if (!(flags & kSCNetworkFlagsReachable) || - (flags & kSCNetworkFlagsConnectionRequired)) { + if (!(flags & kSCNetworkReachabilityFlagsReachable) || + (flags & kSCNetworkReachabilityFlagsConnectionRequired)) { // if not reachable *OR* connection required ok = FALSE; } @@ -598,12 +702,13 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address) , CFRelease , replyMPCopyDescription }; - mach_port_t port; int32_t error; + mach_port_t mp; + CFRunLoopSourceRef rls; (void) gettimeofday(&dnsQueryStart, NULL); - error = getnameinfo_async_start(&port, + error = getnameinfo_async_start(&mp, sa, sa->sa_len, NI_NAMEREQD, // flags @@ -616,12 +721,13 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address) dnsActive = TRUE; dnsPort = CFMachPortCreateWithPort(NULL, - port, + mp, getnameinfo_async_handleCFReply, &context, NULL); - dnsRLS = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0); - CFRunLoopAddSource(CFRunLoopGetCurrent(), dnsRLS, kCFRunLoopDefaultMode); + rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0); + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); } done : @@ -732,13 +838,14 @@ configuration_changed(SCDynamicStoreRef store, CFArrayRef changedKeys, void *inf // if active, cancel any in-progress attempt to resolve the primary IP address if (dnsPort != NULL) { + mach_port_t mp = CFMachPortGetPort(dnsPort); + /* cancel the outstanding DNS query */ - getnameinfo_async_cancel(CFMachPortGetPort(dnsPort)); - CFRunLoopSourceInvalidate(dnsRLS); - CFRelease(dnsRLS); - dnsRLS = NULL; + CFMachPortInvalidate(dnsPort); CFRelease(dnsPort); dnsPort = NULL; + + getnameinfo_async_cancel(mp); } // if active, cancel any queued configuration change @@ -920,7 +1027,7 @@ main(int argc, char **argv) done : - smb_update_configuration(NULL, store); + smb_update_configuration(NULL, (void *)store); CFRelease(store); diff --git a/Plugins/IPMonitor/test_ipv4_routelist_filter.sh b/Plugins/IPMonitor/test_ipv4_routelist_filter.sh new file mode 100644 index 0000000..924de28 --- /dev/null +++ b/Plugins/IPMonitor/test_ipv4_routelist_filter.sh @@ -0,0 +1,2 @@ +#!/bin/sh +sed '/Process [0-9][0-9]*: [0-9][0-9]* nodes malloced/d; s/^\(Process \)[0-9][0-9]*:\(.*\)/\1XXXX\2/' diff --git a/Plugins/IPMonitor/test_ipv4_routelist_reference.txt b/Plugins/IPMonitor/test_ipv4_routelist_reference.txt new file mode 100644 index 0000000..6698c5b --- /dev/null +++ b/Plugins/IPMonitor/test_ipv4_routelist_reference.txt @@ -0,0 +1,768 @@ + +Starting test test1 +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.19 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.19 Ifp en0 Ifa 10.0.0.19 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 + 1. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.13 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.13 Ifp en0 Ifa 10.0.0.13 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.13 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.13 Ifp en0 Ifa 10.0.0.13 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 + 1. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.19 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.19 Ifp en0 Ifa 10.0.0.19 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +routes1 and routes2 are the same + +Starting test test2 +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 + 1. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.13 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.13 Ifp en0 Ifa 10.0.0.13 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.13 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.13 Ifp en0 Ifa 10.0.0.13 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 + 1. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +routes1 and routes2 are the same + +Starting test test3 +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} + +routes1 and routes2 are the same + +Starting test test4 +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} + +routes1 and routes2 are the same + +Starting test test5 +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 6. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12 + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 +} + +test: Adding = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22 +} + +Routes are = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 6. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} + +routes1 and routes2 are the same + +Compare 1 to 2: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +Compare 2 to 1: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +Compare 1 to 1: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} + +Compare 1 to 3: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 + 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] + 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] + 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 +} +Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] +Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] +Add new[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] +Add new[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] +Add new[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 + +Compare 3 to 1: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 + 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] + 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] + 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] +Remove old[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] +Remove old[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] +Remove old[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 +Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + +Compare 2 to 3: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 + 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] + 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] + 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 +} +Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] +Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] +Add new[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] +Add new[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] +Add new[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 + +Compare 3 to 2: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 + 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] + 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] + 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] +Remove old[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] +Remove old[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] +Remove old[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 +Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + +Compare 3 to 4: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 + 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] + 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] + 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} +Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 +Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] +Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED] +Remove old[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 +Remove old[4] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] +Remove old[5] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +Remove old[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED] +Remove old[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED] +Remove old[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30 +Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] +Add new[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] +Add new[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +Add new[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] +Add new[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 +Add new[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] + +Compare 5 to 4: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 6. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED] +} +Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22 +Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] [SCOPED] +Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] + +Compare 6 to 7: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.255.96.1 Ifp en2 Ifa 17.255.98.164 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en0 Ifa 17.202.42.113 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en1 Ifa 17.202.42.111 [SCOPED] + 3. Dest 0.0.0.0 Mask 0.0.0.0 Gate 169.254.11.33 Ifp fw0 Ifa 169.254.11.33 [direct] [last] [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 [SCOPED] + 6. Dest 17.255.96.0 Mask 255.255.240.0 Gate 17.255.98.164 Ifp en2 Ifa 17.255.98.164 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.255.96.1 Ifp en2 Ifa 17.255.98.164 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en1 Ifa 17.202.42.111 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en0 Ifa 17.202.42.113 [SCOPED] + 3. Dest 0.0.0.0 Mask 0.0.0.0 Gate 169.254.11.33 Ifp fw0 Ifa 169.254.11.33 [direct] [last] [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 [SCOPED] + 6. Dest 17.255.96.0 Mask 255.255.240.0 Gate 17.255.98.164 Ifp en2 Ifa 17.255.98.164 +} +Remove old[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 +Remove old[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 [SCOPED] +Add new[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 +Add new[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 [SCOPED] + +Compare 7 to 6: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.255.96.1 Ifp en2 Ifa 17.255.98.164 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en1 Ifa 17.202.42.111 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en0 Ifa 17.202.42.113 [SCOPED] + 3. Dest 0.0.0.0 Mask 0.0.0.0 Gate 169.254.11.33 Ifp fw0 Ifa 169.254.11.33 [direct] [last] [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 [SCOPED] + 6. Dest 17.255.96.0 Mask 255.255.240.0 Gate 17.255.98.164 Ifp en2 Ifa 17.255.98.164 +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.255.96.1 Ifp en2 Ifa 17.255.98.164 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en0 Ifa 17.202.42.113 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en1 Ifa 17.202.42.111 [SCOPED] + 3. Dest 0.0.0.0 Mask 0.0.0.0 Gate 169.254.11.33 Ifp fw0 Ifa 169.254.11.33 [direct] [last] [SCOPED] + 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 + 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 [SCOPED] + 6. Dest 17.255.96.0 Mask 255.255.240.0 Gate 17.255.98.164 Ifp en2 Ifa 17.255.98.164 +} +Remove old[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 +Remove old[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 [SCOPED] +Add new[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 +Add new[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 [SCOPED] + +Compare 8 to 9: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [first] + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [first] + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 +Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] +Remove old[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 +Remove old[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] +Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [first] +Add new[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [SCOPED] +Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] +Add new[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [first] +Add new[4] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [SCOPED] +Add new[5] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 + +Compare 8 to 10: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [last] [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [last] [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 +Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] +Remove old[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 +Remove old[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] +Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 +Add new[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] +Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [last] [SCOPED] +Add new[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +Add new[4] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [last] [SCOPED] +Add new[5] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 + +Compare 8 to 11: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] + 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [never] [SCOPED] + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 + 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [never] [SCOPED] + 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 +} +Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 +Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] +Remove old[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 +Remove old[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] +Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 +Add new[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED] +Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [never] [SCOPED] +Add new[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 +Add new[4] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [never] [SCOPED] +Add new[5] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30 + +Compare 12 to 13: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED] +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED] +} + +Compare 13 to 14: +Old Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 + 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED] + 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED] +} +New Routes = = { + 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED*] + 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED*] +} +Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 +Remove old[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 + +Checking for leaks +Process XXXX 0 leaks for 0 total leaked bytes. diff --git a/Plugins/IPMonitor/test_reference.sh b/Plugins/IPMonitor/test_reference.sh new file mode 100644 index 0000000..c4df41f --- /dev/null +++ b/Plugins/IPMonitor/test_reference.sh @@ -0,0 +1,87 @@ +#!/bin/sh + +tmpfile=/tmp/test_reference_output$$.txt + +cleanup() +{ + if [ -f "${tmpfile}" ]; then + echo removing "${tmpfile}" + rm -f "${tmpfile}" + fi + exit 1 +} + +trap cleanup 1 2 3 15 + +run_program() +{ + program="${1}" + filter="${2}" + if [ "${filter}" = "" ]; then + ${program} + else + ${program} | ${filter} + fi +} + +usage() +{ + echo "usage: $0 ( create | test ) [ ]" + exit 1 +} + +command="${1}" +program="${2}" +ref_file="${3}" +filter="${4}" + +if [ "${ref_file}" = "" ]; then + usage "${0}" +fi + +if [ "${program}" = "" ]; then + usage "${0}" +fi + +if [ ! -f "${program}" ]; then + echo "program '${program}' doesn't exit" + exit 1 +fi +if [ ! -x "${program}" ]; then + program="sh ${program}" +fi +# echo "The program is ${program}" + +if [ ! "${filter}" = "" ]; then + if [ ! -f "${filter}" ]; then + echo "filter '${filter}' doesn't exit" + exit 1 + fi + if [ ! -x "${filter}" ]; then + filter="sh ${filter}" + fi +# echo "The filter is ${filter}" +else + echo no filter +fi + +if [ "${command}" = "create" ]; then + run_program "${program}" "${filter}" > "${ref_file}" +elif [ "${command}" = "test" ]; then + if [ ! -f "${ref_file}" ]; then + echo "reference file '${ref_file}' doesn't exist" + exit 1 + fi + run_program "${program}" "${filter}" > "${tmpfile}" + cmp "${tmpfile}" "${ref_file}" + if [ ! $? -eq 0 ]; then + echo FAILURE + diff "${tmpfile}" "${ref_file}" + exit 1 + fi + echo SUCCESS +else + usage "${0}" +fi + +exit 0 \ No newline at end of file diff --git a/Plugins/InterfaceNamer/Info.plist b/Plugins/InterfaceNamer/Info.plist index baee3f1..1fede74 100644 --- a/Plugins/InterfaceNamer/Info.plist +++ b/Plugins/InterfaceNamer/Info.plist @@ -2,6 +2,8 @@ + Builtin + CFBundleDevelopmentRegion English CFBundleExecutable @@ -11,16 +13,14 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - SystemConfiguration + com.apple.SystemConfiguration.InterfaceNamer CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 - Builtin - + 1.10 diff --git a/Plugins/InterfaceNamer/ifnamer.c b/Plugins/InterfaceNamer/ifnamer.c index 6d94985..1637c7a 100644 --- a/Plugins/InterfaceNamer/ifnamer.c +++ b/Plugins/InterfaceNamer/ifnamer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2007 Apple Inc. All rights reserved. + * Copyright (c) 2001-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -170,6 +170,7 @@ static CFMutableDictionaryRef S_state = NULL; */ static CFRunLoopTimerRef S_timer = NULL; +#if !TARGET_OS_IPHONE /* * Virtual network interface configuration * S_prefs : SCPreferences to configuration @@ -179,6 +180,7 @@ static CFRunLoopTimerRef S_timer = NULL; static SCPreferencesRef S_prefs = NULL; static CFArrayRef S_bonds = NULL; static CFArrayRef S_vlans = NULL; +#endif /* !TARGET_OS_IPHONE */ static void addTimestamp(CFMutableDictionaryRef dict, CFStringRef key) @@ -446,6 +448,7 @@ updateStore(void) return; } +#if !TARGET_OS_IPHONE static void updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef prefs, SCPreferencesNotification notificationType, @@ -521,6 +524,7 @@ updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef prefs, SCPreferencesSynchronize(prefs); return; } +#endif /* !TARGET_OS_IPHONE */ static CFDictionaryRef createInterfaceDict(SCNetworkInterfaceRef interface) @@ -664,11 +668,23 @@ lookupAirPortInterface(CFArrayRef db_list, CFIndex * where) dict = CFArrayGetValueAtIndex(db_list, i); if_type = CFDictionaryGetValue(dict, CFSTR(kSCNetworkInterfaceType)); - if ((if_type != NULL) && - CFEqual(if_type, kSCNetworkInterfaceTypeIEEE80211)) { - if (where) - *where = i; - return (dict); + if (if_type != NULL) { + if (CFEqual(if_type, kSCNetworkInterfaceTypeIEEE80211)) { + if (where) + *where = i; + return (dict); + } + } else { + CFStringRef path; + + path = CFDictionaryGetValue(dict, CFSTR(kIOPathMatchKey)); + if ((CFStringFind(path, CFSTR("IO80211Interface") , 0).location != kCFNotFound) || + (CFStringFind(path, CFSTR("AirPort") , 0).location != kCFNotFound) || + (CFStringFind(path, CFSTR("AppleWireless80211"), 0).location != kCFNotFound)) { + if (where) + *where = i; + return (dict); + } } } return (NULL); @@ -1077,7 +1093,9 @@ updateInterfaces() * in the HW config (or have yet to show up). */ writeInterfaceList(S_dblist); +#if !TARGET_OS_IPHONE updateVirtualNetworkInterfaceConfiguration(NULL, kSCPreferencesNotificationApply, NULL); +#endif /* !TARGET_OS_IPHONE */ updateStore(); if (S_iflist != NULL) { @@ -1156,6 +1174,9 @@ compareMacAddress(const void *val1, const void *val2, void *context) return res; } +#ifndef kIOPlatformUUIDKey +#define kIOPlatformUUIDKey "IOPlatformUUID" +#endif static void updatePlatformUUID() { @@ -1424,8 +1445,8 @@ iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, int *count) SCLog(TRUE, LOG_ERR, CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryEntryGetLocationInPlane returned 0x%x"), kr); + CFRelease(str); goto next; - break; } CFArrayAppendValue(newNodes, str); @@ -1667,7 +1688,7 @@ setup_IOKit(CFBundleRef bundle) quietCallback((void *)S_notify, MACH_PORT_NULL, kIOMessageServiceBusyStateChange, - (void *)busy); + (void *)(uintptr_t)busy); CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(S_notify), @@ -1704,6 +1725,7 @@ setup_IOKit(CFBundleRef bundle) return ok; } +#if !TARGET_OS_IPHONE static Boolean setup_Virtual(CFBundleRef bundle) { @@ -1727,15 +1749,18 @@ setup_Virtual(CFBundleRef bundle) // schedule if (!SCPreferencesScheduleWithRunLoop(S_prefs, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) { - SCLog(TRUE, LOG_ERR, - CFSTR(MY_PLUGIN_NAME ": SCPreferencesScheduleWithRunLoop() failed: %s"), - SCErrorString(SCError())); - CFRelease(S_prefs); - return FALSE; + if (SCError() != kSCStatusNoStoreServer) { + SCLog(TRUE, LOG_ERR, + CFSTR(MY_PLUGIN_NAME ": SCPreferencesScheduleWithRunLoop() failed: %s"), + SCErrorString(SCError())); + CFRelease(S_prefs); + return FALSE; + } } return TRUE; } +#endif /* !TARGET_OS_IPHONE */ __private_extern__ void @@ -1745,10 +1770,12 @@ load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose) S_debug = TRUE; } +#if !TARGET_OS_IPHONE // setup virtual network interface monitoring if (!setup_Virtual(bundle)) { goto error; } +#endif /* !TARGET_OS_IPHONE */ // setup [IOKit] network interface monitoring if (!setup_IOKit(bundle)) { diff --git a/Plugins/KernelEventMonitor/Info.plist b/Plugins/KernelEventMonitor/Info.plist index 79c5601..9bc200b 100644 --- a/Plugins/KernelEventMonitor/Info.plist +++ b/Plugins/KernelEventMonitor/Info.plist @@ -11,15 +11,15 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - SystemConfiguration + com.apple.SystemConfiguration.KernelEventMonitor CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 + 1.10 Requires com.apple.SystemConfiguration.InterfaceNamer diff --git a/Plugins/KernelEventMonitor/ev_dlil.c b/Plugins/KernelEventMonitor/ev_dlil.c index debda25..82487f3 100644 --- a/Plugins/KernelEventMonitor/ev_dlil.c +++ b/Plugins/KernelEventMonitor/ev_dlil.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2002-2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -77,12 +77,9 @@ interface_update_status(const char *if_name, CFBooleanRef active, { CFStringRef key = NULL; CFMutableDictionaryRef newDict = NULL; - CFBooleanRef state = NULL; key = create_interface_key(if_name); newDict = copy_entity(key); - state = isA_CFBoolean(CFDictionaryGetValue(newDict, - kSCPropNetLinkActive)); /* if new status available, update cache */ if (active == NULL) { CFDictionaryRemoveValue(newDict, kSCPropNetLinkActive); diff --git a/Plugins/KernelEventMonitor/ev_ipv4.c b/Plugins/KernelEventMonitor/ev_ipv4.c index 40518e4..4f1c15f 100644 --- a/Plugins/KernelEventMonitor/ev_ipv4.c +++ b/Plugins/KernelEventMonitor/ev_ipv4.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2005, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2002-2005, 2007, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -32,13 +32,15 @@ #include "cache.h" #include "ev_ipv4.h" -#ifndef kSCEntNetIPv4ARPCollision -#define kSCEntNetIPv4ARPCollision CFSTR("IPv4ARPCollision") -#endif /* kSCEntNetIPv4ARPCollision */ +#ifndef kSCEntNetIPv4ARPCollision +#define kSCEntNetIPv4ARPCollision CFSTR("IPv4ARPCollision") +#endif /* kSCEntNetIPv4ARPCollision */ -#ifndef kSCEntNetIPv4PortInUse -#define kSCEntNetIPv4PortInUse CFSTR("PortInUse") -#endif /* kSCEntNetIPv4PortInUse */ +#if !TARGET_OS_IPHONE +#ifndef kSCEntNetIPv4PortInUse +#define kSCEntNetIPv4PortInUse CFSTR("PortInUse") +#endif /* kSCEntNetIPv4PortInUse */ +#endif /* !TARGET_OS_IPHONE */ #define IP_FORMAT "%d.%d.%d.%d" #define IP_CH(ip, i) (((u_char *)(ip))[i]) @@ -260,6 +262,7 @@ interface_collision_ipv4(const char *if_name, struct in_addr ip_addr, int hw_len return; } +#if !TARGET_OS_IPHONE __private_extern__ void port_in_use_ipv4(uint16_t port, pid_t req_pid) @@ -277,3 +280,4 @@ port_in_use_ipv4(uint16_t port, pid_t req_pid) CFRelease(key); return; } +#endif /* !TARGET_OS_IPHONE */ diff --git a/Plugins/KernelEventMonitor/ev_ipv4.h b/Plugins/KernelEventMonitor/ev_ipv4.h index b4f1718..786cf09 100644 --- a/Plugins/KernelEventMonitor/ev_ipv4.h +++ b/Plugins/KernelEventMonitor/ev_ipv4.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2002-2005, 2007, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -32,6 +32,7 @@ #ifndef _EV_IPV4_H #define _EV_IPV4_H +#include #include __BEGIN_DECLS @@ -40,7 +41,10 @@ void interface_update_ipv4 (struct ifaddrs *ifap, const char *if_name); void interface_collision_ipv4(const char *if_name, struct in_addr ip_addr, int hw_len, const void * hw_addr); +#if !TARGET_OS_IPHONE void port_in_use_ipv4(uint16_t port, pid_t req_pid); +#endif /* !TARGET_OS_IPHONE */ + __END_DECLS #endif /* _EV_IPV4_H */ diff --git a/Plugins/KernelEventMonitor/eventmon.c b/Plugins/KernelEventMonitor/eventmon.c index 9c74f17..bc24c8f 100644 --- a/Plugins/KernelEventMonitor/eventmon.c +++ b/Plugins/KernelEventMonitor/eventmon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -58,10 +58,12 @@ #include "ev_dlil.h" #include "ev_ipv4.h" #include "ev_ipv6.h" -#include "ev_appletalk.h" - #include +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK +#include "ev_appletalk.h" +#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */ + static const char *inetEventName[] = { "", "INET address added", @@ -92,6 +94,7 @@ static const char *dlEventName[] = { "KEV_DL_PROTO_DETACHED", }; +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK static const char *atalkEventName[] = { "", "KEV_ATALK_ENABLED", @@ -102,6 +105,7 @@ static const char *atalkEventName[] = { "KEV_ATALK_ROUTERDOWN", "KEV_ATALK_ZONELISTCHANGED" }; +#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */ static const char *inet6EventName[] = { "", @@ -113,12 +117,10 @@ static const char *inet6EventName[] = { "KEV_INET6_DEFROUTER" }; - __private_extern__ Boolean network_changed = FALSE; __private_extern__ SCDynamicStoreRef store = NULL; __private_extern__ Boolean _verbose = FALSE; - __private_extern__ int dgram_socket(int domain) @@ -242,6 +244,7 @@ dlEventNameString(uint32_t event_code) return ("New Apple network DL subcode"); } +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK static const char * atalkEventNameString(uint32_t event_code) { @@ -250,7 +253,7 @@ atalkEventNameString(uint32_t event_code) } return ("New Apple network AppleTalk subcode"); } - +#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */ static void copy_if_name(struct net_event_data * ev, char * ifr_name, int ifr_len) @@ -305,6 +308,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg) ev->hw_addr); break; } +#if !TARGET_OS_IPHONE case KEV_INET_PORTINUSE : { struct kev_in_portinuse * ev; ev = (struct kev_in_portinuse *)event_data; @@ -315,6 +319,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg) port_in_use_ipv4(ev->port, ev->req_pid); break; } +#endif /* !TARGET_OS_IPHONE */ default : handled = FALSE; break; @@ -438,6 +443,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg) } break; } +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK case KEV_ATALK_SUBCLASS: { struct kev_atalk_data * ev; @@ -476,6 +482,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg) } break; } +#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */ default : handled = FALSE; break; @@ -493,7 +500,6 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg) return; } - static void processEvent_Apple_IOKit(struct kern_event_msg *ev_msg) { @@ -506,6 +512,17 @@ processEvent_Apple_IOKit(struct kern_event_msg *ev_msg) return; } +static void +processEvent_Apple_System(struct kern_event_msg *ev_msg) +{ + switch (ev_msg->kev_subclass) { + default : + logEvent(CFSTR("New Apple System subclass"), ev_msg); + break; + } + + return; +} static void eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info) @@ -539,6 +556,9 @@ eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const case KEV_IOKIT_CLASS : processEvent_Apple_IOKit(ev_msg); break; + case KEV_SYSTEM_CLASS : + processEvent_Apple_System(ev_msg); + break; default : /* unrecognized (Apple) event class */ logEvent(CFSTR("New (Apple) class"), ev_msg); @@ -568,7 +588,6 @@ eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const } - __private_extern__ void prime_KernelEventMonitor() @@ -617,11 +636,13 @@ prime_KernelEventMonitor() */ interface_update_ipv6(ifap, NULL); +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK /* * update AppleTalk network addresses already assigned * to the interfaces. */ interface_update_appletalk(ifap, NULL); +#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */ freeifaddrs(ifap); @@ -638,29 +659,27 @@ prime_KernelEventMonitor() return; } - static CFStringRef kevSocketCopyDescription(const void *info) { return CFStringCreateWithFormat(NULL, NULL, CFSTR("")); } - __private_extern__ void load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose) { - int so; - int status; - struct kev_request kev_req; - CFSocketRef es; CFSocketContext context = { 0 , (void *)1 , NULL , NULL , kevSocketCopyDescription }; + CFSocketRef es; + struct kev_request kev_req; CFRunLoopSourceRef rls; + int so; + int status; if (bundleVerbose) { _verbose = TRUE; @@ -715,11 +734,11 @@ load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose) } /* Create a CFSocketRef for the PF_SYSTEM kernel event socket */ - es = CFSocketCreateWithNative(NULL, - so, - kCFSocketReadCallBack, - eventCallback, - &context); + es = CFSocketCreateWithNative(NULL, + so, + kCFSocketReadCallBack, + eventCallback, + &context); /* Create and add a run loop source for the event socket */ rls = CFSocketCreateRunLoopSource(NULL, es, 0); @@ -750,11 +769,13 @@ load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose) #undef getIF #undef updateStore +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK #define getIF getIF_at #define updateStore updateStore_at #include "ev_appletalk.c" #undef getIF #undef updateStore +#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */ int main(int argc, char **argv) diff --git a/Plugins/Kicker/Info.plist b/Plugins/Kicker/Info.plist index adc989c..21cece0 100644 --- a/Plugins/Kicker/Info.plist +++ b/Plugins/Kicker/Info.plist @@ -11,15 +11,15 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - SystemConfiguration + com.apple.SystemConfiguration.Kicker CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 + 1.10 Requires com.apple.SystemConfiguration.ATconfig diff --git a/Plugins/LinkConfiguration/Info.plist b/Plugins/LinkConfiguration/Info.plist index da65bbe..3933e3c 100644 --- a/Plugins/LinkConfiguration/Info.plist +++ b/Plugins/LinkConfiguration/Info.plist @@ -11,15 +11,15 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - SystemConfiguration + com.apple.SystemConfiguration.LinkConfiguration CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 + 1.10 Requires com.apple.SystemConfiguration.InterfaceNamer diff --git a/Plugins/Logger/Info-Embedded.plist b/Plugins/Logger/Info-Embedded.plist new file mode 100644 index 0000000..f9f67de --- /dev/null +++ b/Plugins/Logger/Info-Embedded.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Logger + CFBundleIdentifier + com.apple.SystemConfiguration.Logger + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + com.apple.SystemConfiguration.Logger + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.10 + CFBundleSignature + ???? + CFBundleVersion + 1.10 + Enabled + + Verbose + + LOG_ALL + + LOG_IO_SYSTEMPOWER_EVENTS + + LOG_NETWORK_KERNEL_EVENTS + + LOG_NOTIFY_DNS_CONFIGURATION + + LOG_NOTIFY_NETWORK_CHANGE + + LOG_SC_NETWORKCHANGE + + LOG_SC_PRIMARYSERVICE + + LOG_SC_REACHABILITY + + LOG_SC_REACHABILITY_HOSTS + + mail.me.com + + + diff --git a/Plugins/Logger/Info.plist b/Plugins/Logger/Info.plist new file mode 100644 index 0000000..83f8d68 --- /dev/null +++ b/Plugins/Logger/Info.plist @@ -0,0 +1,60 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Logger + CFBundleIdentifier + com.apple.SystemConfiguration.Logger + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + com.apple.SystemConfiguration.Logger + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.10 + CFBundleSignature + ???? + CFBundleVersion + 1.10 + Enabled + + Verbose + + LOG_ALL + + LOG_IO_SYSTEMPOWER_EVENTS + + LOG_IO_WAKEUUID_EVENTS + + LOG_NETWORK_KERNEL_EVENTS + + LOG_NOTIFY_DNS_CONFIGURATION + + LOG_NOTIFY_NETWORK_CHANGE + + LOG_NOTIFY_SMB_CONFIGURATION + + LOG_NOTIFY_UTMPX_CHANGE + + LOG_SC_BTMM_CONFIGURATION + + LOG_SC_CONSOLEUSER + + LOG_SC_DIRECTORYSERVICES_SEARCHPOLICY + + LOG_SC_NETWORKCHANGE + + LOG_SC_PRIMARYSERVICE + + LOG_SC_REACHABILITY + + LOG_SC_REACHABILITY_HOSTS + + mail.me.com + + + diff --git a/Plugins/Logger/Makefile b/Plugins/Logger/Makefile new file mode 100644 index 0000000..1fa0070 --- /dev/null +++ b/Plugins/Logger/Makefile @@ -0,0 +1,6 @@ +logger: logger.c + cc -Wall -g -DMAIN -o logger logger.c -framework CoreFoundation -framework SystemConfiguration -framework IOKit -ldnsinfo + +clean: + rm -rf logger logger.dSYM + diff --git a/Plugins/Logger/logger.c b/Plugins/Logger/logger.c new file mode 100644 index 0000000..3abe51d --- /dev/null +++ b/Plugins/Logger/logger.c @@ -0,0 +1,1832 @@ +/* + * Copyright (c) 2005-2009 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * Modification History + * + * January 15, 2005 Allan Nathanson + * - initial revision + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +/* generic MessageTracer keys */ +#define MSGTRACER_KEY_DOMAIN "com.apple.message.domain" +#define MSGTRACER_KEY_SIG "com.apple.message.signature" +#define MSGTRACER_KEY_UUID "com.apple.message.uuid" +#define MSGTRACER_KEY_VALUE1 "com.apple.message.value" + + +#define MY_ASL_FACILITY "com.apple.SystemConfiguration.Logger" +#define MY_MSGTRACER_DOMAIN "com.apple.network.log" + + +static aslmsg log_msg = NULL; +static io_connect_t power = MACH_PORT_NULL; +static Boolean verbose = FALSE; + + +static char * +elapsed() +{ + static char str[128]; + struct tm tm_diff; + struct tm tm_now; + struct timeval tv_diff; + struct timeval tv_now; + static struct timeval tv_then = { 0, 0 }; + + (void)gettimeofday(&tv_now, NULL); + + (void)localtime_r(&tv_now.tv_sec, &tm_now); + + timersub(&tv_now, &tv_then, &tv_diff); + (void)localtime_r(&tv_diff.tv_sec, &tm_diff); +#ifdef MAIN + sprintf(str, "%2d:%02d:%02d.%03d (+%ld.%03d)", + tm_now.tm_hour, + tm_now.tm_min, + tm_now.tm_sec, + tv_now.tv_usec / 1000, + tv_diff.tv_sec, + tv_diff.tv_usec / 1000); +#else + sprintf(str, ".%03d (+%ld.%03d)", + tv_now.tv_usec / 1000, + tv_diff.tv_sec, + tv_diff.tv_usec / 1000); +#endif + + tv_then = tv_now; + return str; +} + + +#pragma mark - +#pragma mark [Network] Kernel Events + + +static CFStringRef +copyInterfaceFlags(const char *if_name) +{ + const char * iff_up = "? "; + struct ifreq ifr; + const char *ifm_active = "? "; + int sock; + CFStringRef str = NULL; + + sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock == -1) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("socket() failed")); + return NULL; + } + + bzero((char *)&ifr, sizeof(ifr)); + (void) strncpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name)); + if (ioctl(sock, SIOCGIFFLAGS, (caddr_t)&ifr) == 0) { + struct ifmediareq ifm; + + iff_up = (ifr.ifr_flags & IFF_UP) ? "yes" : "no "; + + bzero((char *)&ifm, sizeof(ifm)); + (void) strncpy(ifm.ifm_name, if_name, sizeof(ifm.ifm_name)); + if ((ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifm) == 0) && + (ifm.ifm_count > 0) && + (ifm.ifm_status & IFM_AVALID)) { + ifm_active = (ifm.ifm_status & IFM_ACTIVE) ? "yes" : "no "; + } + + str = CFStringCreateWithFormat(NULL, + NULL, + CFSTR("\n%-5s: IFF_UP = %s IFM_ACTIVE = %s"), + if_name, + iff_up, + ifm_active); + } + + (void)close(sock); + + return str; +} + + +static int +prefixLength(struct sockaddr_in6 *sin6) +{ + register u_int8_t *name = &sin6->sin6_addr.s6_addr[0]; + register int byte; + register int bit; + int plen = 0; + + for (byte = 0; byte < sizeof(struct in6_addr); byte++, plen += 8) { + if (name[byte] != 0xff) { + break; + } + } + + if (byte == sizeof(struct in6_addr)) { + return plen; + } + + for (bit = 7; bit != 0; bit--, plen++) { + if (!(name[byte] & (1 << bit))) { + break; + } + } + + for (; bit != 0; bit--) { + if (name[byte] & (1 << bit)) { + return 0; + } + } + + byte++; + for (; byte < sizeof(struct in6_addr); byte++) { + if (name[byte]) { + return 0; + } + } + + return plen; +} + + +static void +KernelEvent_notification(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info) +{ + int so = CFSocketGetNative(s); + int status; + char buf[1024]; + struct kern_event_msg *ev_msg = (struct kern_event_msg *)&buf[0]; + int offset = 0; + + status = recv(so, &buf, sizeof(buf), 0); + if (status == -1) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("recv() failed: %s"), strerror(errno)); + CFSocketInvalidate(s); + return; + } + + while (offset < status) { + if ((offset + ev_msg->total_size) > status) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("missed SYSPROTO_EVENT event, buffer not big enough")); + break; + } + + switch (ev_msg->vendor_code) { + case KEV_VENDOR_APPLE : + switch (ev_msg->kev_class) { + case KEV_NETWORK_CLASS : { + void *event_data = &ev_msg->event_data[0]; + + switch (ev_msg->kev_subclass) { + case KEV_DL_SUBCLASS : { + struct net_event_data *ev; + char if_name[IFNAMSIZ+1]; + + ev = (struct net_event_data *)event_data; + + bzero(&if_name, sizeof(if_name)); + snprintf(if_name, IFNAMSIZ, "%s%d", + ev->if_name, + ev->if_unit); + + switch (ev_msg->event_code) { + case KEV_DL_IF_ATTACHED : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: attached"), + elapsed(), + if_name); + break; + } + case KEV_DL_IF_DETACHING : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: detaching"), + elapsed(), + if_name); + break; + } + case KEV_DL_IF_DETACHED : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: detached"), + elapsed(), + if_name); + break; + } + case KEV_DL_LINK_OFF : { + CFStringRef str; + + str = verbose ? copyInterfaceFlags(if_name) : NULL; + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: link down%@"), + elapsed(), + if_name, + str != NULL ? str : CFSTR("")); + if (str != NULL) CFRelease(str); + break; + } + case KEV_DL_LINK_ON : { + CFStringRef str; + + str = verbose ? copyInterfaceFlags(if_name) : NULL; + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: link up%@"), + elapsed(), + if_name, + str != NULL ? str : CFSTR("")); + if (str != NULL) CFRelease(str); + break; + } + default : + break; + } + break; + } + case KEV_INET_SUBCLASS : { + char addr[128]; + struct kev_in_data *ev; + char if_name[IFNAMSIZ+1]; + char mask[128]; + + ev = (struct kev_in_data *)event_data; + + bzero(&if_name, sizeof(if_name)); + snprintf(if_name, IFNAMSIZ, "%s%d", + ev->link_data.if_name, + ev->link_data.if_unit); + + switch (ev_msg->event_code) { + case KEV_INET_NEW_ADDR : + case KEV_INET_CHANGED_ADDR : + case KEV_INET_ADDR_DELETED : { + struct sockaddr_in sin; + + bzero(&sin, sizeof(sin)); + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + sin.sin_addr = ev->ia_addr; + _SC_sockaddr_to_string((struct sockaddr *)&sin, addr, sizeof(addr)); + + bzero(&sin, sizeof(sin)); + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = ntohl(ev->ia_subnetmask); + _SC_sockaddr_to_string((struct sockaddr *)&sin, mask, sizeof(mask)); + break; + } + default : + break; + } + + switch (ev_msg->event_code) { + case KEV_INET_NEW_ADDR : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: IPv4 address added (%s/%s)"), + elapsed(), + if_name, + addr, + mask); + break; + } + case KEV_INET_CHANGED_ADDR : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: IPv4 address changed (%s/%s)"), + elapsed(), + if_name, + addr, + mask); + break; + } + case KEV_INET_ADDR_DELETED : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: IPv4 address removed (%s/%s)"), + elapsed(), + if_name, + addr, + mask); + break; + } + default : + break; + } + break; + } + case KEV_INET6_SUBCLASS : { + char addr[128]; + struct kev_in6_data *ev; + char if_name[IFNAMSIZ+1]; + int plen = 0; + + ev = (struct kev_in6_data *)event_data; + + bzero(&if_name, sizeof(if_name)); + snprintf(if_name, IFNAMSIZ, "%s%d", + ev->link_data.if_name, + ev->link_data.if_unit); + + switch (ev_msg->event_code) { + case KEV_INET6_NEW_USER_ADDR : + case KEV_INET6_NEW_LL_ADDR : + case KEV_INET6_CHANGED_ADDR : + case KEV_INET6_ADDR_DELETED : { + _SC_sockaddr_to_string((struct sockaddr *)&ev->ia_addr, addr, sizeof(addr)); + plen = prefixLength(&ev->ia_prefixmask); + break; + } + default : + break; + } + + switch (ev_msg->event_code) { + case KEV_INET6_NEW_USER_ADDR : + case KEV_INET6_NEW_LL_ADDR : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: IPv6 address added (%s/%d)"), + elapsed(), + if_name, + addr, + plen); + break; + } + case KEV_INET6_CHANGED_ADDR : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: IPv6 address changed (%s/%d)"), + elapsed(), + if_name, + addr, + plen); + break; + } + case KEV_INET6_ADDR_DELETED : { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s kernel event: %s: IPv6 address removed"), + elapsed(), + if_name); + break; + } + default : + break; + } + break; + } + default : + break; + } + break; + } + default : + break; + } + break; + default : + /* unrecognized vendor code */ + break; + } + offset += ev_msg->total_size; + ev_msg = (struct kern_event_msg *)&buf[offset]; + } + + return; +} + + +static void +add_KernelEvent_notification() +{ + CFSocketRef es; + CFSocketContext es_context = { 0, NULL, NULL, NULL, NULL }; + struct kev_request kev_req; + CFRunLoopSourceRef rls; + int so; + int yes = 1; + + /* Open an event socket */ + so = socket(PF_SYSTEM, SOCK_RAW, SYSPROTO_EVENT); + if (so == -1) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("socket() failed")); + return; + } + + /* establish filter to return all events */ + kev_req.vendor_code = 0; + kev_req.kev_class = 0; /* Not used if vendor_code is 0 */ + kev_req.kev_subclass = 0; /* Not used if either kev_class OR vendor_code are 0 */ + if (ioctl(so, SIOCSKEVFILT, &kev_req) == -1) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("ioctl(, SIOCSKEVFILT, ) failed")); + (void)close(so); + return; + } + + if (ioctl(so, FIONBIO, &yes) == -1) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("ioctl(, FIONBIO, ) failed")); + (void)close(so); + return; + } + + /* Create a CFSocketRef for the PF_SYSTEM kernel event socket */ + es = CFSocketCreateWithNative(NULL, + so, + kCFSocketReadCallBack, + KernelEvent_notification, + &es_context); + + /* Create and add a run loop source for the event socket */ + rls = CFSocketCreateRunLoopSource(NULL, es, -1); + CFRelease(es); + + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + return; +} + + +#pragma mark - +#pragma mark Power Management Events + + +static void +power_notification(void *refcon, io_service_t service, natural_t messageType, void *messageArgument) +{ + switch (messageType) { + case kIOMessageCanDevicePowerOff : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: can device power off?"), + elapsed()); + break; + case kIOMessageDeviceWillPowerOff : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: device will power off"), + elapsed()); + break; + case kIOMessageDeviceWillNotPowerOff : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: device will not power off"), + elapsed()); + break; + case kIOMessageDeviceHasPoweredOn : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: device has powered on"), + elapsed()); + break; + case kIOMessageCanSystemPowerOff : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: can system power off?"), + elapsed()); + break; + case kIOMessageSystemWillPowerOff : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: system will power off"), + elapsed()); + break; + case kIOMessageSystemWillNotPowerOff : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: system will not power off"), + elapsed()); + break; + case kIOMessageCanSystemSleep : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: can system sleep?"), + elapsed()); + /* + * Idle sleep is about to kick in, but applications have + * a chance to allow sleep (by calling IOAllowPowerChange) + * or to prevent sleep (by calling IOCancelPowerChange). + */ + IOAllowPowerChange(power, (long)messageArgument); + break; + case kIOMessageSystemWillSleep : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: system will sleep"), + elapsed()); + IOAllowPowerChange(power, (long)messageArgument); + break; + case kIOMessageSystemWillNotSleep : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: system will not sleep"), + elapsed()); + break; + case kIOMessageSystemHasPoweredOn : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: system has powered on"), + elapsed()); + break; + case kIOMessageSystemWillRestart : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: system will restart"), + elapsed()); + break; + case kIOMessageSystemWillPowerOn : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: system will power on"), + elapsed()); + break; + default : + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s IORegisterForSystemPower: message=%08lx"), + elapsed(), + (long unsigned int)messageType); + break; + } + + return; +} + + +static void +add_power_notification() +{ + io_object_t iterator; + IONotificationPortRef notify; + + power = IORegisterForSystemPower(0, ¬ify, power_notification, &iterator); + if (power == MACH_PORT_NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("IORegisterForSystemPower() failed")); + return; + } + + CFRunLoopAddSource(CFRunLoopGetCurrent(), + IONotificationPortGetRunLoopSource(notify), + kCFRunLoopCommonModes); + + return; +} + + +#ifdef kIOPMMessageSleepWakeUUIDChange +static void +wake_uuid_notification(void *refcon, io_service_t service, natural_t messageType, void *messageArgument) +{ + CFStringRef wake_uuid = NULL; + + if (messageType == kIOPMMessageSleepWakeUUIDChange) { + if (messageArgument == kIOPMMessageSleepWakeUUIDSet) { + wake_uuid = IORegistryEntryCreateCFProperty(service, CFSTR(kIOPMSleepWakeUUIDKey), NULL, 0); + } + + if (wake_uuid != NULL) { + char uuid[256]; + + _SC_cfstring_to_cstring(wake_uuid, uuid, sizeof(uuid), kCFStringEncodingUTF8); + asl_set(log_msg, MSGTRACER_KEY_DOMAIN, MY_MSGTRACER_DOMAIN); + asl_set(log_msg, MSGTRACER_KEY_UUID , uuid); + + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s wake UUID notification: UUID set (%@)"), + elapsed(), + wake_uuid); + + CFRelease(wake_uuid); + } else { + asl_unset(log_msg, MSGTRACER_KEY_DOMAIN); + asl_unset(log_msg, MSGTRACER_KEY_UUID); + + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s wake UUID notification: UUID not set"), + elapsed()); + } + } + + return; +} + + +static void +add_wake_uuid_notification() +{ + kern_return_t kr; + io_object_t notification = IO_OBJECT_NULL; + IONotificationPortRef notifyPort; + io_service_t service; + + notifyPort = IONotificationPortCreate(kIOMasterPortDefault); + service = IORegistryEntryFromPath(kIOMasterPortDefault, + kIOPowerPlane ":/IOPowerConnection/IOPMrootDomain"); + kr = IOServiceAddInterestNotification(notifyPort, + service, + kIOGeneralInterest, + wake_uuid_notification, + NULL, // refCon + ¬ification); + if (kr != KERN_SUCCESS) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, + CFSTR("IOServiceAddInterestNotification() failed, kr=0x%x"), + kr); + return; + } + + CFRunLoopAddSource(CFRunLoopGetCurrent(), + IONotificationPortGetRunLoopSource(notifyPort), + kCFRunLoopDefaultMode); + + wake_uuid_notification(NULL, + service, + kIOPMMessageSleepWakeUUIDChange, + kIOPMMessageSleepWakeUUIDSet); + + return; +} +#endif // kIOPMMessageSleepWakeUUIDChange + + +#pragma mark - +#pragma mark SCDynamicStore "network" Events + + +static void +NetworkChange_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context) +{ + CFIndex i; + CFIndex n; + CFMutableStringRef str = CFStringCreateMutable(NULL, 0); + + CFStringAppendFormat(str, + NULL, + CFSTR("%s SCDynamicStore \"network\" notification"), + elapsed()); + + n = CFArrayGetCount(changedKeys); + for (i = 0; i < n; i++) { + CFStringRef key; + + key = CFArrayGetValueAtIndex(changedKeys, i); + if (CFStringHasSuffix(key, kSCEntNetLink)) { + CFDictionaryRef dict; + const char *val = "?"; + + dict = SCDynamicStoreCopyValue(store, key); + if (dict != NULL) { + CFBooleanRef link; + + link = CFDictionaryGetValue(dict, kSCPropNetLinkActive); + if (link != NULL) { + val = CFBooleanGetValue(link) ? "up" : "down"; + } + + CFRelease(dict); + } + CFStringAppendFormat(str, NULL, CFSTR("\n%@ (%s)"), key, val); + } else if (CFStringHasSuffix(key, kSCEntNetIPv4) || + CFStringHasSuffix(key, kSCEntNetIPv6)) { + CFDictionaryRef dict; + + dict = SCDynamicStoreCopyValue(store, key); + if (dict != NULL) { + CFStringRef val; + + val = _SCCopyDescription(dict, NULL); + CFStringAppendFormat(str, NULL, CFSTR("\n%@ : %@"), key, val); + CFRelease(val); + CFRelease(dict); + } else { + CFStringAppendFormat(str, NULL, CFSTR("\n%@ : removed"), key); + } + } else { + CFStringAppendFormat(str, NULL, CFSTR("\n%@"), key); + } + } + + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str); + CFRelease(str); + return; +} + + +static void +add_NetworkChange_notification() +{ + CFStringRef dns_key; + CFStringRef key; + CFMutableArrayRef keys; + Boolean ok; + CFStringRef pattern; + CFMutableArrayRef patterns; + SCDynamicStoreRef store; + CFRunLoopSourceRef rls; + + store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-NetworkChange"), NetworkChange_notification, NULL); + if (store == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed")); + return; + } + + keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + + // Interface list + + key = SCDynamicStoreKeyCreateNetworkInterface(NULL, kSCDynamicStoreDomainState); + CFArrayAppendValue(keys, key); + CFRelease(key); + + // IPv4 + + key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4); + CFArrayAppendValue(keys, key); + CFRelease(key); + + pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + + pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + + // IPv6 + + key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6); + CFArrayAppendValue(keys, key); + CFRelease(key); + + pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + + pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + + // Link + + pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetLink); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + + // AirPort (e.g. BSSID) + + pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetAirPort); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + + // DNS + + key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetDNS); + CFArrayAppendValue(keys, key); + CFRelease(key); + + dns_key = CFStringCreateWithCString(NULL, + dns_configuration_notify_key(), + kCFStringEncodingASCII); + key = CFStringCreateWithFormat(NULL, NULL, CFSTR("Notify:%@"), dns_key); + CFRelease(dns_key); + CFArrayAppendValue(keys, key); + CFRelease(key); + + // Proxies + + key = SCDynamicStoreKeyCreateProxies(NULL); + CFArrayAppendValue(keys, key); + CFRelease(key); + + // ComputerName, LocalHostName + + key = SCDynamicStoreKeyCreateComputerName(NULL); + CFArrayAppendValue(keys, key); + CFRelease(key); + + key = SCDynamicStoreKeyCreateHostNames(NULL); + CFArrayAppendValue(keys, key); + CFRelease(key); + + ok = SCDynamicStoreSetNotificationKeys(store, keys, patterns); + CFRelease(keys); + CFRelease(patterns); + if (!ok) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed")); + CFRelease(store); + return; + } + + rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(store); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(store); + return; +} + + +static void +PrimaryService_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context) +{ + CFDictionaryRef entity; + CFStringRef key; + static CFStringRef oldPrimary = NULL; + CFStringRef newPrimary = NULL; + + key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4); + entity = SCDynamicStoreCopyValue(store, key); + CFRelease(key); + if (isA_CFDictionary(entity) && + CFDictionaryGetValueIfPresent(entity, + kSCDynamicStorePropNetPrimaryService, + (const void **)&newPrimary) && + isA_CFString(newPrimary)) { + CFRetain(newPrimary); + } else { + newPrimary = NULL; + } + + if (!_SC_CFEqual(oldPrimary, newPrimary)) { + if (newPrimary != NULL) { + CFStringRef newInterface; + + newInterface = CFDictionaryGetValue(entity, kSCDynamicStorePropNetPrimaryInterface); + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s Primary service: %@ (%@)"), + elapsed(), + newPrimary, + newInterface != NULL ? newInterface : CFSTR("?")); + } else { + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s Primary service: removed"), + elapsed()); + } + } + + if (oldPrimary != NULL) CFRelease(oldPrimary); + oldPrimary = newPrimary; + + if (entity != NULL) CFRelease(entity); + return; +} + + +static void +add_PrimaryService_notification() +{ + CFStringRef key; + CFMutableArrayRef keys; + Boolean ok; + SCDynamicStoreRef store; + CFRunLoopSourceRef rls; + + store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-PrimaryService"), PrimaryService_notification, NULL); + if (store == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed")); + return; + } + + keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4); + CFArrayAppendValue(keys, key); + CFRelease(key); + + ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL); + CFRelease(keys); + if (!ok) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed")); + CFRelease(store); + return; + } + + rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(store); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(store); + return; +} + + +#pragma mark - +#pragma mark Reachability Events + + +static void +reachability_notification(SCNetworkReachabilityRef ref, SCNetworkReachabilityFlags flags, void *info) +{ + CFStringRef hostname = (CFStringRef)info; + + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s reachability changed: %@: flags=0x%08x"), + elapsed(), + hostname, + flags); + return; +} + + +static void +add_reachability_notification(CFArrayRef hosts) +{ + SCNetworkReachabilityContext context = { 0, NULL, CFRetain, CFRelease, CFCopyDescription }; + CFIndex i; + CFIndex n; + SCNetworkReachabilityRef target; + + struct watch { + in_addr_t addr; + CFStringRef name; + } watchAddresses[] = { { 0, CFSTR("0.0.0.0") }, + { IN_LINKLOCALNETNUM, CFSTR("169.254.0.0") }, + { (u_int32_t)0xe00000fb, CFSTR("224.0.0.251") }, + }; + + for (i = 0; i < sizeof(watchAddresses)/sizeof(watchAddresses[0]); i++) { + struct sockaddr_in sin; + + bzero(&sin, sizeof(sin)); + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = htonl(watchAddresses[i].addr); + + target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin); + if (target == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilityCreateWithAddress() failed")); + return; + } + + context.info = (void *)watchAddresses[i].name; + if (!SCNetworkReachabilitySetCallback(target, reachability_notification, &context)) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilitySetCallback() failed")); + CFRelease(target); + return; + } + + if (!SCNetworkReachabilityScheduleWithRunLoop(target, CFRunLoopGetCurrent(), kCFRunLoopCommonModes)) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilityScheduleWithRunLoop() failed")); + CFRelease(target); + return; + } + + CFRelease(target); + } + + n = (hosts != NULL) ? CFArrayGetCount(hosts) : 0; + for (i = 0; i < n; i++) { + CFStringRef host; + char *nodename; + + host = CFArrayGetValueAtIndex(hosts, i); + if (!isA_CFString(host) || (CFStringGetLength(host) == 0)) { + continue; + } + + nodename = _SC_cfstring_to_cstring(host, NULL, 0, kCFStringEncodingUTF8); + target = SCNetworkReachabilityCreateWithName(NULL, nodename); + CFAllocatorDeallocate(NULL, nodename); + if (target == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilityCreateWithName() failed")); + return; + } + + context.info = (void *)host; + if (!SCNetworkReachabilitySetCallback(target, reachability_notification, &context)) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilitySetCallback() failed")); + CFRelease(target); + return; + } + + if (!SCNetworkReachabilityScheduleWithRunLoop(target, CFRunLoopGetCurrent(), kCFRunLoopCommonModes)) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilityScheduleWithRunLoop() failed")); + CFRelease(target); + return; + } + + CFRelease(target); + } + + return; +} + + +#pragma mark - +#pragma mark Console User/Information Events + + +#if !TARGET_OS_EMBEDDED +static void +console_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context) +{ + gid_t gid; + CFArrayRef info; + CFMutableStringRef str = CFStringCreateMutable(NULL, 0); + uid_t uid; + CFStringRef user; + + CFStringAppendFormat(str, + NULL, + CFSTR("%s SCDynamicStore console notification"), + elapsed()); + + user = SCDynamicStoreCopyConsoleUser(store, &uid, &gid); + if (user != NULL) { + CFStringAppendFormat(str, NULL, CFSTR("\nconsole user = %@"), user); + CFRelease(user); + } else { + CFStringAppendFormat(str, NULL, CFSTR("\nno console user")); + } + + info = SCDynamicStoreCopyConsoleInformation(store); + if (info != NULL) { + CFIndex i; + CFIndex n; + + n = CFArrayGetCount(info); + for (i = 0; i < n; i++) { + CFDictionaryRef session; + CFNumberRef sessionID; + CFStringRef sessionUserName; + CFBooleanRef sessionOnConsole; + + session = CFArrayGetValueAtIndex(info, i); + sessionID = CFDictionaryGetValue(session, kSCConsoleSessionID); + sessionUserName = CFDictionaryGetValue(session, kSCConsoleSessionUserName); + sessionOnConsole = CFDictionaryGetValue(session, kSCConsoleSessionOnConsole); + + CFStringAppendFormat(str, NULL, CFSTR("\n%d : id=%@, user=%@, console=%s"), + i, + sessionID, + sessionUserName != NULL ? sessionUserName : CFSTR("?"), + sessionOnConsole != NULL ? CFBooleanGetValue(sessionOnConsole) ? "yes" : "no" : "?"); + } + + CFRelease(info); + } + + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str); + CFRelease(str); + return; +} + + +static void +add_console_notification() +{ + CFStringRef key; + CFMutableArrayRef keys; + Boolean ok; + SCDynamicStoreRef store; + CFRunLoopSourceRef rls; + + store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-console"), console_notification, NULL); + if (store == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed")); + return; + } + + keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + + key = SCDynamicStoreKeyCreateConsoleUser(NULL); + CFArrayAppendValue(keys, key); + CFRelease(key); + + ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL); + CFRelease(keys); + if (!ok) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed")); + CFRelease(store); + return; + } + + rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(store); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(store); + return; +} +#endif // !TARGET_OS_EMBEDDED + + +#pragma mark - +#pragma mark Directory Services Events + + +//#include +#ifndef kDSStdNotifySearchPolicyChanged +#define kDSStdNotifySearchPolicyChanged "com.apple.DirectoryService.NotifyTypeStandard:SearchPolicyChanged" +#endif + + +#if !TARGET_OS_EMBEDDED +static void +directoryServices_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context) +{ + CFIndex i; + CFIndex n; + CFMutableStringRef str = CFStringCreateMutable(NULL, 0); + + CFStringAppendFormat(str, + NULL, + CFSTR("%s SCDynamicStore DirectoryServices notification"), + elapsed()); + + n = CFArrayGetCount(changedKeys); + for (i = 0; i < n; i++) { + CFStringRef key; + + key = CFArrayGetValueAtIndex(changedKeys, i); + CFStringAppendFormat(str, NULL, CFSTR("\n%@"), key); + } + + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str); + CFRelease(str); + return; +} + + +static void +add_DirectoryServices_notification() +{ + CFStringRef key; + CFMutableArrayRef keys; + Boolean ok; + SCDynamicStoreRef store; + CFRunLoopSourceRef rls; + + store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-directoryServices"), directoryServices_notification, NULL); + if (store == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed")); + return; + } + + keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + + key = CFSTR(kDSStdNotifySearchPolicyChanged); + CFArrayAppendValue(keys, key); +// CFRelease(key); + + ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL); + CFRelease(keys); + if (!ok) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed")); + CFRelease(store); + return; + } + + rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(store); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(store); + return; +} +#endif // !TARGET_OS_EMBEDDED + + +#pragma mark - +#pragma mark DNS Configuration Events + + +static void +dnsinfo_notification(CFMachPortRef port, void *msg, CFIndex size, void *info) +{ + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s dnsinfo notification"), + elapsed()); + + return; +} + + +static void +add_dnsinfo_notification() +{ + const char *key; + CFMachPortRef mp; + mach_port_t notify_port; + int notify_token; + CFRunLoopSourceRef rls; + uint32_t status; + + key = dns_configuration_notify_key(); + status = notify_register_mach_port(key, ¬ify_port, 0, ¬ify_token); + if (status != NOTIFY_STATUS_OK) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed")); + return; + } + + mp = CFMachPortCreateWithPort(NULL, notify_port, dnsinfo_notification, NULL, NULL); + if (mp == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed")); + (void)notify_cancel(notify_token); + return; + } + + rls = CFMachPortCreateRunLoopSource(NULL, mp, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(mp); + (void)notify_cancel(notify_token); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(mp); + return; +} + + +#pragma mark - +#pragma mark Network Configuration Change Events + + +#define NETWORKCHANGED_NOTIFY_KEY "com.apple.system.config.network_change" + +static void +network_notification(CFMachPortRef port, void *msg, CFIndex size, void *info) +{ + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s network_change notification"), + elapsed()); + + return; +} + + +static void +add_network_notification() +{ + CFMachPortRef mp; + mach_port_t notify_port; + int notify_token; + CFRunLoopSourceRef rls; + uint32_t status; + + status = notify_register_mach_port(NETWORKCHANGED_NOTIFY_KEY, + ¬ify_port, + 0, + ¬ify_token); + if (status != NOTIFY_STATUS_OK) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed")); + return; + } + + mp = CFMachPortCreateWithPort(NULL, notify_port, network_notification, NULL, NULL); + if (mp == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed")); + (void)notify_cancel(notify_token); + return; + } + + rls = CFMachPortCreateRunLoopSource(NULL, mp, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(mp); + (void)notify_cancel(notify_token); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(mp); + return; +} + + +#pragma mark - +#pragma mark SMB Configuration Events + + +#define SMBCONFIGURATION_NOTIFY_KEY "com.apple.system.SystemConfiguration.smb_configuration" + + +#if !TARGET_OS_EMBEDDED +static void +smbconf_notification(CFMachPortRef port, void *msg, CFIndex size, void *info) +{ + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, + CFSTR("%s smb.conf notification"), + elapsed()); + + return; +} + + +static void +add_smbconf_notification() +{ + CFMachPortRef mp; + mach_port_t notify_port; + int notify_token; + CFRunLoopSourceRef rls; + uint32_t status; + + status = notify_register_mach_port(SMBCONFIGURATION_NOTIFY_KEY, + ¬ify_port, + 0, + ¬ify_token); + if (status != NOTIFY_STATUS_OK) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed")); + return; + } + + mp = CFMachPortCreateWithPort(NULL, notify_port, smbconf_notification, NULL, NULL); + if (mp == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed")); + (void)notify_cancel(notify_token); + return; + } + + rls = CFMachPortCreateRunLoopSource(NULL, mp, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(mp); + (void)notify_cancel(notify_token); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(mp); + return; +} +#endif // !TARGET_OS_EMBEDDED + + +#pragma mark - +#pragma mark pututxline Events + + +#if !TARGET_OS_EMBEDDED +static const char * +ut_time(struct utmpx *utmpx) +{ + static char str[16]; + struct tm tm; + + (void)localtime_r(&utmpx->ut_tv.tv_sec, &tm); + snprintf(str, sizeof(str), "%2d:%02d:%02d.%03d", + tm.tm_hour, + tm.tm_min, + tm.tm_sec, + utmpx->ut_tv.tv_usec / 1000); + + return str; +} + + +static const char * +ut_id(struct utmpx *utmpx) +{ + char *cp; + static char str[16]; + + cp = utmpx->ut_id + sizeof(utmpx->ut_id); + while(--cp >= utmpx->ut_id && isprint(*cp)) {} + if(cp < utmpx->ut_id) { + snprintf(str, sizeof(str), "%-4.4s", utmpx->ut_id); + } else { + snprintf(str, sizeof(str), + "0x%2.2x%2.2x%2.2x%2.2x", + utmpx->ut_id[0], + utmpx->ut_id[1], + utmpx->ut_id[2], + utmpx->ut_id[3]); + } + + return str; +} + + +static const char * +ut_pid(struct utmpx *utmpx) +{ + static char pid[16]; + + snprintf(pid, sizeof(pid), "%d", utmpx->ut_pid); + + return pid; +} + + +static void +pututxline_notification(CFMachPortRef port, void *msg, CFIndex size, void *info) +{ + CFMutableStringRef str = CFStringCreateMutable(NULL, 0); + struct utmpx *utmpx; + + CFStringAppendFormat(str, + NULL, + CFSTR("%s pututxline notification"), + elapsed()); + + setutxent(); + while ((utmpx = getutxent()) != NULL) { + const char * entry_id = NULL; + const char * entry_line = NULL; + const char * entry_pid = NULL; + const char * entry_tv = NULL; + const char * entry_type; + const char * entry_user = NULL; + char line[128]; + int n; + + switch (utmpx->ut_type) { + case BOOT_TIME : // Time of a system boot. + entry_type = "Boot"; + entry_tv = ut_time(utmpx); + break; + case DEAD_PROCESS : // A session leader exited. + entry_type = "Dead process"; + entry_id = ut_id (utmpx); + entry_pid = ut_pid (utmpx); + entry_tv = ut_time(utmpx); + break; + case EMPTY : // No valid user accounting information. + continue; + case INIT_PROCESS : // A process spawned by init(8). + entry_type = "Init process"; + entry_id = ut_id (utmpx); + entry_pid = ut_pid (utmpx); + entry_tv = ut_time(utmpx); + break; + case LOGIN_PROCESS : // The session leader of a logged-in user. + entry_type = "Login"; + entry_id = ut_id (utmpx); + entry_user = utmpx->ut_user; + entry_pid = ut_pid (utmpx); + entry_tv = ut_time(utmpx); + break; + case NEW_TIME : // Time after system clock change. + entry_type = "New time"; + entry_tv = ut_time(utmpx); + break; + case OLD_TIME : // Time before system clock change. + entry_type = "Old time"; + entry_tv = ut_time(utmpx); + break; + case RUN_LVL : // Run level. Provided for compatibility, not used. + entry_type = "Run level"; + break; + case USER_PROCESS : // A user process. + entry_type = "User Process"; + entry_id = ut_id (utmpx); + entry_user = utmpx->ut_user; + entry_line = utmpx->ut_line; + entry_pid = ut_pid (utmpx); + entry_tv = ut_time(utmpx); + break; + case SHUTDOWN_TIME : // Time of system shutdown + entry_type = "Shutdown time"; + entry_tv = ut_time(utmpx); + break; + default : + entry_type = "Unknown"; + break; + } + + snprintf(line, sizeof(line), + // type time id=0x12345678 pid=12345 user=abcdefgh line + "\n%-13s %2s%12s %3s%-10s %4s%-5s %5s%-8s %5s%s", + entry_type, + entry_tv != NULL ? "@ " : "", + entry_tv != NULL ? entry_tv : "", // hh:mm:ss.ddd + entry_id != NULL ? "id=" : "", + entry_id != NULL ? entry_id : "", // 0x12345678 + entry_pid != NULL ? "pid=" : "", + entry_pid != NULL ? entry_pid : "", // ##### + entry_user != NULL ? "user=" : "", + entry_user != NULL ? entry_user : "", // <=256 chars + entry_line != NULL ? "line=" : "", + entry_line != NULL ? entry_line : "" // <= 32 chars + ); + + n = strlen(line) - 1; + while ((n > 0) && (line[n] == ' ')) { + line[n] = '\0'; + --n; + } + + CFStringAppendFormat(str, NULL, CFSTR("%s"), line); + } + endutxent(); + + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str); + CFRelease(str); + return; +} + + +static void +add_pututxline_notification() +{ + CFMachPortRef mp; + mach_port_t notify_port; + int notify_token; + CFRunLoopSourceRef rls; + uint32_t status; + + status = notify_register_mach_port(UTMPX_CHANGE_NOTIFICATION, ¬ify_port, 0, ¬ify_token); + if (status != NOTIFY_STATUS_OK) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed")); + return; + } + + mp = CFMachPortCreateWithPort(NULL, notify_port, pututxline_notification, NULL, NULL); + if (mp == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed")); + (void)notify_cancel(notify_token); + return; + } + + rls = CFMachPortCreateRunLoopSource(NULL, mp, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(mp); + (void)notify_cancel(notify_token); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(mp); + return; +} +#endif // !TARGET_OS_EMBEDDED + + +#pragma mark - +#pragma mark BackToMyMac Status Events + + +#ifndef kDSStdNotifyBTMMStatusChanged +#define kDSStdNotifyBTMMStatusChanged "State:/Network/BackToMyMac" +#endif + + +#if !TARGET_OS_EMBEDDED +static void +BTMM_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context) +{ + CFIndex i; + CFIndex n; + CFMutableStringRef str = CFStringCreateMutable(NULL, 0); + + CFStringAppendFormat(str, + NULL, + CFSTR("%s SCDynamicStore Back to My Mac notification"), + elapsed()); + + n = CFArrayGetCount(changedKeys); + for (i = 0; i < n; i++) { + CFStringRef key; + CFDictionaryRef dict; + + key = CFArrayGetValueAtIndex(changedKeys, i); + dict = SCDynamicStoreCopyValue(store, key); + if (dict != NULL) { + CFStringRef val; + + val = _SCCopyDescription(dict, NULL); + CFStringAppendFormat(str, NULL, CFSTR("\n%@ : %@"), key, val); + CFRelease(val); + CFRelease(dict); + } else { + CFStringAppendFormat(str, NULL, CFSTR("\n%@ : removed"), key); + } + } + + SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str); + CFRelease(str); + return; +} + + +static void +add_BTMM_notification() +{ + CFStringRef key; + CFMutableArrayRef keys; + Boolean ok; + SCDynamicStoreRef store; + CFRunLoopSourceRef rls; + + store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-BackToMyMac"), BTMM_notification, NULL); + if (store == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed")); + return; + } + + keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + + key = CFSTR(kDSStdNotifyBTMMStatusChanged); + CFArrayAppendValue(keys, key); + + ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL); + CFRelease(keys); + if (!ok) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed")); + CFRelease(store); + return; + } + + rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1); + if (rls == NULL) { + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed")); + CFRelease(store); + return; + } + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRelease(store); + return; +} +#endif // !TARGET_OS_EMBEDDED + + +#pragma mark - + + +static inline Boolean +bValFromDictionary(CFDictionaryRef dict, CFStringRef key) +{ + CFBooleanRef bVal; + Boolean result = FALSE; + + if ((dict != NULL) && + CFDictionaryGetValueIfPresent(dict, key, (const void **)&bVal) && + isA_CFBoolean(bVal)) { + result = CFBooleanGetValue(bVal); + } + + return result; +} + + +void +load(CFBundleRef bundle, Boolean bundleVerbose) +{ + CFDictionaryRef config; + Boolean log_all; + + verbose = bundleVerbose; + + log_msg = asl_new(ASL_TYPE_MSG); + asl_set(log_msg, ASL_KEY_FACILITY, MY_ASL_FACILITY); + + elapsed(); + + config = CFBundleGetInfoDictionary(bundle); + config = isA_CFDictionary(config); + log_all = bValFromDictionary(config, CFSTR("LOG_ALL")); + +#ifdef kIOPMMessageSleepWakeUUIDChange + if (log_all || bValFromDictionary(config, CFSTR("LOG_IO_WAKEUUID_EVENTS"))) { + add_wake_uuid_notification(); + } +#endif // kIOPMMessageSleepWakeUUIDChange + + if (log_all || bValFromDictionary(config, CFSTR("LOG_IO_SYSTEMPOWER_EVENTS"))) { + add_power_notification(); + } + + if (log_all || bValFromDictionary(config, CFSTR("LOG_NETWORK_KERNEL_EVENTS"))) { + add_KernelEvent_notification(); + } + + if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_DNS_CONFIGURATION"))) { + add_dnsinfo_notification(); + } + + if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_NETWORK_CHANGE"))) { + add_network_notification(); + } + +#if !TARGET_OS_EMBEDDED + if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_SMB_CONFIGURATION"))) { + add_smbconf_notification(); + } +#endif // !TARGET_OS_EMBEDDED + +#if !TARGET_OS_EMBEDDED + if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_UTMPX_CHANGE"))) { + add_pututxline_notification(); + } +#endif // !TARGET_OS_EMBEDDED + +#if !TARGET_OS_EMBEDDED + if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_BTMM_CONFIGURATION"))) { + add_BTMM_notification(); + } +#endif // !TARGET_OS_EMBEDDED + +#if !TARGET_OS_EMBEDDED + if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_CONSOLEUSER"))) { + add_console_notification(); + } +#endif // !TARGET_OS_EMBEDDED + +#if !TARGET_OS_EMBEDDED + if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_DIRECTORYSERVICES_SEARCHPOLICY"))) { + add_DirectoryServices_notification(); + } +#endif // !TARGET_OS_EMBEDDED + + if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_NETWORKCHANGE"))) { + add_NetworkChange_notification(); + } + + if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_PRIMARYSERVICE"))) { + add_PrimaryService_notification(); + } + + if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_REACHABILITY"))) { + CFArrayRef hosts = NULL; + + if ((config == NULL) || + !CFDictionaryGetValueIfPresent(config, CFSTR("LOG_SC_REACHABILITY_HOSTS"), (const void **)&hosts) || + !isA_CFArray(hosts) || + (CFArrayGetCount(hosts) == 0)) { + hosts = NULL; + } + + add_reachability_notification(hosts); + } + + return; +} + +#ifdef MAIN + +int +main(int argc, char **argv) +{ + _sc_log = FALSE; + _sc_verbose = (argc > 1) ? TRUE : FALSE; + _sc_debug = TRUE; + + load(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE); + CFRunLoopRun(); + /* not reached */ + exit(0); + return 0; +} + +#endif /* MAIN */ diff --git a/Plugins/NetworkIdentification/Info.plist b/Plugins/NetworkIdentification/Info.plist index 1651cef..78e6222 100644 --- a/Plugins/NetworkIdentification/Info.plist +++ b/Plugins/NetworkIdentification/Info.plist @@ -11,15 +11,15 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - SystemConfiguration + com.apple.SystemConfiguration.NetworkIdentification CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 + 1.10 Builtin diff --git a/Plugins/NetworkIdentification/NetworkIdentification.c b/Plugins/NetworkIdentification/NetworkIdentification.c index c5444df..3f5ad51 100644 --- a/Plugins/NetworkIdentification/NetworkIdentification.c +++ b/Plugins/NetworkIdentification/NetworkIdentification.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. + * Copyright (c) 2005-2007, 2009 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -965,7 +965,6 @@ ServiceWatcherUpdate(ServiceWatcherRef watcher, Boolean update_signatures) CFArrayInsertValueAtIndex(watcher->signatures, 0, new_sig_dict); CFRelease(new_sig_dict); - sig_dict = new_sig_dict; save_signatures = TRUE; } active_dict @@ -1216,17 +1215,6 @@ load_NetworkIdentification(CFBundleRef bundle, Boolean bundleVerbose) return; } -__private_extern__ -void -stop_NetworkIdentification(CFRunLoopSourceRef stopRls) -{ - if (S_watcher != NULL) { - ServiceWatcherSaveSignatures(S_watcher); - } - CFRunLoopSourceSignal(stopRls); -} - - #ifdef TEST_NETWORKIDENTIFICATION #undef TEST_NETWORKIDENTIFICATION diff --git a/Plugins/PreferencesMonitor/Info.plist b/Plugins/PreferencesMonitor/Info.plist index 80aa625..722d017 100644 --- a/Plugins/PreferencesMonitor/Info.plist +++ b/Plugins/PreferencesMonitor/Info.plist @@ -11,15 +11,15 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - SystemConfiguration + com.apple.SystemConfiguration.PreferencesMonitor CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 + 1.10 Builtin Requires diff --git a/Plugins/PreferencesMonitor/prefsmon.c b/Plugins/PreferencesMonitor/prefsmon.c index 5466f22..637f827 100644 --- a/Plugins/PreferencesMonitor/prefsmon.c +++ b/Plugins/PreferencesMonitor/prefsmon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -35,6 +35,7 @@ */ +#include #include #include #include @@ -65,14 +66,16 @@ static CFMutableArrayRef removedPrefsKeys; /* old prefs keys to be removed */ static Boolean _verbose = FALSE; -static void +static Boolean establishNewPreferences() { CFBundleRef bundle; + SCNetworkSetRef current = NULL; Boolean ok = FALSE; int sc_status = kSCStatusFailed; SCNetworkSetRef set = NULL; CFStringRef setName = NULL; + Boolean updated = FALSE; while (TRUE) { ok = SCPreferencesLock(prefs, TRUE); @@ -82,40 +85,47 @@ establishNewPreferences() sc_status = SCError(); if (sc_status == kSCStatusStale) { - (void) SCPreferencesSynchronize(prefs); + SCPreferencesSynchronize(prefs); } else { SCLog(TRUE, LOG_ERR, CFSTR("Could not acquire network configuration lock: %s"), SCErrorString(sc_status)); - return; + return FALSE; } } - set = SCNetworkSetCreate(prefs); - if (set == NULL) { - ok = FALSE; - sc_status = SCError(); - goto done; + current = SCNetworkSetCopyCurrent(prefs); + if (current != NULL) { + set = current; } - bundle = _SC_CFBundleGet(); - if (bundle != NULL) { - setName = CFBundleCopyLocalizedString(bundle, - CFSTR("DEFAULT_SET_NAME"), - CFSTR("Automatic"), - NULL); - } + if (set == NULL) { + set = SCNetworkSetCreate(prefs); + if (set == NULL) { + ok = FALSE; + sc_status = SCError(); + goto done; + } - ok = SCNetworkSetSetName(set, (setName != NULL) ? setName : CFSTR("Automatic")); - if (!ok) { - sc_status = SCError(); - goto done; - } + bundle = _SC_CFBundleGet(); + if (bundle != NULL) { + setName = CFBundleCopyLocalizedString(bundle, + CFSTR("DEFAULT_SET_NAME"), + CFSTR("Automatic"), + NULL); + } - ok = SCNetworkSetSetCurrent(set); - if (!ok) { - sc_status = SCError(); - goto done; + ok = SCNetworkSetSetName(set, (setName != NULL) ? setName : CFSTR("Automatic")); + if (!ok) { + sc_status = SCError(); + goto done; + } + + ok = SCNetworkSetSetCurrent(set); + if (!ok) { + sc_status = SCError(); + goto done; + } } ok = SCNetworkSetEstablishDefaultConfiguration(set); @@ -130,6 +140,7 @@ establishNewPreferences() ok = SCPreferencesCommitChanges(prefs); if (ok) { SCLog(TRUE, LOG_NOTICE, CFSTR("New network configuration saved")); + updated = TRUE; } else { sc_status = SCError(); if (sc_status == EROFS) { @@ -140,7 +151,7 @@ establishNewPreferences() /* apply (committed or temporary/read-only) changes */ (void) SCPreferencesApplyChanges(prefs); - } else if (set != NULL) { + } else if ((current == NULL) && (set != NULL)) { (void) SCNetworkSetRemove(set); } @@ -153,28 +164,35 @@ establishNewPreferences() (void)SCPreferencesUnlock(prefs); if (setName != NULL) CFRelease(setName); if (set != NULL) CFRelease(set); - return; + return updated; } static Boolean -quiet() +quiet(Boolean *timeout) { CFDictionaryRef dict; - Boolean quiet = FALSE; + Boolean _quiet = FALSE; + Boolean _timeout = FALSE; // check if quiet dict = SCDynamicStoreCopyValue(store, initKey); if (dict != NULL) { - if (isA_CFDictionary(dict) && - (CFDictionaryContainsKey(dict, CFSTR("*QUIET*")) || - CFDictionaryContainsKey(dict, CFSTR("*TIMEOUT*")))) { - quiet = TRUE; + if (isA_CFDictionary(dict)) { + if (CFDictionaryContainsKey(dict, CFSTR("*QUIET*"))) { + _quiet = TRUE; + } + if (CFDictionaryContainsKey(dict, CFSTR("*TIMEOUT*"))) { + _timeout = TRUE; + } } CFRelease(dict); } - return quiet; + if (timeout != NULL) { + *timeout = _timeout; + } + return _quiet; } @@ -215,8 +233,8 @@ watchQuietEnable() ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL); CFRelease(keys); if (!ok) { - SCPrint(TRUE, stderr, - CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s\n"), SCErrorString(SCError())); + SCLog(TRUE, LOG_ERR, + CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s\n"), SCErrorString(SCError())); watchQuietDisable(); } @@ -226,9 +244,26 @@ watchQuietEnable() static void watchQuietCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info) { - if (quiet()) { + Boolean _quiet; + Boolean _timeout = FALSE; + + _quiet = quiet(&_timeout); + if (_quiet +#if !TARGET_OS_IPHONE + || _timeout +#endif /* !TARGET_OS_IPHONE */ + ) { watchQuietDisable(); - establishNewPreferences(); + } + + if (_quiet || _timeout) { + static int logged = 0; + + (void) establishNewPreferences(); + if (_timeout && (logged++ == 0)) { + SCLog(TRUE, LOG_NOTICE, + CFSTR("Network configuration creation timed out waiting for IORegistry")); + } } return; @@ -554,6 +589,7 @@ updateConfiguration(SCPreferencesRef prefs, { +#if !TARGET_OS_IPHONE if ((notificationType & kSCPreferencesNotificationCommit) == kSCPreferencesNotificationCommit) { SCNetworkSetRef current; @@ -564,6 +600,7 @@ updateConfiguration(SCPreferencesRef prefs, CFRelease(current); } } +#endif /* !TARGET_OS_IPHONE */ if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) { return; @@ -581,36 +618,6 @@ updateConfiguration(SCPreferencesRef prefs, } -__private_extern__ -void -stop_PreferencesMonitor(CFRunLoopSourceRef stopRls) -{ - // cleanup - - watchQuietDisable(); - - if (prefs != NULL) { - if (!SCPreferencesUnscheduleFromRunLoop(prefs, - CFRunLoopGetCurrent(), - kCFRunLoopDefaultMode)) { - SCLog(TRUE, LOG_ERR, - CFSTR("SCPreferencesUnscheduleFromRunLoop() failed: %s"), - SCErrorString(SCError())); - } - CFRelease(prefs); - prefs = NULL; - } - - if (store != NULL) { - CFRelease(store); - store = NULL; - } - - CFRunLoopSourceSignal(stopRls); - return; -} - - __private_extern__ void prime_PreferencesMonitor() diff --git a/SCMonitor/English.lproj/Localizable.strings b/SCMonitor/English.lproj/Localizable.strings index bc1126f6f1db85db535961cc50786f2e528a5c72..254469037da82dfcc7cc9eed965dc5cbdea2726e 100644 GIT binary patch literal 1608 zcmbW1Pfr3d5XI-rr)W0OlhJrKCL$6&$Vx^6k~%Ygt)=)s-~c&Q7PD zH#2Yg@o5!1VT9S)gT30&Qgf_*>sXI@#{QT!WpwNX$=MRCgyGP?D*Tpaq7S>nAeEr+%m#i z*o0)4rwMzC>5Tn4w+i)ah4Bd8qqXevkG%%52-(3_ zAjIc<5j!C(%hg&gJI;Q~OGHHS+`wmxQMGHN%(wi?v#PB8w2_rPt^cWzY^TJV$CCOC zI9tGmV|E^}a8y%y30mj#9N4v86XkH>?VZK`)S4?zYSV`&s*xBWwxoCo(eB6KBHoTc zk$`ka90`8@%i_>G9ed|&874c=g9Lx6&(xGScX3wtt~o9ah~GWWz#g(RVo=sIn+#}? z)eMjNLT5H@>ev+XH}))9^H)_W$K8BR@|@Z3>mvRNy*Rqb-~lYtJ2dsVneaN5;qgyA ze{s1D>xytGV|iS%)mOxR@m7`F=6~v6k$pQLvO8${EXECUTABLE_NAME} CFBundlePackageType BNDL + CFBundleShortVersionString + 1.10 CFBundleSignature ???? - CFBundleShortVersionString - 1.9.2 CFBundleVersion - 1.9.2 + 1.10 CFPlugInDynamicRegistration NO CFPlugInFactories @@ -36,5 +36,7 @@ CFPlugInUnloadFunction + LimitLoadToSessionType + Aqua diff --git a/SCMonitor/monitor.c b/SCMonitor/monitor.c index 0afa500..17b347d 100644 --- a/SCMonitor/monitor.c +++ b/SCMonitor/monitor.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2007-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -31,30 +31,69 @@ #include #include #include +#include #include #include #include +#include +#include #include #include "UserEventAgentInterface.h" -#define MY_BUNDLE_ID CFSTR("com.apple.SystemConfiguration.SCMonitor") +#define MY_BUNDLE_ID "com.apple.SystemConfiguration.SCMonitor" #define MY_ICON_PATH "/System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns" #define NETWORK_PREF_APP "/System/Library/PreferencePanes/Network.prefPane" #define NETWORK_PREF_CMD "New Interface" +/* + * The following keys/values control the actions taken when a new interface + * has been detected and whether we interact with the user. + * + * The keys/values can be provided globally (in SCMonitor.plugin's Info.plist + * file) or per-inteface in the IORegistry. + * + * For the "New Interface Detected Action" key we define the following [CFString] + * values : + * + * "None" No action, ignore this interface. + * "Prompt" Post a "new interface detected" notification to the user. + * "Configure" Automatically configure this interface without any + * intervention. + * + * Note: automatic configuration may require authorization if the logged + * in user is NOT "root" (eUID==0) or if the "system.preferences" + * administrator right is not currently available. + * + * An [older] "User Intervention" key is also supported. That CFBoolean + * key, if present and TRUE, implies "Configure" configuration of the + * interface without intervention. + */ + typedef struct { UserEventAgentInterfaceStruct *_UserEventAgentInterface; CFUUIDRef _factoryID; UInt32 _refCount; - Boolean no_user_intervention; + aslmsg log_msg; + + CFStringRef configuration_action; CFRunLoopSourceRef monitorRls; - CFMutableSetRef knownInterfaces; + IONotificationPortRef notifyPort; + io_iterator_t notifyIterator; + CFMutableArrayRef notifyNodes; + + // interfaces that we already know about + CFMutableSetRef interfaces_known; + + // interfaces that should be auto-configured (no user notification) + CFMutableArrayRef interfaces_configure; + + // interfaces that require user notification + CFMutableArrayRef interfaces_prompt; - CFMutableArrayRef userInterfaces; CFUserNotificationRef userNotification; CFRunLoopSourceRef userRls; } MyType; @@ -63,11 +102,11 @@ static CFMutableDictionaryRef notify_to_instance = NULL; #pragma mark - -#pragma mark Watch for new [network] interfaces +#pragma mark New interface notification / configuration static void -open_NetworkPrefPane(void) +open_NetworkPrefPane(MyType *myInstance) { AEDesc aeDesc = { typeNull, NULL }; CFArrayRef prefArray; @@ -87,7 +126,7 @@ open_NetworkPrefPane(void) strlen(NETWORK_PREF_CMD), &aeDesc); if (status != noErr) { - SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: AECreateDesc() failed: %d"), status); + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: AECreateDesc() failed: %d"), status); } prefSpec.appURL = NULL; @@ -98,7 +137,7 @@ open_NetworkPrefPane(void) status = LSOpenFromURLSpec(&prefSpec, NULL); if (status != noErr) { - SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: LSOpenFromURLSpec() failed: %d"), status); + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: LSOpenFromURLSpec() failed: %d"), status); } CFRelease(prefArray); @@ -110,9 +149,14 @@ open_NetworkPrefPane(void) static void notify_remove(MyType *myInstance, Boolean cancel) { - if (myInstance->userInterfaces != NULL) { - CFRelease(myInstance->userInterfaces); - myInstance->userInterfaces = NULL; + if (myInstance->interfaces_configure != NULL) { + CFRelease(myInstance->interfaces_configure); + myInstance->interfaces_configure = NULL; + } + + if (myInstance->interfaces_prompt != NULL) { + CFRelease(myInstance->interfaces_prompt); + myInstance->interfaces_prompt = NULL; } if (myInstance->userRls != NULL) { @@ -127,7 +171,7 @@ notify_remove(MyType *myInstance, Boolean cancel) status = CFUserNotificationCancel(myInstance->userNotification); if (status != 0) { - SCLog(TRUE, LOG_ERR, + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: CFUserNotificationCancel() failed, status=%d"), status); } @@ -157,7 +201,7 @@ notify_reply(CFUserNotificationRef userNotification, CFOptionFlags response_flag } } if (myInstance == NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: can't find user notification")); + SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCMonitor: can't find user notification")); return; } @@ -165,7 +209,7 @@ notify_reply(CFUserNotificationRef userNotification, CFOptionFlags response_flag switch (response_flags & 0x3) { case kCFUserNotificationDefaultResponse: // user asked to configure interface - open_NetworkPrefPane(); + open_NetworkPrefPane(myInstance); break; default: // user cancelled @@ -184,19 +228,18 @@ notify_add(MyType *myInstance) CFMutableDictionaryRef dict = NULL; SInt32 error = 0; CFIndex i; - CFMutableArrayRef message; - CFIndex n = CFArrayGetCount(myInstance->userInterfaces); + CFIndex n = CFArrayGetCount(myInstance->interfaces_prompt); CFURLRef url = NULL; if (myInstance->userNotification != NULL) { CFMutableArrayRef save = NULL; if (n > 0) { - CFRetain(myInstance->userInterfaces); - save = myInstance->userInterfaces; + CFRetain(myInstance->interfaces_prompt); + save = myInstance->interfaces_prompt; } notify_remove(myInstance, TRUE); - myInstance->userInterfaces = save; + myInstance->interfaces_prompt = save; if (n == 0) { return; } @@ -208,16 +251,27 @@ notify_add(MyType *myInstance) &kCFTypeDictionaryValueCallBacks); // set localization URL - bundle = CFBundleGetBundleWithIdentifier(MY_BUNDLE_ID); + bundle = CFBundleGetBundleWithIdentifier(CFSTR(MY_BUNDLE_ID)); if (bundle != NULL) { url = CFBundleCopyBundleURL(bundle); } +#ifdef MAIN + if (url == NULL) { + url = CFURLCreateFromFileSystemRepresentation(NULL, + (const UInt8 *)"/System/Library/UserEventPlugins/SCMonitor.plugin", + strlen("/System/Library/UserEventPlugins/SCMonitor.plugin"), + FALSE); + if (bundle == NULL) { + bundle = CFBundleCreate(NULL, url); + } + } +#endif // MAIN if (url != NULL) { // set URL CFDictionarySetValue(dict, kCFUserNotificationLocalizationURLKey, url); CFRelease(url); } else { - SCLog(TRUE, LOG_NOTICE, CFSTR("SCMonitor: can't find bundle")); + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: can't find bundle")); goto done; } @@ -237,29 +291,44 @@ notify_add(MyType *myInstance) (n == 1) ? CFSTR("HEADER_1") : CFSTR("HEADER_N")); // message - message = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); - CFArrayAppendValue(message, - (n == 1) ? CFSTR("MESSAGE_S1") : CFSTR("MESSAGE_SN")); - for (i = 0; i < n; i++) { + if (n == 1) { + CFStringRef format; SCNetworkInterfaceRef interface; + CFStringRef message; CFStringRef name; - interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, i); +#define MESSAGE_1 "The \"%@\" network interface has not been set up. To set up this interface, use Network Preferences." + + format = CFBundleCopyLocalizedString(bundle, + CFSTR("MESSAGE_1"), + CFSTR(MESSAGE_1), + NULL); + interface = CFArrayGetValueAtIndex(myInstance->interfaces_prompt, 0); name = SCNetworkInterfaceGetLocalizedDisplayName(interface); - if (n == 1) { - CFArrayAppendValue(message, name); - } else { - CFStringRef str; + message = CFStringCreateWithFormat(NULL, NULL, format, name); + CFDictionarySetValue(dict, kCFUserNotificationAlertMessageKey, message); + CFRelease(message); + CFRelease(format); + } else { + CFMutableArrayRef message; + message = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + CFArrayAppendValue(message, CFSTR("MESSAGE_SN")); + for (i = 0; i < n; i++) { + SCNetworkInterfaceRef interface; + CFStringRef name; + CFStringRef str; + + interface = CFArrayGetValueAtIndex(myInstance->interfaces_prompt, i); + name = SCNetworkInterfaceGetLocalizedDisplayName(interface); str = CFStringCreateWithFormat(NULL, NULL, CFSTR("\r\t%@"), name); CFArrayAppendValue(message, str); CFRelease(str); } + CFArrayAppendValue(message, CFSTR("MESSAGE_EN")); + CFDictionarySetValue(dict, kCFUserNotificationAlertMessageKey, message); + CFRelease(message); } - CFArrayAppendValue(message, - (n == 1) ? CFSTR("MESSAGE_E1") : CFSTR("MESSAGE_EN")); - CFDictionarySetValue(dict, kCFUserNotificationAlertMessageKey, message); - CFRelease(message); // button titles CFDictionaryAddValue(dict, kCFUserNotificationDefaultButtonTitleKey, CFSTR("OPEN_NP")); @@ -272,7 +341,7 @@ notify_add(MyType *myInstance) &error, dict); if (myInstance->userNotification == NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: CFUserNotificationCreate() failed, %d"), error); + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: CFUserNotificationCreate() failed, %d"), error); goto done; } @@ -282,7 +351,7 @@ notify_add(MyType *myInstance) notify_reply, 0); if (myInstance->userRls == NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: CFUserNotificationCreateRunLoopSource() failed")); + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: CFUserNotificationCreateRunLoopSource() failed")); CFRelease(myInstance->userNotification); myInstance->userNotification = NULL; goto done; @@ -310,7 +379,7 @@ notify_configure(MyType *myInstance) { AuthorizationRef authorization = NULL; CFIndex i; - CFIndex n; + CFIndex n = CFArrayGetCount(myInstance->interfaces_configure); Boolean ok; SCPreferencesRef prefs = NULL; SCNetworkSetRef set = NULL; @@ -326,8 +395,8 @@ notify_configure(MyType *myInstance) flags, &authorization); if (status != errAuthorizationSuccess) { - SCLog(TRUE, LOG_ERR, - CFSTR("AuthorizationCreate() failed: status = %d\n"), + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, + CFSTR("AuthorizationCreate() failed: status = %d"), status); return; } @@ -343,38 +412,37 @@ notify_configure(MyType *myInstance) } } - n = CFArrayGetCount(myInstance->userInterfaces); for (i = 0; i < n; i++) { SCNetworkInterfaceRef interface; - - interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, i); + + interface = CFArrayGetValueAtIndex(myInstance->interfaces_configure, i); ok = SCNetworkSetEstablishDefaultInterfaceConfiguration(set, interface); if (ok) { CFStringRef name; name = SCNetworkInterfaceGetLocalizedDisplayName(interface); - SCLog(TRUE, LOG_NOTICE, CFSTR("add service for %@"), name); + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_NOTICE, CFSTR("add service for %@"), name); } } - + ok = SCPreferencesCommitChanges(prefs); if (!ok) { - SCLog(TRUE, LOG_ERR, - CFSTR("SCPreferencesCommitChanges() failed: %s\n"), + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, + CFSTR("SCPreferencesCommitChanges() failed: %s"), SCErrorString(SCError())); - goto done; - } - - ok = SCPreferencesApplyChanges(prefs); + goto done; + } + + ok = SCPreferencesApplyChanges(prefs); if (!ok) { - SCLog(TRUE, LOG_ERR, - CFSTR("SCPreferencesApplyChanges() failed: %s\n"), + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, + CFSTR("SCPreferencesApplyChanges() failed: %s"), SCErrorString(SCError())); - goto done; - } + goto done; + } done : - + if (set != NULL) { CFRelease(set); set = NULL; @@ -384,29 +452,32 @@ notify_configure(MyType *myInstance) CFRelease(prefs); prefs = NULL; } - - if (authorization != NULL) { - AuthorizationFree(authorization, kAuthorizationFlagDefaults); - // AuthorizationFree(authorization, kAuthorizationFlagDestroyRights); - authorization = NULL; - } - - CFRelease(myInstance->userInterfaces); - myInstance->userInterfaces = NULL; - + + if (authorization != NULL) { + AuthorizationFree(authorization, kAuthorizationFlagDefaults); +// AuthorizationFree(authorization, kAuthorizationFlagDestroyRights); + authorization = NULL; + } + + CFRelease(myInstance->interfaces_configure); + myInstance->interfaces_configure = NULL; + return; } +#pragma mark - + + static void -updateInterfaceList(SCDynamicStoreRef store, CFArrayRef changes, void * arg) +updateInterfaceList(MyType *myInstance) { + Boolean changed = FALSE; CFIndex i; CFArrayRef interfaces; - MyType *myInstance = (MyType *)arg; + CFMutableSetRef interfaces_old = NULL; CFIndex n; SCPreferencesRef prefs; - CFMutableSetRef previouslyKnown = NULL; SCNetworkSetRef set = NULL; prefs = SCPreferencesCreate(NULL, CFSTR("SCMonitor"), NULL); @@ -422,139 +493,150 @@ updateInterfaceList(SCDynamicStoreRef store, CFArrayRef changes, void * arg) } } - previouslyKnown = CFSetCreateMutableCopy(NULL, 0, myInstance->knownInterfaces); + interfaces_old = CFSetCreateMutableCopy(NULL, 0, myInstance->interfaces_known); interfaces = SCNetworkInterfaceCopyAll(); if (interfaces != NULL) { - n = CFArrayGetCount(interfaces); for (i = 0; i < n; i++) { - CFStringRef bsdName; SCNetworkInterfaceRef interface; Boolean ok; interface = CFArrayGetValueAtIndex(interfaces, i); - bsdName = SCNetworkInterfaceGetBSDName(interface); - if (bsdName == NULL) { - // if no BSD name + + if (_SCNetworkInterfaceIsBuiltin(interface)) { + // skip built-in interfaces continue; } - CFSetRemoveValue(previouslyKnown, bsdName); - - if (CFSetContainsValue(myInstance->knownInterfaces, bsdName)) { - // if known interface + // track new vs. old (removed) interfaces + CFSetRemoveValue(interfaces_old, interface); + if (CFSetContainsValue(myInstance->interfaces_known, interface)) { + // if we already know about this interface continue; } - - CFSetAddValue(myInstance->knownInterfaces, bsdName); + CFSetAddValue(myInstance->interfaces_known, interface); + changed = TRUE; ok = SCNetworkSetEstablishDefaultInterfaceConfiguration(set, interface); if (ok) { + CFStringRef action; + // this is a *new* interface - if (myInstance->userInterfaces == NULL) { - myInstance->userInterfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + + action = _SCNetworkInterfaceGetConfigurationAction(interface); + if (action == NULL) { + // if no per-interface action, use [global] default + action = myInstance->configuration_action; + } + if ((action == NULL) || + (!CFEqual(action, kSCNetworkInterfaceConfigurationActionValueNone) && + !CFEqual(action, kSCNetworkInterfaceConfigurationActionValueConfigure))) { + action = kSCNetworkInterfaceConfigurationActionValuePrompt; + } + + if (CFEqual(action, kSCNetworkInterfaceConfigurationActionValueNone)) { + continue; + } else if (CFEqual(action, kSCNetworkInterfaceConfigurationActionValueConfigure)) { + // configure automatically (without user intervention) + if (myInstance->interfaces_configure == NULL) { + myInstance->interfaces_configure = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + } + CFArrayAppendValue(myInstance->interfaces_configure, interface); + } else { + // notify user + if (myInstance->interfaces_prompt == NULL) { + myInstance->interfaces_prompt = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + } + CFArrayAppendValue(myInstance->interfaces_prompt, interface); } - CFArrayAppendValue(myInstance->userInterfaces, interface); } } CFRelease(interfaces); } - n = CFSetGetCount(previouslyKnown); + // remove any posted notifications for network interfaces that have been removed + n = CFSetGetCount(interfaces_old); if (n > 0) { - const void * names_q[32]; - const void ** names = names_q; + const void * paths_q[32]; + const void ** paths = paths_q; - if (n > (CFIndex)(sizeof(names_q) / sizeof(CFTypeRef))) - names = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0); - CFSetGetValues(previouslyKnown, names); + if (n > (CFIndex)(sizeof(paths_q) / sizeof(CFTypeRef))) + paths = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0); + CFSetGetValues(interfaces_old, paths); for (i = 0; i < n; i++) { - if (myInstance->userInterfaces != NULL) { + if (myInstance->interfaces_prompt != NULL) { CFIndex j; - j = CFArrayGetCount(myInstance->userInterfaces); - while (--j >= 0) { - CFStringRef bsdName; + j = CFArrayGetCount(myInstance->interfaces_prompt); + while (j > 0) { SCNetworkInterfaceRef interface; - interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, j); - bsdName = SCNetworkInterfaceGetBSDName(interface); - if (CFEqual(bsdName, names[i])) { + j--; + interface = CFArrayGetValueAtIndex(myInstance->interfaces_prompt, j); + if (CFEqual(interface, paths[i])) { // if we have previously posted a notification // for this no-longer-present interface - CFArrayRemoveValueAtIndex(myInstance->userInterfaces, j); + CFArrayRemoveValueAtIndex(myInstance->interfaces_prompt, j); + changed = TRUE; } } } - CFSetRemoveValue(myInstance->knownInterfaces, names[i]); + CFSetRemoveValue(myInstance->interfaces_known, paths[i]); } - if (names != names_q) CFAllocatorDeallocate(NULL, names); + if (paths != paths_q) CFAllocatorDeallocate(NULL, paths); } done : - if (myInstance->userInterfaces != NULL) { - if (myInstance->no_user_intervention) { - // add network services for new interfaces + if (changed) { + if (myInstance->interfaces_configure != NULL) { + // if we have network services to configure automatically notify_configure(myInstance); - } else { - // post notification + } + + if (myInstance->interfaces_prompt != NULL) { + // if we have network services that require user intervention + // post notification for new interfaces notify_add(myInstance); } } + if (interfaces_old != NULL) CFRelease(interfaces_old); if (set != NULL) CFRelease(set); CFRelease(prefs); return; } +#pragma mark - +#pragma mark Watch for new [network] interfaces + + static void -watcher_remove(MyType *myInstance) +update_lan(SCDynamicStoreRef store, CFArrayRef changes, void * arg) { - if (myInstance->monitorRls != NULL) { - CFRunLoopSourceInvalidate(myInstance->monitorRls); - CFRelease(myInstance->monitorRls); - myInstance->monitorRls = NULL; - } - - if (myInstance->knownInterfaces != NULL) { - CFRelease(myInstance->knownInterfaces); - myInstance->knownInterfaces = NULL; - } + MyType *myInstance = (MyType *)arg; + updateInterfaceList(myInstance); return; } static void -watcher_add(MyType *myInstance) +watcher_add_lan(MyType *myInstance) { - CFBundleRef bundle; SCDynamicStoreContext context = { 0, (void *)myInstance, NULL, NULL, NULL }; CFDictionaryRef dict; CFStringRef key; CFArrayRef keys; SCDynamicStoreRef store; - bundle = CFBundleGetBundleWithIdentifier(MY_BUNDLE_ID); - if (bundle != NULL) { - CFDictionaryRef info; - CFBooleanRef user_intervention; - - info = CFBundleGetInfoDictionary(bundle); - user_intervention = CFDictionaryGetValue(info, CFSTR("User Intervention")); - if (isA_CFBoolean(user_intervention)) { - myInstance->no_user_intervention = !CFBooleanGetValue(user_intervention); - } - } - - store = SCDynamicStoreCreate(NULL, CFSTR("SCMonitor"), updateInterfaceList, &context); + store = SCDynamicStoreCreate(NULL, CFSTR("SCMonitor"), update_lan, &context); if (store == NULL) { - SCLog(TRUE, LOG_ERR, + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: SCDynamicStoreCreate() failed: %s"), SCErrorString(SCError())); return; @@ -572,7 +654,7 @@ watcher_add(MyType *myInstance) kCFRunLoopDefaultMode); // initialize the list of known interfaces - myInstance->knownInterfaces = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks); + myInstance->interfaces_known = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks); dict = SCDynamicStoreCopyValue(store, key); if (dict != NULL) { if (isA_CFDictionary(dict)) { @@ -587,7 +669,13 @@ watcher_add(MyType *myInstance) bsdName = CFArrayGetValueAtIndex(interfaces, i); if (isA_CFString(bsdName)) { - CFSetAddValue(myInstance->knownInterfaces, bsdName); + SCNetworkInterfaceRef interface; + + interface = _SCNetworkInterfaceCreateWithBSDName(NULL, bsdName, kIncludeNoVirtualInterfaces); + if (interface != NULL) { + CFSetAddValue(myInstance->interfaces_known, interface); + CFRelease(interface); + } } } } @@ -601,6 +689,360 @@ watcher_add(MyType *myInstance) } +static void +watcher_remove_lan(MyType *myInstance) +{ + if (myInstance->monitorRls != NULL) { + CFRunLoopSourceInvalidate(myInstance->monitorRls); + CFRelease(myInstance->monitorRls); + myInstance->monitorRls = NULL; + } + + if (myInstance->interfaces_known != NULL) { + CFRelease(myInstance->interfaces_known); + myInstance->interfaces_known = NULL; + } + + return; +} + + +#pragma mark - + + +typedef struct { + io_registry_entry_t interface; + MyType *myInstance; + io_object_t notification; +} MyNode; + + +static void +add_node_watcher(MyType *myInstance, io_registry_entry_t node, io_registry_entry_t interface); + + +static void +update_node(void *refCon, io_service_t service, natural_t messageType, void *messageArgument) +{ + CFIndex i; + CFDataRef myData = (CFDataRef)refCon; + MyType *myInstance; + MyNode *myNode; + + myNode = (MyNode *)CFDataGetBytePtr(myData); + myInstance = myNode->myInstance; + + switch (messageType) { + case kIOMessageServicePropertyChange : { + Boolean initializing = FALSE; + SCNetworkInterfaceRef interface; + CFTypeRef val; + + if (myNode->interface == MACH_PORT_NULL) { + // if we are not watching the "Initializing" property + return; + } + + val = IORegistryEntryCreateCFProperty(service, CFSTR("Initializing"), NULL, 0); + if (val != NULL) { + initializing = (isA_CFBoolean(val) && CFBooleanGetValue(val)); + CFRelease(val); + if (initializing) { + // if initialization not complete, keep watching + return; + } + } + + // node is ready + interface = _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(myNode->interface); + if (interface != NULL) { + CFRelease(interface); + + // watch interface (to see when/if it's removed) + add_node_watcher(myInstance, myNode->interface, MACH_PORT_NULL); + } + break; + } + + case kIOMessageServiceIsTerminated : + break; + + default : + return; + } + + // remove no-longer-needed notification + if (myNode->interface != MACH_PORT_NULL) { + IOObjectRelease(myNode->interface); + myNode->interface = MACH_PORT_NULL; + } + IOObjectRelease(myNode->notification); + i = CFArrayGetFirstIndexOfValue(myInstance->notifyNodes, + CFRangeMake(0, CFArrayGetCount(myInstance->notifyNodes)), + myData); + if (i != kCFNotFound) { + CFArrayRemoveValueAtIndex(myInstance->notifyNodes, i); + if (CFArrayGetCount(myInstance->notifyNodes) == 0) { + CFRelease(myInstance->notifyNodes); + myInstance->notifyNodes = NULL; + } + } + + updateInterfaceList(myInstance); + return; +} + + +static void +add_node_watcher(MyType *myInstance, io_registry_entry_t node, io_registry_entry_t interface) +{ + kern_return_t kr; + CFMutableDataRef myData; + MyNode *myNode; + + // wait for initialization to complete + myData = CFDataCreateMutable(NULL, sizeof(MyNode)); + CFDataSetLength(myData, sizeof(MyNode)); + myNode = (MyNode *)CFDataGetBytePtr(myData); + bzero(myNode, sizeof(MyNode)); + if (interface != MACH_PORT_NULL) { + IOObjectRetain(interface); + } + myNode->interface = interface; + myNode->myInstance = myInstance; + myNode->notification = MACH_PORT_NULL; + + kr = IOServiceAddInterestNotification(myInstance->notifyPort, // IONotificationPortRef + node, // io_service_t + kIOGeneralInterest, // interestType + update_node, // IOServiceInterestCallback + (void *)myData, // refCon + &myNode->notification); // notification + if (kr == KERN_SUCCESS) { + if (myInstance->notifyNodes == NULL) { + myInstance->notifyNodes = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + } + CFArrayAppendValue(myInstance->notifyNodes, myData); + } else { + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, + CFSTR("add_init_watcher IOServiceAddInterestNotification() failed, kr = 0x%x"), kr); + } + CFRelease(myData); +} + + +static void +add_init_watcher(MyType *myInstance, io_registry_entry_t interface) +{ + kern_return_t kr; + io_registry_entry_t node = interface; + CFTypeRef val = NULL; + + while (node != MACH_PORT_NULL) { + io_registry_entry_t parent; + + val = IORegistryEntryCreateCFProperty(node, CFSTR("HiddenPort"), NULL, 0); + if (val != NULL) { + CFRelease(val); + val = NULL; + break; + } + + val = IORegistryEntryCreateCFProperty(node, CFSTR("Initializing"), NULL, 0); + if (val != NULL) { + break; + } + + parent = MACH_PORT_NULL; + kr = IORegistryEntryGetParentEntry(node, kIOServicePlane, &parent); + switch (kr) { + case kIOReturnSuccess : // if we have a parent node + case kIOReturnNoDevice : // if we have hit the root node + break; + default : + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("add_init_watcher IORegistryEntryGetParentEntry() failed, kr = 0x%x"), kr); + break; + } + if (node != interface) { + IOObjectRelease(node); + } + node = parent; + } + + if (val != NULL) { + if (isA_CFBoolean(val) && CFBooleanGetValue(val)) { + // watch the "Initializing" node + add_node_watcher(myInstance, node, interface); + } + + CFRelease(val); + } + + if ((node != MACH_PORT_NULL) && (node != interface)) { + IOObjectRelease(node); + } + + return; +} + + +static void +update_serial(void *refcon, io_iterator_t iter) +{ + MyType *myInstance = (MyType *)refcon; + io_registry_entry_t obj; + + while ((obj = IOIteratorNext(iter)) != MACH_PORT_NULL) { + SCNetworkInterfaceRef interface; + + interface = _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(obj); + if (interface != NULL) { + CFRelease(interface); + + // watch interface (to see when/if it's removed) + add_node_watcher(myInstance, obj, MACH_PORT_NULL); + } else { + // check interface, watch if initializing + add_init_watcher(myInstance, obj); + } + + IOObjectRelease(obj); + } + + updateInterfaceList(myInstance); + return; +} + + +static void +watcher_add_serial(MyType *myInstance) +{ + kern_return_t kr; + + myInstance->notifyPort = IONotificationPortCreate(kIOMasterPortDefault); + if (myInstance->notifyPort == NULL) { + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, + CFSTR("SCMonitor: IONotificationPortCreate failed")); + return; + } + + // watch for the introduction of new network serial devices + kr = IOServiceAddMatchingNotification(myInstance->notifyPort, + kIOFirstMatchNotification, + IOServiceMatching("IOSerialBSDClient"), + &update_serial, + (void *)myInstance, // refCon + &myInstance->notifyIterator); // notification + if (kr != KERN_SUCCESS) { + SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, + CFSTR("SCMonitor : IOServiceAddMatchingNotification returned 0x%x"), + kr); + return; + } + + myInstance->notifyNodes = NULL; + + // Get the current list of matches and arm the notification for + // future interface arrivals. + update_serial((void *)myInstance, myInstance->notifyIterator); + + // and keep watching + CFRunLoopAddSource(CFRunLoopGetCurrent(), + IONotificationPortGetRunLoopSource(myInstance->notifyPort), + kCFRunLoopDefaultMode); + return; +} + + +static void +watcher_remove_serial(MyType *myInstance) +{ + if (myInstance->notifyNodes != NULL) { + CFIndex i; + CFIndex n = CFArrayGetCount(myInstance->notifyNodes); + + for (i = 0; i < n; i++) { + CFDataRef myData; + MyNode *myNode; + + myData = CFArrayGetValueAtIndex(myInstance->notifyNodes, i); + myNode = (MyNode *)CFDataGetBytePtr(myData); + if (myNode->interface != MACH_PORT_NULL) { + IOObjectRelease(myNode->interface); + } + IOObjectRelease(myNode->notification); + } + + CFRelease(myInstance->notifyNodes); + myInstance->notifyNodes = NULL; + } + + if (myInstance->notifyIterator != MACH_PORT_NULL) { + IOObjectRelease(myInstance->notifyIterator); + myInstance->notifyIterator = MACH_PORT_NULL; + } + + if (myInstance->notifyPort != MACH_PORT_NULL) { + IONotificationPortDestroy(myInstance->notifyPort); + myInstance->notifyPort = NULL; + } + + return; +} + + +#pragma mark - + + +static void +watcher_add(MyType *myInstance) +{ + CFBundleRef bundle; + + if (myInstance->log_msg == NULL) { + myInstance->log_msg = asl_new(ASL_TYPE_MSG); + asl_set(myInstance->log_msg, ASL_KEY_FACILITY, MY_BUNDLE_ID); + } + + bundle = CFBundleGetBundleWithIdentifier(CFSTR(MY_BUNDLE_ID)); + if (bundle != NULL) { + CFStringRef action; + CFDictionaryRef info; + + info = CFBundleGetInfoDictionary(bundle); + action = CFDictionaryGetValue(info, kSCNetworkInterfaceConfigurationActionKey); + action = isA_CFString(action); + + if (action != NULL) { + myInstance->configuration_action = action; + } else { + CFBooleanRef user_intervention; + + user_intervention = CFDictionaryGetValue(info, CFSTR("User Intervention")); + if (isA_CFBoolean(user_intervention) && !CFBooleanGetValue(user_intervention)) { + myInstance->configuration_action = kSCNetworkInterfaceConfigurationActionValueConfigure; + } + } + } + + watcher_add_lan(myInstance); + watcher_add_serial(myInstance); + return; +} + + +static void +watcher_remove(MyType *myInstance) +{ + watcher_remove_lan(myInstance); + watcher_remove_serial(myInstance); + + asl_free(myInstance->log_msg); + myInstance->log_msg = NULL; + return; +} + + #pragma mark - #pragma mark UserEventAgent stubs diff --git a/SystemConfiguration.fproj/BondConfiguration.c b/SystemConfiguration.fproj/BondConfiguration.c index bc5ed68..7746e7a 100644 --- a/SystemConfiguration.fproj/BondConfiguration.c +++ b/SystemConfiguration.fproj/BondConfiguration.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -40,8 +40,6 @@ #include #include -#include - #include #include #include @@ -731,16 +729,18 @@ SCBondInterfaceGetOptions(SCBondInterfaceRef bond) static Boolean _SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members) { + CFIndex i; SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)bond; + CFIndex n; + CFMutableArrayRef newMembers; Boolean ok = TRUE; + n = (members != NULL) ? CFArrayGetCount(members) : 0; + // set member interfaces in the stored preferences if (interfacePrivate->prefs != NULL) { CFDictionaryRef dict; - CFIndex i; - CFIndex n; CFMutableDictionaryRef newDict; - CFMutableArrayRef newMembers; CFStringRef path; path = CFStringCreateWithFormat(NULL, @@ -758,7 +758,6 @@ _SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members) } newMembers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); - n = (members != NULL) ? CFArrayGetCount(members) : 0; for (i = 0; i < n; i++) { SCNetworkInterfaceRef interface; CFStringRef memberName; @@ -778,12 +777,21 @@ _SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members) } if (ok) { - CFRelease(interfacePrivate->bond.interfaces); - if (members == NULL) { - interfacePrivate->bond.interfaces = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks); - } else { - interfacePrivate->bond.interfaces = CFArrayCreateCopy(NULL, members); + newMembers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + for (i = 0; i < n; i++) { + SCNetworkInterfaceRef member; + SCNetworkInterfacePrivateRef newMember; + + member = CFArrayGetValueAtIndex(members, i); + newMember = __SCNetworkInterfaceCreateCopy(NULL, + member, + interfacePrivate->prefs, + interfacePrivate->serviceID); + CFArrayAppendValue(newMembers, newMember); + CFRelease(newMember); } + CFRelease(interfacePrivate->bond.interfaces); + interfacePrivate->bond.interfaces = newMembers; } return ok; @@ -1876,1563 +1884,3 @@ _SCBondInterfaceUpdateConfiguration(SCPreferencesRef prefs) return ok; } - - -#pragma mark - -#pragma mark Deprecated SPIs (remove when no longer referenced) - - -/* ---------- Bond "device" ---------- */ - -Boolean -IsBondSupported(CFStringRef device) -{ - SCNetworkInterfaceRef interface; - SCNetworkInterfacePrivateRef interfacePrivate; - Boolean isBond = FALSE; - - interface = _SCNetworkInterfaceCreateWithBSDName(NULL, device, - kIncludeNoVirtualInterfaces); - interfacePrivate = (SCNetworkInterfacePrivateRef)interface; - isBond = interfacePrivate->supportsBond; - CFRelease(interface); - - return isBond; -} - -/* ---------- BondInterface ---------- */ - -typedef struct { - - /* base CFType information */ - CFRuntimeBase cfBase; - - /* bond interface configuration */ - CFStringRef ifname; // e.g. bond0, bond1, ... - CFArrayRef devices; // e.g. en0, en1, ... - CFDictionaryRef options; // e.g. UserDefinedName - -} BondInterfacePrivate, * BondInterfacePrivateRef; - - -static CFStringRef __BondInterfaceCopyDescription (CFTypeRef cf); -static void __BondInterfaceDeallocate (CFTypeRef cf); -static Boolean __BondInterfaceEqual (CFTypeRef cf1, CFTypeRef cf2); - - -static const CFRuntimeClass __BondInterfaceClass = { - 0, // version - "BondInterface", // className - NULL, // init - NULL, // copy - __BondInterfaceDeallocate, // dealloc - __BondInterfaceEqual, // equal - NULL, // hash - NULL, // copyFormattingDesc - __BondInterfaceCopyDescription // copyDebugDesc -}; - - -static CFTypeID __kBondInterfaceTypeID = _kCFRuntimeNotATypeID; - - -static pthread_once_t bondInterface_init = PTHREAD_ONCE_INIT; - - -static CFStringRef -__BondInterfaceCopyDescription(CFTypeRef cf) -{ - CFAllocatorRef allocator = CFGetAllocator(cf); - CFMutableStringRef result; - BondInterfacePrivateRef bondPrivate = (BondInterfacePrivateRef)cf; - - result = CFStringCreateMutable(allocator, 0); - CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); - CFStringAppendFormat(result, NULL, CFSTR("if = %@"), bondPrivate->ifname); - if (bondPrivate->devices != NULL) { - CFIndex i; - CFIndex n; - - CFStringAppendFormat(result, NULL, CFSTR(", devices =")); - - n = CFArrayGetCount(bondPrivate->devices); - for (i = 0; i < n; i++) { - CFStringAppendFormat(result, - NULL, - CFSTR(" %@"), - CFArrayGetValueAtIndex(bondPrivate->devices, i)); - } - } - if (bondPrivate->options != NULL) { - CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), bondPrivate->options); - } - CFStringAppendFormat(result, NULL, CFSTR("}")); - - return result; -} - - -static void -__BondInterfaceDeallocate(CFTypeRef cf) -{ - BondInterfacePrivateRef bondPrivate = (BondInterfacePrivateRef)cf; - - /* release resources */ - - CFRelease(bondPrivate->ifname); - if (bondPrivate->devices) CFRelease(bondPrivate->devices); - if (bondPrivate->options) CFRelease(bondPrivate->options); - - return; -} - - -static Boolean -__BondInterfaceEquiv(CFTypeRef cf1, CFTypeRef cf2) -{ - BondInterfacePrivateRef bond1 = (BondInterfacePrivateRef)cf1; - BondInterfacePrivateRef bond2 = (BondInterfacePrivateRef)cf2; - - if (bond1 == bond2) - return TRUE; - - if (!CFEqual(bond1->ifname, bond2->ifname)) - return FALSE; // if not the same interface - - if (!CFEqual(bond1->devices, bond2->devices)) - return FALSE; // if not the same device - - return TRUE; -} - - -static Boolean -__BondInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2) -{ - BondInterfacePrivateRef bond1 = (BondInterfacePrivateRef)cf1; - BondInterfacePrivateRef bond2 = (BondInterfacePrivateRef)cf2; - - if (!__BondInterfaceEquiv(bond1, bond2)) - return FALSE; // if not the same Bond interface/devices - - if (bond1->options != bond2->options) { - // if the options may differ - if ((bond1->options != NULL) && (bond2->options != NULL)) { - // if both Bonds have options - if (!CFEqual(bond1->options, bond2->options)) { - // if the options are not equal - return FALSE; - } - } else { - // if only one Bond has options - return FALSE; - } - } - - return TRUE; -} - - -static void -__BondInterfaceInitialize(void) -{ - __kBondInterfaceTypeID = _CFRuntimeRegisterClass(&__BondInterfaceClass); - return; -} - - -static __inline__ CFTypeRef -isA_BondInterface(CFTypeRef obj) -{ - return (isA_CFType(obj, BondInterfaceGetTypeID())); -} - - -CFTypeID -BondInterfaceGetTypeID(void) -{ - pthread_once(&bondInterface_init, __BondInterfaceInitialize); /* initialize runtime */ - return __kBondInterfaceTypeID; -} - - -static BondInterfaceRef -__BondInterfaceCreatePrivate(CFAllocatorRef allocator, - CFStringRef ifname) -{ - BondInterfacePrivateRef bondPrivate; - uint32_t size; - - /* initialize runtime */ - pthread_once(&bondInterface_init, __BondInterfaceInitialize); - - /* allocate bond */ - size = sizeof(BondInterfacePrivate) - sizeof(CFRuntimeBase); - bondPrivate = (BondInterfacePrivateRef)_CFRuntimeCreateInstance(allocator, - __kBondInterfaceTypeID, - size, - NULL); - if (bondPrivate == NULL) { - return NULL; - } - - /* establish the bond */ - - bondPrivate->ifname = CFStringCreateCopy(allocator, ifname); - bondPrivate->devices = NULL; - bondPrivate->options = NULL; - - return (BondInterfaceRef)bondPrivate; -} - - -CFStringRef -BondInterfaceGetInterface(BondInterfaceRef bond) -{ - BondInterfacePrivateRef bondPrivate = (BondInterfacePrivateRef)bond; - CFStringRef bond_if = NULL; - - if (isA_BondInterface(bond)) { - bond_if = bondPrivate->ifname; - } - - return bond_if; -} - - -CFArrayRef -BondInterfaceGetDevices(BondInterfaceRef bond) -{ - BondInterfacePrivateRef bondPrivate = (BondInterfacePrivateRef)bond; - CFArrayRef bond_devices = NULL; - - if (isA_BondInterface(bond)) { - bond_devices = bondPrivate->devices; - } - - return bond_devices; -} - - -CFDictionaryRef -BondInterfaceGetOptions(BondInterfaceRef bond) -{ - BondInterfacePrivateRef bondPrivate = (BondInterfacePrivateRef)bond; - CFDictionaryRef bond_options = NULL; - - if (isA_BondInterface(bond)) { - bond_options = bondPrivate->options; - } - - return bond_options; -} - - -static void -BondInterfaceSetDevices(BondInterfaceRef bond, CFArrayRef newDevices) -{ - BondInterfacePrivateRef bondPrivate = (BondInterfacePrivateRef)bond; - - if (isA_BondInterface(bond)) { - CFAllocatorRef allocator = CFGetAllocator(bond); - - if (bondPrivate->devices != NULL) CFRelease(bondPrivate->devices); - if ((newDevices != NULL) && (CFArrayGetCount(newDevices) > 0)) { - bondPrivate->devices = CFArrayCreateCopy(allocator, newDevices); - } else { - bondPrivate->devices = NULL; - } - } - - return; -} - - -static void -BondInterfaceSetOptions(BondInterfaceRef bond, CFDictionaryRef newOptions) -{ - BondInterfacePrivateRef bondPrivate = (BondInterfacePrivateRef)bond; - - if (isA_BondInterface(bond)) { - CFAllocatorRef allocator = CFGetAllocator(bond); - - if (bondPrivate->options) CFRelease(bondPrivate->options); - if (newOptions != NULL) { - bondPrivate->options = CFDictionaryCreateCopy(allocator, newOptions); - } else { - bondPrivate->options = NULL; - } - } - - return; -} - - -/* ---------- BondPreferences ---------- */ - -typedef struct { - - /* base CFType information */ - CFRuntimeBase cfBase; - - /* lock */ - pthread_mutex_t lock; - - /* underlying preferences */ - SCPreferencesRef prefs; - - /* base Bonds (before any commits) */ - CFArrayRef bBase; - -} BondPreferencesPrivate, * BondPreferencesPrivateRef; - - -static CFStringRef __BondPreferencesCopyDescription (CFTypeRef cf); -static void __BondPreferencesDeallocate (CFTypeRef cf); - - -static const CFRuntimeClass __BondPreferencesClass = { - 0, // version - "BondPreferences", // className - NULL, // init - NULL, // copy - __BondPreferencesDeallocate, // dealloc - NULL, // equal - NULL, // hash - NULL, // copyFormattingDesc - __BondPreferencesCopyDescription // copyDebugDesc -}; - - -static CFTypeID __kBondPreferencesTypeID = _kCFRuntimeNotATypeID; - - -static pthread_once_t bondPreferences_init = PTHREAD_ONCE_INIT; - - -static CFStringRef -__BondPreferencesCopyDescription(CFTypeRef cf) -{ - CFAllocatorRef allocator = CFGetAllocator(cf); - CFIndex i; - CFArrayRef keys; - CFIndex n; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)cf; - CFMutableStringRef result; - - result = CFStringCreateMutable(allocator, 0); - CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); - - keys = SCPreferencesCopyKeyList(prefsPrivate->prefs); - n = CFArrayGetCount(keys); - for (i = 0; i < n; i++) { - CFStringRef key; - CFPropertyListRef val; - - key = CFArrayGetValueAtIndex(keys, i); - val = SCPreferencesGetValue(prefsPrivate->prefs, key); - - CFStringAppendFormat(result, NULL, CFSTR("%@ : %@"), key, val); - } - CFRelease(keys); - - CFStringAppendFormat(result, NULL, CFSTR(" }")); - - return result; -} - - -static void -__BondPreferencesDeallocate(CFTypeRef cf) -{ - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)cf; - - /* release resources */ - - pthread_mutex_destroy(&prefsPrivate->lock); - - if (prefsPrivate->prefs) CFRelease(prefsPrivate->prefs); - if (prefsPrivate->bBase) CFRelease(prefsPrivate->bBase); - - return; -} - - -static void -__BondPreferencesInitialize(void) -{ - __kBondPreferencesTypeID = _CFRuntimeRegisterClass(&__BondPreferencesClass); - return; -} - - -static __inline__ CFTypeRef -isA_BondPreferences(CFTypeRef obj) -{ - return (isA_CFType(obj, BondPreferencesGetTypeID())); -} - - -CFArrayRef -_BondPreferencesCopyActiveInterfaces() -{ - CFArrayCallBacks callbacks; - struct ifaddrs *ifap; - struct ifaddrs *ifp; - int s; - CFMutableArrayRef bonds = NULL; - - if (getifaddrs(&ifap) == -1) { - _SCErrorSet(errno); - SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno)); - return NULL; - } - - s = inet_dgram_socket(); - if (s == -1) { - _SCErrorSet(errno); - goto done; - } - - callbacks = kCFTypeArrayCallBacks; - callbacks.equal = __BondInterfaceEquiv; - bonds = CFArrayCreateMutable(NULL, 0, &callbacks); - - for (ifp = ifap; ifp != NULL; ifp = ifp->ifa_next) { - BondInterfaceRef bond; - CFStringRef bond_if; - CFMutableArrayRef devices = NULL; - struct if_bond_status_req *ibsr_p; - struct if_data *if_data; - - if_data = (struct if_data *)ifp->ifa_data; - if (if_data == NULL - || ifp->ifa_addr->sa_family != AF_LINK - || if_data->ifi_type != IFT_IEEE8023ADLAG) { - continue; - } - ibsr_p = if_bond_status_req_copy(s, ifp->ifa_name); - if (ibsr_p == NULL) { - if (errno == EBUSY) { - continue; - } - - _SCErrorSet(errno); - SCLog(TRUE, LOG_ERR, - CFSTR("if_bond_status_req_copy(%s) failed: %s"), - ifp->ifa_name, - strerror(errno)); - CFRelease(bonds); - bonds = NULL; - goto done; - } - if (ibsr_p->ibsr_total > 0) { - int i; - struct if_bond_status * ibs_p; - devices = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); - - // iterate over each member device - ibs_p = (struct if_bond_status *)ibsr_p->ibsr_buffer; - for (i = 0; i < ibsr_p->ibsr_total; i++) { - CFStringRef device; - char if_name[IFNAMSIZ + 1]; - - bzero(&if_name, sizeof(if_name)); - bcopy(ibs_p[i].ibs_if_name, if_name, IFNAMSIZ); - device = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII); - CFArrayAppendValue(devices, device); - CFRelease(device); - } - } - free(ibsr_p); - bond_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII); - bond = __BondInterfaceCreatePrivate(NULL, bond_if); - CFRelease(bond_if); - - if (devices != NULL) { - BondInterfaceSetDevices(bond, devices); - CFRelease(devices); - } - CFArrayAppendValue(bonds, bond); - CFRelease(bond); - } - - done : - - (void) close(s); - freeifaddrs(ifap); - return bonds; -} - - -static CFIndex -findBond(CFArrayRef bonds, CFStringRef interface) -{ - CFIndex found = kCFNotFound; - CFIndex i; - CFIndex n; - - n = isA_CFArray(bonds) ? CFArrayGetCount(bonds) : 0; - for (i = 0; i < n; i++) { - CFDictionaryRef bond_dict; - CFStringRef bond_if; - - bond_dict = CFArrayGetValueAtIndex(bonds, i); - if (!isA_CFDictionary(bond_dict)) { - break; // if the prefs are confused - } - - bond_if = CFDictionaryGetValue(bond_dict, __kBondInterface_interface); - if (!isA_CFString(bond_if)) { - break; // if the prefs are confused - } - - if (!CFEqual(bond_if, interface)) { - continue; // if not a match - } - - // if we have found a match - found = i; - break; - } - - return found; -} - - -static void -setConfigurationChanged(BondPreferencesRef prefs) -{ - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - - /* - * to facilitate device configuration we will take - * a snapshot of the Bond preferences before any - * changes are made. Then, when the changes are - * applied we can compare what we had to what we - * want and configured the system accordingly. - */ - if (prefsPrivate->bBase == NULL) { - prefsPrivate->bBase = BondPreferencesCopyInterfaces(prefs); - } - - return; -} - - -CFTypeID -BondPreferencesGetTypeID(void) -{ - pthread_once(&bondPreferences_init, __BondPreferencesInitialize); /* initialize runtime */ - return __kBondPreferencesTypeID; -} - - -BondPreferencesRef -BondPreferencesCreate(CFAllocatorRef allocator) -{ - CFBundleRef bundle; - CFStringRef bundleID = NULL; - CFStringRef name = CFSTR("BondConfiguration"); - BondPreferencesPrivateRef prefsPrivate; - uint32_t size; - - /* initialize runtime */ - pthread_once(&bondPreferences_init, __BondPreferencesInitialize); - - /* allocate preferences */ - size = sizeof(BondPreferencesPrivate) - sizeof(CFRuntimeBase); - prefsPrivate = (BondPreferencesPrivateRef)_CFRuntimeCreateInstance(allocator, - __kBondPreferencesTypeID, - size, - NULL); - if (prefsPrivate == NULL) { - return NULL; - } - - /* establish the prefs */ - - pthread_mutex_init(&prefsPrivate->lock, NULL); - - bundle = CFBundleGetMainBundle(); - if (bundle) { - bundleID = CFBundleGetIdentifier(bundle); - if (bundleID) { - CFRetain(bundleID); - } else { - CFURLRef url; - - url = CFBundleCopyExecutableURL(bundle); - if (url) { - bundleID = CFURLCopyPath(url); - CFRelease(url); - } - } - } - - if (bundleID) { - CFStringRef fullName; - - if (CFEqual(bundleID, CFSTR("/"))) { - CFRelease(bundleID); - bundleID = CFStringCreateWithFormat(allocator, NULL, CFSTR("(%d)"), getpid()); - } - - fullName = CFStringCreateWithFormat(allocator, NULL, CFSTR("%@:%@"), bundleID, name); - name = fullName; - CFRelease(bundleID); - } else { - CFRetain(name); - } - - prefsPrivate->prefs = SCPreferencesCreate(allocator, name, BOND_PREFERENCES_ID); - CFRelease(name); - - prefsPrivate->bBase = NULL; - - return (BondPreferencesRef)prefsPrivate; -} - - -CFArrayRef -BondPreferencesCopyInterfaces(BondPreferencesRef prefs) -{ - CFAllocatorRef allocator; - CFArrayCallBacks callbacks; - CFIndex i; - CFIndex n; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - CFMutableArrayRef result; - CFArrayRef bonds; - - if (!isA_BondPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return NULL; - } - - allocator = CFGetAllocator(prefs); - callbacks = kCFTypeArrayCallBacks; - callbacks.equal = __BondInterfaceEquiv; - result = CFArrayCreateMutable(allocator, 0, &callbacks); - - bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS); - if ((bonds != NULL) && !isA_CFArray(bonds)) { - goto error; // if the prefs are confused - } - - n = (bonds != NULL) ? CFArrayGetCount(bonds) : 0; - for (i = 0; i < n; i++) { - BondInterfaceRef bond; - CFDictionaryRef bond_dict; - CFStringRef bond_if; - CFArrayRef devices; - CFDictionaryRef options; - - bond_dict = CFArrayGetValueAtIndex(bonds, i); - if (!isA_CFDictionary(bond_dict)) { - goto error; // if the prefs are confused - } - - bond_if = CFDictionaryGetValue(bond_dict, __kBondInterface_interface); - if (!isA_CFString(bond_if)) { - goto error; // if the prefs are confused - } - - - devices = CFDictionaryGetValue(bond_dict, __kBondInterface_devices); - if ((devices != NULL) && !isA_CFArray(devices)) { - goto error; // if the prefs are confused - } - - options = CFDictionaryGetValue(bond_dict, __kBondInterface_options); - if ((options != NULL) && !isA_CFDictionary(options)) { - goto error; // if the prefs are confused - } - - bond = __BondInterfaceCreatePrivate(allocator, bond_if); - BondInterfaceSetDevices(bond, devices); - BondInterfaceSetOptions(bond, options); - CFArrayAppendValue(result, bond); - CFRelease(bond); - } - - return result; - - error : - - _SCErrorSet(kSCStatusFailed); - CFRelease(result); - return NULL; -} - - -BondInterfaceRef -BondPreferencesCreateInterface(BondPreferencesRef prefs) -{ - CFArrayRef active_bonds = NULL; - CFAllocatorRef allocator; - CFArrayRef config_bonds; - CFIndex i; - CFIndex nActive; - CFIndex nConfig; - BondInterfaceRef newBond = NULL; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - - if (!isA_BondPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return NULL; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - /* get "configured" Bonds (and check to ensure the device is available) */ - config_bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS); - if ((config_bonds != NULL) && !isA_CFArray(config_bonds)) { - // if the prefs are confused - _SCErrorSet(kSCStatusFailed); - goto done; - } - - nConfig = (config_bonds != NULL) ? CFArrayGetCount(config_bonds) : 0; - - /* get "active" Bonds */ - active_bonds = _BondPreferencesCopyActiveInterfaces(); - nActive = isA_CFArray(active_bonds) ? CFArrayGetCount(active_bonds) : 0; - - /* create a new bond using an unused interface name */ - allocator = CFGetAllocator(prefs); - - for (i = 0; newBond == NULL; i++) { - CFIndex j; - CFMutableDictionaryRef newDict; - CFMutableArrayRef newBonds; - CFStringRef bond_if; - - bond_if = CFStringCreateWithFormat(allocator, NULL, CFSTR("bond%d"), i); - - for (j = 0; j < nActive; j++) { - CFStringRef active_if; - BondInterfaceRef active_bond; - - active_bond = CFArrayGetValueAtIndex(active_bonds, j); - active_if = BondInterfaceGetInterface(active_bond); - - if (CFEqual(bond_if, active_if)) { - goto next_if; // if bond interface name not available - } - } - - for (j = 0; j < nConfig; j++) { - CFDictionaryRef config; - CFStringRef config_if; - - config = CFArrayGetValueAtIndex(config_bonds, j); - if (!isA_CFDictionary(config)) { - // if the prefs are confused - _SCErrorSet(kSCStatusFailed); - CFRelease(bond_if); - goto done; - } - - config_if = CFDictionaryGetValue(config, __kBondInterface_interface); - if (!isA_CFString(config_if)) { - // if the prefs are confused - _SCErrorSet(kSCStatusFailed); - CFRelease(bond_if); - goto done; - } - - if (CFEqual(bond_if, config_if)) { - goto next_if; // if bond interface name not available - } - } - - /* create the bond */ - - newDict = CFDictionaryCreateMutable(allocator, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - CFDictionaryAddValue(newDict, __kBondInterface_interface, bond_if); - - /* create the accessor handle to be returned */ - - newBond = __BondInterfaceCreatePrivate(allocator, bond_if); - - /* save in the prefs */ - - if (nConfig > 0) { - newBonds = CFArrayCreateMutableCopy(allocator, 0, config_bonds); - } else { - newBonds = CFArrayCreateMutable(allocator, 0, &kCFTypeArrayCallBacks); - } - CFArrayAppendValue(newBonds, newDict); - CFRelease(newDict); - - /* yes, we're going to be changing the configuration */ - setConfigurationChanged(prefs); - - (void) SCPreferencesSetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS, newBonds); - CFRelease(newBonds); - - next_if : - CFRelease(bond_if); - } - - done : - - if (active_bonds != NULL) CFRelease(active_bonds); - - pthread_mutex_unlock(&prefsPrivate->lock); - - return (BondInterfaceRef) newBond; -} - - -static Boolean -_BondPreferencesUpdate(BondPreferencesRef prefs, BondInterfaceRef bond) -{ - CFAllocatorRef allocator; - CFIndex bond_index; - CFArrayRef devices; - CFStringRef interface; - CFMutableDictionaryRef newDict; - CFMutableArrayRef newBonds; - CFDictionaryRef options; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - CFArrayRef bonds; - - bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS); - if ((bonds != NULL) && !isA_CFArray(bonds)) { - // if the prefs are confused - _SCErrorSet(kSCStatusFailed); - return FALSE; - } - - interface = BondInterfaceGetInterface(bond); - bond_index = findBond(bonds, interface); - if (bond_index == kCFNotFound) { - _SCErrorSet(kSCStatusNoKey); - return FALSE; - } - - /* create the bond dictionary */ - - allocator = CFGetAllocator(prefs); - newDict = CFDictionaryCreateMutable(allocator, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - CFDictionaryAddValue(newDict, __kBondInterface_interface, interface); - - devices = BondInterfaceGetDevices(bond); - if (devices != NULL) { - CFDictionaryAddValue(newDict, __kBondInterface_devices, devices); - } - - options = BondInterfaceGetOptions(bond); - if (options != NULL) { - CFDictionaryAddValue(newDict, __kBondInterface_options, options); - } - - /* yes, we're going to be changing the configuration */ - setConfigurationChanged(prefs); - - /* update the prefs */ - - newBonds = CFArrayCreateMutableCopy(allocator, 0, bonds); - CFArraySetValueAtIndex(newBonds, bond_index, newDict); - CFRelease(newDict); - (void) SCPreferencesSetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS, newBonds); - CFRelease(newBonds); - - return TRUE; -} - - -Boolean -BondPreferencesAddDevice(BondPreferencesRef prefs, - BondInterfaceRef bond, - CFStringRef device) -{ - CFArrayRef config_bonds; - CFIndex i; - CFIndex nConfig; - Boolean ok = TRUE; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - - if (!isA_BondPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!isA_BondInterface(bond)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!isA_CFString(device)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!IsBondSupported(device)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - /* get "configured" bonds */ - config_bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS); - if ((config_bonds != NULL) && !isA_CFArray(config_bonds)) { - _SCErrorSet(kSCStatusFailed); - ok = FALSE; - goto done; - } - - nConfig = (config_bonds != NULL) ? CFArrayGetCount(config_bonds) : 0; - - /* check to ensure the requested device is available */ - for (i = 0; ok && (i < nConfig); i++) { - CFDictionaryRef config_bond; - CFArrayRef devices; - - config_bond = CFArrayGetValueAtIndex(config_bonds, i); - if (!isA_CFDictionary(config_bond)) { - ok = FALSE; // if the prefs are confused - break; - } - - devices = CFDictionaryGetValue(config_bond, __kBondInterface_devices); - if ((devices != NULL) && !isA_CFArray(devices)) { - ok = FALSE; // if the prefs are confused - break; - } - - if (devices == NULL) { - continue; // if no devices - } - - ok = !CFArrayContainsValue(devices, - CFRangeMake(0, CFArrayGetCount(devices)), - device); - } - - if (ok) { - CFArrayRef devices; - CFMutableArrayRef newDevices; - - devices = BondInterfaceGetDevices(bond); - if (devices != NULL) { - devices = CFArrayCreateCopy(NULL, devices); - newDevices = CFArrayCreateMutableCopy(NULL, 0, devices); - } else { - newDevices = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); - } - CFArrayAppendValue(newDevices, device); - BondInterfaceSetDevices(bond, newDevices); - CFRelease(newDevices); - - ok = _BondPreferencesUpdate(prefs, bond); - if (!ok) { - BondInterfaceSetDevices(bond, devices); - } - - if (devices != NULL) { - CFRelease(devices); - } - } else { - _SCErrorSet(kSCStatusKeyExists); - } - - done : - - pthread_mutex_unlock(&prefsPrivate->lock); - - return ok; -} - - -Boolean -BondPreferencesRemoveDevice(BondPreferencesRef prefs, - BondInterfaceRef bond, - CFStringRef device) -{ - CFIndex bond_index; - CFArrayRef devices; - Boolean ok = FALSE; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - - if (!isA_BondPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!isA_BondInterface(bond)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!isA_CFString(device)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - devices = BondInterfaceGetDevices(bond); - if (devices != NULL) { - bond_index = CFArrayGetFirstIndexOfValue(devices, - CFRangeMake(0, CFArrayGetCount(devices)), - device); - if (bond_index != kCFNotFound) { - CFMutableArrayRef newDevices; - - devices = CFArrayCreateCopy(NULL, devices); - newDevices = CFArrayCreateMutableCopy(NULL, 0, devices); - CFArrayRemoveValueAtIndex(newDevices, bond_index); - BondInterfaceSetDevices(bond, newDevices); - CFRelease(newDevices); - - ok = _BondPreferencesUpdate(prefs, bond); - if (!ok) { - BondInterfaceSetDevices(bond, devices); - } - - CFRelease(devices); - } else { - _SCErrorSet(kSCStatusNoKey); - } - } - - pthread_mutex_unlock(&prefsPrivate->lock); - - return ok; -} - - -Boolean -BondPreferencesSetOptions(BondPreferencesRef prefs, BondInterfaceRef bond, CFDictionaryRef newOptions) -{ - Boolean ok = FALSE; - CFDictionaryRef options; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - - if (!isA_BondPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!isA_BondInterface(bond)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - options = BondInterfaceGetOptions(bond); - if (options != NULL) { - options = CFDictionaryCreateCopy(NULL, options); - } - - BondInterfaceSetOptions(bond, newOptions); - ok = _BondPreferencesUpdate(prefs, bond); - if (!ok) { - BondInterfaceSetOptions(bond, options); - } - - if (options != NULL) { - CFRelease(options); - } - - pthread_mutex_unlock(&prefsPrivate->lock); - - return ok; -} - - -Boolean -BondPreferencesRemoveInterface(BondPreferencesRef prefs, - BondInterfaceRef bond) -{ - CFIndex bond_index; - Boolean ok = FALSE; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - CFArrayRef bonds; - - if (!isA_BondPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!isA_BondInterface(bond)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS); - if (!isA_CFArray(bonds)) { - // if the prefs are confused - _SCErrorSet(kSCStatusFailed); - goto done; - } - - bond_index = findBond(bonds, BondInterfaceGetInterface(bond)); - if (bond_index == kCFNotFound) { - _SCErrorSet(kSCStatusNoKey); - goto done; - } - - /* yes, we're going to be changing the configuration */ - setConfigurationChanged(prefs); - - /* remove the bond */ - - if (CFArrayGetCount(bonds) > 1) { - CFAllocatorRef allocator; - CFMutableArrayRef newBonds; - - allocator = CFGetAllocator(prefs); - newBonds = CFArrayCreateMutableCopy(allocator, 0, bonds); - CFArrayRemoveValueAtIndex(newBonds, bond_index); - (void) SCPreferencesSetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS, newBonds); - CFRelease(newBonds); - } else { - (void) SCPreferencesRemoveValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS); - } - - ok = TRUE; - - done : - - pthread_mutex_unlock(&prefsPrivate->lock); - - return ok; -} - - -Boolean -BondPreferencesCommitChanges(BondPreferencesRef prefs) -{ - Boolean ok = FALSE; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - - if (!isA_BondPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - ok = SCPreferencesCommitChanges(prefsPrivate->prefs); - if (!ok) { - return ok; - } - - if (prefsPrivate->bBase != NULL) { - CFRelease(prefsPrivate->bBase); - prefsPrivate->bBase = NULL; - } - - return TRUE; -} - - -Boolean -_BondPreferencesUpdateConfiguration(BondPreferencesRef prefs) -{ - return TRUE; -} - - -Boolean -BondPreferencesApplyChanges(BondPreferencesRef prefs) -{ - SCPreferencesRef defaultPrefs; - Boolean ok = FALSE; - BondPreferencesPrivateRef prefsPrivate = (BondPreferencesPrivateRef)prefs; - - if (!isA_BondPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - /* apply the preferences */ - ok = SCPreferencesApplyChanges(prefsPrivate->prefs); - if (!ok) { - goto done; - } - - /* apply the Bond configuration */ - defaultPrefs = SCPreferencesCreate(NULL, CFSTR("BondPreferencesApplyChanges"), NULL); - { - /* - * Note: In an ideal world, we'd simply call SCPreferencesApplyChanges() - * Unfortunately, it's possible that the caller (e.g NetworkCfgTool) - * is holding the lock on the default prefs and since "Apply" attempts - * to grab the lock we could end up in a deadlock situation. - */ -#include "SCPreferencesInternal.h" - SCPreferencesPrivateRef defaultPrefsPrivate; - - defaultPrefsPrivate = (SCPreferencesPrivateRef)defaultPrefs; - - pthread_mutex_lock(&defaultPrefsPrivate->lock); - if (defaultPrefsPrivate->session == NULL) { - __SCPreferencesAddSession(defaultPrefs); - } - pthread_mutex_unlock(&defaultPrefsPrivate->lock); - - ok = SCDynamicStoreNotifyValue(defaultPrefsPrivate->session, defaultPrefsPrivate->sessionKeyApply); - } - CFRelease(defaultPrefs); - if (!ok) { - goto done; - } - - done : - - pthread_mutex_unlock(&prefsPrivate->lock); - - return ok; -} - - -/* ---------- BondStatus ---------- */ - -typedef struct { - - /* base CFType information */ - CFRuntimeBase cfBase; - - /* bond interface */ - BondInterfaceRef bond; - - /* bond status */ - CFDictionaryRef status_interface; // interface status - CFArrayRef devices; // per-device status - CFDictionaryRef status_devices; - -} BondStatusPrivate, * BondStatusPrivateRef; - - -static CFStringRef __BondStatusCopyDescription (CFTypeRef cf); -static void __BondStatusDeallocate (CFTypeRef cf); -static Boolean __BondStatusEqual (CFTypeRef cf1, CFTypeRef cf2); - - -static const CFRuntimeClass __BondStatusClass = { - 0, // version - "BondStatus", // className - NULL, // init - NULL, // copy - __BondStatusDeallocate, // dealloc - __BondStatusEqual, // equal - NULL, // hash - NULL, // copyFormattingDesc - __BondStatusCopyDescription // copyDebugDesc -}; - - -static CFTypeID __kBondStatusTypeID = _kCFRuntimeNotATypeID; - - -static pthread_once_t bondStatus_init_X = PTHREAD_ONCE_INIT; - - -static CFStringRef -__BondStatusCopyDescription(CFTypeRef cf) -{ - CFAllocatorRef allocator = CFGetAllocator(cf); - CFMutableStringRef result; - BondStatusPrivateRef statusPrivate = (BondStatusPrivateRef)cf; - - result = CFStringCreateMutable(allocator, 0); - CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); - CFStringAppendFormat(result, NULL, CFSTR(" bond = %@"), statusPrivate->bond); - CFStringAppendFormat(result, NULL, CFSTR(" interface = %@"), statusPrivate->status_interface); - CFStringAppendFormat(result, NULL, CFSTR(" devices = %@"), statusPrivate->status_devices); - CFStringAppendFormat(result, NULL, CFSTR(" }")); - - return result; -} - - -static void -__BondStatusDeallocate(CFTypeRef cf) -{ - BondStatusPrivateRef statusPrivate = (BondStatusPrivateRef)cf; - - /* release resources */ - - CFRelease(statusPrivate->bond); - CFRelease(statusPrivate->status_interface); - if (statusPrivate->devices != NULL) CFRelease(statusPrivate->devices); - CFRelease(statusPrivate->status_devices); - return; -} - - -static Boolean -__BondStatusEqual(CFTypeRef cf1, CFTypeRef cf2) -{ - BondStatusPrivateRef status1 = (BondStatusPrivateRef)cf1; - BondStatusPrivateRef status2 = (BondStatusPrivateRef)cf2; - - if (status1 == status2) - return TRUE; - - if (!CFEqual(status1->bond, status2->bond)) - return FALSE; // if not the same bond - - if (!CFEqual(status1->status_interface, status2->status_interface)) - return FALSE; // if not the same interface status - - if (!CFEqual(status1->status_devices, status2->status_devices)) - return FALSE; // if not the same device status - - return TRUE; -} - - -static void -__BondStatusInitialize(void) -{ - __kBondStatusTypeID = _CFRuntimeRegisterClass(&__BondStatusClass); - return; -} - - -static __inline__ CFTypeRef -isA_BondStatus(CFTypeRef obj) -{ - return (isA_CFType(obj, BondStatusGetTypeID())); -} - - -CFTypeID -BondStatusGetTypeID(void) -{ - pthread_once(&bondStatus_init_X, __BondStatusInitialize); /* initialize runtime */ - return __kBondStatusTypeID; -} - - -static BondStatusRef -__BondStatusCreatePrivate(CFAllocatorRef allocator, - BondInterfaceRef bond, - CFDictionaryRef status_interface, - CFDictionaryRef status_devices) -{ - BondStatusPrivateRef statusPrivate; - uint32_t size; - - /* initialize runtime */ - pthread_once(&bondStatus_init_X, __BondStatusInitialize); - - /* allocate bond */ - size = sizeof(BondStatusPrivate) - sizeof(CFRuntimeBase); - statusPrivate = (BondStatusPrivateRef)_CFRuntimeCreateInstance(allocator, - __kBondStatusTypeID, - size, - NULL); - if (statusPrivate == NULL) { - return NULL; - } - - /* establish the bond status */ - - statusPrivate->bond = CFRetain(bond); - statusPrivate->status_interface = CFDictionaryCreateCopy(allocator, status_interface); - statusPrivate->devices = NULL; - statusPrivate->status_devices = CFDictionaryCreateCopy(allocator, status_devices); - - return (BondStatusRef)statusPrivate; -} - - -BondStatusRef -BondInterfaceCopyStatus(BondInterfaceRef bond) -{ - BondInterfacePrivateRef bondPrivate = (BondInterfacePrivateRef)bond; - int bond_if_active; - int bond_if_status; - CFIndex i; - struct if_bond_status_req *ibsr_p = NULL; - char if_name[IFNAMSIZ + 1]; - CFIndex n; - CFNumberRef num; - int s; - struct if_bond_status * scan_p; - BondStatusRef status = NULL; - CFMutableDictionaryRef status_devices; - CFMutableDictionaryRef status_interface; - - if (!isA_BondInterface(bond)) { - return NULL; - } - - s = inet_dgram_socket(); - if (s == -1) { - _SCErrorSet(errno); - goto done; - } - _SC_cfstring_to_cstring(bondPrivate->ifname, if_name, - sizeof(if_name), kCFStringEncodingASCII); - (void)siocgifmedia(s, if_name, &bond_if_status, &bond_if_active); - ibsr_p = if_bond_status_req_copy(s, if_name); - if (ibsr_p == NULL) { - _SCErrorSet(errno); - goto done; - } - status_interface = CFDictionaryCreateMutable(NULL, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - - status_devices = CFDictionaryCreateMutable(NULL, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - n = ibsr_p->ibsr_total; - for (i = 0, scan_p = (struct if_bond_status *)ibsr_p->ibsr_buffer; i < n; i++, scan_p++) { - CFStringRef bond_if; - int collecting = 0; - int distributing = 0; - struct if_bond_partner_state * ps; - CFMutableDictionaryRef status_device; - int status_val; - - ps = &scan_p->ibs_partner_state; - - status_device = CFDictionaryCreateMutable(NULL, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - if (lacp_actor_partner_state_in_sync(scan_p->ibs_state)) { - /* we're in-sync */ - status_val = kSCBondStatusOK; - if (lacp_actor_partner_state_in_sync(ps->ibps_state)) { - /* partner is also in-sync */ - if (lacp_actor_partner_state_collecting(scan_p->ibs_state) - && lacp_actor_partner_state_distributing(ps->ibps_state)) { - /* we're able to collect (receive) frames */ - collecting = 1; - } - if (lacp_actor_partner_state_distributing(scan_p->ibs_state) - && lacp_actor_partner_state_collecting(ps->ibps_state)) { - /* we're able to distribute (transmit) frames */ - distributing = 1; - } - } - } - else { - int active = 0; - int status = 0; - static lacp_system zeroes = {{0,0,0,0,0,0}}; - - (void)siocgifmedia(s, scan_p->ibs_if_name, &status, &active); - if ((status & IFM_AVALID) == 0 || (status & IFM_ACTIVE) == 0 - || (active & IFM_FDX) == 0) { - /* link down or not full-duplex */ - status_val = kSCBondStatusLinkInvalid; - } - else if (ps->ibps_system_priority == 0 - && bcmp(&zeroes, &ps->ibps_system, sizeof(zeroes)) == 0) { - /* no one on the other end of the link */ - status_val = kSCBondStatusNoPartner; - } - else if (active != bond_if_active) { - /* the link speed was different */ - status_val = kSCBondStatusLinkInvalid; - } - else { - /* partner is not in the active group */ - status_val = kSCBondStatusNotInActiveGroup; - } - } - num = CFNumberCreate(NULL, kCFNumberIntType, &status_val); - CFDictionarySetValue(status_device, kSCBondStatusDeviceAggregationStatus, num); - CFRelease(num); - num = CFNumberCreate(NULL, kCFNumberIntType, &collecting); - CFDictionarySetValue(status_device, kSCBondStatusDeviceCollecting, num); - CFRelease(num); - num = CFNumberCreate(NULL, kCFNumberIntType, &distributing); - CFDictionarySetValue(status_device, kSCBondStatusDeviceDistributing, num); - CFRelease(num); - bond_if = CFArrayGetValueAtIndex(bondPrivate->devices, i); - CFDictionarySetValue(status_devices, bond_if, status_device); - CFRelease(status_device); - } - - status = __BondStatusCreatePrivate(NULL, bond, status_interface, status_devices); - - CFRelease(status_interface); - CFRelease(status_devices); - done: - if (s != -1) { - close(s); - } - if (ibsr_p != NULL) { - free(ibsr_p); - } - return status; -} - - -CFArrayRef -BondStatusGetDevices(BondStatusRef bondStatus) -{ - BondStatusPrivateRef statusPrivate = (BondStatusPrivateRef)bondStatus; - - if (!isA_BondStatus(bondStatus)) { - return NULL; - } - - if (statusPrivate->devices == NULL) { - const void * keys_q[N_QUICK]; - const void ** keys = keys_q; - CFIndex n; - - n = CFDictionaryGetCount(statusPrivate->status_devices); - if (n > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) { - keys = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0); - } - CFDictionaryGetKeysAndValues(statusPrivate->status_devices, keys, NULL); - statusPrivate->devices = CFArrayCreate(NULL, keys, n, &kCFTypeArrayCallBacks); - if (keys != keys_q) { - CFAllocatorDeallocate(NULL, keys); - } - } - - return statusPrivate->devices; -} - - -CFDictionaryRef -BondStatusGetInterfaceStatus(BondStatusRef bondStatus) -{ - BondStatusPrivateRef statusPrivate = (BondStatusPrivateRef)bondStatus; - - if (!isA_BondStatus(bondStatus)) { - return NULL; - } - - return statusPrivate->status_interface; -} - - -CFDictionaryRef -BondStatusGetDeviceStatus(BondStatusRef bondStatus, CFStringRef device) -{ - BondStatusPrivateRef statusPrivate = (BondStatusPrivateRef)bondStatus; - - if (!isA_BondStatus(bondStatus)) { - return NULL; - } - - return CFDictionaryGetValue(statusPrivate->status_devices, device); -} diff --git a/SystemConfiguration.fproj/BondConfiguration.h b/SystemConfiguration.fproj/BondConfiguration.h deleted file mode 100644 index bcf06b1..0000000 --- a/SystemConfiguration.fproj/BondConfiguration.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _BONDCONFIGURATION_H -#define _BONDCONFIGURATION_H - -/*! - @header BONDCONFIGURATION -*/ - -#include -#include -#include -#include - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - -typedef const struct __BondInterface * BondInterfaceRef; - -typedef const struct __BondPreferences * BondPreferencesRef; - -typedef const struct __BondStatus * BondStatusRef; - - -__BEGIN_DECLS - -// ---------- - -Boolean -IsBondSupported (CFStringRef device) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // e.g. "en0", "en1", ... - -// ---------- - -CFTypeID -BondInterfaceGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -CFStringRef -BondInterfaceGetInterface (BondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // returns "bond0", "bond1", ... - -CFArrayRef /* of CFStringRef's */ -BondInterfaceGetDevices (BondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -CFDictionaryRef -BondInterfaceGetOptions (BondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // e.g. UserDefinedName, ... - -// ---------- - -CFTypeID -BondPreferencesGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -BondPreferencesRef -BondPreferencesCreate (CFAllocatorRef allocator) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -CFArrayRef /* of BondInterfaceRef's */ -BondPreferencesCopyInterfaces (BondPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -BondInterfaceRef -BondPreferencesCreateInterface (BondPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -Boolean -BondPreferencesRemoveInterface (BondPreferencesRef prefs, - BondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -Boolean -BondPreferencesAddDevice (BondPreferencesRef prefs, - BondInterfaceRef bond, - CFStringRef device) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // e.g. "en0", "en1", ... - -Boolean -BondPreferencesRemoveDevice (BondPreferencesRef prefs, - BondInterfaceRef bond, - CFStringRef device) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // e.g. "en0", "en1", ... - -Boolean -BondPreferencesSetOptions (BondPreferencesRef prefs, - BondInterfaceRef bond, - CFDictionaryRef newOptions) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -Boolean -BondPreferencesCommitChanges (BondPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -Boolean -BondPreferencesApplyChanges (BondPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -// ---------- - -CFTypeID -BondStatusGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -BondStatusRef -BondInterfaceCopyStatus (BondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -CFArrayRef -BondStatusGetDevices (BondStatusRef bondStatus) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -CFDictionaryRef -BondStatusGetInterfaceStatus (BondStatusRef bondStatus) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -CFDictionaryRef -BondStatusGetDeviceStatus (BondStatusRef bondStatus, - CFStringRef device) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -__END_DECLS - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ - -#endif /* _BONDCONFIGURATION_H */ diff --git a/SystemConfiguration.fproj/BondConfigurationPrivate.h b/SystemConfiguration.fproj/BondConfigurationPrivate.h deleted file mode 100644 index 1eb7419..0000000 --- a/SystemConfiguration.fproj/BondConfigurationPrivate.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _BONDCONFIGURATIONPRIVATE_H -#define _BONDCONFIGURATIONPRIVATE_H - -#include -#include - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - -/*! - @header BONDConfigurationPrivate - */ - -__BEGIN_DECLS - -__END_DECLS - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ - -#endif /* _BONDCONFIGURATIONPRIVATE_H */ diff --git a/SystemConfiguration.fproj/DHCPClientPreferences.h b/SystemConfiguration.fproj/DHCPClientPreferences.h index 9f2e4ba..cac5fb2 100644 --- a/SystemConfiguration.fproj/DHCPClientPreferences.h +++ b/SystemConfiguration.fproj/DHCPClientPreferences.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2001, 2004, 2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,8 +22,12 @@ */ #ifndef _DHCPCLIENTPREFERENCES_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _DHCPCLIENTPREFERENCES_H +#include #include #include @@ -50,9 +54,9 @@ __BEGIN_DECLS */ Boolean -DHCPClientPreferencesSetApplicationOptions(CFStringRef applicationID, - UInt8 * options, - CFIndex count); +DHCPClientPreferencesSetApplicationOptions (CFStringRef applicationID, + UInt8 *options, + CFIndex count) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function DHCPClientPreferencesCopyApplicationOptions @@ -68,9 +72,10 @@ DHCPClientPreferencesSetApplicationOptions(CFStringRef applicationID, */ UInt8 * -DHCPClientPreferencesCopyApplicationOptions(CFStringRef applicationID, - CFIndex * count); +DHCPClientPreferencesCopyApplicationOptions (CFStringRef applicationID, + CFIndex *count) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); __END_DECLS -#endif /* _DHCPCLIENTPREFERENCES_H */ +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ +#endif /* _DHCPCLIENTPREFERENCES_H */ diff --git a/SystemConfiguration.fproj/English.lproj/Localizable.strings b/SystemConfiguration.fproj/English.lproj/Localizable.strings index 480aa330d86b1d15cde96089e4fb6ab42c83f077..87406e7c67fcbda09260e06507699978b6c1a778 100644 GIT binary patch literal 1298 zcmchXT}uK%6o%hxf5oy8R2NxY1ra2=p=c_8kP#uGmQiWAM)>Ee=gh9{nrU@W2+oD?ahI9$4?IN5&n|SUaqS%%;r8x+RY4 zWEp)G6zEJjwN+6|T{W58SY_>;*lM0QjGUgSGSOpPyU*S+HI}(uQDN@zhGbrIvJAI5 zj7FR@2A&42gsd2&rw^VXJ2y^~r@H&4d6waFsl1BtD#5NxT^kETQMQda(3`qYO$~Mu z?oo!-?SUM|-VOdxK?$rTI{Qm*Z&DGR2+(M^U^*LUHhp#{c{gjNG$jZg8RqU3ya6so zxHg-`3VqyK?_V0Z18$oaP;|bo^D~WYC+ua6K>j~}kF>8t?dd?B*kKR+)!xXv9vHiu zSagJSN#Ga{@yzySbjhN-ep)4+pJub_!sd5u9oTgDYp%9<)iw9N1AMI$SGWm#=`Hda su2=I!K3b!`{QNaor+7=JsEm5{tM~9dkKbXgM@l+3(U{cU>}6E-9i&{tc>n+a delta 163 zcmbQlb&ZAX-+u-!2K|ZLt`mcTCf70QO+Lab3PAaMAREL>2J)2{tS9~#pZtumK-HDOks$zR gj1SPb03bUU2*ZK=AO;tNfs+?9%QHhYDKOdt0DFTW_W%F@ diff --git a/SystemConfiguration.fproj/English.lproj/NetworkInterface.strings b/SystemConfiguration.fproj/English.lproj/NetworkInterface.strings index a297a9afed60a20ef619d1582ebee14edad70932..9a0d08b25dbffbaa46661467018aeb5b155c6402 100644 GIT binary patch delta 321 zcmaDLy-AVj|G$mQHmvLl3@!|z41SyKSTotVl^8M^3K)tRQW=sbI_PtHG6XOLgE*7t z@w76#GE_{q;*g%q%^@@YRL7xBs delta 37 tcmdm__&}QZ-+zXUOg5~{N(|PMC$dRS4q)TkT)=9_KKU0<&EzY*djav+4G;hT diff --git a/SystemConfiguration.fproj/Info-Embedded.plist b/SystemConfiguration.fproj/Info-Embedded.plist new file mode 100644 index 0000000..8714e9f --- /dev/null +++ b/SystemConfiguration.fproj/Info-Embedded.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + SystemConfiguration + CFBundleGetInfoString + 1.10 + CFBundleIdentifier + com.apple.SystemConfiguration + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + SystemConfiguration + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.10 + CFBundleSignature + ???? + CFBundleVersion + 1.10 + + diff --git a/SystemConfiguration.fproj/Info.plist b/SystemConfiguration.fproj/Info.plist index fb43f61..8714e9f 100644 --- a/SystemConfiguration.fproj/Info.plist +++ b/SystemConfiguration.fproj/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable SystemConfiguration CFBundleGetInfoString - 1.9.2 + 1.10 CFBundleIdentifier com.apple.SystemConfiguration CFBundleInfoDictionaryVersion @@ -17,10 +17,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.9.2 + 1.10 CFBundleSignature ???? CFBundleVersion - 1.9.2 + 1.10 diff --git a/SystemConfiguration.fproj/LinkConfiguration.h b/SystemConfiguration.fproj/LinkConfiguration.h index 95e9ef9..6a6c53f 100644 --- a/SystemConfiguration.fproj/LinkConfiguration.h +++ b/SystemConfiguration.fproj/LinkConfiguration.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2002, 2004, 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -25,6 +25,7 @@ #ifndef _LINKCONFIGURATION_H #define _LINKCONFIGURATION_H +#include #include #include @@ -62,7 +63,7 @@ NetworkInterfaceCopyMediaOptions( CFDictionaryRef *active, CFArrayRef *available, Boolean filter - ) AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; + ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA); /*! @function NetworkInterfaceCopyMediaSubTypes @@ -76,7 +77,7 @@ NetworkInterfaceCopyMediaOptions( CFArrayRef NetworkInterfaceCopyMediaSubTypes( CFArrayRef available - ) AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; + ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA); /*! @function NetworkInterfaceCopyMediaSubTypeOptions @@ -93,7 +94,7 @@ CFArrayRef NetworkInterfaceCopyMediaSubTypeOptions( CFArrayRef available, CFStringRef subType - ) AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; + ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA); /*! @function NetworkInterfaceCopyMTU @@ -116,7 +117,7 @@ NetworkInterfaceCopyMTU( int *mtu_cur, int *mtu_min, int *mtu_max - ) AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; + ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA); __END_DECLS diff --git a/SystemConfiguration.fproj/NetworkConfiguration.plist b/SystemConfiguration.fproj/NetworkConfiguration.plist index 3fb9a4c..de4cf22 100644 --- a/SystemConfiguration.fproj/NetworkConfiguration.plist +++ b/SystemConfiguration.fproj/NetworkConfiguration.plist @@ -9,15 +9,15 @@ Bluetooth ConnectionPersonality - v.34 Personality + Default Personality ConnectionScript - /Library/Modem Scripts/Apple Modems.ccl + /Library/Modem Scripts/Generic Dialup.ccl DataCompression 1 DeviceModel - Apple Modem (v.34) + Dialup Device DeviceVendor - Apple + Generic DialMode WaitForDialTone ErrorCorrection @@ -38,6 +38,8 @@ JoinMode Automatic + IPSec-IPv4 + IrDA L2TP-IPv4 @@ -45,15 +47,15 @@ Modem ConnectionPersonality - v.34 Personality + Default Personality ConnectionScript - /Library/Modem Scripts/Apple Modems.ccl + /Library/Modem Scripts/Generic Dialup.ccl DataCompression 1 DeviceModel - Apple Modem (v.34) + Dialup Device DeviceVendor - Apple + Generic DialMode WaitForDialTone ErrorCorrection @@ -451,7 +453,7 @@ WWAN ConnectionScript - /Library/Modem Scripts/WWAN Support + /Library/Modem Scripts/WWAN.ccl DataCompression 1 DialMode @@ -501,13 +503,6 @@ Ethernet - AppleTalk - - ConfigMethod - Node - __INACTIVE__ - - DNS IPv4 @@ -558,13 +553,6 @@ IEEE80211 - AppleTalk - - ConfigMethod - Node - __INACTIVE__ - - DNS IPv4 @@ -588,6 +576,28 @@ 1 + IPSec-IPv4 + + DNS + + IPv4 + + ConfigMethod + Automatic + + Proxies + + ExceptionList + + *.local + 169.254/16 + + FTPPassive + 1 + + + L2TP-IPv4 + PPP-Bluetooth DNS @@ -770,8 +780,6 @@ PPTP-IPv4 - PPTP-L2TP - VLAN DNS diff --git a/SystemConfiguration.fproj/SCD.c b/SystemConfiguration.fproj/SCD.c index 797571d..070ff01 100644 --- a/SystemConfiguration.fproj/SCD.c +++ b/SystemConfiguration.fproj/SCD.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -42,52 +42,89 @@ #include "SCDynamicStoreInternal.h" #include "config.h" /* MiG generated file */ + /* framework variables */ -Boolean _sc_debug = FALSE; /* TRUE if debugging enabled */ -Boolean _sc_verbose = FALSE; /* TRUE if verbose logging enabled */ -Boolean _sc_log = TRUE; /* TRUE if SCLog() output goes to syslog */ +int _sc_debug = FALSE; /* non-zero if debugging enabled */ +int _sc_verbose = FALSE; /* non-zero if verbose logging enabled */ +int _sc_log = TRUE; /* 0 if SC messages should be written to stdout/stderr, + 1 if SC messages should be logged w/asl(3), + 2 if SC messages should be written to stdout/stderr AND logged */ -static const struct sc_errmsg { - int status; - char *message; -} sc_errmsgs[] = { - { kSCStatusAccessError, "Permission denied" }, - { kSCStatusFailed, "Failed!" }, - { kSCStatusInvalidArgument, "Invalid argument" }, - { kSCStatusKeyExists, "Key already defined" }, - { kSCStatusLocked, "Lock already held" }, - { kSCStatusMaxLink, "Maximum link count exceeded" }, - { kSCStatusNeedLock, "Lock required for this operation" }, - { kSCStatusNoStoreServer, "Configuration daemon not (no longer) available" }, - { kSCStatusNoStoreSession, "Configuration daemon session not active" }, - { kSCStatusNoConfigFile, "Configuration file not found" }, - { kSCStatusNoKey, "No such key" }, - { kSCStatusNoLink, "No such link" }, - { kSCStatusNoPrefsSession, "Preference session not active" }, - { kSCStatusNotifierActive, "Notifier is currently active" }, - { kSCStatusOK, "Success!" }, - { kSCStatusPrefsBusy, "Preferences update currently in progress" }, - { kSCStatusReachabilityUnknown, "Network reachability cannot be determined" }, - { kSCStatusStale, "Write attempted on stale version of object" }, -}; -#define nSC_ERRMSGS (sizeof(sc_errmsgs)/sizeof(struct sc_errmsg)) +#pragma mark - +#pragma mark Thread specific data -#define USE_SCCOPYDESCRIPTION -#ifdef USE_SCCOPYDESCRIPTION -// from -extern CFStringRef _CFStringCreateWithFormatAndArgumentsAux(CFAllocatorRef alloc, CFStringRef (*copyDescFunc)(void *, CFDictionaryRef), CFDictionaryRef formatOptions, CFStringRef format, va_list arguments); +typedef struct { + aslclient _asl; + int _sc_error; +} __SCThreadSpecificData, *__SCThreadSpecificDataRef; + + +static pthread_once_t tsKeyInitialized = PTHREAD_ONCE_INIT; +static pthread_key_t tsDataKey; -#define N_QUICK 32 -static CFStringRef -_SCCopyDescription(void *info, CFDictionaryRef formatOptions) +static void +__SCThreadSpecificDataFinalize(void *arg) { + __SCThreadSpecificDataRef tsd = (__SCThreadSpecificDataRef)arg; + + if (tsd != NULL) { + if (tsd->_asl != NULL) asl_close(tsd->_asl); + CFAllocatorDeallocate(kCFAllocatorSystemDefault, tsd); + } + return; +} + + +static void +__SCThreadSpecificKeyInitialize() +{ + pthread_key_create(&tsDataKey, __SCThreadSpecificDataFinalize); + return; +} + + +static __SCThreadSpecificDataRef +__SCGetThreadSpecificData() +{ + __SCThreadSpecificDataRef tsd; + + pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize); + + tsd = pthread_getspecific(tsDataKey); + if (tsd == NULL) { + tsd = CFAllocatorAllocate(kCFAllocatorSystemDefault, sizeof(__SCThreadSpecificData), 0); + tsd->_asl = asl_open(NULL, NULL, 0); + asl_set_filter(tsd->_asl, ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG)); + tsd->_sc_error = kSCStatusOK; + pthread_setspecific(tsDataKey, tsd); + } + + return tsd; +} + + +#pragma mark - +#pragma mark Logging + + +#define ENABLE_SC_FORMATTING +#ifdef ENABLE_SC_FORMATTING +// from +extern CFStringRef _CFStringCreateWithFormatAndArgumentsAux(CFAllocatorRef alloc, CFStringRef (*copyDescFunc)(CFTypeRef, CFDictionaryRef), CFDictionaryRef formatOptions, CFStringRef format, va_list arguments); +#endif /* ENABLE_SC_FORMATTING */ + + +CFStringRef +_SCCopyDescription(CFTypeRef cf, CFDictionaryRef formatOptions) +{ +#ifdef ENABLE_SC_FORMATTING CFMutableDictionaryRef nFormatOptions; CFStringRef prefix1; CFStringRef prefix2; - CFTypeID type = CFGetTypeID(info); + CFTypeID type = CFGetTypeID(cf); if (!formatOptions || !CFDictionaryGetValueIfPresent(formatOptions, CFSTR("PREFIX1"), (const void **)&prefix1)) { @@ -99,7 +136,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) formatOptions, CFSTR("%@%@"), prefix1, - info); + cf); } if (type == CFBooleanGetTypeID()) { @@ -107,7 +144,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) formatOptions, CFSTR("%@%s"), prefix1, - CFBooleanGetValue(info) ? "TRUE" : "FALSE"); + CFBooleanGetValue(cf) ? "TRUE" : "FALSE"); } if (type == CFDataGetTypeID()) { @@ -119,8 +156,8 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) str = CFStringCreateMutable(NULL, 0); CFStringAppendFormat(str, formatOptions, CFSTR("%@ 0x"), prefix1); - data = CFDataGetBytePtr(info); - dataLen = CFDataGetLength(info); + data = CFDataGetBytePtr(cf); + dataLen = CFDataGetLength(cf); for (i = 0; i < dataLen; i++) { CFStringAppendFormat(str, NULL, CFSTR("%02x"), data[i]); } @@ -133,7 +170,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) formatOptions, CFSTR("%@%@"), prefix1, - info); + cf); } if (type == CFDateGetTypeID()) { @@ -142,7 +179,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) CFTimeZoneRef tZone; tZone = CFTimeZoneCopySystem(); - gDate = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(info), tZone); + gDate = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(cf), tZone); str = CFStringCreateWithFormat(NULL, formatOptions, CFSTR("%@%02d/%02d/%04d %02d:%02d:%02.0f %@"), @@ -160,7 +197,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) if (!formatOptions || !CFDictionaryGetValueIfPresent(formatOptions, CFSTR("PREFIX2"), (const void **)&prefix2)) { - prefix2 = CFStringCreateCopy(NULL, prefix1); + prefix2 = prefix1; } if (formatOptions) { @@ -172,8 +209,10 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) &kCFTypeDictionaryValueCallBacks); } +#define N_QUICK 32 + if (type == CFArrayGetTypeID()) { - const void * elements_q[32]; + const void * elements_q[N_QUICK]; const void ** elements = elements_q; CFIndex i; CFIndex nElements; @@ -182,11 +221,11 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) str = CFStringCreateMutable(NULL, 0); CFStringAppendFormat(str, formatOptions, CFSTR("%@ {"), prefix1); - nElements = CFArrayGetCount(info); + nElements = CFArrayGetCount(cf); if (nElements > 0) { if (nElements > (CFIndex)(sizeof(elements_q)/sizeof(CFTypeRef))) elements = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0); - CFArrayGetValues(info, CFRangeMake(0, nElements), elements); + CFArrayGetValues(cf, CFRangeMake(0, nElements), elements); for (i = 0; i < nElements; i++) { CFMutableStringRef nPrefix1; CFMutableStringRef nPrefix2; @@ -213,7 +252,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) CFRelease(nPrefix2); CFRelease(nStr); - vStr = _SCCopyDescription((void *)elements[i], nFormatOptions); + vStr = _SCCopyDescription((CFTypeRef)elements[i], nFormatOptions); CFStringAppendFormat(str, formatOptions, CFSTR("\n%@"), @@ -242,18 +281,18 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) str = CFStringCreateMutable(NULL, 0); CFStringAppendFormat(str, formatOptions, CFSTR("%@ {"), prefix1); - nElements = CFDictionaryGetCount(info); + nElements = CFDictionaryGetCount(cf); if (nElements > 0) { if (nElements > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) { keys = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0); values = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0); } - CFDictionaryGetKeysAndValues(info, keys, values); + CFDictionaryGetKeysAndValues(cf, keys, values); for (i = 0; i < nElements; i++) { CFStringRef kStr; CFStringRef vStr; - kStr = _SCCopyDescription((void *)keys[i], NULL); + kStr = _SCCopyDescription((CFTypeRef)keys[i], NULL); nPrefix1 = CFStringCreateMutable(NULL, 0); CFStringAppendFormat(nPrefix1, @@ -273,7 +312,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) CFRelease(nPrefix2); CFRelease(kStr); - vStr = _SCCopyDescription((void *)values[i], nFormatOptions); + vStr = _SCCopyDescription((CFTypeRef)values[i], nFormatOptions); CFStringAppendFormat(str, formatOptions, CFSTR("\n%@"), @@ -292,70 +331,75 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions) } CFRelease(nFormatOptions); +#endif /* ENABLE_SC_FORMATTING */ - { - CFStringRef cfStr; - CFStringRef str; - - cfStr = CFCopyDescription(info); - str = CFStringCreateWithFormat(NULL, - formatOptions, - CFSTR("%@%@"), - prefix1, - cfStr); - CFRelease(cfStr); - return str; - } + return CFStringCreateWithFormat(NULL, + formatOptions, + CFSTR("%@%@"), + prefix1, + cf); } -#endif /* USE_SCCOPYDESCRIPTION */ - static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static void -__SCLog(int level, CFStringRef formatString, va_list formatArguments) +__SCLog(aslclient asl, aslmsg msg, int level, CFStringRef formatString, va_list formatArguments) { + CFDataRef line; CFArrayRef lines; CFStringRef str; -#ifdef USE_SCCOPYDESCRIPTION + if (asl == NULL) { + __SCThreadSpecificDataRef tsd; + + tsd = __SCGetThreadSpecificData(); + asl = tsd->_asl; + } + +#ifdef ENABLE_SC_FORMATTING str = _CFStringCreateWithFormatAndArgumentsAux(NULL, _SCCopyDescription, NULL, formatString, formatArguments); -#else /* USE_SCCOPYDESCRIPTION */ +#else /* ENABLE_SC_FORMATTING */ str = CFStringCreateWithFormatAndArguments (NULL, NULL, formatString, formatArguments); -#endif /* !USE_SCCOPYDESCRIPTION */ - - lines = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR("\n")); - CFRelease(str); - - if (lines) { - int i; - int n = CFArrayGetCount(lines); - - pthread_mutex_lock(&lock); - for (i = 0; i < n; i++) { - CFDataRef line; - - line = CFStringCreateExternalRepresentation(NULL, - CFArrayGetValueAtIndex(lines, i), - kCFStringEncodingUTF8, - (UInt8)'?'); - if (line) { - syslog (level, "%.*s", (int)CFDataGetLength(line), CFDataGetBytePtr(line)); - CFRelease(line); +#endif /* !ENABLE_SC_FORMATTING */ + + if (level >= 0) { + lines = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR("\n")); + if (lines != NULL) { + int i; + int n = CFArrayGetCount(lines); + + for (i = 0; i < n; i++) { + line = CFStringCreateExternalRepresentation(NULL, + CFArrayGetValueAtIndex(lines, i), + kCFStringEncodingUTF8, + (UInt8)'?'); + if (line) { + asl_log(asl, msg, level, "%.*s", (int)CFDataGetLength(line), CFDataGetBytePtr(line)); + CFRelease(line); + } } + CFRelease(lines); + } + } else { + line = CFStringCreateExternalRepresentation(NULL, + str, + kCFStringEncodingUTF8, + (UInt8)'?'); + if (line) { + asl_log(asl, msg, ~level, "%.*s", (int)CFDataGetLength(line), CFDataGetBytePtr(line)); + CFRelease(line); } - pthread_mutex_unlock(&lock); - CFRelease(lines); } + CFRelease(str); return; } @@ -367,18 +411,18 @@ __SCPrint(FILE *stream, CFStringRef formatString, va_list formatArguments, Boole CFDataRef line; CFStringRef str; -#ifdef USE_SCCOPYDESCRIPTION +#ifdef ENABLE_SC_FORMATTING str = _CFStringCreateWithFormatAndArgumentsAux(NULL, _SCCopyDescription, NULL, formatString, formatArguments); -#else /* USE_SCCOPYDESCRIPTION */ +#else /* ENABLE_SC_FORMATTING */ str = CFStringCreateWithFormatAndArguments (NULL, NULL, formatString, formatArguments); -#endif /* !USE_SCCOPYDESCRIPTION */ +#endif /* !ENABLE_SC_FORMATTING */ line = CFStringCreateExternalRepresentation(NULL, str, @@ -422,7 +466,7 @@ SCLog(Boolean condition, int level, CFStringRef formatString, ...) va_start(formatArguments, formatString); if (_sc_log > 0) { - __SCLog(level, formatString, formatArguments); + __SCLog(NULL, NULL, level, formatString, formatArguments); } if (_sc_log != 1) { __SCPrint((LOG_PRI(level) > LOG_NOTICE) ? stderr : stdout, @@ -437,6 +481,31 @@ SCLog(Boolean condition, int level, CFStringRef formatString, ...) } +void +SCLOG(aslclient asl, aslmsg msg, int level, CFStringRef formatString, ...) +{ + va_list formatArguments; + + va_start(formatArguments, formatString); + if (_sc_log > 0) { + __SCLog(asl, msg, level, formatString, formatArguments); + } + if (_sc_log != 1) { + if (level < 0) { + level = ~level; + } + __SCPrint((level > ASL_LEVEL_NOTICE) ? stderr : stdout, + formatString, + formatArguments, + (_sc_log > 0), // trace + TRUE); // add newline + } + va_end(formatArguments); + + return; +} + + void SCPrint(Boolean condition, FILE *stream, CFStringRef formatString, ...) { @@ -471,36 +540,38 @@ SCTrace(Boolean condition, FILE *stream, CFStringRef formatString, ...) } -typedef struct { - int _sc_error; -} __SCThreadSpecificData, *__SCThreadSpecificDataRef; - - -static pthread_once_t tsKeyInitialized = PTHREAD_ONCE_INIT; -static pthread_key_t tsDataKey; +#pragma mark - +#pragma mark SC error handling / logging -static void -__SCThreadSpecificDataFinalize(void *arg) -{ - __SCThreadSpecificDataRef tsd = (__SCThreadSpecificDataRef)arg; - - if (!tsd) return; - - CFAllocatorDeallocate(kCFAllocatorSystemDefault, tsd); - return; -} - - -static void -__SCThreadSpecificKeyInitialize() -{ - pthread_key_create(&tsDataKey, __SCThreadSpecificDataFinalize); - return; -} +const CFStringRef kCFErrorDomainSystemConfiguration = CFSTR("com.apple.SystemConfiguration"); -const CFStringRef kCFErrorDomainSystemConfiguration = CFSTR("com.apple.SystemConfiguration"); +static const struct sc_errmsg { + int status; + char *message; +} sc_errmsgs[] = { + { kSCStatusAccessError, "Permission denied" }, + { kSCStatusConnectionNoService, "Network service for connection not available" }, + { kSCStatusFailed, "Failed!" }, + { kSCStatusInvalidArgument, "Invalid argument" }, + { kSCStatusKeyExists, "Key already defined" }, + { kSCStatusLocked, "Lock already held" }, + { kSCStatusMaxLink, "Maximum link count exceeded" }, + { kSCStatusNeedLock, "Lock required for this operation" }, + { kSCStatusNoStoreServer, "Configuration daemon not (no longer) available" }, + { kSCStatusNoStoreSession, "Configuration daemon session not active" }, + { kSCStatusNoConfigFile, "Configuration file not found" }, + { kSCStatusNoKey, "No such key" }, + { kSCStatusNoLink, "No such link" }, + { kSCStatusNoPrefsSession, "Preference session not active" }, + { kSCStatusNotifierActive, "Notifier is currently active" }, + { kSCStatusOK, "Success!" }, + { kSCStatusPrefsBusy, "Preferences update currently in progress" }, + { kSCStatusReachabilityUnknown, "Network reachability cannot be determined" }, + { kSCStatusStale, "Write attempted on stale version of object" }, +}; +#define nSC_ERRMSGS (sizeof(sc_errmsgs)/sizeof(struct sc_errmsg)) void @@ -508,15 +579,7 @@ _SCErrorSet(int error) { __SCThreadSpecificDataRef tsd; - pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize); - - tsd = pthread_getspecific(tsDataKey); - if (!tsd) { - tsd = CFAllocatorAllocate(kCFAllocatorSystemDefault, sizeof(__SCThreadSpecificData), 0); - bzero(tsd, sizeof(__SCThreadSpecificData)); - pthread_setspecific(tsDataKey, tsd); - } - + tsd = __SCGetThreadSpecificData(); tsd->_sc_error = error; return; } @@ -532,10 +595,8 @@ SCCopyLastError(void) __SCThreadSpecificDataRef tsd; CFMutableDictionaryRef userInfo = NULL; - pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize); - - tsd = pthread_getspecific(tsDataKey); - code = tsd ? tsd->_sc_error : kSCStatusOK; + tsd = __SCGetThreadSpecificData(); + code =tsd->_sc_error; for (i = 0; i < (int)nSC_ERRMSGS; i++) { if (sc_errmsgs[i].status == code) { @@ -563,7 +624,7 @@ SCCopyLastError(void) domain = kCFErrorDomainMach; done : - + error = CFErrorCreate(NULL, domain, code, userInfo); if (userInfo != NULL) CFRelease(userInfo); return error; @@ -575,10 +636,8 @@ SCError(void) { __SCThreadSpecificDataRef tsd; - pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize); - - tsd = pthread_getspecific(tsDataKey); - return tsd ? tsd->_sc_error : kSCStatusOK; + tsd = __SCGetThreadSpecificData(); + return tsd->_sc_error; } diff --git a/SystemConfiguration.fproj/SCDAdd.c b/SystemConfiguration.fproj/SCDAdd.c index 16b464f..e22424a 100644 --- a/SystemConfiguration.fproj/SCDAdd.c +++ b/SystemConfiguration.fproj/SCDAdd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -56,6 +56,7 @@ SCDynamicStoreAddTemporaryValue(SCDynamicStoreRef store, CFStringRef key, CFProp if (store == NULL) { /* sorry, you must provide a session */ _SCErrorSet(kSCStatusNoStoreSession); + return FALSE; } if (storePrivate->server == MACH_PORT_NULL) { @@ -91,11 +92,13 @@ SCDynamicStoreAddTemporaryValue(SCDynamicStoreRef store, CFStringRef key, CFProp CFRelease(xmlData); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreAddTemporaryValue configadd_s(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddTemporaryValue configadd_s(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; @@ -162,11 +165,13 @@ SCDynamicStoreAddValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR CFRelease(xmlData); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreAddValue configadd(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddValue configadd(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDConsoleUser.c b/SystemConfiguration.fproj/SCDConsoleUser.c index b114d13..0504412 100644 --- a/SystemConfiguration.fproj/SCDConsoleUser.c +++ b/SystemConfiguration.fproj/SCDConsoleUser.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -202,7 +202,7 @@ SCDynamicStoreSetConsoleInformation(SCDynamicStoreRef store, CFStringRef consoleUser; CFMutableDictionaryRef dict = NULL; CFStringRef key = SCDynamicStoreKeyCreateConsoleUser(NULL); - Boolean ok = TRUE; + Boolean ok = FALSE; Boolean tempSession = FALSE; if (store == NULL) { @@ -211,13 +211,13 @@ SCDynamicStoreSetConsoleInformation(SCDynamicStoreRef store, NULL, NULL); if (store == NULL) { - return FALSE; + goto done; } tempSession = TRUE; } if ((user == NULL) && (sessions == NULL)) { - (void) SCDynamicStoreRemoveValue(store, key); + ok = SCDynamicStoreRemoveValue(store, key); goto done; } @@ -267,7 +267,7 @@ SCDynamicStoreSetConsoleUser(SCDynamicStoreRef store, CFMutableDictionaryRef dict = NULL; CFStringRef key = SCDynamicStoreKeyCreateConsoleUser(NULL); CFNumberRef num; - Boolean ok = TRUE; + Boolean ok = FALSE; Boolean tempSession = FALSE; if (store == NULL) { @@ -276,13 +276,13 @@ SCDynamicStoreSetConsoleUser(SCDynamicStoreRef store, NULL, NULL); if (store == NULL) { - return FALSE; + goto done; } tempSession = TRUE; } if (user == NULL) { - (void) SCDynamicStoreRemoveValue(store, key); + ok = SCDynamicStoreRemoveValue(store, key); goto done; } diff --git a/SystemConfiguration.fproj/SCDGet.c b/SystemConfiguration.fproj/SCDGet.c index b71e645..ba86734 100644 --- a/SystemConfiguration.fproj/SCDGet.c +++ b/SystemConfiguration.fproj/SCDGet.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -102,24 +102,20 @@ SCDynamicStoreCopyMultiple(SCDynamicStoreRef store, if (xmlPatterns) CFRelease(xmlPatterns); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCopyMultiple configget_m(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyMultiple configget_m(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return NULL; } if (sc_status != kSCStatusOK) { - status = vm_deallocate(mach_task_self(), (vm_address_t)xmlDictRef, xmlDictLen); -#ifdef DEBUG - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreCopyMultiple vm_deallocate(): %s"), mach_error_string(status)); - /* non-fatal???, proceed */ - } -#endif /* DEBUG */ + (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDictRef, xmlDictLen); _SCErrorSet(sc_status); return NULL; } @@ -181,24 +177,20 @@ SCDynamicStoreCopyValue(SCDynamicStoreRef store, CFStringRef key) CFRelease(utfKey); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCopyValue configget(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyValue configget(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return NULL; } if (sc_status != kSCStatusOK) { - status = vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen); -#ifdef DEBUG - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreCopyValue vm_deallocate(): %s"), mach_error_string(status)); - /* non-fatal???, proceed */ - } -#endif /* DEBUG */ + (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen); _SCErrorSet(sc_status); return NULL; } diff --git a/SystemConfiguration.fproj/SCDHostName.c b/SystemConfiguration.fproj/SCDHostName.c index 112b432..3a0e61f 100644 --- a/SystemConfiguration.fproj/SCDHostName.c +++ b/SystemConfiguration.fproj/SCDHostName.c @@ -482,12 +482,14 @@ _SC_stringIsValidDNSName(const char *name) } else if (isalnum(ch) == 0) { switch (ch) { case '.': - case '-': - if (prev == '.' || prev == '-') { - /* a label cannot begin or end with a hyphen */ + if (prev == '.') { + /* no empty labels */ return FALSE; } break; + case '-': + /* hyphens are OK within a label */ + break; default: /* an invalid character */ return FALSE; diff --git a/SystemConfiguration.fproj/SCDList.c b/SystemConfiguration.fproj/SCDList.c index f193b7c..7659c0f 100644 --- a/SystemConfiguration.fproj/SCDList.c +++ b/SystemConfiguration.fproj/SCDList.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -82,24 +82,20 @@ SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef pattern) CFRelease(utfPattern); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCopyKeyList configlist(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyKeyList configlist(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return NULL; } if (sc_status != kSCStatusOK) { - status = vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen); -#ifdef DEBUG - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreCopyKeyList vm_deallocate(): %s"), mach_error_string(status)); - /* non-fatal???, proceed */ - } -#endif /* DEBUG */ + (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen); _SCErrorSet(sc_status); return NULL; } diff --git a/SystemConfiguration.fproj/SCDLock.c b/SystemConfiguration.fproj/SCDLock.c index c3f5d22..291cb32 100644 --- a/SystemConfiguration.fproj/SCDLock.c +++ b/SystemConfiguration.fproj/SCDLock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -62,11 +62,13 @@ SCDynamicStoreLock(SCDynamicStoreRef store) status = configlock(storePrivate->server, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreLock configlock(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreLock configlock(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDNotifierAdd.c b/SystemConfiguration.fproj/SCDNotifierAdd.c index 063ef9d..7e58721 100644 --- a/SystemConfiguration.fproj/SCDNotifierAdd.c +++ b/SystemConfiguration.fproj/SCDNotifierAdd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -78,11 +78,13 @@ SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean is CFRelease(utfKey); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreAddWatchedKey notifyadd(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddWatchedKey notifyadd(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDNotifierCancel.c b/SystemConfiguration.fproj/SCDNotifierCancel.c index 450f1b9..fa290e9 100644 --- a/SystemConfiguration.fproj/SCDNotifierCancel.c +++ b/SystemConfiguration.fproj/SCDNotifierCancel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -67,17 +67,22 @@ SCDynamicStoreNotifyCancel(SCDynamicStoreRef store) return TRUE; case Using_NotifierInformViaCallback : /* invalidate and release the run loop source */ - CFRunLoopSourceInvalidate(storePrivate->callbackRLS); - CFRelease(storePrivate->callbackRLS); - storePrivate->callbackRLS = NULL; + if (storePrivate->callbackRLS != NULL) { + CFRunLoopSourceInvalidate(storePrivate->callbackRLS); + CFRelease(storePrivate->callbackRLS); + storePrivate->callbackRLS = NULL; + } /* invalidate and release the callback mach port */ - CFMachPortInvalidate(storePrivate->callbackPort); - CFRelease(storePrivate->callbackPort); - storePrivate->callbackPort = NULL; + if (storePrivate->callbackPort != NULL) { + __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreNotifyCancel", CFMachPortGetPort(storePrivate->callbackPort)); + CFMachPortInvalidate(storePrivate->callbackPort); + CFRelease(storePrivate->callbackPort); + storePrivate->callbackPort = NULL; + } - storePrivate->callbackArgument = NULL; - storePrivate->callbackFunction = NULL; + storePrivate->callbackArgument = NULL; + storePrivate->callbackFunction = NULL; break; default : break; @@ -89,11 +94,13 @@ SCDynamicStoreNotifyCancel(SCDynamicStoreRef store) storePrivate->notifyStatus = NotifierNotRegistered; if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyCancel notifycancel(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCancel notifycancel(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDNotifierGetChanges.c b/SystemConfiguration.fproj/SCDNotifierGetChanges.c index 04dc9b5..a302091 100644 --- a/SystemConfiguration.fproj/SCDNotifierGetChanges.c +++ b/SystemConfiguration.fproj/SCDNotifierGetChanges.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -67,24 +67,20 @@ SCDynamicStoreCopyNotifiedKeys(SCDynamicStoreRef store) (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCopyNotifiedKeys notifychanges(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyNotifiedKeys notifychanges(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return NULL; } if (sc_status != kSCStatusOK) { - status = vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen); -#ifdef DEBUG - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreCopyNotifiedKeys vm_deallocate(): %s"), mach_error_string(status)); - /* non-fatal???, proceed */ - } -#endif /* DEBUG */ + (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen); _SCErrorSet(sc_status); return NULL; } diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c b/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c index aa1faef..3e22cc4 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaCallback.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -31,6 +31,12 @@ * - initial revision */ +#include +#include +#include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE #include #include @@ -39,6 +45,7 @@ #include "SCDynamicStoreInternal.h" #include "config.h" /* MiG generated file */ + static void informCallback(CFMachPortRef port, void *msg, CFIndex size, void *info) { @@ -82,19 +89,24 @@ informCallback(CFMachPortRef port, void *msg, CFIndex size, void *info) #endif /* DEBUG */ /* invalidate the run loop source */ - CFRunLoopSourceInvalidate(storePrivate->callbackRLS); - CFRelease(storePrivate->callbackRLS); - storePrivate->callbackRLS = NULL; + if (storePrivate->callbackRLS != NULL) { + CFRunLoopSourceInvalidate(storePrivate->callbackRLS); + CFRelease(storePrivate->callbackRLS); + storePrivate->callbackRLS = NULL; + } /* invalidate port */ - CFMachPortInvalidate(storePrivate->callbackPort); - CFRelease(storePrivate->callbackPort); - storePrivate->callbackPort = NULL; + if (storePrivate->callbackPort != NULL) { + __MACH_PORT_DEBUG(TRUE, "*** informCallback", CFMachPortGetPort(storePrivate->callbackPort)); + CFMachPortInvalidate(storePrivate->callbackPort); + CFRelease(storePrivate->callbackPort); + storePrivate->callbackPort = NULL; + } /* disable notifier */ - storePrivate->notifyStatus = NotifierNotRegistered; - storePrivate->callbackArgument = NULL; - storePrivate->callbackFunction = NULL; + storePrivate->notifyStatus = NotifierNotRegistered; + storePrivate->callbackArgument = NULL; + storePrivate->callbackFunction = NULL; return; } @@ -149,13 +161,29 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef store, } /* Allocating port (for server response) */ - storePrivate->callbackPort = CFMachPortCreate(NULL, - informCallback, - &context, - NULL); + status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port); + if (status != KERN_SUCCESS) { + SCLog(TRUE, LOG_ERR, CFSTR("mach_port_allocate(): %s"), mach_error_string(status)); + _SCErrorSet(status); + return FALSE; + } + + status = mach_port_insert_right(mach_task_self(), + port, + port, + MACH_MSG_TYPE_MAKE_SEND); + if (status != KERN_SUCCESS) { + /* + * We can't insert a send right into our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("mach_port_insert_right(): %s"), mach_error_string(status)); + _SCErrorSet(status); + return FALSE; + } /* Request a notification when/if the server dies */ - port = CFMachPortGetPort(storePrivate->callbackPort); status = mach_port_request_notification(mach_task_self(), port, MACH_NOTIFY_NO_SENDERS, @@ -164,18 +192,19 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef store, MACH_MSG_TYPE_MAKE_SEND_ONCE, &oldNotify); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyCallback mach_port_request_notification(): %s"), mach_error_string(status)); - CFMachPortInvalidate(storePrivate->callbackPort); - CFRelease(storePrivate->callbackPort); + /* + * We can't request a notification for our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback mach_port_request_notification(): %s"), mach_error_string(status)); _SCErrorSet(status); return FALSE; } -#ifdef DEBUG if (oldNotify != MACH_PORT_NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback(): why is oldNotify != MACH_PORT_NULL?")); + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback(): oldNotify != MACH_PORT_NULL")); } -#endif /* DEBUG */ /* Requesting notification via mach port */ status = notifyviaport(storePrivate->server, @@ -184,14 +213,22 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef store, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyCallback notifyviaport(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - CFMachPortInvalidate(storePrivate->callbackPort); - CFRelease(storePrivate->callbackPort); - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback notifyviaport(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; + + if (status == MACH_SEND_INVALID_DEST) { + /* remove the send right that we tried (but failed) to pass to the server */ + (void) mach_port_deallocate(mach_task_self(), port); + } + + /* remove our receive right */ + (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1); _SCErrorSet(status); return FALSE; } @@ -202,11 +239,13 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef store, } /* set notifier active */ - storePrivate->notifyStatus = Using_NotifierInformViaCallback; + storePrivate->notifyStatus = Using_NotifierInformViaCallback; /* Creating/adding a run loop source for the port */ + __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreNotifyCallback", port); storePrivate->callbackArgument = arg; storePrivate->callbackFunction = func; + storePrivate->callbackPort = CFMachPortCreateWithPort(NULL, port, informCallback, &context, NULL); storePrivate->callbackRLS = CFMachPortCreateRunLoopSource(NULL, storePrivate->callbackPort, 0); CFRunLoopAddSource(runLoop, storePrivate->callbackRLS, kCFRunLoopDefaultMode); @@ -235,33 +274,38 @@ rlsCallback(CFMachPortRef port, void *msg, CFIndex size, void *info) #endif /* DEBUG */ /* invalidate the run loop source(s) */ - CFRunLoopSourceInvalidate(storePrivate->callbackRLS); - CFRelease(storePrivate->callbackRLS); - storePrivate->callbackRLS = NULL; + if (storePrivate->callbackRLS != NULL) { + CFRunLoopSourceInvalidate(storePrivate->callbackRLS); + CFRelease(storePrivate->callbackRLS); + storePrivate->callbackRLS = NULL; + } /* invalidate port */ - CFMachPortInvalidate(storePrivate->callbackPort); - CFRelease(storePrivate->callbackPort); - storePrivate->callbackPort = NULL; + if (storePrivate->callbackPort != NULL) { + __MACH_PORT_DEBUG(TRUE, "*** rlsCallback w/MACH_NOTIFY_NO_SENDERS", CFMachPortGetPort(storePrivate->callbackPort)); + CFMachPortInvalidate(storePrivate->callbackPort); + CFRelease(storePrivate->callbackPort); + storePrivate->callbackPort = NULL; + } return; } /* signal the real runloop source */ - CFRunLoopSourceSignal(storePrivate->rls); + if (storePrivate->rls != NULL) { + CFRunLoopSourceSignal(storePrivate->rls); + } return; } static void -rlsPortInvalidate(CFMachPortRef mp, void *info) { - mach_port_t port = CFMachPortGetPort(mp); +portInvalidate(CFMachPortRef port, void *info) { + mach_port_t mp = CFMachPortGetPort(port); - // A simple deallocate won't get rid of all the references we've accumulated -#ifdef DEBUG - SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" invalidate = %d"), port); -#endif /* DEBUG */ - (void)mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1); + __MACH_PORT_DEBUG(TRUE, "*** portInvalidate", mp); + /* remove our receive right */ + (void)mach_port_mod_refs(mach_task_self(), mp, MACH_PORT_RIGHT_RECEIVE, -1); } @@ -272,7 +316,9 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode) SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store; #ifdef DEBUG - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("schedule notifications for mode %@"), mode); + SCLog(_sc_verbose, LOG_DEBUG, + CFSTR("schedule notifications for mode %@"), + (rl != NULL) ? mode : CFSTR("libdispatch")); #endif /* DEBUG */ if (storePrivate->rlsRefs++ == 0) { @@ -294,7 +340,7 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode) /* Allocating port (for server response) */ status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("mach_port_allocate(): %s"), mach_error_string(status)); + SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule mach_port_allocate(): %s"), mach_error_string(status)); return; } @@ -303,8 +349,12 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode) port, MACH_MSG_TYPE_MAKE_SEND); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("mach_port_insert_right(): %s"), mach_error_string(status)); - (void) mach_port_destroy(mach_task_self(), port); + /* + * We can't insert a send right into our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule mach_port_insert_right(): %s"), mach_error_string(status)); return; } @@ -317,37 +367,63 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode) MACH_MSG_TYPE_MAKE_SEND_ONCE, &oldNotify); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("mach_port_request_notification(): %s"), mach_error_string(status)); - (void) mach_port_destroy(mach_task_self(), port); + /* + * We can't request a notification for our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule mach_port_request_notification(): %s"), mach_error_string(status)); return; } -#ifdef DEBUG if (oldNotify != MACH_PORT_NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule(): why is oldNotify != MACH_PORT_NULL?")); + SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule(): oldNotify != MACH_PORT_NULL")); } -#endif /* DEBUG */ + __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule", port); status = notifyviaport(storePrivate->server, port, 0, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("notifyviaport(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), port); - port = MACH_PORT_NULL; - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule notifyviaport(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; + + if (status == MACH_SEND_INVALID_DEST) { + /* remove the send right that we tried (but failed) to pass to the server */ + (void) mach_port_deallocate(mach_task_self(), port); + } + + /* remove our receive right */ + (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1); return; } + __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule (after notifyviaport)", port); storePrivate->callbackPort = CFMachPortCreateWithPort(NULL, port, rlsCallback, &context, NULL); - CFMachPortSetInvalidationCallBack(storePrivate->callbackPort, rlsPortInvalidate); + if (storePrivate->callbackPort == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("*** CFMachPortCreateWithPort returned NULL while attempting to schedule")); + SCLog(TRUE, LOG_ERR, CFSTR("*** a SCDynamicStore notification. Did this process call \"fork\" without")); + SCLog(TRUE, LOG_ERR, CFSTR("*** calling \"exec\"")); + + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + storePrivate->server = MACH_PORT_NULL; + + /* remove our receive right */ + (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1); + return; + } + CFMachPortSetInvalidationCallBack(storePrivate->callbackPort, portInvalidate); storePrivate->callbackRLS = CFMachPortCreateRunLoopSource(NULL, storePrivate->callbackPort, 0); } - if (storePrivate->callbackRLS != NULL) { + if ((rl != NULL) && (storePrivate->callbackRLS != NULL)) { CFRunLoopAddSource(rl, storePrivate->callbackRLS, mode); + __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule (after CFRunLoopAddSource)", CFMachPortGetPort(storePrivate->callbackPort)); } return; @@ -361,10 +437,12 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode) SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store; #ifdef DEBUG - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("cancel notifications for mode %@"), mode); + SCLog(_sc_verbose, LOG_DEBUG, + CFSTR("cancel notifications for mode %@"), + (rl != NULL) ? mode : CFSTR("libdispatch")); #endif /* DEBUG */ - if (storePrivate->callbackRLS != NULL) { + if ((rl != NULL) && (storePrivate->callbackRLS != NULL)) { CFRunLoopRemoveSource(rl, storePrivate->callbackRLS, mode); } @@ -375,6 +453,9 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode) #ifdef DEBUG SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" cancel callback runloop source")); #endif /* DEBUG */ + __MACH_PORT_DEBUG((storePrivate->callbackPort != NULL), + "*** rlsCancel", + CFMachPortGetPort(storePrivate->callbackPort)); if (storePrivate->callbackRLS != NULL) { /* invalidate & remove the run loop source */ @@ -385,6 +466,9 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode) if (storePrivate->callbackPort != NULL) { /* invalidate port */ + __MACH_PORT_DEBUG((storePrivate->callbackPort != NULL), + "*** rlsCancel (before invalidating CFMachPort)", + CFMachPortGetPort(storePrivate->callbackPort)); CFMachPortInvalidate(storePrivate->callbackPort); CFRelease(storePrivate->callbackPort); storePrivate->callbackPort = NULL; @@ -393,16 +477,19 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode) if (storePrivate->server != MACH_PORT_NULL) { status = notifycancel(storePrivate->server, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_INFO, CFSTR("notifycancel(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("rlsCancel notifycancel(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; return; } } } + return; } @@ -433,7 +520,7 @@ rlsPerform(void *info) rlsFunction = storePrivate->rlsFunction; - if (NULL != storePrivate->rlsContext.retain) { + if (storePrivate->rlsContext.retain != NULL) { context_info = (void *)storePrivate->rlsContext.retain(storePrivate->rlsContext.info); context_release = storePrivate->rlsContext.release; } else { @@ -489,8 +576,8 @@ rlsRelease(CFTypeRef cf) static CFStringRef rlsCopyDescription(const void *info) { - CFMutableStringRef result; - SCDynamicStoreRef store = (SCDynamicStoreRef)info; + CFMutableStringRef result; + SCDynamicStoreRef store = (SCDynamicStoreRef)info; SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store; result = CFStringCreateMutable(NULL, 0); @@ -568,12 +655,145 @@ SCDynamicStoreCreateRunLoopSource(CFAllocatorRef allocator, }; storePrivate->rls = CFRunLoopSourceCreate(allocator, order, &context); + if (storePrivate->rls == NULL) { + _SCErrorSet(kSCStatusFailed); + } } - if (storePrivate->rls == NULL) { - _SCErrorSet(kSCStatusFailed); - return NULL; + return storePrivate->rls; +} + + +#if !TARGET_OS_IPHONE +static boolean_t +SCDynamicStoreNotifyMIGCallback(mach_msg_header_t *message, mach_msg_header_t *reply) +{ + SCDynamicStorePrivateRef storePrivate; + + storePrivate = dispatch_get_context(dispatch_get_current_queue()); + if (storePrivate != NULL) { + CFRetain(storePrivate); + dispatch_async(storePrivate->dispatchQueue, ^{ + rlsPerform(storePrivate); + CFRelease(storePrivate); + }); } + reply->msgh_remote_port = MACH_PORT_NULL; + return false; +} - return storePrivate->rls; + +Boolean +SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue) +{ + Boolean ok = FALSE; + SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store; + + if (store == NULL) { + /* sorry, you must provide a session */ + _SCErrorSet(kSCStatusNoStoreSession); + return FALSE; + } + + if (storePrivate->server == MACH_PORT_NULL) { + /* sorry, you must have an open session to play */ + _SCErrorSet(kSCStatusNoStoreServer); + return FALSE; + } + + if (queue != NULL) { + dispatch_queue_attr_t attr; + mach_port_t mp; + long res; + + if ((storePrivate->dispatchQueue != NULL) || (storePrivate->rls != NULL)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + if (storePrivate->notifyStatus != NotifierNotRegistered) { + /* sorry, you can only have one notification registered at once... */ + _SCErrorSet(kSCStatusNotifierActive); + return FALSE; + } + + /* + * mark our using of the SCDynamicStore notifications, create and schedule + * the notification port (storePrivate->callbackPort), and a bunch of other + * "setup" + */ + storePrivate->notifyStatus = Using_NotifierInformViaDispatch; + rlsSchedule((void*)store, NULL, NULL); + storePrivate->dispatchQueue = queue; + dispatch_retain(storePrivate->dispatchQueue); + + /* + * create a queue for the mig source, we'll use this queue's context + * to carry the store pointer for the callback code. + */ + attr = dispatch_queue_attr_create(); + res = dispatch_queue_attr_set_finalizer(attr, + ^(dispatch_queue_t dq) { + SCDynamicStoreRef store; + + store = (SCDynamicStoreRef)dispatch_get_context(dq); + CFRelease(store); + }); + if (res != 0) { + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStore dispatch_queue_attr_set_finalizer() failed")); + dispatch_release(attr); + _SCErrorSet(kSCStatusFailed); + goto cleanup; + } + storePrivate->callbackQueue = dispatch_queue_create("com.apple.SCDynamicStore.notifications", attr); + dispatch_release(attr); + if (storePrivate->callbackQueue == NULL){ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStore dispatch_queue_create() failed")); + _SCErrorSet(kSCStatusFailed); + goto cleanup; + } + CFRetain(store); // Note: will be released when the dispatch queue is released + dispatch_set_context(storePrivate->callbackQueue, (void *)store); + + dispatch_suspend(storePrivate->callbackQueue); + mp = CFMachPortGetPort(storePrivate->callbackPort); + storePrivate->callbackSource = dispatch_source_mig_create(mp, sizeof(mach_msg_header_t), NULL, storePrivate->callbackQueue, SCDynamicStoreNotifyMIGCallback); + if (storePrivate->callbackSource == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStore dispatch_source_mig_create() failed")); + _SCErrorSet(kSCStatusFailed); + goto cleanup; + } + dispatch_resume(storePrivate->callbackQueue); + + ok = TRUE; + goto done; + } else { + if (storePrivate->dispatchQueue == NULL) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + ok = TRUE; + } + + cleanup : + + if (storePrivate->callbackSource != NULL) { + dispatch_cancel(storePrivate->callbackSource); + dispatch_release(storePrivate->callbackSource); + storePrivate->callbackSource = NULL; + } + if (storePrivate->callbackQueue != NULL) { + dispatch_release(storePrivate->callbackQueue); + storePrivate->callbackQueue = NULL; + } + dispatch_release(storePrivate->dispatchQueue); + storePrivate->dispatchQueue = NULL; + rlsCancel((void*)store, NULL, NULL); + storePrivate->notifyStatus = NotifierNotRegistered; + + done : + + return ok; } +#endif // !TARGET_OS_IPHONE diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaFD.c b/SystemConfiguration.fproj/SCDNotifierInformViaFD.c index 54fac50..221181c 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaFD.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaFD.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2005, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -50,11 +50,13 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef store, int32_t identifier, int *fd) { + size_t n; + int sc_status; + int sock; SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store; kern_return_t status; - int sc_status; + char tmpdir[PATH_MAX]; struct sockaddr_un un; - int sock; if (store == NULL) { /* sorry, you must provide a session */ @@ -81,18 +83,29 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef store, } /* establish a UNIX domain socket for server->client notification */ + + n = confstr(_CS_DARWIN_USER_TEMP_DIR, tmpdir, sizeof(tmpdir)); + if ((n <= 0) || (n >= sizeof(tmpdir))) { + (void) strlcpy(tmpdir, _PATH_TMP, sizeof(tmpdir)); + } + bzero(&un, sizeof(un)); un.sun_family = AF_UNIX; snprintf(un.sun_path, sizeof(un.sun_path)-1, - "%s%s-%d", - _PATH_VARTMP, + "%s%s-%d-%d", + tmpdir, "SCDynamicStoreNotifyFileDescriptor", + getpid(), storePrivate->server); + /* ensure that the path does not already exist */ + (void) unlink(un.sun_path); + if (bind(sock, (struct sockaddr *)&un, sizeof(un)) == -1) { _SCErrorSet(errno); SCLog(TRUE, LOG_NOTICE, CFSTR("SCDynamicStoreNotifyFileDescriptor bind(): %s"), strerror(errno)); + (void) unlink(un.sun_path); (void) close(sock); return FALSE; } @@ -100,6 +113,7 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef store, if (listen(sock, 0) == -1) { _SCErrorSet(errno); SCLog(TRUE, LOG_NOTICE, CFSTR("SCDynamicStoreNotifyFileDescriptor listen(): %s"), strerror(errno)); + (void) unlink(un.sun_path); (void) close(sock); return FALSE; } @@ -111,16 +125,29 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef store, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyFileDescriptor notifyviafd(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyFileDescriptor notifyviafd(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; } + (void) unlink(un.sun_path); + + if (sc_status != kSCStatusOK) { + _SCErrorSet(sc_status); + SCLog(TRUE, LOG_NOTICE, + CFSTR("SCDynamicStoreNotifyFileDescriptor server error: %s"), + SCErrorString(sc_status)); + (void) close(sock); + return FALSE; + } + *fd = accept(sock, 0, 0); if (*fd == -1) { _SCErrorSet(errno); diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c b/SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c index ded7a25..9e6a532 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -68,7 +68,7 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier, /* Allocating port (for server response) */ status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, port); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyMachPort mach_port_allocate(): %s"), mach_error_string(status)); + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort mach_port_allocate(): %s"), mach_error_string(status)); _SCErrorSet(status); return FALSE; } @@ -78,8 +78,12 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier, *port, MACH_MSG_TYPE_MAKE_SEND); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyMachPort mach_port_insert_right(): %s"), mach_error_string(status)); - (void) mach_port_destroy(mach_task_self(), *port); + /* + * We can't insert a send right into our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort mach_port_insert_right(): %s"), mach_error_string(status)); *port = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; @@ -94,18 +98,20 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier, MACH_MSG_TYPE_MAKE_SEND_ONCE, &oldNotify); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyMachPort mach_port_request_notification(): %s"), mach_error_string(status)); - (void) mach_port_destroy(mach_task_self(), *port); + /* + * We can't request a notification for our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort mach_port_request_notification(): %s"), mach_error_string(status)); *port = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; } -#ifdef DEBUG if (oldNotify != MACH_PORT_NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort(): why is oldNotify != MACH_PORT_NULL?")); + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort(): oldNotify != MACH_PORT_NULL")); } -#endif /* DEBUG */ status = notifyviaport(storePrivate->server, *port, @@ -113,19 +119,29 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyMachPort notifyviaport(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), *port); - *port = MACH_PORT_NULL; - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort notifyviaport(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; + + if (status == MACH_SEND_INVALID_DEST) { + /* remove the send right that we tried (but failed) to pass to the server */ + (void) mach_port_deallocate(mach_task_self(), *port); + } + + /* remove our receive right */ + (void) mach_port_mod_refs(mach_task_self(), *port, MACH_PORT_RIGHT_RECEIVE, -1); + *port = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; } /* set notifier active */ + __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreNotifyMachPort", *port); storePrivate->notifyStatus = Using_NotifierInformViaMachPort; return TRUE; diff --git a/SystemConfiguration.fproj/SCDNotifierInformViaSignal.c b/SystemConfiguration.fproj/SCDNotifierInformViaSignal.c index 22986dc..495d79b 100644 --- a/SystemConfiguration.fproj/SCDNotifierInformViaSignal.c +++ b/SystemConfiguration.fproj/SCDNotifierInformViaSignal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -75,11 +75,13 @@ SCDynamicStoreNotifySignal(SCDynamicStoreRef store, pid_t pid, int sig) status = notifyviasignal(storePrivate->server, task, sig, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifySignal notifyviasignal(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifySignal notifyviasignal(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDNotifierRemove.c b/SystemConfiguration.fproj/SCDNotifierRemove.c index c392f44..42e3cd3 100644 --- a/SystemConfiguration.fproj/SCDNotifierRemove.c +++ b/SystemConfiguration.fproj/SCDNotifierRemove.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -78,11 +78,13 @@ SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean CFRelease(utfKey); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreRemoveWatchedKey notifyremove(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreRemoveWatchedKey notifyremove(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDNotifierSetKeys.c b/SystemConfiguration.fproj/SCDNotifierSetKeys.c index 9ff03ff..9343c99 100644 --- a/SystemConfiguration.fproj/SCDNotifierSetKeys.c +++ b/SystemConfiguration.fproj/SCDNotifierSetKeys.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -93,11 +93,13 @@ SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef store, if (xmlPatterns) CFRelease(xmlPatterns); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreSetNotificationKeys notifyset(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetNotificationKeys notifyset(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDNotifierWait.c b/SystemConfiguration.fproj/SCDNotifierWait.c index 98ad13d..8b654a2 100644 --- a/SystemConfiguration.fproj/SCDNotifierWait.c +++ b/SystemConfiguration.fproj/SCDNotifierWait.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -95,7 +95,7 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store) /* Allocating port (for server response) */ status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait mach_port_allocate(): %s"), mach_error_string(status)); + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait mach_port_allocate(): %s"), mach_error_string(status)); _SCErrorSet(status); return FALSE; } @@ -105,8 +105,12 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store) port, MACH_MSG_TYPE_MAKE_SEND); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait mach_port_insert_right(): %s"), mach_error_string(status)); - (void) mach_port_destroy(mach_task_self(), port); + /* + * We can't insert a send right into our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait mach_port_insert_right(): %s"), mach_error_string(status)); _SCErrorSet(status); return FALSE; } @@ -120,17 +124,19 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store) MACH_MSG_TYPE_MAKE_SEND_ONCE, &oldNotify); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait mach_port_request_notification(): %s"), mach_error_string(status)); - (void) mach_port_destroy(mach_task_self(), port); + /* + * We can't request a notification for our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait mach_port_request_notification(): %s"), mach_error_string(status)); _SCErrorSet(status); return FALSE; } -#ifdef DEBUG if (oldNotify != MACH_PORT_NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait(): why is oldNotify != MACH_PORT_NULL?")); + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait(): oldNotify != MACH_PORT_NULL")); } -#endif /* DEBUG */ status = notifyviaport(storePrivate->server, port, @@ -138,12 +144,22 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store) (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait notifyviaport(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait notifyviaport(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; + + if (status == MACH_SEND_INVALID_DEST) { + /* remove the send right that we tried (but failed) to pass to the server */ + (void) mach_port_deallocate(mach_task_self(), port); + } + + /* remove our receive right */ + (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1); _SCErrorSet(status); return FALSE; } @@ -175,7 +191,7 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store) #ifdef DEBUG SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait communication with server failed, destroying port %d"), port); #endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), port); + (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE , -1); _SCErrorSet(kSCStatusNoStoreServer); return FALSE; } @@ -185,17 +201,22 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store) (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait notifycancel(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait notifycancel(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; + + /* remove our receive right */ + (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE , -1); _SCErrorSet(status); return FALSE; } - (void) mach_port_destroy(mach_task_self(), port); + (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE , -1); return TRUE; } diff --git a/SystemConfiguration.fproj/SCDNotify.c b/SystemConfiguration.fproj/SCDNotify.c index 14520e1..72f23b9 100644 --- a/SystemConfiguration.fproj/SCDNotify.c +++ b/SystemConfiguration.fproj/SCDNotify.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -75,11 +75,13 @@ SCDynamicStoreNotifyValue(SCDynamicStoreRef store, CFRelease(utfKey); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyValue confignotify(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyValue confignotify(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDOpen.c b/SystemConfiguration.fproj/SCDOpen.c index 8b2379f..77db1bb 100644 --- a/SystemConfiguration.fproj/SCDOpen.c +++ b/SystemConfiguration.fproj/SCDOpen.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -44,7 +44,6 @@ #include "config.h" /* MiG generated file */ -static int _sc_active = 0; static CFStringRef _sc_bundleID = NULL; static pthread_mutex_t _sc_lock = PTHREAD_MUTEX_INITIALIZER; static mach_port_t _sc_server = MACH_PORT_NULL; @@ -113,7 +112,6 @@ __SCDynamicStoreDeallocate(CFTypeRef cf) { int oldThreadState; int sc_status; - kern_return_t status; SCDynamicStoreRef store = (SCDynamicStoreRef)cf; SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store; @@ -127,15 +125,19 @@ __SCDynamicStoreDeallocate(CFTypeRef cf) } if (storePrivate->server != MACH_PORT_NULL) { - status = configclose(storePrivate->server, (int *)&sc_status); -#ifdef DEBUG - if (status != KERN_SUCCESS) { - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCDynamicStoreDeallocate configclose(): %s"), mach_error_string(status)); - } -#endif /* DEBUG */ - - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreDeallocate", storePrivate->server); + (void) configclose(storePrivate->server, (int *)&sc_status); + __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreDeallocate (after configclose)", storePrivate->server); + + /* + * the above call to configclose() should result in the SCDynamicStore + * server code deallocating it's receive right. That, in turn, should + * result in our send becoming a dead name. We could explicitly remove + * the dead name right with a call to mach_port_mod_refs() but, to be + * sure, we use mach_port_deallocate() since that will get rid of a + * send, send_once, or dead name right. + */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); storePrivate->server = MACH_PORT_NULL; } @@ -151,16 +153,6 @@ __SCDynamicStoreDeallocate(CFTypeRef cf) CFRelease(storePrivate->keys); CFRelease(storePrivate->patterns); - /* cleanup */ - pthread_mutex_lock(&_sc_lock); - _sc_active--; /* drop the number of active dynamic store sessions */ - if ((_sc_active == 0) && (_sc_server != MACH_PORT_NULL)) { - /* release the [last] reference to the server */ - (void)mach_port_deallocate(mach_task_self(), _sc_server); - _sc_server = MACH_PORT_NULL; - } - pthread_mutex_unlock(&_sc_lock); - return; } @@ -186,9 +178,7 @@ childForkHandler() { /* the process has forked (and we are the child process) */ - _sc_active = 0; _sc_server = MACH_PORT_NULL; - return; } @@ -196,7 +186,8 @@ childForkHandler() static pthread_once_t initialized = PTHREAD_ONCE_INIT; static void -__SCDynamicStoreInitialize(void) { +__SCDynamicStoreInitialize(void) +{ CFBundleRef bundle; /* register with CoreFoundation */ @@ -233,6 +224,38 @@ __SCDynamicStoreInitialize(void) { } +static mach_port_t +__SCDynamicStoreServerPort(kern_return_t *status) +{ + mach_port_t server = MACH_PORT_NULL; + char *server_name; + + server_name = getenv("SCD_SERVER"); + if (!server_name) { + server_name = SCD_SERVER; + } + + *status = bootstrap_look_up(bootstrap_port, server_name, &server); + switch (*status) { + case BOOTSTRAP_SUCCESS : + /* service currently registered, "a good thing" (tm) */ + return server; + case BOOTSTRAP_UNKNOWN_SERVICE : + /* service not currently registered, try again later */ + break; + default : +#ifdef DEBUG + SCLog(_sc_verbose, LOG_DEBUG, + CFSTR("SCDynamicStoreCreate[WithOptions] bootstrap_look_up() failed: status=%s"), + bootstrap_strerror(*status)); +#endif /* DEBUG */ + break; + } + + return MACH_PORT_NULL; +} + + SCDynamicStorePrivateRef __SCDynamicStoreCreatePrivate(CFAllocatorRef allocator, const CFStringRef name, @@ -305,45 +328,6 @@ __SCDynamicStoreCreatePrivate(CFAllocatorRef allocator, storePrivate->notifySignal = 0; storePrivate->notifySignalTask = TASK_NULL; - /* initialize global state */ - - pthread_mutex_lock(&_sc_lock); - - /* get the server port */ - if (_sc_server == MACH_PORT_NULL) { - char *server_name; - kern_return_t status; - - server_name = getenv("SCD_SERVER"); - if (!server_name) { - server_name = SCD_SERVER; - } - - status = bootstrap_look_up(bootstrap_port, server_name, &_sc_server); - switch (status) { - case BOOTSTRAP_SUCCESS : - /* service currently registered, "a good thing" (tm) */ - break; - case BOOTSTRAP_UNKNOWN_SERVICE : - /* service not currently registered, try again later */ - sc_status = status; - goto done; - default : -#ifdef DEBUG - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCreate[WithOptions] bootstrap_look_up() failed: status=%d"), status); -#endif /* DEBUG */ - sc_status = status; - goto done; - } - } - - /* bump the number of active dynamic store sessions */ - _sc_active++; - - done : - - pthread_mutex_unlock(&_sc_lock); - if (sc_status != kSCStatusOK) { _SCErrorSet(sc_status); CFRelease(storePrivate); @@ -364,15 +348,16 @@ SCDynamicStoreCreateWithOptions(CFAllocatorRef allocator, SCDynamicStoreCallBack callout, SCDynamicStoreContext *context) { + int sc_status = kSCStatusFailed; + mach_port_t server; + kern_return_t status = KERN_SUCCESS; SCDynamicStorePrivateRef storePrivate; - kern_return_t status; CFDataRef utfName; /* serialized name */ xmlData_t myNameRef; CFIndex myNameLen; CFDataRef xmlOptions = NULL; /* serialized options */ xmlData_t myOptionsRef = NULL; CFIndex myOptionsLen = 0; - int sc_status = kSCStatusFailed; /* * allocate and initialize a new session @@ -406,30 +391,61 @@ SCDynamicStoreCreateWithOptions(CFAllocatorRef allocator, } /* open a new session with the server */ - status = configopen(_sc_server, - myNameRef, - myNameLen, - myOptionsRef, - myOptionsLen, - &storePrivate->server, - (int *)&sc_status); + server = _sc_server; + while (TRUE) { + if (server != MACH_PORT_NULL) { + status = configopen(server, + myNameRef, + myNameLen, + myOptionsRef, + myOptionsLen, + &storePrivate->server, + (int *)&sc_status); + if (status == KERN_SUCCESS) { + break; + } + + // our [cached] server port is not valid + if (status != MACH_SEND_INVALID_DEST) { + // if we got an unexpected error, don't retry + sc_status = status; + break; + } + } + + pthread_mutex_lock(&_sc_lock); + if (_sc_server != MACH_PORT_NULL) { + if (server == _sc_server) { + // if the server we tried returned the error + (void)mach_port_deallocate(mach_task_self(), _sc_server); + _sc_server = __SCDynamicStoreServerPort(&sc_status); + } else { + // another thread has refreshed the SCDynamicStore server port + } + } else { + _sc_server = __SCDynamicStoreServerPort(&sc_status); + } + server = _sc_server; + pthread_mutex_unlock(&_sc_lock); + + if (server == MACH_PORT_NULL) { + // if SCDynamicStore server not available + break; + } + } + __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreCreate[WithOptions]", storePrivate->server); /* clean up */ CFRelease(utfName); if (xmlOptions) CFRelease(xmlOptions); - if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCreate[WithOptions] configopen(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - sc_status = status; - goto done; - } - done : if (sc_status != kSCStatusOK) { + SCLog(TRUE, + (status == KERN_SUCCESS) ? LOG_DEBUG : LOG_ERR, + CFSTR("SCDynamicStoreCreate[WithOptions] configopen(): %s"), + SCErrorString(sc_status)); _SCErrorSet(sc_status); CFRelease(storePrivate); storePrivate = NULL; diff --git a/SystemConfiguration.fproj/SCDPrivate.c b/SystemConfiguration.fproj/SCDPrivate.c index 3688149..d41332b 100644 --- a/SystemConfiguration.fproj/SCDPrivate.c +++ b/SystemConfiguration.fproj/SCDPrivate.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -48,6 +48,10 @@ #include #include +#include +#include +#include + #define N_QUICK 32 @@ -60,7 +64,12 @@ _SC_cfstring_to_cstring(CFStringRef cfstr, char *buf, CFIndex bufLen, CFStringEn { CFIndex converted; CFIndex last = 0; - CFIndex len = CFStringGetLength(cfstr); + CFIndex len; + + if (cfstr == NULL) { + cfstr = CFSTR(""); + } + len = CFStringGetLength(cfstr); /* how much buffer space will we really need? */ converted = CFStringGetBytes(cfstr, @@ -326,7 +335,7 @@ _SCSerializeString(CFStringRef str, CFDataRef *data, void **dataRef, CFIndex *da *dataLen = CFDataGetLength(myData); status = vm_read(mach_task_self(), (vm_address_t)CFDataGetBytePtr(myData), // address - (vm_size_t) CFDataGetLength(myData), // size + *dataLen, // size (void *)dataRef, &len); if (status != KERN_SUCCESS) { @@ -387,7 +396,7 @@ _SCSerializeData(CFDataRef data, void **dataRef, CFIndex *dataLen) *dataLen = CFDataGetLength(data); status = vm_read(mach_task_self(), (vm_address_t)CFDataGetBytePtr(data), // address - CFDataGetLength(data), // size + *dataLen, // size (void *)dataRef, &len); if (status != KERN_SUCCESS) { @@ -825,6 +834,7 @@ _SC_CFBundleCopyNonLocalizedString(CFBundleRef bundle, CFStringRef key, CFString #pragma mark DOS encoding/codepage +#if !TARGET_OS_IPHONE void _SC_dos_encoding_and_codepage(CFStringEncoding macEncoding, UInt32 macRegion, @@ -911,209 +921,224 @@ _SC_dos_encoding_and_codepage(CFStringEncoding macEncoding, *dosCodepage = CFStringConvertEncodingToWindowsCodepage(*dosEncoding); return; } - - -#include -#include - - -CFDataRef -_SC_dos_copy_string(CFStringRef str, CFStringEncoding dosEncoding, UInt32 dosCodepage) -{ - USet *charSet = NULL; - UConverter *conv = NULL; - UErrorCode ec = U_ZERO_ERROR; - char ianaName[16]; - CFDataRef line = NULL; - CFMutableStringRef newStr = NULL; - CFStringRef set = NULL; - int32_t setSize; - UChar *setChars; - CFStringRef transform; - - /* - * using ICU, convert the target character set into the - * set of Unicode characters that can be converted to - * that character set. - * - * Note: a full list of character set identifiers accepted - * by ICU can be found at : - * - * http://dev.icu-project.org/cgi-bin/viewcvs.cgi/icu/source/data/mappings/convrtrs.txt?view=co - */ - snprintf(ianaName, sizeof(ianaName), "cp%d", (int)dosCodepage); - charSet = uset_open(0, 0); - //ec = U_ZERO_ERROR; - conv = ucnv_open(ianaName, &ec); - if (U_FAILURE(ec)) { - SCPrint(TRUE, stderr, CFSTR("ucnv_open() failed, ec = %s\n"), u_errorName(ec)); - goto done; - } - //ec = U_ZERO_ERROR; - ucnv_getUnicodeSet(conv, charSet, UCNV_ROUNDTRIP_SET, &ec); - if (U_FAILURE(ec)) { - SCPrint(TRUE, stderr, CFSTR("ucnv_getUnicodeSet() failed, ec = %s\n"), u_errorName(ec)); - goto done; - } - - /* - * Next, we create a transform pattern that will transform *only* - * the characters that are not in the target charset. - */ - //ec = U_ZERO_ERROR; - setSize = uset_toPattern(charSet, NULL, 0, FALSE, &ec); - if (U_FAILURE(ec) && (ec != U_BUFFER_OVERFLOW_ERROR)) { - SCPrint(TRUE, stderr, CFSTR("uset_toPattern() failed, ec = %s\n"), u_errorName(ec)); - goto done; - } - setChars = (UChar *)calloc(setSize, sizeof(UChar)); - ec = U_ZERO_ERROR; - (void)uset_toPattern(charSet, setChars, setSize, FALSE, &ec); - set = CFStringCreateWithCharacters(NULL, setChars, setSize); - free(setChars); - - /* - * Now make a transform pattern that will: - * 1. Only affect characters *not* in the target character set - * 2. Convert curly quotes, etc. to ASCII equivalents - * 3. Convert any non-Latin characters to Latin - * 4. Decompose any combining marks if possible - * 5. Remove anything that's not ASCII - * - * ... and transform the string - */ - transform = CFStringCreateWithFormat(NULL, NULL, - CFSTR("[^%@]; Publishing-Any; Any-Latin; NFKD; [:^ASCII:] Remove"), - set); - newStr = CFStringCreateMutableCopy(NULL, 0, str); - CFStringNormalize(newStr, kCFStringNormalizationFormC); - if (!CFStringTransform(newStr, NULL, transform, FALSE)) { - CFRelease(newStr); - newStr = NULL; - } - CFRelease(transform); - - done : - - if (newStr != NULL) { - line = CFStringCreateExternalRepresentation(NULL, newStr, dosEncoding, 0); - CFRelease(newStr); - } - - if (charSet != NULL) uset_close(charSet); - if (conv != NULL) ucnv_close(conv); - if (set != NULL) CFRelease(set); - - return line; -} +#endif // !TARGET_OS_IPHONE #pragma mark - #pragma mark Debugging +/* + * print status of in-use mach ports + */ void -__showMachPortStatus(void) +_SC_logMachPortStatus(void) { -#ifdef DEBUG - /* print status of in-use mach ports */ - if (_sc_debug) { - kern_return_t status; - mach_port_name_array_t ports; - mach_port_type_array_t types; - int pi, pn, tn; - CFMutableStringRef str; - - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("----------")); - - /* report on ALL mach ports associated with this task */ - status = mach_port_names(mach_task_self(), &ports, &pn, &types, &tn); - if (status == MACH_MSG_SUCCESS) { - str = CFStringCreateMutable(NULL, 0); - for (pi = 0; pi < pn; pi++) { - char rights[16], *rp = &rights[0]; - - if (types[pi] != MACH_PORT_TYPE_NONE) { - *rp++ = ' '; - *rp++ = '('; - if (types[pi] & MACH_PORT_TYPE_SEND) - *rp++ = 'S'; - if (types[pi] & MACH_PORT_TYPE_RECEIVE) - *rp++ = 'R'; - if (types[pi] & MACH_PORT_TYPE_SEND_ONCE) - *rp++ = 'O'; - if (types[pi] & MACH_PORT_TYPE_PORT_SET) - *rp++ = 'P'; - if (types[pi] & MACH_PORT_TYPE_DEAD_NAME) - *rp++ = 'D'; - *rp++ = ')'; - } - *rp = '\0'; - CFStringAppendFormat(str, NULL, CFSTR(" %d%s"), ports[pi], rights); + kern_return_t status; + mach_port_name_array_t ports; + mach_port_type_array_t types; + mach_msg_type_number_t pi, pn, tn; + CFMutableStringRef str; + + SCLog(TRUE, LOG_DEBUG, CFSTR("----------")); + + /* report on ALL mach ports associated with this task */ + status = mach_port_names(mach_task_self(), &ports, &pn, &types, &tn); + if (status == MACH_MSG_SUCCESS) { + str = CFStringCreateMutable(NULL, 0); + for (pi = 0; pi < pn; pi++) { + char rights[16], *rp = &rights[0]; + + if (types[pi] != MACH_PORT_TYPE_NONE) { + *rp++ = ' '; + *rp++ = '('; + if (types[pi] & MACH_PORT_TYPE_SEND) + *rp++ = 'S'; + if (types[pi] & MACH_PORT_TYPE_RECEIVE) + *rp++ = 'R'; + if (types[pi] & MACH_PORT_TYPE_SEND_ONCE) + *rp++ = 'O'; + if (types[pi] & MACH_PORT_TYPE_PORT_SET) + *rp++ = 'P'; + if (types[pi] & MACH_PORT_TYPE_DEAD_NAME) + *rp++ = 'D'; + *rp++ = ')'; } - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("Task ports (n=%d):%@"), pn, str); - CFRelease(str); - } else { - /* log (but ignore) errors */ - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("mach_port_names(): %s"), mach_error_string(status)); + *rp = '\0'; + CFStringAppendFormat(str, NULL, CFSTR(" %d%s"), ports[pi], rights); } + SCLog(TRUE, LOG_DEBUG, CFSTR("Task ports (n=%d):%@"), pn, str); + CFRelease(str); } -#endif /* DEBUG */ + return; } void -__showMachPortReferences(mach_port_t port) +_SC_logMachPortReferences(const char *str, mach_port_t port) { -#ifdef DEBUG - kern_return_t status; + const char *blanks = " "; + char buf[60]; + mach_port_type_t pt; + mach_port_status_t recv_status = { 0 }; mach_port_urefs_t refs_send = 0; mach_port_urefs_t refs_recv = 0; mach_port_urefs_t refs_once = 0; mach_port_urefs_t refs_pset = 0; mach_port_urefs_t refs_dead = 0; + kern_return_t status; - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("user references for mach port %d"), port); + buf[0] = '\0'; + if (str != NULL) { + static int is_configd = -1; - status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, &refs_send); - if (status != KERN_SUCCESS) { - SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_SEND): %s"), mach_error_string(status)); - return; + if (is_configd == -1) { + char name[64] = ""; + + (void) proc_name(getpid(), name, sizeof(name)); + is_configd = (strncmp(name, "configd", sizeof(name)) == 0); + } + if (is_configd == 1) { + // if "configd", add indication if this is the M[ain] or [P]lugin thread + strlcpy(buf, + (CFRunLoopGetMain() == CFRunLoopGetCurrent()) ? "M " : "P ", + sizeof(buf)); + } + + // add provided string + strlcat(buf, str, sizeof(buf)); + + // fill + strlcat(buf, blanks, sizeof(buf)); + if (strcmp(&buf[sizeof(buf) - 3], " ") == 0) { + buf[sizeof(buf) - 3] = ':'; + } } - status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, &refs_recv); + status = mach_port_type(mach_task_self(), port, &pt); if (status != KERN_SUCCESS) { - SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_RECEIVE): %s"), mach_error_string(status)); - return; + SCLog(TRUE, LOG_DEBUG, + CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND): %s"), + buf, + port, + mach_error_string(status)); } - status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND_ONCE, &refs_once); - if (status != KERN_SUCCESS) { - SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_SEND_ONCE): %s"), mach_error_string(status)); - return; + if ((pt & MACH_PORT_TYPE_SEND) != 0) { + status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, &refs_send); + if (status != KERN_SUCCESS) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND): %s"), + buf, + port, + mach_error_string(status)); + } } - status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_PORT_SET, &refs_pset); - if (status != KERN_SUCCESS) { - SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_PORT_SET): %s"), mach_error_string(status)); - return; + if ((pt & MACH_PORT_TYPE_RECEIVE) != 0) { + mach_msg_type_number_t count; + + status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, &refs_recv); + if (status != KERN_SUCCESS) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_RECEIVE): %s"), + buf, + port, + mach_error_string(status)); + } + + count = MACH_PORT_RECEIVE_STATUS_COUNT; + status = mach_port_get_attributes(mach_task_self(), + port, + MACH_PORT_RECEIVE_STATUS, + (mach_port_info_t)&recv_status, + &count); + if (status != KERN_SUCCESS) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("%mach_port_get_attributes(..., %d, MACH_PORT_RECEIVE_STATUS): %s"), + buf, + port, + mach_error_string(status)); + } } - status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_DEAD_NAME, &refs_dead); - if (status != KERN_SUCCESS) { - SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_DEAD_NAME): %s"), mach_error_string(status)); - return; + if ((pt & MACH_PORT_TYPE_SEND_ONCE) != 0) { + status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND_ONCE, &refs_once); + if (status != KERN_SUCCESS) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND_ONCE): %s"), + buf, + port, + mach_error_string(status)); + } } - SCLog(_sc_verbose, LOG_DEBUG, - CFSTR(" send = %d, receive = %d, send once = %d, port set = %d, dead name = %d"), - refs_send, - refs_recv, - refs_once, - refs_pset, - refs_dead); + if ((pt & MACH_PORT_TYPE_PORT_SET) != 0) { + status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_PORT_SET, &refs_pset); + if (status != KERN_SUCCESS) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_PORT_SET): %s"), + buf, + port, + mach_error_string(status)); + } + } + + if ((pt & MACH_PORT_TYPE_DEAD_NAME) != 0) { + status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_DEAD_NAME, &refs_dead); + if (status != KERN_SUCCESS) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_DEAD_NAME): %s"), + buf, + port, + mach_error_string(status)); + } + } + + SCLog(TRUE, LOG_DEBUG, + CFSTR("%smach port 0x%x (%d): send=%d, receive=%d, send once=%d, port set=%d, dead name=%d%s%s"), + buf, + port, + port, + refs_send, + refs_recv, + refs_once, + refs_pset, + refs_dead, + recv_status.mps_nsrequest ? ", no more senders" : "", + ((pt & MACH_PORT_TYPE_DEAD_NAME) != 0) ? ", dead name request" : ""); -#endif /* DEBUG */ return; } + + +CFStringRef +_SC_copyBacktrace() +{ + int n; + void *stack[64]; + char **symbols; + CFMutableStringRef trace; + + n = backtrace(stack, sizeof(stack)/sizeof(stack[0])); + if (n == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("backtrace() failed: %s"), strerror(errno)); + return NULL; + } + + trace = CFStringCreateMutable(NULL, 0); + + symbols = backtrace_symbols(stack, n); + if (symbols != NULL) { + int i; + + for (i = 0; i < n; i++) { + CFStringAppendFormat(trace, NULL, CFSTR("%s\n"), symbols[i]); + } + + free(symbols); + } + + return trace; +} diff --git a/SystemConfiguration.fproj/SCDRemove.c b/SystemConfiguration.fproj/SCDRemove.c index fa6ef00..1b95ae3 100644 --- a/SystemConfiguration.fproj/SCDRemove.c +++ b/SystemConfiguration.fproj/SCDRemove.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -77,11 +77,13 @@ SCDynamicStoreRemoveValue(SCDynamicStoreRef store, CFStringRef key) CFRelease(utfKey); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreRemoveValue configremove(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreRemoveValue configremove(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDSet.c b/SystemConfiguration.fproj/SCDSet.c index baa3cb9..4504855 100644 --- a/SystemConfiguration.fproj/SCDSet.c +++ b/SystemConfiguration.fproj/SCDSet.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -124,11 +124,13 @@ SCDynamicStoreSetMultiple(SCDynamicStoreRef store, if (xmlNotify != NULL) CFRelease(xmlNotify); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreSetMultiple configset_m(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetMultiple configset_m(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; @@ -196,11 +198,13 @@ SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR CFRelease(xmlData); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreSetValue configset(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetValue configset(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDSnapshot.c b/SystemConfiguration.fproj/SCDSnapshot.c index 9af36f0..d869d38 100644 --- a/SystemConfiguration.fproj/SCDSnapshot.c +++ b/SystemConfiguration.fproj/SCDSnapshot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -61,11 +61,13 @@ SCDynamicStoreSnapshot(SCDynamicStoreRef store) status = snapshot(storePrivate->server, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreSnapshot snapshot(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSnapshot snapshot(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDTouch.c b/SystemConfiguration.fproj/SCDTouch.c index 1b96735..f1a7027 100644 --- a/SystemConfiguration.fproj/SCDTouch.c +++ b/SystemConfiguration.fproj/SCDTouch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -77,11 +77,13 @@ SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key) CFRelease(utfKey); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreTouchValue configtouch(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreTouchValue configtouch(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDUnlock.c b/SystemConfiguration.fproj/SCDUnlock.c index 462f446..994d57a 100644 --- a/SystemConfiguration.fproj/SCDUnlock.c +++ b/SystemConfiguration.fproj/SCDUnlock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -61,11 +61,13 @@ SCDynamicStoreUnlock(SCDynamicStoreRef store) /* (attempt to) release the servers lock */ status = configunlock(storePrivate->server, (int *)&sc_status); if (status != KERN_SUCCESS) { -#ifdef DEBUG - if (status != MACH_SEND_INVALID_DEST) - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreUnlock configunlock(): %s"), mach_error_string(status)); -#endif /* DEBUG */ - (void) mach_port_destroy(mach_task_self(), storePrivate->server); + if (status == MACH_SEND_INVALID_DEST) { + /* the server's gone and our session port's dead, remove the dead name right */ + (void) mach_port_deallocate(mach_task_self(), storePrivate->server); + } else { + /* we got an unexpected error, leave the [session] port alone */ + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreUnlock configunlock(): %s"), mach_error_string(status)); + } storePrivate->server = MACH_PORT_NULL; _SCErrorSet(status); return FALSE; diff --git a/SystemConfiguration.fproj/SCDynamicStore.h b/SystemConfiguration.fproj/SCDynamicStore.h index 6331e92..716d5dc 100644 --- a/SystemConfiguration.fproj/SCDynamicStore.h +++ b/SystemConfiguration.fproj/SCDynamicStore.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,12 +22,20 @@ */ #ifndef _SCDYNAMICSTORE_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCDYNAMICSTORE_H -#include +#include +#include #include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE #include + /*! @header SCDynamicStore @discussion The SCDynamicStore API provides access to the key-value @@ -103,7 +111,7 @@ __BEGIN_DECLS @discussion Returns the type identifier of all SCDynamicStore instances. */ CFTypeID -SCDynamicStoreGetTypeID (void); +SCDynamicStoreGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @@ -131,9 +139,7 @@ SCDynamicStoreCreate ( CFStringRef name, SCDynamicStoreCallBack callout, SCDynamicStoreContext *context - ); - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreCreateWithOptions @@ -179,11 +185,9 @@ SCDynamicStoreCreateWithOptions ( CFDictionaryRef storeOptions, SCDynamicStoreCallBack callout, SCDynamicStoreContext *context - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); -extern const CFStringRef kSCDynamicStoreUseSessionKeys AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; /* CFBoolean */ - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ +extern const CFStringRef kSCDynamicStoreUseSessionKeys __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /* CFBoolean */ /*! @function SCDynamicStoreCreateRunLoopSource @@ -213,7 +217,25 @@ SCDynamicStoreCreateRunLoopSource ( CFAllocatorRef allocator, SCDynamicStoreRef store, CFIndex order - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); + +#if !TARGET_OS_IPHONE +/*! + @function SCDynamicStoreSetDispatchQueue + @discussion Initiates notifications for the Notification + Keys in store to the callback contained in store. + @param store A reference to the dynamic store session. + @param queue The dispatch queue to run the callback function on. + Pass NULL to disable notifications, and release the queue. + @result Returns TRUE on success, FALSE on failure. + + */ +Boolean +SCDynamicStoreSetDispatchQueue ( + SCDynamicStoreRef store, + dispatch_queue_t queue + ) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA); +#endif // !TARGET_OS_IPHONE /*! @function SCDynamicStoreCopyKeyList @@ -230,7 +252,7 @@ CFArrayRef SCDynamicStoreCopyKeyList ( SCDynamicStoreRef store, CFStringRef pattern - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreAddValue @@ -247,7 +269,7 @@ SCDynamicStoreAddValue ( SCDynamicStoreRef store, CFStringRef key, CFPropertyListRef value - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreAddTemporaryValue @@ -266,7 +288,7 @@ SCDynamicStoreAddTemporaryValue ( SCDynamicStoreRef store, CFStringRef key, CFPropertyListRef value - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreCopyValue @@ -281,7 +303,7 @@ CFPropertyListRef SCDynamicStoreCopyValue ( SCDynamicStoreRef store, CFStringRef key - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreCopyMultiple @@ -301,7 +323,7 @@ SCDynamicStoreCopyMultiple ( SCDynamicStoreRef store, CFArrayRef keys, CFArrayRef patterns - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreSetValue @@ -317,7 +339,7 @@ SCDynamicStoreSetValue ( SCDynamicStoreRef store, CFStringRef key, CFPropertyListRef value - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreSetMultiple @@ -334,7 +356,7 @@ SCDynamicStoreSetMultiple ( CFDictionaryRef keysToSet, CFArrayRef keysToRemove, CFArrayRef keysToNotify - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreRemoveValue @@ -349,7 +371,7 @@ Boolean SCDynamicStoreRemoveValue ( SCDynamicStoreRef store, CFStringRef key - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreNotifyValue @@ -365,7 +387,7 @@ Boolean SCDynamicStoreNotifyValue ( SCDynamicStoreRef store, CFStringRef key - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreSetNotificationKeys @@ -384,7 +406,7 @@ SCDynamicStoreSetNotificationKeys ( SCDynamicStoreRef store, CFArrayRef keys, CFArrayRef patterns - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreCopyNotifiedKeys @@ -401,8 +423,9 @@ SCDynamicStoreSetNotificationKeys ( CFArrayRef SCDynamicStoreCopyNotifiedKeys ( SCDynamicStoreRef store - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); __END_DECLS -#endif /* _SCDYNAMICSTORE_H */ +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ +#endif /* _SCDYNAMICSTORE_H */ diff --git a/SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h b/SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h index 8866343..db0590a 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h +++ b/SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2001, 2002, 2004, 2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,8 +22,12 @@ */ #ifndef _SCDYNAMICSTORECOPYDHCPINFO_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCDYNAMICSTORECOPYDHCPINFO_H +#include #include #include #include @@ -56,7 +60,8 @@ __BEGIN_DECLS A non-NULL return value must be released using CFRelease(). */ CFDictionaryRef -SCDynamicStoreCopyDHCPInfo(SCDynamicStoreRef store, CFStringRef serviceID); +SCDynamicStoreCopyDHCPInfo (SCDynamicStoreRef store, + CFStringRef serviceID) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function DHCPInfoGetOptionData @@ -72,7 +77,8 @@ SCDynamicStoreCopyDHCPInfo(SCDynamicStoreRef store, CFStringRef serviceID); The return value must NOT be released. */ CFDataRef -DHCPInfoGetOptionData(CFDictionaryRef info, UInt8 code); +DHCPInfoGetOptionData (CFDictionaryRef info, + UInt8 code) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function DHCPInfoGetLeaseStartTime @@ -87,8 +93,9 @@ DHCPInfoGetOptionData(CFDictionaryRef info, UInt8 code); The return value must NOT be released. */ CFDateRef -DHCPInfoGetLeaseStartTime(CFDictionaryRef info); +DHCPInfoGetLeaseStartTime (CFDictionaryRef info) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); __END_DECLS -#endif /* _SCDYNAMICSTORECOPYDHCPINFO_H */ +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ +#endif /* _SCDYNAMICSTORECOPYDHCPINFO_H */ diff --git a/SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h b/SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h index 36f5f63..5b102b0 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h +++ b/SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,8 +22,12 @@ */ #ifndef _SCDYNAMICSTORECOPYSPECIFIC_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCDYNAMICSTORECOPYSPECIFIC_H +#include #include #include #include @@ -58,7 +62,7 @@ CFStringRef SCDynamicStoreCopyComputerName ( SCDynamicStoreRef store, CFStringEncoding *nameEncoding - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreCopyConsoleUser @@ -87,7 +91,7 @@ SCDynamicStoreCopyConsoleUser ( SCDynamicStoreRef store, uid_t *uid, gid_t *gid - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA); /*! @function SCDynamicStoreCopyLocalHostName @@ -102,7 +106,7 @@ SCDynamicStoreCopyConsoleUser ( CFStringRef SCDynamicStoreCopyLocalHostName ( SCDynamicStoreRef store - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreCopyLocation @@ -118,7 +122,7 @@ SCDynamicStoreCopyLocalHostName ( CFStringRef SCDynamicStoreCopyLocation ( SCDynamicStoreRef store - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA); /*! @function SCDynamicStoreCopyProxies @@ -203,8 +207,9 @@ SCDynamicStoreCopyLocation ( CFDictionaryRef SCDynamicStoreCopyProxies ( SCDynamicStoreRef store - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); __END_DECLS -#endif /* _SCDYNAMICSTORECOPYSPECIFIC_H */ +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ +#endif /* _SCDYNAMICSTORECOPYSPECIFIC_H */ diff --git a/SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h b/SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h index 4cc0856..b3bc351 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h +++ b/SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2003-2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,6 +24,7 @@ #ifndef _SCDYNAMICSTORECOPYSPECIFICPRIVATE_H #define _SCDYNAMICSTORECOPYSPECIFICPRIVATE_H +#include #include #include #include @@ -41,14 +42,22 @@ __BEGIN_DECLS /* * Predefined keys for the console session dictionaries */ -extern const CFStringRef kSCConsoleSessionID; /* value is CFNumber */ -extern const CFStringRef kSCConsoleSessionUserName; /* value is CFString */ -extern const CFStringRef kSCConsoleSessionUID; /* value is CFNumber (a uid_t) */ -extern const CFStringRef kSCConsoleSessionConsoleSet; /* value is CFNumber */ -extern const CFStringRef kSCConsoleSessionOnConsole; /* value is CFBoolean */ -extern const CFStringRef kSCConsoleSessionLoginDone; /* value is CFBoolean */ -extern const CFStringRef kSCConsoleSessionSystemSafeBoot; /* value is CFBoolean */ -extern const CFStringRef kSCConsoleSessionLoginwindowSafeLogin; /* value is CFBoolean */ +extern const CFStringRef kSCConsoleSessionID /* value is CFNumber */ + __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); +extern const CFStringRef kSCConsoleSessionUserName /* value is CFString */ + __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); +extern const CFStringRef kSCConsoleSessionUID /* value is CFNumber (a uid_t) */ + __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); +extern const CFStringRef kSCConsoleSessionConsoleSet /* value is CFNumber */ + __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); +extern const CFStringRef kSCConsoleSessionOnConsole /* value is CFBoolean */ + __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); +extern const CFStringRef kSCConsoleSessionLoginDone /* value is CFBoolean */ + __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); +extern const CFStringRef kSCConsoleSessionSystemSafeBoot /* value is CFBoolean */ + __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); +extern const CFStringRef kSCConsoleSessionLoginwindowSafeLogin /* value is CFBoolean */ + __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); /*! @function SCDynamicStoreCopyConsoleInformation @@ -68,7 +77,7 @@ extern const CFStringRef kSCConsoleSessionLoginwindowSafeLogin; /* value is CFBo CFArrayRef SCDynamicStoreCopyConsoleInformation ( SCDynamicStoreRef store - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); __END_DECLS diff --git a/SystemConfiguration.fproj/SCDynamicStoreInternal.h b/SystemConfiguration.fproj/SCDynamicStoreInternal.h index c03620d..2481504 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreInternal.h +++ b/SystemConfiguration.fproj/SCDynamicStoreInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2009 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,7 +24,12 @@ #ifndef _SCDYNAMICSTOREINTERNAL_H #define _SCDYNAMICSTOREINTERNAL_H +#include +#include #include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE #include #include #include @@ -42,7 +47,8 @@ typedef enum { Using_NotifierInformViaMachPort, Using_NotifierInformViaFD, Using_NotifierInformViaSignal, - Using_NotifierInformViaRunLoop + Using_NotifierInformViaRunLoop, + Using_NotifierInformViaDispatch } __SCDynamicStoreNotificationStatus; @@ -73,6 +79,13 @@ typedef struct { CFMachPortRef callbackPort; CFRunLoopSourceRef callbackRLS; +#if !TARGET_OS_IPHONE + /* "client" information associated with SCDynamicStoreSetDispatchQueue() */ + dispatch_queue_t dispatchQueue; + dispatch_source_t callbackSource; + dispatch_queue_t callbackQueue; +#endif // !TARGET_OS_IPHONE + /* "server" SCDynamicStoreKeys being watched */ CFMutableSetRef keys; CFMutableSetRef patterns; @@ -100,12 +113,6 @@ __SCDynamicStoreCreatePrivate (CFAllocatorRef allocator, SCDynamicStoreCallBack callout, SCDynamicStoreContext *context); -void -__showMachPortStatus (void); - -void -__showMachPortReferences (mach_port_t port); - __END_DECLS #endif /* _SCDYNAMICSTOREINTERNAL_H */ diff --git a/SystemConfiguration.fproj/SCDynamicStoreKey.h b/SystemConfiguration.fproj/SCDynamicStoreKey.h index 1edb7e1..7e3fbc0 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreKey.h +++ b/SystemConfiguration.fproj/SCDynamicStoreKey.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2002, 2004, 2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,8 +22,12 @@ */ #ifndef _SCDYNAMICSTOREKEY_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCDYNAMICSTOREKEY_H +#include #include #include @@ -61,7 +65,7 @@ SCDynamicStoreKeyCreate ( CFAllocatorRef allocator, CFStringRef fmt, ... - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreKeyCreateNetworkGlobalEntity @@ -86,7 +90,7 @@ SCDynamicStoreKeyCreateNetworkGlobalEntity ( CFAllocatorRef allocator, CFStringRef domain, CFStringRef entity - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreKeyCreateNetworkInterface @@ -108,7 +112,7 @@ CFStringRef SCDynamicStoreKeyCreateNetworkInterface ( CFAllocatorRef allocator, CFStringRef domain - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreKeyCreateNetworkInterfaceEntity @@ -136,7 +140,7 @@ SCDynamicStoreKeyCreateNetworkInterfaceEntity ( CFStringRef domain, CFStringRef ifname, CFStringRef entity - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreKeyCreateNetworkServiceEntity @@ -165,7 +169,7 @@ SCDynamicStoreKeyCreateNetworkServiceEntity ( CFStringRef domain, CFStringRef serviceID, CFStringRef entity - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreKeyCreateComputerName @@ -183,7 +187,7 @@ SCDynamicStoreKeyCreateNetworkServiceEntity ( CFStringRef SCDynamicStoreKeyCreateComputerName ( CFAllocatorRef allocator - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreKeyCreateConsoleUser @@ -200,7 +204,7 @@ SCDynamicStoreKeyCreateComputerName ( CFStringRef SCDynamicStoreKeyCreateConsoleUser ( CFAllocatorRef allocator - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA); /*! @function SCDynamicStoreKeyCreateHostNames @@ -218,7 +222,7 @@ SCDynamicStoreKeyCreateConsoleUser ( CFStringRef SCDynamicStoreKeyCreateHostNames ( CFAllocatorRef allocator - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreKeyCreateLocation @@ -236,7 +240,7 @@ SCDynamicStoreKeyCreateHostNames ( CFStringRef SCDynamicStoreKeyCreateLocation ( CFAllocatorRef allocator - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/); /*! @function SCDynamicStoreKeyCreateProxies @@ -254,8 +258,9 @@ SCDynamicStoreKeyCreateLocation ( CFStringRef SCDynamicStoreKeyCreateProxies ( CFAllocatorRef allocator - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); __END_DECLS -#endif /* _SCDYNAMICSTOREKEY_H */ +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ +#endif /* _SCDYNAMICSTOREKEY_H */ diff --git a/SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h b/SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h index f3b03eb..668ae5c 100644 --- a/SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h +++ b/SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2001, 2003-2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,6 +24,7 @@ #ifndef _SCDYNAMICSTORESETSPECIFICPRIVATE_H #define _SCDYNAMICSTORESETSPECIFICPRIVATE_H +#include #include #include @@ -61,7 +62,7 @@ SCDynamicStoreSetConsoleInformation ( uid_t uid, gid_t gid, CFArrayRef sessions - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA); /*! @function SCDynamicStoreSetConsoleUser @@ -83,7 +84,7 @@ SCDynamicStoreSetConsoleUser ( const char *user, uid_t uid, gid_t gid - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA); __END_DECLS diff --git a/SystemConfiguration.fproj/SCNetwork.h b/SystemConfiguration.fproj/SCNetwork.h index b512aca..8e04726 100644 --- a/SystemConfiguration.fproj/SCNetwork.h +++ b/SystemConfiguration.fproj/SCNetwork.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,6 +24,7 @@ #ifndef _SCNETWORK_H #define _SCNETWORK_H +#include #include #include #include @@ -53,6 +54,10 @@ nodename or address is reachable, whether a connection is required, and whether some user intervention may be required when establishing a connection. + + Note: the SCNetworkConnection flags have been deprecated + in favor of the newer SCNetworkReachability flags defined + in SCNetworkReachability.h. @constant kSCNetworkFlagsTransientConnection This flag indicates that the specified nodename or address can be reached via a transient connection, such as PPP. @@ -104,7 +109,7 @@ enum { kSCNetworkFlagsConnectionAutomatic = 1<<3, kSCNetworkFlagsInterventionRequired = 1<<4, kSCNetworkFlagsIsLocalAddress = 1<<16, - kSCNetworkFlagsIsDirect = 1<<17 + kSCNetworkFlagsIsDirect = 1<<17, }; typedef uint32_t SCNetworkConnectionFlags; @@ -114,6 +119,18 @@ __BEGIN_DECLS @function SCNetworkCheckReachabilityByAddress @discussion Determines if the given network address is reachable using the current network configuration. + + Note: this API has been deprecated but you can + get equivalent results with : +
+	SCNetworkReachabiltyRef   target;
+	SCNetworkReachabiltyFlags flags = 0;
+	Boolean                   ok;
+
+	target = SCNetworkReachabilityCreateWithAddress(NULL, address);
+	ok = SCNetworkReachabilityGetFlags(target, &flags);
+	CFRelease(target);
+
@param address The network address of the desired host. @param addrlen The length, in bytes, of the address. @param flags A pointer to memory that will be filled with a @@ -127,12 +144,24 @@ SCNetworkCheckReachabilityByAddress ( const struct sockaddr *address, socklen_t addrlen, SCNetworkConnectionFlags *flags - ); + ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); /*! @function SCNetworkCheckReachabilityByName @discussion Determines if the given network host or node name is reachable using the current network configuration. + + Note: this API has been deprecated but you can + get equivalent results with : +
+	SCNetworkReachabiltyRef   target;
+	SCNetworkReachabiltyFlags flags = 0;
+	Boolean                   ok;
+
+	target = SCNetworkReachabilityCreateWithName(NULL, name);
+	ok = SCNetworkReachabilityGetFlags(target, &flags);
+	CFRelease(target);
+
@param nodename The node name of the desired host. This name would be the same as that passed to the gethostbyname(3) or getaddrinfo(3) functions. @@ -146,7 +175,7 @@ Boolean SCNetworkCheckReachabilityByName ( const char *nodename, SCNetworkConnectionFlags *flags - ); + ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); /*! @function SCNetworkInterfaceRefreshConfiguration @@ -162,8 +191,8 @@ SCNetworkCheckReachabilityByName ( */ Boolean SCNetworkInterfaceRefreshConfiguration ( - CFStringRef ifName - ) DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER; + CFStringRef ifName + ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA); __END_DECLS diff --git a/SystemConfiguration.fproj/SCNetworkConfiguration.h b/SystemConfiguration.fproj/SCNetworkConfiguration.h index 5398682..7e20211 100644 --- a/SystemConfiguration.fproj/SCNetworkConfiguration.h +++ b/SystemConfiguration.fproj/SCNetworkConfiguration.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,15 +22,17 @@ */ #ifndef _SCNETWORKCONFIGURATION_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCNETWORKCONFIGURATION_H -#include +#include +#include #include #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - /*! @header SCNetworkConfiguration @discussion The SCNetworkConfiguration API provides access to the @@ -63,89 +65,92 @@ typedef const struct __SCNetworkInterface * SCNetworkInterfaceRef; /*! @const kSCNetworkInterfaceType6to4 */ -extern const CFStringRef kSCNetworkInterfaceType6to4 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceType6to4 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeBluetooth */ -extern const CFStringRef kSCNetworkInterfaceTypeBluetooth AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeBluetooth __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeBond */ -extern const CFStringRef kSCNetworkInterfaceTypeBond AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeBond __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA); /*! @const kSCNetworkInterfaceTypeEthernet */ -extern const CFStringRef kSCNetworkInterfaceTypeEthernet AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeEthernet __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeFireWire */ -extern const CFStringRef kSCNetworkInterfaceTypeFireWire AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeFireWire __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeIEEE80211 */ -extern const CFStringRef kSCNetworkInterfaceTypeIEEE80211 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // IEEE 802.11, AirPort +extern const CFStringRef kSCNetworkInterfaceTypeIEEE80211 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); // IEEE 802.11, AirPort + +/*! + @const kSCNetworkInterfaceTypeIPSec + */ +extern const CFStringRef kSCNetworkInterfaceTypeIPSec __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeIrDA */ -extern const CFStringRef kSCNetworkInterfaceTypeIrDA AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeIrDA __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeL2TP */ -extern const CFStringRef kSCNetworkInterfaceTypeL2TP AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeL2TP __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeModem */ -extern const CFStringRef kSCNetworkInterfaceTypeModem AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeModem __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypePPP */ -extern const CFStringRef kSCNetworkInterfaceTypePPP AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypePPP __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypePPTP */ -extern const CFStringRef kSCNetworkInterfaceTypePPTP AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypePPTP __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeSerial */ -extern const CFStringRef kSCNetworkInterfaceTypeSerial AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeSerial __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceTypeVLAN */ -extern const CFStringRef kSCNetworkInterfaceTypeVLAN AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeVLAN __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA); /*! @const kSCNetworkInterfaceTypeWWAN */ -extern const CFStringRef kSCNetworkInterfaceTypeWWAN AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeWWAN __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /* special network interfaces (and types) */ /*! @const kSCNetworkInterfaceTypeIPv4 */ -extern const CFStringRef kSCNetworkInterfaceTypeIPv4 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkInterfaceTypeIPv4 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkInterfaceIPv4 @discussion A network interface that can used for layering other - interfaces (e.g. 6to4, PPTP, L2TP) over an existing + interfaces (e.g. 6to4, IPSec, PPTP, L2TP) over an existing IPv4 network. */ -extern const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +extern const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @group Interface configuration (Bond) @@ -167,8 +172,7 @@ typedef SCNetworkInterfaceRef SCBondInterfaceRef; */ typedef const struct __SCBondStatus * SCBondStatusRef; -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ - +#if !TARGET_OS_IPHONE /*! @enum Ethernet Bond Aggregation Status (kSCBondStatusDeviceAggregationStatus) codes @discussion Returned status codes. @@ -185,23 +189,22 @@ enum { kSCBondStatusNotInActiveGroup = 3, /* We're talking to a partner, but the link aggregation group is different from the one that's active */ kSCBondStatusUnknown = 999 /* Non-specific failure */ }; +#endif // !TARGET_OS_IPHONE /*! @const kSCBondStatusDeviceAggregationStatus */ -extern const CFStringRef kSCBondStatusDeviceAggregationStatus /* CFNumber */ AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCBondStatusDeviceAggregationStatus /* CFNumber */ __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA); /*! @const kSCBondStatusDeviceCollecting */ -extern const CFStringRef kSCBondStatusDeviceCollecting /* CFNumber (0 or 1) */ AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCBondStatusDeviceCollecting /* CFNumber (0 or 1) */ __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA); /*! @const kSCBondStatusDeviceDistributing */ -extern const CFStringRef kSCBondStatusDeviceDistributing /* CFNumber (0 or 1) */ AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +extern const CFStringRef kSCBondStatusDeviceDistributing /* CFNumber (0 or 1) */ __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA); /*! @group Interface configuration (VLAN) @@ -216,8 +219,6 @@ extern const CFStringRef kSCBondStatusDeviceDistributing /* CFNumber (0 or 1) */ */ typedef SCNetworkInterfaceRef SCVLANInterfaceRef; -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ - /*! @group Protocol configuration @@ -238,37 +239,32 @@ typedef const struct __SCNetworkProtocol * SCNetworkProtocolRef; /*! @const kSCNetworkProtocolTypeAppleTalk */ -extern const CFStringRef kSCNetworkProtocolTypeAppleTalk AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkProtocolTypeAppleTalk __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); /*! @const kSCNetworkProtocolTypeDNS */ -extern const CFStringRef kSCNetworkProtocolTypeDNS AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkProtocolTypeDNS __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkProtocolTypeIPv4 */ -extern const CFStringRef kSCNetworkProtocolTypeIPv4 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkProtocolTypeIPv4 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkProtocolTypeIPv6 */ -extern const CFStringRef kSCNetworkProtocolTypeIPv6 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern const CFStringRef kSCNetworkProtocolTypeIPv6 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkProtocolTypeProxies */ -extern const CFStringRef kSCNetworkProtocolTypeProxies AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +extern const CFStringRef kSCNetworkProtocolTypeProxies __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @const kSCNetworkProtocolTypeSMB */ -extern const CFStringRef kSCNetworkProtocolTypeSMB AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ - +extern const CFStringRef kSCNetworkProtocolTypeSMB __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @group Service configuration @@ -319,7 +315,7 @@ __BEGIN_DECLS @discussion Returns the type identifier of all SCNetworkInterface instances. */ CFTypeID -SCNetworkInterfaceGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceCopyAll @@ -328,7 +324,7 @@ SCNetworkInterfaceGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LA You must release the returned value. */ CFArrayRef /* of SCNetworkInterfaceRef's */ -SCNetworkInterfaceCopyAll (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceCopyAll (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetSupportedInterfaceTypes @@ -339,7 +335,7 @@ SCNetworkInterfaceCopyAll (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATE NULL if no interface types are supported. */ CFArrayRef /* of kSCNetworkInterfaceTypeXXX CFStringRef's */ -SCNetworkInterfaceGetSupportedInterfaceTypes (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceGetSupportedInterfaceTypes (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetSupportedProtocolTypes @@ -350,7 +346,7 @@ SCNetworkInterfaceGetSupportedInterfaceTypes (SCNetworkInterfaceRef interface) NULL if no protocol types are supported. */ CFArrayRef /* of kSCNetworkProtocolTypeXXX CFStringRef's */ -SCNetworkInterfaceGetSupportedProtocolTypes (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceGetSupportedProtocolTypes (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceCreateWithInterface @@ -365,7 +361,7 @@ SCNetworkInterfaceGetSupportedProtocolTypes (SCNetworkInterfaceRef interface) A */ SCNetworkInterfaceRef SCNetworkInterfaceCreateWithInterface (SCNetworkInterfaceRef interface, - CFStringRef interfaceType) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + CFStringRef interfaceType) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetBSDName @@ -376,7 +372,7 @@ SCNetworkInterfaceCreateWithInterface (SCNetworkInterfaceRef interface, NULL if no BSD name is available. */ CFStringRef -SCNetworkInterfaceGetBSDName (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceGetBSDName (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetConfiguration @@ -387,9 +383,7 @@ SCNetworkInterfaceGetBSDName (SCNetworkInterfaceRef interface) AVAILABLE_MAC_ or an error was encountered. */ CFDictionaryRef -SCNetworkInterfaceGetConfiguration (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +SCNetworkInterfaceGetConfiguration (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetExtendedConfiguration @@ -402,9 +396,7 @@ SCNetworkInterfaceGetConfiguration (SCNetworkInterfaceRef interface) AVAILABLE */ CFDictionaryRef SCNetworkInterfaceGetExtendedConfiguration (SCNetworkInterfaceRef interface, - CFStringRef extendedType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ + CFStringRef extendedType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetHardwareAddressString @@ -413,7 +405,7 @@ SCNetworkInterfaceGetExtendedConfiguration (SCNetworkInterfaceRef interface, @result A string representing the hardware (MAC) address for the interface. */ CFStringRef -SCNetworkInterfaceGetHardwareAddressString (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceGetHardwareAddressString (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetInterface @@ -423,7 +415,7 @@ SCNetworkInterfaceGetHardwareAddressString (SCNetworkInterfaceRef interface) AV NULL if this is a leaf interface. */ SCNetworkInterfaceRef -SCNetworkInterfaceGetInterface (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceGetInterface (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetInterfaceType @@ -432,7 +424,7 @@ SCNetworkInterfaceGetInterface (SCNetworkInterfaceRef interface) AVAILABLE_MA @result The interface type. */ CFStringRef -SCNetworkInterfaceGetInterfaceType (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceGetInterfaceType (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceGetLocalizedDisplayName @@ -443,7 +435,7 @@ SCNetworkInterfaceGetInterfaceType (SCNetworkInterfaceRef interface) AVAILABLE NULL if no name is available. */ CFStringRef -SCNetworkInterfaceGetLocalizedDisplayName (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkInterfaceGetLocalizedDisplayName (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceSetConfiguration @@ -454,9 +446,7 @@ SCNetworkInterfaceGetLocalizedDisplayName (SCNetworkInterfaceRef interface) AVA */ Boolean SCNetworkInterfaceSetConfiguration (SCNetworkInterfaceRef interface, - CFDictionaryRef config) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 + CFDictionaryRef config) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceSetExtendedConfiguration @@ -468,11 +458,7 @@ SCNetworkInterfaceSetConfiguration (SCNetworkInterfaceRef interface, Boolean SCNetworkInterfaceSetExtendedConfiguration (SCNetworkInterfaceRef interface, CFStringRef extendedType, - CFDictionaryRef config) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 + CFDictionaryRef config) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); #pragma mark - @@ -501,7 +487,7 @@ SCNetworkInterfaceCopyMediaOptions (SCNetworkInterfaceRef interface, CFDictionaryRef *current, CFDictionaryRef *active, CFArrayRef *available, - Boolean filter) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + Boolean filter) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceCopyMediaSubTypes @@ -513,7 +499,7 @@ SCNetworkInterfaceCopyMediaOptions (SCNetworkInterfaceRef interface, 100baseTX, etc). NULL if no subtypes are available. */ CFArrayRef -SCNetworkInterfaceCopyMediaSubTypes (CFArrayRef available) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCNetworkInterfaceCopyMediaSubTypes (CFArrayRef available) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceCopyMediaSubTypeOptions @@ -528,7 +514,7 @@ SCNetworkInterfaceCopyMediaSubTypes (CFArrayRef available) AVAILABLE_MAC_OS_X */ CFArrayRef SCNetworkInterfaceCopyMediaSubTypeOptions (CFArrayRef available, - CFStringRef subType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFStringRef subType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceCopyMTU @@ -550,7 +536,7 @@ Boolean SCNetworkInterfaceCopyMTU (SCNetworkInterfaceRef interface, int *mtu_cur, int *mtu_min, - int *mtu_max) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + int *mtu_max) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceSetMediaOptions @@ -565,7 +551,7 @@ SCNetworkInterfaceCopyMTU (SCNetworkInterfaceRef interface, Boolean SCNetworkInterfaceSetMediaOptions (SCNetworkInterfaceRef interface, CFStringRef subtype, - CFArrayRef options) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFArrayRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceSetMTU @@ -577,7 +563,7 @@ SCNetworkInterfaceSetMediaOptions (SCNetworkInterfaceRef interface, */ Boolean SCNetworkInterfaceSetMTU (SCNetworkInterfaceRef interface, - int mtu) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + int mtu) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkInterfaceForceConfigurationRefresh @@ -589,7 +575,6 @@ SCNetworkInterfaceSetMTU (SCNetworkInterfaceRef interface, allow the caller to give a hint to the system that the network infrastructure or configuration has changed. - Note: This function requires root (euid==0) privilege or, alternatively, you may pass an SCNetworkInterface which is derived from a sequence of calls to : @@ -601,11 +586,7 @@ SCNetworkInterfaceSetMTU (SCNetworkInterfaceRef interface, @result Returns TRUE if the notification was sent; FALSE otherwise. */ Boolean -SCNetworkInterfaceForceConfigurationRefresh (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +SCNetworkInterfaceForceConfigurationRefresh (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @group Interface configuration (Bond) @@ -622,7 +603,7 @@ SCNetworkInterfaceForceConfigurationRefresh (SCNetworkInterfaceRef interface) A You must release the returned value. */ CFArrayRef /* of SCBondInterfaceRef's */ -SCBondInterfaceCopyAll (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondInterfaceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceCopyAvailableMemberInterfaces @@ -633,7 +614,7 @@ SCBondInterfaceCopyAll (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_ You must release the returned value. */ CFArrayRef /* of SCNetworkInterfaceRef's */ -SCBondInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceCreate @@ -643,7 +624,7 @@ SCBondInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs) AVAILABL You must release the returned value. */ SCBondInterfaceRef -SCBondInterfaceCreate (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondInterfaceCreate (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceRemove @@ -652,7 +633,7 @@ SCBondInterfaceCreate (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_1 @result TRUE if the interface was removed; FALSE if an error was encountered. */ Boolean -SCBondInterfaceRemove (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondInterfaceRemove (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceGetMemberInterfaces @@ -661,7 +642,7 @@ SCBondInterfaceRemove (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_ @result The list of interfaces. */ CFArrayRef /* of SCNetworkInterfaceRef's */ -SCBondInterfaceGetMemberInterfaces (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondInterfaceGetMemberInterfaces (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceGetOptions @@ -671,7 +652,7 @@ SCBondInterfaceGetMemberInterfaces (SCBondInterfaceRef bond) AVAILABLE_MAC_OS NULL if no changes to the default configuration have been saved. */ CFDictionaryRef -SCBondInterfaceGetOptions (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondInterfaceGetOptions (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceSetMemberInterfaces @@ -683,7 +664,7 @@ SCBondInterfaceGetOptions (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSI Boolean SCBondInterfaceSetMemberInterfaces (SCBondInterfaceRef bond, CFArrayRef members) /* of SCNetworkInterfaceRef's */ - AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceSetLocalizedDisplayName @@ -694,7 +675,7 @@ SCBondInterfaceSetMemberInterfaces (SCBondInterfaceRef bond, */ Boolean SCBondInterfaceSetLocalizedDisplayName (SCBondInterfaceRef bond, - CFStringRef newName) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFStringRef newName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceSetOptions @@ -705,7 +686,7 @@ SCBondInterfaceSetLocalizedDisplayName (SCBondInterfaceRef bond, */ Boolean SCBondInterfaceSetOptions (SCBondInterfaceRef bond, - CFDictionaryRef newOptions) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); #pragma mark - @@ -717,14 +698,14 @@ SCBondInterfaceSetOptions (SCBondInterfaceRef bond, You must release the returned value. */ SCBondStatusRef -SCBondInterfaceCopyStatus (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondInterfaceCopyStatus (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondStatusGetTypeID @discussion Returns the type identifier of all SCBondStatus instances. */ CFTypeID -SCBondStatusGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondStatusGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondStatusGetMemberInterfaces @@ -734,7 +715,7 @@ SCBondStatusGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; @result The list of interfaces. */ CFArrayRef /* of SCNetworkInterfaceRef's */ -SCBondStatusGetMemberInterfaces (SCBondStatusRef bondStatus) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondStatusGetMemberInterfaces (SCBondStatusRef bondStatus) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondStatusGetInterfaceStatus @@ -744,10 +725,14 @@ SCBondStatusGetMemberInterfaces (SCBondStatusRef bondStatus) AVAILABLE_MAC_OS @param interface The specific member interface; NULL if you want the status of the Ethernet Bond. @result The interface status. + + Note: at present, no information about the status of the Ethernet + Bond is returned. As long as one member interface is active + then the bond should be operational. */ CFDictionaryRef SCBondStatusGetInterfaceStatus (SCBondStatusRef bondStatus, - SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @group Interface configuration (VLAN) @@ -763,7 +748,7 @@ SCBondStatusGetInterfaceStatus (SCBondStatusRef bondStatus, You must release the returned value. */ CFArrayRef /* of SCVLANInterfaceRef's */ -SCVLANInterfaceCopyAll (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCVLANInterfaceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceCopyAvailablePhysicalInterfaces @@ -773,7 +758,7 @@ SCVLANInterfaceCopyAll (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_ You must release the returned value. */ CFArrayRef /* of SCNetworkInterfaceRef's */ -SCVLANInterfaceCopyAvailablePhysicalInterfaces (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCVLANInterfaceCopyAvailablePhysicalInterfaces (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceCreate @@ -789,7 +774,7 @@ SCVLANInterfaceCopyAvailablePhysicalInterfaces (void) AVAILABLE_MAC_OS_X_VE SCVLANInterfaceRef SCVLANInterfaceCreate (SCPreferencesRef prefs, SCNetworkInterfaceRef physical, - CFNumberRef tag) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFNumberRef tag) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceRemove @@ -798,7 +783,7 @@ SCVLANInterfaceCreate (SCPreferencesRef prefs, @result TRUE if the interface was removed; FALSE if an error was encountered. */ Boolean -SCVLANInterfaceRemove (SCVLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCVLANInterfaceRemove (SCVLANInterfaceRef vlan) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceGetPhysicalInterface @@ -807,7 +792,7 @@ SCVLANInterfaceRemove (SCVLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_ @result The list of interfaces. */ SCNetworkInterfaceRef -SCVLANInterfaceGetPhysicalInterface (SCVLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCVLANInterfaceGetPhysicalInterface (SCVLANInterfaceRef vlan) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceGetTag @@ -816,7 +801,7 @@ SCVLANInterfaceGetPhysicalInterface (SCVLANInterfaceRef vlan) AVAILABLE_MAC_O @result The tag. */ CFNumberRef -SCVLANInterfaceGetTag (SCVLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCVLANInterfaceGetTag (SCVLANInterfaceRef vlan) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceGetOptions @@ -826,7 +811,7 @@ SCVLANInterfaceGetTag (SCVLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_ NULL if no changes to the default configuration have been saved. */ CFDictionaryRef -SCVLANInterfaceGetOptions (SCVLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCVLANInterfaceGetOptions (SCVLANInterfaceRef vlan) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceSetPhysicalInterfaceAndTag @@ -841,7 +826,7 @@ SCVLANInterfaceGetOptions (SCVLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSI Boolean SCVLANInterfaceSetPhysicalInterfaceAndTag (SCVLANInterfaceRef vlan, SCNetworkInterfaceRef physical, - CFNumberRef tag) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFNumberRef tag) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceSetLocalizedDisplayName @@ -852,7 +837,7 @@ SCVLANInterfaceSetPhysicalInterfaceAndTag (SCVLANInterfaceRef vlan, */ Boolean SCVLANInterfaceSetLocalizedDisplayName (SCVLANInterfaceRef vlan, - CFStringRef newName) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFStringRef newName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCVLANInterfaceSetOptions @@ -863,9 +848,8 @@ SCVLANInterfaceSetLocalizedDisplayName (SCVLANInterfaceRef vlan, */ Boolean SCVLANInterfaceSetOptions (SCVLANInterfaceRef vlan, - CFDictionaryRef newOptions) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ /* -------------------------------------------------------------------------------- * PROTOCOLS @@ -883,7 +867,7 @@ SCVLANInterfaceSetOptions (SCVLANInterfaceRef vlan, @discussion Returns the type identifier of all SCNetworkProtocol instances. */ CFTypeID -SCNetworkProtocolGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkProtocolGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkProtocolGetConfiguration @@ -894,7 +878,7 @@ SCNetworkProtocolGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LAT or an error was encountered. */ CFDictionaryRef -SCNetworkProtocolGetConfiguration (SCNetworkProtocolRef protocol) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkProtocolGetConfiguration (SCNetworkProtocolRef protocol) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkProtocolGetEnabled @@ -903,7 +887,7 @@ SCNetworkProtocolGetConfiguration (SCNetworkProtocolRef protocol) AVAILABLE_MA @result TRUE if the protocol is enabled. */ Boolean -SCNetworkProtocolGetEnabled (SCNetworkProtocolRef protocol) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkProtocolGetEnabled (SCNetworkProtocolRef protocol) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkProtocolGetProtocolType @@ -912,7 +896,7 @@ SCNetworkProtocolGetEnabled (SCNetworkProtocolRef protocol) AVAILABLE_MAC_OS_ @result The protocol type. */ CFStringRef -SCNetworkProtocolGetProtocolType (SCNetworkProtocolRef protocol) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkProtocolGetProtocolType (SCNetworkProtocolRef protocol) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkProtocolSetConfiguration @@ -923,7 +907,7 @@ SCNetworkProtocolGetProtocolType (SCNetworkProtocolRef protocol) AVAILABLE_MAC */ Boolean SCNetworkProtocolSetConfiguration (SCNetworkProtocolRef protocol, - CFDictionaryRef config) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + CFDictionaryRef config) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkProtocolSetEnabled @@ -934,7 +918,7 @@ SCNetworkProtocolSetConfiguration (SCNetworkProtocolRef protocol, */ Boolean SCNetworkProtocolSetEnabled (SCNetworkProtocolRef protocol, - Boolean enabled) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + Boolean enabled) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /* -------------------------------------------------------------------------------- * SERVICES @@ -952,7 +936,7 @@ SCNetworkProtocolSetEnabled (SCNetworkProtocolRef protocol, @discussion Returns the type identifier of all SCNetworkService instances. */ CFTypeID -SCNetworkServiceGetTypeID (void); +SCNetworkServiceGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceAddProtocolType @@ -967,7 +951,7 @@ SCNetworkServiceGetTypeID (void); */ Boolean SCNetworkServiceAddProtocolType (SCNetworkServiceRef service, - CFStringRef protocolType) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + CFStringRef protocolType) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceCopyAll @@ -977,7 +961,7 @@ SCNetworkServiceAddProtocolType (SCNetworkServiceRef service, You must release the returned value. */ CFArrayRef /* of SCNetworkServiceRef's */ -SCNetworkServiceCopyAll (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkServiceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceCopyProtocols @@ -987,7 +971,7 @@ SCNetworkServiceCopyAll (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION You must release the returned value. */ CFArrayRef /* of SCNetworkProtocolRef's */ -SCNetworkServiceCopyProtocols (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkServiceCopyProtocols (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceCreate @@ -999,7 +983,7 @@ SCNetworkServiceCopyProtocols (SCNetworkServiceRef service) AVAILABLE_MAC_OS_ */ SCNetworkServiceRef SCNetworkServiceCreate (SCPreferencesRef prefs, - SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceCopy @@ -1013,9 +997,7 @@ SCNetworkServiceCreate (SCPreferencesRef prefs, */ SCNetworkServiceRef SCNetworkServiceCopy (SCPreferencesRef prefs, - CFStringRef serviceID) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 + CFStringRef serviceID) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceEstablishDefaultConfiguration @@ -1027,9 +1009,7 @@ SCNetworkServiceCopy (SCPreferencesRef prefs, @result TRUE if the configuration was updated; FALSE if an error was encountered. */ Boolean -SCNetworkServiceEstablishDefaultConfiguration (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ +SCNetworkServiceEstablishDefaultConfiguration (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceGetEnabled @@ -1038,7 +1018,7 @@ SCNetworkServiceEstablishDefaultConfiguration (SCNetworkServiceRef service) AV @result TRUE if the service is enabled. */ Boolean -SCNetworkServiceGetEnabled (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkServiceGetEnabled (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceGetInterface @@ -1048,7 +1028,7 @@ SCNetworkServiceGetEnabled (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_V NULL if an error was encountered. */ SCNetworkInterfaceRef -SCNetworkServiceGetInterface (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkServiceGetInterface (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceGetName @@ -1057,7 +1037,7 @@ SCNetworkServiceGetInterface (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X @result The [user specified] name. */ CFStringRef -SCNetworkServiceGetName (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkServiceGetName (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceCopyProtocol @@ -1070,7 +1050,7 @@ SCNetworkServiceGetName (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VER */ SCNetworkProtocolRef SCNetworkServiceCopyProtocol (SCNetworkServiceRef service, - CFStringRef protocolType) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + CFStringRef protocolType) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceGetServiceID @@ -1079,7 +1059,7 @@ SCNetworkServiceCopyProtocol (SCNetworkServiceRef service, @result The service identifier. */ CFStringRef -SCNetworkServiceGetServiceID (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkServiceGetServiceID (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceRemove @@ -1088,7 +1068,7 @@ SCNetworkServiceGetServiceID (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X @result TRUE if the service was removed; FALSE if an error was encountered. */ Boolean -SCNetworkServiceRemove (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkServiceRemove (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceRemoveProtocolType @@ -1100,7 +1080,7 @@ SCNetworkServiceRemove (SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERS */ Boolean SCNetworkServiceRemoveProtocolType (SCNetworkServiceRef service, - CFStringRef protocolType) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + CFStringRef protocolType) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceSetEnabled @@ -1111,7 +1091,7 @@ SCNetworkServiceRemoveProtocolType (SCNetworkServiceRef service, */ Boolean SCNetworkServiceSetEnabled (SCNetworkServiceRef service, - Boolean enabled) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + Boolean enabled) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkServiceSetName @@ -1127,7 +1107,7 @@ SCNetworkServiceSetEnabled (SCNetworkServiceRef service, */ Boolean SCNetworkServiceSetName (SCNetworkServiceRef service, - CFStringRef name) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + CFStringRef name) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /* -------------------------------------------------------------------------------- @@ -1146,7 +1126,7 @@ SCNetworkServiceSetName (SCNetworkServiceRef service, @discussion Returns the type identifier of all SCNetworkSet instances. */ CFTypeID -SCNetworkSetGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetAddService @@ -1163,9 +1143,7 @@ SCNetworkSetGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; */ Boolean SCNetworkSetAddService (SCNetworkSetRef set, - SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 + SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetContainsInterface @@ -1177,9 +1155,7 @@ SCNetworkSetAddService (SCNetworkSetRef set, */ Boolean SCNetworkSetContainsInterface (SCNetworkSetRef set, - SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ + SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetCopyAll @@ -1189,7 +1165,7 @@ SCNetworkSetContainsInterface (SCNetworkSetRef set, You must release the returned value. */ CFArrayRef /* of SCNetworkSetRef's */ -SCNetworkSetCopyAll (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetCopyCurrent @@ -1198,7 +1174,7 @@ SCNetworkSetCopyAll (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_ @result The current set; NULL if no current set has been defined. */ SCNetworkSetRef -SCNetworkSetCopyCurrent (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetCopyCurrent (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetCopyServices @@ -1208,7 +1184,7 @@ SCNetworkSetCopyCurrent (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION You must release the returned value. */ CFArrayRef /* of SCNetworkServiceRef's */ -SCNetworkSetCopyServices (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetCopyServices (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetCreate @@ -1218,7 +1194,7 @@ SCNetworkSetCopyServices (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10 You must release the returned value. */ SCNetworkSetRef -SCNetworkSetCreate (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetCreate (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetCopy @@ -1232,7 +1208,7 @@ SCNetworkSetCreate (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_4 */ SCNetworkSetRef SCNetworkSetCopy (SCPreferencesRef prefs, - CFStringRef setID) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + CFStringRef setID) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetGetName @@ -1241,7 +1217,7 @@ SCNetworkSetCopy (SCPreferencesRef prefs, @result The [user specified] name. */ CFStringRef -SCNetworkSetGetName (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetGetName (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetGetSetID @@ -1250,7 +1226,7 @@ SCNetworkSetGetName (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_A @result The set identifier. */ CFStringRef -SCNetworkSetGetSetID (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetGetSetID (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetGetServiceOrder @@ -1263,7 +1239,7 @@ SCNetworkSetGetSetID (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_ was encountered. */ CFArrayRef /* of serviceID CFStringRef's */ -SCNetworkSetGetServiceOrder (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetGetServiceOrder (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetRemove @@ -1272,7 +1248,7 @@ SCNetworkSetGetServiceOrder (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION @result TRUE if the set was removed; FALSE if an error was encountered. */ Boolean -SCNetworkSetRemove (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetRemove (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetRemoveService @@ -1284,7 +1260,7 @@ SCNetworkSetRemove (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_AN */ Boolean SCNetworkSetRemoveService (SCNetworkSetRef set, - SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetSetCurrent @@ -1294,7 +1270,7 @@ SCNetworkSetRemoveService (SCNetworkSetRef set, FALSE if an error was encountered. */ Boolean -SCNetworkSetSetCurrent (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +SCNetworkSetSetCurrent (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetSetName @@ -1309,7 +1285,7 @@ SCNetworkSetSetCurrent (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_ */ Boolean SCNetworkSetSetName (SCNetworkSetRef set, - CFStringRef name) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + CFStringRef name) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSetSetServiceOrder @@ -1320,11 +1296,10 @@ SCNetworkSetSetName (SCNetworkSetRef set, */ Boolean SCNetworkSetSetServiceOrder (SCNetworkSetRef set, - CFArrayRef newOrder) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; /* serviceID CFStringRef's */ + CFArrayRef newOrder) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /* serviceID CFStringRef's */ __END_DECLS -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ - +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #endif /* _SCNETWORKCONFIGURATION_H */ diff --git a/SystemConfiguration.fproj/SCNetworkConfigurationInternal.c b/SystemConfiguration.fproj/SCNetworkConfigurationInternal.c index e1792e0..13ba9e8 100644 --- a/SystemConfiguration.fproj/SCNetworkConfigurationInternal.c +++ b/SystemConfiguration.fproj/SCNetworkConfigurationInternal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -535,3 +535,59 @@ __extract_password(SCPreferencesRef prefs, return exists; } + +__private_extern__ +Boolean +__remove_password(SCPreferencesRef prefs, + CFDictionaryRef config, + CFStringRef passwordKey, + CFStringRef encryptionKey, + CFStringRef encryptionKeyChainValue, + CFStringRef unique_id, + CFDictionaryRef *newConfig) +{ + CFStringRef encryption = NULL; + Boolean ok = FALSE; + + // check for keychain password + if (config != NULL) { + encryption = CFDictionaryGetValue(config, encryptionKey); + } + if ((encryption == NULL) || + (isA_CFString(encryption) && + CFEqual(encryption, encryptionKeyChainValue))) { + // remove keychain password + if (prefs != NULL) { + ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id); + } else { + ok = _SCSecKeychainPasswordItemRemove(NULL, unique_id); + } + } + + // as needed, check if we have an in-line password that we can remove + if (!ok && (encryption == NULL) && (config != NULL)) { + CFDataRef inline_password; + + inline_password = CFDictionaryGetValue(config, passwordKey); + inline_password = __copy_legacy_password(inline_password); + if (inline_password != NULL) { + CFRelease(inline_password); + ok = TRUE; + } + } + + if (newConfig != NULL) { + if (ok && (config != NULL)) { + CFMutableDictionaryRef temp; + + temp = CFDictionaryCreateMutableCopy(NULL, 0, config); + CFDictionaryRemoveValue(temp, passwordKey); + CFDictionaryRemoveValue(temp, encryptionKey); + *newConfig = (CFDictionaryRef)temp; + } else { + *newConfig = NULL; + } + } + + return ok; +} diff --git a/SystemConfiguration.fproj/SCNetworkConfigurationInternal.h b/SystemConfiguration.fproj/SCNetworkConfigurationInternal.h index 5203eb5..55305ed 100644 --- a/SystemConfiguration.fproj/SCNetworkConfigurationInternal.h +++ b/SystemConfiguration.fproj/SCNetworkConfigurationInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -25,7 +25,6 @@ #define _SCNETWORKCONFIGURATIONINTERNAL_H -#include #include #include #include @@ -47,6 +46,9 @@ typedef struct { // name CFStringRef name; + // misc + Boolean established; + } SCNetworkSetPrivate, *SCNetworkSetPrivateRef; @@ -64,6 +66,9 @@ typedef struct { // prefs SCPreferencesRef prefs; + // store (for live SCNetworkService) + SCDynamicStoreRef store; + // name CFStringRef name; @@ -115,6 +120,7 @@ typedef struct { // [SCPreferences] interface entity information CFStringRef entity_device; // interface device + CFStringRef entity_device_unique; // ... UniqueIdentifier CFStringRef entity_type; // interface type CFStringRef entity_subtype; // interface subtype @@ -126,19 +132,20 @@ typedef struct { CFDataRef address; CFStringRef addressString; Boolean builtin; + CFStringRef configurationAction; CFStringRef location; CFStringRef path; CFMutableDictionaryRef overrides; Boolean modemIsV92; - Boolean supportsBond; - Boolean supportsVLAN; CFNumberRef type; CFNumberRef unit; // misc int sort_order; // sort order for this interface +#if !TARGET_OS_IPHONE // for BOND interfaces + Boolean supportsBond; struct { CFArrayRef interfaces; CFDictionaryRef options; @@ -146,11 +153,13 @@ typedef struct { } bond; // for VLAN interfaces + Boolean supportsVLAN; struct { SCNetworkInterfaceRef interface; CFNumberRef tag; // e.g. 1 <= tag <= 4094 CFDictionaryRef options; } vlan; +#endif // !TARGET_OS_IPHONE } SCNetworkInterfacePrivate, *SCNetworkInterfacePrivateRef; @@ -178,6 +187,7 @@ __SCNetworkInterfaceCreatePrivate (CFAllocatorRef allocator, CFStringRef serviceID, io_string_t path); +#if !TARGET_OS_IPHONE SCNetworkInterfacePrivateRef _SCBondInterfaceCreatePrivate (CFAllocatorRef allocator, CFStringRef bond_if); @@ -185,12 +195,20 @@ _SCBondInterfaceCreatePrivate (CFAllocatorRef allocator, SCNetworkInterfacePrivateRef _SCVLANInterfaceCreatePrivate (CFAllocatorRef allocator, CFStringRef vlan_if); +#endif // !TARGET_OS_IPHONE CFDictionaryRef __SCNetworkInterfaceCopyInterfaceEntity (SCNetworkInterfaceRef interface); CFArrayRef -__SCNetworkInterfaceCopyDeepConfiguration (SCNetworkInterfaceRef interface); +__SCNetworkInterfaceCopyDeepConfiguration (SCNetworkSetRef set, + SCNetworkInterfaceRef interface); + +CFStringRef +__SCNetworkInterfaceCopyXLocalizedDisplayName (SCNetworkInterfaceRef interface); + +CFStringRef +__SCNetworkInterfaceCopyXNonLocalizedDisplayName(SCNetworkInterfaceRef interface); CFStringRef __SCNetworkInterfaceGetDefaultConfigurationType (SCNetworkInterfaceRef interface); @@ -218,15 +236,18 @@ __SCNetworkInterfaceSetConfiguration (SCNetworkInterfaceRef interface, Boolean okToHold); void -__SCNetworkInterfaceSetDeepConfiguration (SCNetworkInterfaceRef interface, +__SCNetworkInterfaceSetDeepConfiguration (SCNetworkSetRef set, + SCNetworkInterfaceRef interface, CFArrayRef configs); +#if !TARGET_OS_IPHONE Boolean __SCNetworkInterfaceSupportsVLAN (CFStringRef bsd_if); void __SCBondInterfaceListCopyMembers (CFArrayRef interfaces, CFMutableSetRef set); +#endif // !TARGET_OS_IPHONE #pragma mark - #pragma mark SCNetworkProtocol configuration (internal) @@ -310,6 +331,15 @@ __extract_password (SCPreferencesRef prefs, CFStringRef unique_id, CFDataRef *password); +Boolean +__remove_password (SCPreferencesRef prefs, + CFDictionaryRef config, + CFStringRef passwordKey, + CFStringRef encryptionKey, + CFStringRef encryptionKeyChainValue, + CFStringRef unique_id, + CFDictionaryRef *newConfig); + __END_DECLS #endif /* _SCNETWORKCONFIGURATIONINTERNAL_H */ diff --git a/SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h b/SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h index 9d00ed5..ec41e4c 100644 --- a/SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h +++ b/SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2007 Apple Inc. All rights reserved. + * Copyright (c) 2005-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,15 +24,14 @@ #ifndef _SCNETWORKCONFIGURATIONPRIVATE_H #define _SCNETWORKCONFIGURATIONPRIVATE_H -#include +#include +#include #include #include #include #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - /*! @header SCNetworkConfigurationPrivate */ @@ -54,6 +53,7 @@ isA_SCNetworkInterface(CFTypeRef obj) return (isA_CFType(obj, SCNetworkInterfaceGetTypeID())); } +#if !TARGET_OS_IPHONE static __inline__ CFTypeRef isA_SCBondInterface(CFTypeRef obj) { @@ -91,6 +91,7 @@ isA_SCVLANInterface(CFTypeRef obj) return obj; } +#endif // !TARGET_OS_IPHONE /*! @function _SCNetworkInterfaceCompare @@ -103,7 +104,17 @@ isA_SCVLANInterface(CFTypeRef obj) CFComparisonResult _SCNetworkInterfaceCompare (const void *val1, const void *val2, - void *context) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + void *context) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); + +/*! + @function _SCNetworkInterfaceCopySlashDevPath + @discussion Returns the /dev pathname for the interface. + @param interface The network interface. + @result The /dev pathname associated with the interface (e.g. "/dev/modem"); + NULL if no path is available. + */ +CFStringRef +_SCNetworkInterfaceCopySlashDevPath (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0); #define kIncludeNoVirtualInterfaces 0x0 #define kIncludeVLANInterfaces 0x1 @@ -124,7 +135,7 @@ _SCNetworkInterfaceCompare (const void *val1, SCNetworkInterfaceRef _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator, CFStringRef bsdName, - UInt32 flags) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + UInt32 flags) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function _SCNetworkInterfaceCreateWithEntity @@ -138,7 +149,7 @@ _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator, SCNetworkInterfaceRef _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator, CFDictionaryRef interface_entity, - SCNetworkServiceRef service) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject @@ -149,7 +160,22 @@ _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator, You must release the returned value. */ SCNetworkInterfaceRef -_SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); + +#define kSCNetworkInterfaceConfigurationActionKey CFSTR("New Interface Detected Action") +#define kSCNetworkInterfaceConfigurationActionValueNone CFSTR("None") +#define kSCNetworkInterfaceConfigurationActionValuePrompt CFSTR("Prompt") +#define kSCNetworkInterfaceConfigurationActionValueConfigure CFSTR("Configure") + +/*! + @function _SCNetworkInterfaceGetConfigurationAction + @discussion Returns a user-notification / auto-configuration action for the interface. + @param interface The network interface. + @result The user-notification / auto-configuration action; + NULL if the default action should be used. + */ +CFStringRef +_SCNetworkInterfaceGetConfigurationAction (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0); /*! @function _SCNetworkInterfaceGetHardwareAddress @@ -159,7 +185,7 @@ _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj) AV NULL if no hardware address is available. */ CFDataRef -_SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function _SCNetworkInterfaceGetIOInterfaceType @@ -168,7 +194,7 @@ _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface) AVAIL @result The IOInterfaceType associated with the interface */ CFNumberRef -_SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function _SCNetworkInterfaceGetIOInterfaceUnit @@ -178,7 +204,7 @@ _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface) AVAIL NULL if no IOLocation is available. */ CFNumberRef -_SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function _SCNetworkInterfaceGetIOPath @@ -188,7 +214,16 @@ _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface) AVAIL NULL if no IOPath is available. */ CFStringRef -_SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); + +/*! + @function _SCNetworkInterfaceIsBluetoothPAN + @discussion Identifies if a network interface is a Bluetooth PAN device. + @param interface The network interface. + @result TRUE if the interface is a Bluetooth PAN device. + */ +Boolean +_SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0); /*! @function _SCNetworkInterfaceIsBuiltin @@ -197,7 +232,16 @@ _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface) AVAILABLE_MAC @result TRUE if the interface is "built-in". */ Boolean -_SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); + +/*! + @function _SCNetworkInterfaceIsTethered + @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone). + @param interface The network interface. + @result TRUE if the interface is a tethered device. + */ +Boolean +_SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0); /*! @function _SCNetworkInterfaceIsModemV92 @@ -207,7 +251,7 @@ _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) AVAILABLE_MAC @result TRUE if the interface is "v.92" modem. */ Boolean -_SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function _SCNetworkInterfaceForceConfigurationRefresh @@ -217,7 +261,7 @@ _SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface) AVAILABLE_MA @result TRUE if the refresh was successfully posted. */ Boolean -_SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function _SCBondInterfaceCopyActive @@ -226,7 +270,7 @@ _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) AVAILABLE_ You must release the returned value. */ CFArrayRef -_SCBondInterfaceCopyActive (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCBondInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function _SCBondInterfaceUpdateConfiguration @@ -236,7 +280,7 @@ _SCBondInterfaceCopyActive (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LA an error was encountered. */ Boolean -_SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceSetMode @@ -247,7 +291,7 @@ _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) AVAILABLE_MAC_O */ Boolean SCBondInterfaceSetMode (SCBondInterfaceRef bond, - CFNumberRef mode) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFNumberRef mode) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function SCBondInterfaceSetMode @@ -256,7 +300,7 @@ SCBondInterfaceSetMode (SCBondInterfaceRef bond, @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}). */ CFNumberRef -SCBondInterfaceGetMode (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCBondInterfaceGetMode (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function _SCVLANInterfaceCopyActive @@ -265,7 +309,7 @@ SCBondInterfaceGetMode (SCBondInterfaceRef bond) AVAILABLE_MAC_OS_X_VERSIO You must release the returned value. */ CFArrayRef -_SCVLANInterfaceCopyActive (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCVLANInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); /*! @function _SCVLANInterfaceUpdateConfiguration @@ -275,7 +319,7 @@ _SCVLANInterfaceCopyActive (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LA an error was encountered. */ Boolean -_SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +_SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA); #pragma mark - @@ -286,26 +330,27 @@ enum { kSCNetworkInterfacePasswordTypePPP = 1, kSCNetworkInterfacePasswordTypeIPSecSharedSecret, kSCNetworkInterfacePasswordTypeEAPOL, + kSCNetworkInterfacePasswordTypeIPSecXAuth, }; typedef uint32_t SCNetworkInterfacePasswordType; Boolean SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface, - SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFDataRef SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface, - SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface, - SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface, SCNetworkInterfacePasswordType passwordType, CFDataRef password, - CFDictionaryRef options) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); #pragma mark - @@ -339,6 +384,59 @@ isA_SCNetworkService(CFTypeRef obj) return (isA_CFType(obj, SCNetworkServiceGetTypeID())); } +enum { + kSCNetworkServicePrimaryRankDefault = 0, + kSCNetworkServicePrimaryRankFirst = 1, + kSCNetworkServicePrimaryRankLast = 2, + kSCNetworkServicePrimaryRankNever = 3 +}; +typedef uint32_t SCNetworkServicePrimaryRank; + +/*! + @function _SCNetworkServiceCopyActive + @discussion Returns the network service with the specified identifier. + + Note: The service returned by this SPI differs from the SCNetworkServiceCopy + API in that queries and operations interact with the "active" service + represented in the SCDynamicStore. Only a limited subset of the + SCNetworkService APIs are supported. + @param prefs The dynamic store session. + @param serviceID The unique identifier for the service. + @result A reference to the SCNetworkService represented in the SCDynamicStore; + NULL if the serviceID does not exist in the SCDynamicStore or if an + error was encountered. + You must release the returned value. + */ +SCNetworkServiceRef +_SCNetworkServiceCopyActive (SCDynamicStoreRef store, + CFStringRef serviceID) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_1); + +/*! + @function SCNetworkServiceGetPrimaryRank + @discussion Returns the primary service rank associated with a service. + @param service The network service. + @result The primary service rank associated with the specified application; + kSCNetworkServicePrimaryRankDefault if no rank is associated with the + application or an error was encountered. + */ +SCNetworkServicePrimaryRank +SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0); + +/*! + @function SCNetworkServiceSetPrimaryRank + @discussion Updates the the primary service rank associated with a service. + @param service The network service. + @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault + if the default service rank should be used. + @result TRUE if the rank was stored; FALSE if an error was encountered. + + Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast + values can only valid as a transient setting. + */ +Boolean +SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service, + SCNetworkServicePrimaryRank newRank) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0); + #pragma mark - #pragma mark SCNetworkSet configuration (SPI) @@ -373,7 +471,7 @@ isA_SCNetworkSet(CFTypeRef obj) changes were required or if an error was encountered. */ Boolean -SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set); +SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function SCNetworkSetEstablishDefaultInterfaceConfiguration @@ -394,10 +492,8 @@ SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set); */ Boolean SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set, - SCNetworkInterfaceRef interface); + SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); __END_DECLS -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ - #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */ diff --git a/SystemConfiguration.fproj/SCNetworkConnection.c b/SystemConfiguration.fproj/SCNetworkConnection.c index b63ff03..c0b8e21 100644 --- a/SystemConfiguration.fproj/SCNetworkConnection.c +++ b/SystemConfiguration.fproj/SCNetworkConnection.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2007 Apple Inc. All rights reserved. + * Copyright (c) 2003-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -32,16 +32,23 @@ */ +#include +#include +#include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE #include #include - -#include -#include "dy_framework.h" - #include #include #include +#if !TARGET_OS_IPHONE +#include +#include "dy_framework.h" +#endif // !TARGET_OS_IPHONE + #include #include @@ -53,14 +60,18 @@ #include #include #include +#include #include -#include #include "pppcontroller.h" #include +static int debug = 0; +static pthread_once_t initialized = PTHREAD_ONCE_INIT; + + typedef struct { /* base CFType information */ @@ -79,13 +90,17 @@ typedef struct { CFMachPortRef notify_port; /* run loop source, callout, context, rl scheduling info */ + Boolean scheduled; CFRunLoopSourceRef rls; SCNetworkConnectionCallBack rlsFunction; SCNetworkConnectionContext rlsContext; CFMutableArrayRef rlList; - /* misc info */ - int debug; +#if !TARGET_OS_IPHONE + dispatch_queue_t dispatchQueue; // SCNetworkConnectionSetDispatchQueue + dispatch_queue_t callbackQueue; + dispatch_source_t callbackSource; +#endif // !TARGET_OS_IPHONE } SCNetworkConnectionPrivate, *SCNetworkConnectionPrivateRef; @@ -121,26 +136,31 @@ __SCNetworkConnectionDeallocate(CFTypeRef cf) { SCNetworkConnectionPrivateRef connectionPrivate = (SCNetworkConnectionPrivateRef)cf; - if (connectionPrivate->debug) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionDeallocate (0x%x)"), connectionPrivate); - } - /* release resources */ pthread_mutex_destroy(&connectionPrivate->lock); - if (connectionPrivate->rlList != NULL) { + if (connectionPrivate->rls != NULL) { CFRunLoopSourceInvalidate(connectionPrivate->rls); CFRelease(connectionPrivate->rls); + } + + if (connectionPrivate->rlList != NULL) { CFRelease(connectionPrivate->rlList); } if (connectionPrivate->notify_port != NULL) { + mach_port_t mp = CFMachPortGetPort(connectionPrivate->notify_port); + + __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionDeallocate notify_port", mp); CFMachPortInvalidate(connectionPrivate->notify_port); CFRelease(connectionPrivate->notify_port); + mach_port_mod_refs(mach_task_self(), mp, MACH_PORT_RIGHT_RECEIVE, -1); } - if (connectionPrivate->session_port != MACH_PORT_NULL) - mach_port_destroy(mach_task_self(), connectionPrivate->session_port); + if (connectionPrivate->session_port != MACH_PORT_NULL) { + __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionDeallocate session_port", connectionPrivate->session_port); + (void) mach_port_deallocate(mach_task_self(), connectionPrivate->session_port); + } if (connectionPrivate->rlsContext.release != NULL) (*connectionPrivate->rlsContext.release)(connectionPrivate->rlsContext.info); @@ -151,8 +171,6 @@ __SCNetworkConnectionDeallocate(CFTypeRef cf) } -static pthread_once_t initialized = PTHREAD_ONCE_INIT; - static CFTypeID __kSCNetworkConnectionTypeID = _kCFRuntimeNotATypeID; static const CFRuntimeClass __SCNetworkConnectionClass = { @@ -171,41 +189,19 @@ static const CFRuntimeClass __SCNetworkConnectionClass = { static void __SCNetworkConnectionInitialize(void) { - __kSCNetworkConnectionTypeID = _CFRuntimeRegisterClass(&__SCNetworkConnectionClass); - return; -} + char *env; - -static SCNetworkConnectionStatus -__SCNetworkConnectionConvertStatus(int state) -{ - SCNetworkConnectionStatus status = kSCNetworkConnectionDisconnected; - - switch (state) { - case PPP_INITIALIZE: - case PPP_CONNECTLINK: - case PPP_ESTABLISH: - case PPP_AUTHENTICATE: - case PPP_CALLBACK: - case PPP_NETWORK: - case PPP_WAITONBUSY: - status = kSCNetworkConnectionConnecting; - break; - case PPP_TERMINATE: - case PPP_DISCONNECTLINK: - status = kSCNetworkConnectionDisconnecting; - break; - case PPP_RUNNING: - case PPP_ONHOLD: - status = kSCNetworkConnectionConnected; - break; - case PPP_IDLE: - case PPP_DORMANT: - case PPP_HOLDOFF: - default: - status = kSCNetworkConnectionDisconnected; + /* get the debug environment variable */ + env = getenv("PPPDebug"); + if (env != NULL) { + if (sscanf(env, "%d", &debug) != 1) { + /* PPPDebug value is not valid (or non-numeric), set debug to 1 */ + debug = 1; + } } - return status; + + __kSCNetworkConnectionTypeID = _CFRuntimeRegisterClass(&__SCNetworkConnectionClass); + return; } @@ -219,18 +215,17 @@ __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void void (*context_release)(const void *); int error = kSCStatusFailed; mach_msg_id_t msgid = buf->header.msgh_id; - int phase = PPP_IDLE; SCNetworkConnectionCallBack rlsFunction; - kern_return_t status; - SCNetworkConnectionStatus scstatus; + SCNetworkConnectionStatus scstatus = kSCNetworkConnectionInvalid; if (msgid == MACH_NOTIFY_NO_SENDERS) { SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCNetworkConnectionCallBack: PPPController server died")); } else { - status = pppcontroller_getstatus(connectionPrivate->session_port, &phase, &error); + (void) pppcontroller_getstatus(connectionPrivate->session_port, &scstatus, &error); } - if (connectionPrivate->rls == NULL) { + if (!connectionPrivate->scheduled) { + // if not currently scheduled return; } @@ -247,8 +242,6 @@ __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void context_release = NULL; } - scstatus = __SCNetworkConnectionConvertStatus(phase); - (*rlsFunction)(connection, scstatus, context_info); if ((context_release != NULL) && (context_info != NULL)) { (*context_release)(context_info); @@ -283,7 +276,6 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef allocator, SCNetworkConnectionContext *context) { SCNetworkConnectionPrivateRef connectionPrivate = NULL; - char *envdebug; uint32_t size; @@ -305,13 +297,6 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef allocator, /* save the service */ connectionPrivate->service = CFRetain(service); - /* get the debug environment variable */ - envdebug = getenv("PPPDebug"); - if (envdebug) { - if (sscanf(envdebug, "%d", &connectionPrivate->debug) != 1) - connectionPrivate->debug = 1; /* PPPDebug value is invalid, set debug to 1 */ - } - connectionPrivate->rlsFunction = callout; if (context) { @@ -321,18 +306,11 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef allocator, } } - if (connectionPrivate->debug) { - SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) succeeded for service : %@"), connectionPrivate, service); - } - /* success, return the connection reference */ return connectionPrivate; fail: - if (connectionPrivate->debug) - SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) failed for service : %@"), connectionPrivate, service); - /* failure, clean up and leave */ if (connectionPrivate != NULL) { CFRelease(connectionPrivate); @@ -351,7 +329,7 @@ __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate CFDataRef dataRef = NULL; int error = kSCStatusFailed; mach_port_t notify_port = MACH_PORT_NULL; - mach_port_t port_old = MACH_PORT_NULL; + mach_port_t oldNotify = MACH_PORT_NULL; mach_port_t server = MACH_PORT_NULL; kern_return_t status; mach_port_t unpriv_bootstrap_port = MACH_PORT_NULL; @@ -363,7 +341,7 @@ __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate pthread_mutex_lock(&connectionPrivate->lock); if (bootstrap_look_up(bootstrap_port, PPPCONTROLLER_SERVER, &server) != BOOTSTRAP_SUCCESS) { - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("PPP Controller server not found")); + SCLog(_sc_verbose, LOG_ERR, CFSTR("PPP Controller not found")); goto done; } @@ -377,34 +355,73 @@ __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate } if (connectionPrivate->rlsFunction != NULL) { - CFMachPortContext context = { 0 - , (void *)connectionPrivate - , NULL - , NULL - , pppMPCopyDescription - }; - /* allocate port (for server response) */ - connectionPrivate->notify_port = CFMachPortCreate(NULL, __SCNetworkConnectionCallBack, &context, NULL); + status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, ¬ify_port); + if (status != KERN_SUCCESS) { + goto done; + } + + status = mach_port_insert_right(mach_task_self(), + notify_port, + notify_port, + MACH_MSG_TYPE_MAKE_SEND); + if (status != KERN_SUCCESS) { + /* + * We can't insert a send right into our own port! This should + * only happen if someone stomped on OUR port (so let's leave + * the port alone). + */ + SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort mach_port_insert_right(): %s"), mach_error_string(status)); + goto done; + } /* request a notification when/if the server dies */ - notify_port = CFMachPortGetPort(connectionPrivate->notify_port); status = mach_port_request_notification(mach_task_self(), notify_port, MACH_NOTIFY_NO_SENDERS, 1, notify_port, MACH_MSG_TYPE_MAKE_SEND_ONCE, - &port_old); + &oldNotify); if (status != KERN_SUCCESS) { goto done; } + + if (oldNotify != MACH_PORT_NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort(): oldNotify != MACH_PORT_NULL")); + } + + __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionSessionPort notify_port (before)", notify_port); } status = pppcontroller_attach(server, data, dataLen, unpriv_bootstrap_port, notify_port, &connectionPrivate->session_port, &error); if (status != KERN_SUCCESS) { + SCLog(TRUE, LOG_DEBUG, CFSTR("__SCNetworkConnectionSessionPort : pppcontroller_attach failed (status=0x%x)"), status); + if ((notify_port != MACH_PORT_NULL) && (status == MACH_SEND_INVALID_DEST)) { + (void) mach_port_destroy(mach_task_self(), notify_port); + notify_port = MACH_PORT_NULL; + } error = kSCStatusFailed; + goto done; + } + + __MACH_PORT_DEBUG(connectionPrivate->session_port != MACH_PORT_NULL, + "*** __SCNetworkConnectionSessionPort session_port", + connectionPrivate->session_port); + __MACH_PORT_DEBUG(notify_port != MACH_PORT_NULL, + "*** __SCNetworkConnectionSessionPort notify_port", + notify_port); + + if (notify_port != MACH_PORT_NULL) { + CFMachPortContext context = { 0 + , (void *)connectionPrivate + , NULL + , NULL + , pppMPCopyDescription + }; + + connectionPrivate->notify_port = CFMachPortCreateWithPort(NULL, notify_port, __SCNetworkConnectionCallBack, &context, NULL); } done : @@ -417,13 +434,20 @@ __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate if (error != kSCStatusOK) { if (connectionPrivate->session_port != MACH_PORT_NULL) { - mach_port_destroy(mach_task_self(), connectionPrivate->session_port); + __MACH_PORT_DEBUG(TRUE, + "*** __SCNetworkConnectionSessionPort attach failed: session_port", + connectionPrivate->session_port); + mach_port_deallocate(mach_task_self(), connectionPrivate->session_port); connectionPrivate->session_port = MACH_PORT_NULL; } if (connectionPrivate->notify_port != NULL) { + mach_port_t port = CFMachPortGetPort(connectionPrivate->notify_port); + CFMachPortInvalidate(connectionPrivate->notify_port); CFRelease(connectionPrivate->notify_port); connectionPrivate->notify_port = NULL; + __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionSessionPort attach failed: notify_port", port); + mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1); } _SCErrorSet(error); } @@ -475,7 +499,8 @@ SCNetworkConnectionCopyAvailableServices(SCNetworkSetRef set) service = CFArrayGetValueAtIndex(services, i); interface = SCNetworkServiceGetInterface(service); interfaceType = SCNetworkInterfaceGetInterfaceType(interface); - if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { + if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP) || + CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) { CFArrayAppendValue(available, service); } } @@ -484,7 +509,9 @@ SCNetworkConnectionCopyAvailableServices(SCNetworkSetRef set) } } - if (tempSet) CFRelease(set); + if (tempSet && (set != NULL)) { + CFRelease(set); + } return available; } @@ -514,7 +541,6 @@ SCNetworkConnectionCreateWithServiceID(CFAllocatorRef allocator, SCNetworkConnectionContext *context) { SCNetworkConnectionRef connection; - SCPreferencesRef prefs; SCNetworkServiceRef service; if (!isA_CFString(serviceID)) { @@ -522,13 +548,7 @@ SCNetworkConnectionCreateWithServiceID(CFAllocatorRef allocator, return NULL; } - prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkConnectionCreateWithServiceID"), NULL); - if (prefs == NULL) { - return NULL; - } - - service = SCNetworkServiceCopy(prefs, serviceID); - CFRelease(prefs); + service = _SCNetworkServiceCopyActive(NULL, serviceID); if (service == NULL) { return NULL; } @@ -622,7 +642,6 @@ SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection) { SCNetworkConnectionPrivateRef connectionPrivate = (SCNetworkConnectionPrivateRef)connection; int error = kSCStatusFailed; - int phase; SCNetworkConnectionStatus scstatus; mach_port_t session_port; kern_return_t status; @@ -638,12 +657,17 @@ SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection) return kSCNetworkConnectionInvalid; } - status = pppcontroller_getstatus(session_port, &phase, &error); - if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) { - return kSCNetworkConnectionDisconnected; + status = pppcontroller_getstatus(session_port, &scstatus, &error); + if (status != KERN_SUCCESS) { + _SCErrorSet(kSCStatusFailed); + return kSCNetworkConnectionInvalid; + } + + if (error != kSCStatusOK) { + _SCErrorSet(error); + return kSCNetworkConnectionInvalid; } - scstatus = __SCNetworkConnectionConvertStatus(phase); return scstatus; } @@ -724,7 +748,7 @@ SCNetworkConnectionStart(SCNetworkConnectionRef connection, return FALSE; } - if (connectionPrivate->debug) { + if (debug > 0) { CFMutableDictionaryRef mdict = NULL; SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x)"), connectionPrivate); @@ -792,8 +816,9 @@ SCNetworkConnectionStart(SCNetworkConnectionRef connection, dataref = NULL; } - if (connectionPrivate->debug) + if (debug > 0) { SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x), return: %d"), connectionPrivate, error); + } if (error != kSCStatusOK) { goto fail; @@ -830,16 +855,18 @@ SCNetworkConnectionStop(SCNetworkConnectionRef connection, return FALSE; } - if (connectionPrivate->debug) + if (debug > 0) { SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x)"), connectionPrivate); + } status = pppcontroller_stop(session_port, forceDisconnect, &error); if (status != KERN_SUCCESS) { goto fail; } - if (connectionPrivate->debug) + if (debug > 0) { SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x), return: %d"), connectionPrivate, error); + } if (error != kSCStatusOK) { goto fail; @@ -874,16 +901,18 @@ SCNetworkConnectionSuspend(SCNetworkConnectionRef connection) return FALSE; } - if (connectionPrivate->debug) + if (debug > 0) { SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x)"), connectionPrivate); + } status = pppcontroller_suspend(session_port, &error); if (status != KERN_SUCCESS) { goto fail; } - if (connectionPrivate->debug) + if (debug > 0) { SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x), return: %d"), connectionPrivate, error); + } if (error != kSCStatusOK) { goto fail; @@ -918,16 +947,18 @@ SCNetworkConnectionResume(SCNetworkConnectionRef connection) return FALSE; } - if (connectionPrivate->debug) + if (debug > 0) { SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x)"), connectionPrivate); + } status = pppcontroller_resume(session_port, &error); if (status != KERN_SUCCESS) { goto fail; } - if (connectionPrivate->debug) + if (debug > 0) { SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x), return: %d"), connectionPrivate, error); + } if (error != kSCStatusOK) { goto fail; @@ -1000,32 +1031,53 @@ SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection) } -Boolean -SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef connection, - CFRunLoopRef runLoop, - CFStringRef runLoopMode) +#if !TARGET_OS_IPHONE +static boolean_t +SCNetworkConnectionNotifyMIGCallback(mach_msg_header_t *message, mach_msg_header_t *reply) +{ + SCNetworkConnectionPrivateRef connectionPrivate = dispatch_get_context(dispatch_get_current_queue()); + + if (connectionPrivate != NULL) { + CFRetain(connectionPrivate); + dispatch_async(connectionPrivate->dispatchQueue, ^{ + __SCNetworkConnectionCallBack(connectionPrivate->notify_port, message, 4096, connectionPrivate); + CFRelease(connectionPrivate); + }); + } + reply->msgh_remote_port = MACH_PORT_NULL; + return false; +} +#endif // !TARGET_OS_IPHONE + + +static Boolean +__SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef connection, + CFRunLoopRef runLoop, + CFStringRef runLoopMode, +#if !TARGET_OS_IPHONE + dispatch_queue_t queue +#else // !TARGET_OS_IPHONE + void *queue +#endif // !TARGET_OS_IPHONE + ) { SCNetworkConnectionPrivateRef connectionPrivate = (SCNetworkConnectionPrivateRef)connection; int error = kSCStatusFailed; mach_port_t session_port; kern_return_t status; - if (!isA_SCNetworkConnection(connection) || runLoop == NULL || runLoopMode == NULL) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - if (connectionPrivate->rlsFunction == NULL) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } - if ((connectionPrivate->rlList != NULL) && - _SC_isScheduled(NULL, runLoop, runLoopMode, connectionPrivate->rlList)) { - /* already scheduled */ - _SCErrorSet(kSCStatusFailed); +#if !TARGET_OS_IPHONE + if ((connectionPrivate->dispatchQueue != NULL) || // if we are already scheduled on a dispatch queue + ((queue != NULL) && connectionPrivate->scheduled)) { // if we are already scheduled on a CFRunLoop + _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } +#endif // !TARGET_OS_IPHONE session_port = __SCNetworkConnectionSessionPort(connectionPrivate); if (session_port == MACH_PORT_NULL) { @@ -1033,45 +1085,125 @@ SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef connection, return FALSE; } - if (connectionPrivate->rlList == NULL) { + if (!connectionPrivate->scheduled) { status = pppcontroller_notification(session_port, 1, &error); if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) { _SCErrorSet(error); return FALSE; } - connectionPrivate->rls = CFMachPortCreateRunLoopSource(NULL, connectionPrivate->notify_port, 0); - connectionPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + if (runLoop != NULL) { + connectionPrivate->rls = CFMachPortCreateRunLoopSource(NULL, connectionPrivate->notify_port, 0); + connectionPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + } + + connectionPrivate->scheduled = TRUE; } - CFRunLoopAddSource(runLoop, connectionPrivate->rls, runLoopMode); - _SC_schedule(connectionPrivate, runLoop, runLoopMode, connectionPrivate->rlList); +#if !TARGET_OS_IPHONE + if (queue != NULL) { + dispatch_queue_attr_t attr; + mach_port_t mp; + long res; + + connectionPrivate->dispatchQueue = queue; + dispatch_retain(connectionPrivate->dispatchQueue); + + attr = dispatch_queue_attr_create(); + res = dispatch_queue_attr_set_finalizer(attr, + ^(dispatch_queue_t dq) { + SCNetworkConnectionRef connection; + + connection = (SCNetworkConnectionRef)dispatch_get_context(dq); + CFRelease(connection); + }); + if (res != 0) { + SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkConnection dispatch_queue_attr_set_finalizer() failed")); + dispatch_release(attr); + goto fail; + } + connectionPrivate->callbackQueue = dispatch_queue_create("com.apple.SCNetworkConnection.notifications", attr); + dispatch_release(attr); + if (connectionPrivate->callbackQueue == NULL){ + SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkConnection dispatch_queue_create() failed")); + goto fail; + } + CFRetain(connection); // Note: will be released when the dispatch queue is released + dispatch_set_context(connectionPrivate->callbackQueue, connectionPrivate); + + mp = CFMachPortGetPort(connectionPrivate->notify_port); + connectionPrivate->callbackSource = dispatch_source_mig_create(mp, sizeof(mach_msg_header_t), NULL, connectionPrivate->callbackQueue, SCNetworkConnectionNotifyMIGCallback); + if (connectionPrivate->callbackSource == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkConnection dispatch_source_mig_create() failed")); + goto fail; + } + } else +#endif // !TARGET_OS_IPHONE + { + if (!_SC_isScheduled(NULL, runLoop, runLoopMode, connectionPrivate->rlList)) { + /* + * if we do not already have notifications scheduled with + * this runLoop / runLoopMode + */ + CFRunLoopAddSource(runLoop, connectionPrivate->rls, runLoopMode); + } + + _SC_schedule(connection, runLoop, runLoopMode, connectionPrivate->rlList); + } return TRUE; + +#if !TARGET_OS_IPHONE + fail : + + if (connectionPrivate->callbackSource != NULL) { + dispatch_cancel(connectionPrivate->callbackSource); + dispatch_release(connectionPrivate->callbackSource); + connectionPrivate->callbackSource = NULL; + } + if (connectionPrivate->callbackQueue != NULL) { + dispatch_release(connectionPrivate->callbackQueue); + connectionPrivate->callbackQueue = NULL; + } + if (connectionPrivate->dispatchQueue != NULL) { + dispatch_release(connectionPrivate->dispatchQueue); + connectionPrivate->dispatchQueue = NULL; + } + _SCErrorSet(kSCStatusFailed); + return FALSE; +#endif // !TARGET_OS_IPHONE } -Boolean -SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef connection, - CFRunLoopRef runLoop, - CFStringRef runLoopMode) +static Boolean +__SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef connection, + CFRunLoopRef runLoop, + CFStringRef runLoopMode, +#if !TARGET_OS_IPHONE + dispatch_queue_t queue +#else // !TARGET_OS_IPHONE + void *queue +#endif // !TARGET_OS_IPHONE + ) { SCNetworkConnectionPrivateRef connectionPrivate = (SCNetworkConnectionPrivateRef)connection; int error = kSCStatusFailed; + CFIndex n = 0; mach_port_t session_port; kern_return_t status; - if (!isA_SCNetworkConnection(connection) || runLoop == NULL || runLoopMode == NULL) { + if ((runLoop != NULL) && !connectionPrivate->scheduled) { // if we should be scheduled (but are not) _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } - if ((connectionPrivate->rlList == NULL) || - !_SC_unschedule(connectionPrivate, runLoop, runLoopMode, connectionPrivate->rlList, FALSE)) { - /* if not currently scheduled */ - _SCErrorSet(kSCStatusFailed); +#if !TARGET_OS_IPHONE + if (((runLoop == NULL) && (connectionPrivate->dispatchQueue == NULL)) || // if we should be scheduled on a dispatch queue (but are not) + ((runLoop != NULL) && (connectionPrivate->dispatchQueue != NULL))) { // if we should be scheduled on a CFRunLoop (but are scheduled on a dispatch queue) + _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } +#endif // !TARGET_OS_IPHONE session_port = __SCNetworkConnectionSessionPort(connectionPrivate); if (session_port == MACH_PORT_NULL) { @@ -1079,13 +1211,46 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef connection, return FALSE; } - CFRunLoopRemoveSource(runLoop, connectionPrivate->rls, runLoopMode); +#if !TARGET_OS_IPHONE + if (runLoop == NULL) { + dispatch_cancel(connectionPrivate->callbackSource); + dispatch_release(connectionPrivate->callbackSource); + connectionPrivate->callbackSource = NULL; + dispatch_release(connectionPrivate->callbackQueue); + connectionPrivate->callbackQueue = NULL; + dispatch_release(connectionPrivate->dispatchQueue); + connectionPrivate->dispatchQueue = NULL; + } else +#endif // !TARGET_OS_IPHONE + { + if (!_SC_unschedule(connection, runLoop, runLoopMode, connectionPrivate->rlList, FALSE)) { + // if not currently scheduled on this runLoop / runLoopMode + _SCErrorSet(kSCStatusFailed); + return FALSE; + } - if (CFArrayGetCount(connectionPrivate->rlList) == 0) { - CFRelease(connectionPrivate->rls); - connectionPrivate->rls = NULL; - CFRelease(connectionPrivate->rlList); - connectionPrivate->rlList = NULL; + n = CFArrayGetCount(connectionPrivate->rlList); + if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, connectionPrivate->rlList)) { + /* + * if we are no longer scheduled to receive notifications for + * this runLoop / runLoopMode + */ + CFRunLoopRemoveSource(runLoop, connectionPrivate->rls, runLoopMode); + + if (n == 0) { + // if *all* notifications have been unscheduled + CFRelease(connectionPrivate->rlList); + connectionPrivate->rlList = NULL; + CFRunLoopSourceInvalidate(connectionPrivate->rls); + CFRelease(connectionPrivate->rls); + connectionPrivate->rls = NULL; + } + } + } + + if (n == 0) { + // if *all* notifications have been unscheduled + connectionPrivate->scheduled = FALSE; status = pppcontroller_notification(session_port, 0, &error); if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) { @@ -1098,6 +1263,57 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef connection, } +Boolean +SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef connection, + CFRunLoopRef runLoop, + CFStringRef runLoopMode) +{ + if (!isA_SCNetworkConnection(connection) || (runLoop == NULL) || (runLoopMode == NULL)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + return __SCNetworkConnectionScheduleWithRunLoop(connection, runLoop, runLoopMode, NULL); +} + + +Boolean +SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef connection, + CFRunLoopRef runLoop, + CFStringRef runLoopMode) +{ + if (!isA_SCNetworkConnection(connection) || (runLoop == NULL) || (runLoopMode == NULL)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + return __SCNetworkConnectionUnscheduleFromRunLoop(connection, runLoop, runLoopMode, NULL); +} + + +#if !TARGET_OS_IPHONE +Boolean +SCNetworkConnectionSetDispatchQueue(SCNetworkConnectionRef connection, + dispatch_queue_t queue) +{ + Boolean ok = FALSE; + + if (!isA_SCNetworkConnection(connection)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + if (queue != NULL) { + ok = __SCNetworkConnectionScheduleWithRunLoop(connection, NULL, NULL, queue); + } else { + ok = __SCNetworkConnectionUnscheduleFromRunLoop(connection, NULL, NULL, NULL); + } + + return ok; +} +#endif // !TARGET_OS_IPHONE + + #pragma mark - #pragma mark User level "dial" API @@ -1118,9 +1334,12 @@ static Boolean SCNetworkConnectionPrivateCopyDefaultUserOptionsFromArray(CFArray static Boolean SCNetworkConnectionPrivateIsPPPService (SCDynamicStoreRef session, CFStringRef serviceID, CFStringRef subType1, CFStringRef subType2); static void addPasswordFromKeychain (SCDynamicStoreRef session, CFStringRef serviceID, CFDictionaryRef *userOptions); static CFStringRef copyPasswordFromKeychain (CFStringRef uniqueID); -static CFArrayRef copyKeychainEnumerator (CFStringRef uniqueIdentifier); -static int notify_userprefs_token = -1; +static int notify_userprefs_token = -1; + +static CFDictionaryRef onDemand_configuration = NULL; +static pthread_mutex_t onDemand_notify_lock = PTHREAD_MUTEX_INITIALIZER; +static int onDemand_notify_token = -1; /* * return TRUE if domain1 ends with domain2, and will check for trailing "." @@ -1168,46 +1387,316 @@ domainEndsWithDomain(CFStringRef domain1, CFStringRef domain2) return ret; } +/* VPN On Demand */ + +Boolean +__SCNetworkConnectionCopyOnDemandInfoWithName(SCDynamicStoreRef *storeP, + CFStringRef hostName, + Boolean onDemandRetry, + CFStringRef *connectionServiceID, + SCNetworkConnectionStatus *connectionStatus, + CFStringRef *vpnRemoteAddress) /* CFDictionaryRef *info */ +{ + int changed = 1; + CFDictionaryRef configuration; + Boolean ok = FALSE; + int status; + SCDynamicStoreRef store = *storeP; + CFArrayRef triggers; + uint64_t triggersCount = 0; + int triggersIndex; + + pthread_mutex_lock(&onDemand_notify_lock); + if (onDemand_notify_token == -1) { + status = notify_register_check(kSCNETWORKCONNECTION_ONDEMAND_NOTIFY_KEY, &onDemand_notify_token); + if (status != NOTIFY_STATUS_OK) { + SCLog(TRUE, LOG_ERR, CFSTR("notify_register_check() failed, status=%lu"), status); + onDemand_notify_token = -1; + } + } + if (onDemand_notify_token != -1) { + status = notify_check(onDemand_notify_token, &changed); + if (status != NOTIFY_STATUS_OK) { + SCLog(TRUE, LOG_ERR, CFSTR("notify_check() failed, status=%lu"), status); + (void)notify_cancel(onDemand_notify_token); + onDemand_notify_token = -1; + } + } + + if (changed && (onDemand_notify_token != -1)) { + status = notify_get_state(onDemand_notify_token, &triggersCount); + if (status != NOTIFY_STATUS_OK) { + SCLog(TRUE, LOG_ERR, CFSTR("notify_get_state() failed, status=%lu"), status); + (void)notify_cancel(onDemand_notify_token); + onDemand_notify_token = -1; + } + } + + if (changed) { + CFStringRef key; + + if (_sc_debug || (debug > 0)) { + SCLog(TRUE, LOG_INFO, + CFSTR("OnDemand information %s"), + (onDemand_configuration == NULL) ? "fetched" : "updated"); + } + + if (onDemand_configuration != NULL) { + CFRelease(onDemand_configuration); + onDemand_configuration = NULL; + } + + if (triggersCount > 0) { + if (store == NULL) { + store = SCDynamicStoreCreate(NULL, CFSTR("__SCNetworkConnectionCopyOnDemandInfoWithName"), NULL, NULL); + if (store == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionCopyOnDemandInfoWithName SCDynamicStoreCreate() failed")); + + // force retry on next check + if (onDemand_notify_token != -1) { + (void)notify_cancel(onDemand_notify_token); + onDemand_notify_token = -1; + } + pthread_mutex_unlock(&onDemand_notify_lock); + return FALSE; + } + *storeP = store; + } + + key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetOnDemand); + onDemand_configuration = SCDynamicStoreCopyValue(store, key); + CFRelease(key); + if ((onDemand_configuration != NULL) && !isA_CFDictionary(onDemand_configuration)) { + CFRelease(onDemand_configuration); + onDemand_configuration = NULL; + } + } + } + + configuration = (onDemand_configuration != NULL) ? CFRetain(onDemand_configuration) : NULL; + pthread_mutex_unlock(&onDemand_notify_lock); + + if (configuration == NULL) { + // if no "OnDemand" configurations + return FALSE; + } + + triggers = CFDictionaryGetValue(configuration, kSCNetworkConnectionOnDemandTriggers); + triggersCount = isA_CFArray(triggers) ? CFArrayGetCount(triggers) : 0; + for (triggersIndex = 0; triggersIndex < triggersCount; triggersIndex++) { + CFArrayRef domains; + int domainsCount; + int domainsIndex; + CFStringRef key; + CFDictionaryRef trigger; + + trigger = CFArrayGetValueAtIndex(triggers, triggersIndex); + if (!isA_CFDictionary(trigger)) { + // if not a valid "OnDemand" configuration + continue; + } + + /* + * If we haven't tried a resulution yet, we only want to check for a name + * match for domains that require to always connect. + */ + key = onDemandRetry ? kSCNetworkConnectionOnDemandMatchDomainsOnRetry + : kSCNetworkConnectionOnDemandMatchDomainsAlways; + domains = CFDictionaryGetValue(trigger, key); + domainsCount = isA_CFArray(domains) ? CFArrayGetCount(domains) : 0; + for (domainsIndex = 0; domainsIndex < domainsCount; domainsIndex++) { + CFStringRef domain; + + domain = CFArrayGetValueAtIndex(domains, domainsIndex); + if (!isA_CFString(domain)) { + // if not a valid match domain + continue; + } + + if (domainEndsWithDomain(hostName, domain)) { + CFArrayRef exceptions; + int exceptionsCount; + int exceptionsIndex; + CFNumberRef num; + SCNetworkConnectionStatus onDemandStatus = kSCNetworkConnectionDisconnected; + + // we have a matching domain, check against exception list + exceptions = CFDictionaryGetValue(trigger, kSCNetworkConnectionOnDemandMatchDomainsNever); + exceptionsCount = isA_CFArray(exceptions) ? CFArrayGetCount(exceptions) : 0; + for (exceptionsIndex = 0; exceptionsIndex < exceptionsCount; exceptionsIndex++) { + CFStringRef exception; + + exception = CFArrayGetValueAtIndex(exceptions, exceptionsIndex); + if (!isA_CFString(exception)) { + // if not a valid match exception + continue; + } + + if (domainEndsWithDomain(hostName, exception)) { + // found matching exception + if (_sc_debug || (debug > 0)) { + SCLog(TRUE, LOG_INFO, CFSTR("OnDemand match exception")); + } + goto done; + } + } + + // if we have a matching domain and there were no exceptions + // then we pass back the OnDemand info + + if (!CFDictionaryGetValueIfPresent(trigger, + kSCNetworkConnectionOnDemandStatus, + (const void **)&num) || + !isA_CFNumber(num) || + !CFNumberGetValue(num, kCFNumberSInt32Type, &onDemandStatus)) { + onDemandStatus = kSCNetworkConnectionDisconnected; + } + if (connectionStatus != NULL) { + *connectionStatus = onDemandStatus; + } + + if (connectionServiceID != NULL) { + *connectionServiceID = CFDictionaryGetValue(trigger, kSCNetworkConnectionOnDemandServiceID); + *connectionServiceID = isA_CFString(*connectionServiceID); + if (*connectionServiceID != NULL) { + CFRetain(*connectionServiceID); + } + + } + + if (vpnRemoteAddress != NULL) { + *vpnRemoteAddress = CFDictionaryGetValue(trigger, kSCNetworkConnectionOnDemandRemoteAddress); + *vpnRemoteAddress = isA_CFString(*vpnRemoteAddress); + if (*vpnRemoteAddress != NULL) { + CFRetain(*vpnRemoteAddress); + } + } + + if (_sc_debug || (debug > 0)) { + SCLog(TRUE, LOG_INFO, + CFSTR("OnDemand%s match, connection status = %d"), + onDemandRetry ? " (on retry)" : "", + onDemandStatus); + } + + ok = TRUE; + goto done; + } + } + } + +// if (_sc_debug || (debug > 0)) { +// SCLog(TRUE, LOG_INFO, CFSTR("OnDemand domain name(s) not matched")); +// } + + done : + + if (configuration != NULL) CFRelease(configuration); + return ok; +} + Boolean SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions, CFStringRef *serviceID, CFDictionaryRef *userOptions) { - int debug = 0; - char *envdebug; - int prefsChanged; - SCDynamicStoreRef session; + int prefsChanged = 1; + SCDynamicStoreRef session = NULL; Boolean success = FALSE; int status; - envdebug = getenv("PPPDebug"); - if (envdebug) { - if (sscanf(envdebug, "%d", &debug) != 1) - debug = 1; /* PPPDebug value is invalid, set debug to 1 */ + /* initialize runtime */ + pthread_once(&initialized, __SCNetworkConnectionInitialize); + + /* first check for new VPN OnDemand style */ + if (selectionOptions != NULL) { + CFStringRef hostName; + + hostName = CFDictionaryGetValue(selectionOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName); + if (isA_CFString(hostName)) { + CFStringRef connectionServiceID = NULL; + SCNetworkConnectionStatus connectionStatus; + Boolean onDemandRetry; + CFTypeRef val; + + val = CFDictionaryGetValue(selectionOptions, kSCNetworkConnectionSelectionOptionOnDemandRetry); + onDemandRetry = isA_CFBoolean(val) ? CFBooleanGetValue(val) : TRUE; + + success = __SCNetworkConnectionCopyOnDemandInfoWithName(&session, + hostName, + onDemandRetry, + &connectionServiceID, + &connectionStatus, + NULL); + if (debug > 1) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("SCNetworkConnectionCopyUserPreferences __SCNetworkConnectionCopyOnDemandInfoWithName returns %d w/status %d"), + success, + connectionStatus); + } + + if (success) { + // if the hostname matches an OnDemand domain + if (session != NULL) { + CFRelease(session); + } + if (connectionStatus == kSCNetworkConnectionConnected) { + // if we are already connected + if (connectionServiceID != NULL) { + CFRelease(connectionServiceID); + } + return FALSE; + } + + *serviceID = connectionServiceID; + *userOptions = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName, hostName); + return TRUE; + } else if (!onDemandRetry) { + // if the hostname does not match an OnDemand domain and we have + // not yet issued an initial DNS query (i.e. it's not a query + // being retried after the VPN has been established) than we're + // done + if (session != NULL) { + CFRelease(session); + } + return FALSE; + } + } } if (notify_userprefs_token == -1) { status = notify_register_check(k_NetworkConnect_Notification, ¬ify_userprefs_token); - if (status != NOTIFY_STATUS_OK) + if (status != NOTIFY_STATUS_OK) { + SCLog(TRUE, LOG_ERR, CFSTR("notify_register_check() failed, status=%lu"), status); + (void)notify_cancel(notify_userprefs_token); notify_userprefs_token = -1; - else - // clear the flag - notify_check(notify_userprefs_token, &prefsChanged); + } else { + // clear the "something has changed" state + (void) notify_check(notify_userprefs_token, &prefsChanged); + prefsChanged = 1; + } + } + if (notify_userprefs_token != -1) { + status = notify_check(notify_userprefs_token, &prefsChanged); + if (status != NOTIFY_STATUS_OK) { + SCLog(TRUE, LOG_ERR, CFSTR("notify_check() failed, status=%lu"), status); + (void)notify_cancel(notify_userprefs_token); + notify_userprefs_token = -1; + } } - - prefsChanged = 1; - if (notify_userprefs_token != -1) - notify_check(notify_userprefs_token, &prefsChanged); *serviceID = NULL; *userOptions = NULL; - session = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkConnection"), NULL, NULL); if (session == NULL) { - fprintf(stderr, "Error, SCNetworkConnectionCopyUserPreferences, SCDynamicStoreCreate() returned NULL!\n"); + session = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkConnection"), NULL, NULL); + } + if (session == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("Error, SCNetworkConnectionCopyUserPreferences, SCDynamicStoreCreate() returned NULL!")); return FALSE; } @@ -1222,13 +1711,13 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions, CFIndex serviceIndex; CFIndex servicesCount; - hostName = CFDictionaryGetValue(selectionOptions, kSCPropNetPPPOnDemandHostName); - if (!isA_CFString(hostName)) - hostName = NULL; - - // can't select anything + hostName = CFDictionaryGetValue(selectionOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName); + if (hostName == NULL) { + hostName = CFDictionaryGetValue(selectionOptions, kSCPropNetPPPOnDemandHostName); + } + hostName = isA_CFString(hostName); if (hostName == NULL) - goto done_selection; + goto done_selection; // if no hostname for matching priority = CFDictionaryGetValue(selectionOptions, kSCPropNetPPPOnDemandPriority); if (!isA_CFString(priority)) @@ -1278,22 +1767,22 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions, CFNumberGetValue(autodial, kCFNumberIntType, &val); if (val) { - CFArrayRef autoDomains; - CFIndex domainIndex; + CFArrayRef domains; CFIndex domainsCount; + CFIndex domainsIndex; /* we found an conditional connection enabled configuration */ /* check domain */ - autoDomains = CFDictionaryGetValue(pppConfig, kSCPropNetPPPOnDemandDomains); - if (!isA_CFArray(autoDomains)) + domains = CFDictionaryGetValue(pppConfig, kSCPropNetPPPOnDemandDomains); + if (!isA_CFArray(domains)) continue; - domainsCount = CFArrayGetCount(autoDomains); - for (domainIndex = 0; domainIndex < domainsCount; domainIndex++) { + domainsCount = CFArrayGetCount(domains); + for (domainsIndex = 0; domainsIndex < domainsCount; domainsIndex++) { CFStringRef domain; - domain = CFArrayGetValueAtIndex(autoDomains, domainIndex); + domain = CFArrayGetValueAtIndex(domains, domainsIndex); if (!isA_CFString(domain)) continue; @@ -1311,7 +1800,7 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions, *serviceID = serviceName; CFRetain(*serviceID); *userOptions = CFDictionaryCreateMutableCopy(NULL, 0, config); - CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandHostName, hostName); + CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName, hostName); CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandPriority, priority); addPasswordFromKeychain(session, *serviceID, userOptions); success = TRUE; @@ -1335,7 +1824,7 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions, *serviceID = serviceName; CFRetain(*serviceID); *userOptions = CFDictionaryCreateMutableCopy(NULL, 0, config); - CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandHostName, hostName); + CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName, hostName); CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandPriority, priority); addPasswordFromKeychain(session, *serviceID, userOptions); success = TRUE; @@ -1378,7 +1867,7 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions, addPasswordFromKeychain(session, *serviceID, userOptions); } } else { - fprintf(stderr, "Error, userServices are not of type CFArray!\n"); + SCLog(TRUE, LOG_DEBUG, CFSTR("Error, userServices are not of type CFArray!")); } CFRelease(userServices); // this is OK because SCNetworkConnectionPrivateISExpectedCFType() checks for NULL @@ -1398,8 +1887,9 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions, // SCNetworkConnectionPrivateCopyDefaultServiceIDForDial // ---------------------------------------------------- // Try to find the service id to connect -// (1) Start by looking at the last service used in Internet Connect -// (2) If Internet Connect has not been used, find the PPP service with the highest ordering +// (1) Start by looking at the last service used in Network Pref / Network menu extra +// (2) If Network Pref / Network menu extra has not been used, find the PPP service +// with the highest ordering //******************************************************************************************** static Boolean SCNetworkConnectionPrivateCopyDefaultServiceIDForDial(SCDynamicStoreRef session, CFStringRef *serviceID) @@ -1671,48 +2161,7 @@ addPasswordFromKeychain(SCDynamicStoreRef session, CFStringRef serviceID, CFDict } -//******************************************************************************** -// copyPasswordFromKeychain -// -------------------------------------- -// Given a uniqueID, retrieve the password from the keychain -//******************************************************************************** -static CFStringRef -copyPasswordFromKeychain(CFStringRef uniqueID) -{ - CFArrayRef enumerator; - CFIndex n; - CFStringRef password = NULL; - - enumerator = copyKeychainEnumerator(uniqueID); - if (enumerator == NULL) { - return NULL; // if no keychain enumerator - } - - n = CFArrayGetCount(enumerator); - if (n > 0) { - void *data = NULL; - UInt32 dataLen = 0; - SecKeychainItemRef itemRef; - OSStatus result; - - itemRef = (SecKeychainItemRef)CFArrayGetValueAtIndex(enumerator, 0); - result = SecKeychainItemCopyContent(itemRef, // itemRef - NULL, // itemClass - NULL, // attrList - &dataLen, // length - (void *)&data); // outData - if ((result == noErr) && (data != NULL) && (dataLen > 0)) { - password = CFStringCreateWithBytes(NULL, data, dataLen, kCFStringEncodingUTF8, TRUE); - (void) SecKeychainItemFreeContent(NULL, data); - } - - } - - CFRelease(enumerator); - - return password; -} - +#if !TARGET_OS_IPHONE //******************************************************************************** // copyKeychainEnumerator // -------------------------------------- @@ -1762,3 +2211,50 @@ copyKeychainEnumerator(CFStringRef uniqueIdentifier) return itemArray; } +#endif // !TARGET_OS_IPHONE + +//******************************************************************************** +// copyPasswordFromKeychain +// -------------------------------------- +// Given a uniqueID, retrieve the password from the keychain +//******************************************************************************** +static CFStringRef +copyPasswordFromKeychain(CFStringRef uniqueID) +{ +#if !TARGET_OS_IPHONE + CFArrayRef enumerator; + CFIndex n; + CFStringRef password = NULL; + + enumerator = copyKeychainEnumerator(uniqueID); + if (enumerator == NULL) { + return NULL; // if no keychain enumerator + } + + n = CFArrayGetCount(enumerator); + if (n > 0) { + void *data = NULL; + UInt32 dataLen = 0; + SecKeychainItemRef itemRef; + OSStatus result; + + itemRef = (SecKeychainItemRef)CFArrayGetValueAtIndex(enumerator, 0); + result = SecKeychainItemCopyContent(itemRef, // itemRef + NULL, // itemClass + NULL, // attrList + &dataLen, // length + (void *)&data); // outData + if ((result == noErr) && (data != NULL) && (dataLen > 0)) { + password = CFStringCreateWithBytes(NULL, data, dataLen, kCFStringEncodingUTF8, TRUE); + (void) SecKeychainItemFreeContent(NULL, data); + } + + } + + CFRelease(enumerator); + + return password; +#else // !TARGET_OS_IPHONE + return NULL; +#endif // !TARGET_OS_IPHONE +} diff --git a/SystemConfiguration.fproj/SCNetworkConnection.h b/SystemConfiguration.fproj/SCNetworkConnection.h index 6109190..7282b87 100644 --- a/SystemConfiguration.fproj/SCNetworkConnection.h +++ b/SystemConfiguration.fproj/SCNetworkConnection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2003-2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,16 +22,22 @@ */ #ifndef _SCNETWORKCONNECTION_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCNETWORKCONNECTION_H -#include +#include +#include #include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE #include #include #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 /*! @header SCNetworkConnection @@ -202,6 +208,29 @@ typedef void (*SCNetworkConnectionCallBack) ( #define kSCNetworkConnectionErrorsOut CFSTR("ErrorsOut") /* CFNumber */ +/* + Keys for the SCNetworkConnectionCopyUserPreferences() "selectionOptions" + dictionary + */ + +/*! + @define kSCNetworkConnectionSelectionOptionOnDemandHostName + @discussion A host name that will be used to select the + "best" SCNetworkConnection. + */ +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) || TARGET_IPHONE_SIMULATOR +#define kSCNetworkConnectionSelectionOptionOnDemandHostName CFSTR("OnDemandHostName") /* CFString */ +#endif + +/*! + @define kSCNetworkConnectionSelectionOptionOnDemandRetry + @discussion A boolean value used to indicate whether a DNS query has + already been issued for the specified OnDemand host name. + */ +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) || TARGET_IPHONE_SIMULATOR +#define kSCNetworkConnectionSelectionOptionOnDemandRetry CFSTR("OnDemandRetry") /* CFBoolean */ +#endif + __BEGIN_DECLS /*! @@ -210,7 +239,8 @@ __BEGIN_DECLS instances. */ CF_EXPORT -CFTypeID SCNetworkConnectionGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; +CFTypeID +SCNetworkConnectionGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -228,11 +258,12 @@ CFTypeID SCNetworkConnectionGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_3_ @result Returns TRUE if there is a valid service to dial; FALSE if the function was unable to retrieve a service to dial. */ -Boolean SCNetworkConnectionCopyUserPreferences ( +Boolean +SCNetworkConnectionCopyUserPreferences ( CFDictionaryRef selectionOptions, CFStringRef *serviceID, CFDictionaryRef *userOptions - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -262,7 +293,7 @@ SCNetworkConnectionCreateWithServiceID ( CFStringRef serviceID, SCNetworkConnectionCallBack callout, SCNetworkConnectionContext *context - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -274,7 +305,7 @@ SCNetworkConnectionCreateWithServiceID ( CFStringRef SCNetworkConnectionCopyServiceID ( SCNetworkConnectionRef connection - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -297,7 +328,7 @@ SCNetworkConnectionCopyServiceID ( SCNetworkConnectionStatus SCNetworkConnectionGetStatus ( SCNetworkConnectionRef connection - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -325,6 +356,13 @@ SCNetworkConnectionGetStatus ( Modem : ConnectSpeed : the speed of the modem connection in bits/second. + + IPSec : Status : the IPSec-specific status of type + SCNetworkConnectionIPSecStatus + + ConnectTime : the time when the connection was + established. + @/textblock Other dictionaries could be present for PPPoE, PPTP, and L2TP. @@ -338,7 +376,7 @@ SCNetworkConnectionGetStatus ( CFDictionaryRef SCNetworkConnectionCopyExtendedStatus ( SCNetworkConnectionRef connection - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -380,7 +418,7 @@ SCNetworkConnectionCopyExtendedStatus ( CFDictionaryRef SCNetworkConnectionCopyStatistics ( SCNetworkConnectionRef connection - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -432,7 +470,7 @@ SCNetworkConnectionStart ( SCNetworkConnectionRef connection, CFDictionaryRef userOptions, Boolean linger - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -458,7 +496,7 @@ Boolean SCNetworkConnectionStop ( SCNetworkConnectionRef connection, Boolean forceDisconnect - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -474,7 +512,7 @@ SCNetworkConnectionStop ( CFDictionaryRef SCNetworkConnectionCopyUserOptions ( SCNetworkConnectionRef connection - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -492,7 +530,7 @@ SCNetworkConnectionScheduleWithRunLoop ( SCNetworkConnectionRef connection, CFRunLoopRef runLoop, CFStringRef runLoopMode - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); /*! @@ -510,10 +548,28 @@ SCNetworkConnectionUnscheduleFromRunLoop ( SCNetworkConnectionRef connection, CFRunLoopRef runLoop, CFStringRef runLoopMode - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/); -__END_DECLS -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ +#if !TARGET_OS_IPHONE +/*! + @function SCNetworkConnectionSetDispatchQueue + @discussion Caller provides a dispatch queue on which the callback contained in connection will run. + @param connection The SCNetworkConnection to notify. + @param queue The libdispatch queue to run the callback on. + Pass NULL to disable notifications, and release queue. + @result Returns TRUE if the notifications have been enabled/disabled as desired; + FALSE if not. + The error can be retrieved using the SCError function. + */ +Boolean +SCNetworkConnectionSetDispatchQueue ( + SCNetworkConnectionRef connection, + dispatch_queue_t queue + ) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA); +#endif // !TARGET_OS_IPHONE + +__END_DECLS +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #endif /* _SCNETWORKCONNECTION_H */ diff --git a/SystemConfiguration.fproj/SCNetworkConnectionPrivate.c b/SystemConfiguration.fproj/SCNetworkConnectionPrivate.c index 56c444f..3d2a7f0 100644 --- a/SystemConfiguration.fproj/SCNetworkConnectionPrivate.c +++ b/SystemConfiguration.fproj/SCNetworkConnectionPrivate.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2006-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -28,7 +28,6 @@ #include "SCNetworkConfigurationInternal.h" #include #include -#include #pragma mark - @@ -183,6 +182,133 @@ isA_SCUserPreferences(CFTypeRef obj) #define USER_PREFERENCES_DEFAULT CFSTR("ConnectByDefault") +#define LOG_CFPREFERENCES_CHANGES +#ifdef LOG_CFPREFERENCES_CHANGES +#include +#include +#include +#include +static void +logCFPreferencesChange(CFStringRef serviceID, CFArrayRef newPreferences) +{ + CFBooleanRef bVal; + char dir[256]; + CFArrayRef oldPreferences; + CFStringRef str; + CFStringRef trace; + struct tm tm_now; + struct timeval tv_now; + + bVal = CFPreferencesCopyAppValue(CFSTR("LOG_SC_CHANGES"), USER_PREFERENCES_APPLICATION_ID); + if (bVal != NULL) { + if (!isA_CFBoolean(bVal) || !CFBooleanGetValue(bVal)) { + // if debugging not enabled + CFRelease(bVal); + return; + } + } else { + // if debugging not enabled + return; + } + + (void)gettimeofday(&tv_now, NULL); + (void)localtime_r(&tv_now.tv_sec, &tm_now); + + str = CFStringCreateWithFormat(NULL, NULL, + CFSTR("/var/tmp/com.apple.networkConnect-%@-%4d%02d%02d.%02d%02d%02d.%03d"), + serviceID, + tm_now.tm_year + 1900, + tm_now.tm_mon + 1, + tm_now.tm_mday, + tm_now.tm_hour, + tm_now.tm_min, + tm_now.tm_sec, + tv_now.tv_usec / 1000); + _SC_cfstring_to_cstring(str, dir, sizeof(dir), kCFStringEncodingUTF8); + CFRelease(str); + + SCLog(TRUE, LOG_ERR, CFSTR("CFPreferences being updated, old/new in \"%s\""), dir); + + if (mkdir(dir, 0755) == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange mkdir() failed, error = %s"), SCErrorString(errno)); + return; + } + + trace = _SC_copyBacktrace(); + if (trace != NULL) { + FILE *f; + int fd; + char path[256]; + + strlcpy(path, dir, sizeof(path)); + strlcat(path, "/backtrace", sizeof(path)); + fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644); + if (fd == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange fopen() failed, error = %s"), SCErrorString(errno)); + CFRelease(trace); + return; + } + f = fdopen(fd, "w"); + SCPrint(TRUE, f, CFSTR("%@"), trace); + (void) fclose(f); + CFRelease(trace); + } + + oldPreferences = CFPreferencesCopyAppValue(serviceID, USER_PREFERENCES_APPLICATION_ID); + if (oldPreferences != NULL) { + int fd; + CFDataRef data; + char path[256]; + + strlcpy(path, dir, sizeof(path)); + strlcat(path, "/old", sizeof(path)); + fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644); + if (fd == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange fopen() failed, error = %s"), SCErrorString(errno)); + CFRelease(oldPreferences); + return; + } + data = CFPropertyListCreateXMLData(NULL, oldPreferences); + if (data == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange CFPropertyListCreateXMLData() failed")); + close(fd); + CFRelease(oldPreferences); + return; + } + (void) write(fd, CFDataGetBytePtr(data), CFDataGetLength(data)); + (void) close(fd); + CFRelease(data); + CFRelease(oldPreferences); + } + + if (newPreferences != NULL) { + int fd; + CFDataRef data; + char path[256]; + + strlcpy(path, dir, sizeof(path)); + strlcat(path, "/new", sizeof(path)); + fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644); + if (fd == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange fopen() failed, error = %s"), SCErrorString(errno)); + return; + } + data = CFPropertyListCreateXMLData(NULL, newPreferences); + if (data == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange CFPropertyListCreateXMLData() failed")); + close(fd); + return; + } + (void) write(fd, CFDataGetBytePtr(data), CFDataGetLength(data)); + (void) close(fd); + CFRelease(data); + } + + return; +} +#endif // LOG_CFPREFERENCES_CHANGES + + static CFArrayRef copyCFPreferencesForServiceID(CFStringRef serviceID) { @@ -211,6 +337,10 @@ setCFPreferencesForServiceID(CFStringRef serviceID, CFArrayRef newPreferences) return FALSE; } +#ifdef LOG_CFPREFERENCES_CHANGES + logCFPreferencesChange(serviceID, newPreferences); +#endif // LOG_CFPREFERENCES_CHANGES + CFPreferencesSetValue(serviceID, newPreferences, USER_PREFERENCES_APPLICATION_ID, @@ -1013,17 +1143,6 @@ SCNetworkConnectionCreateUserPreferences(SCNetworkConnectionRef connection) } -#ifdef NOTNOW -Boolean -SCNetworkConnectionSelectService(CFDictionaryRef selectionOptions, - SCNetworkServiceRef *service, - SCUserPreferencesRef *userPreferences) -{ - return FALSE; -} -#endif // NOTNOW - - static void update_PPP_entity(SCUserPreferencesRef userPreferences, CFDictionaryRef *userOptions) { @@ -1321,6 +1440,36 @@ copyUserSharedSecretID(CFDictionaryRef config, SCUserPreferencesRef userPreferen } +static CFStringRef +copyUserXAuthID(CFDictionaryRef config, SCUserPreferencesRef userPreferences) +{ + CFMutableStringRef xauth_id = NULL; + + if (config != NULL) { + CFStringRef encryption; + + encryption = CFDictionaryGetValue(config, kSCPropNetIPSecXAuthPasswordEncryption); + if (isA_CFString(encryption) && + CFEqual(encryption, kSCValNetIPSecXAuthPasswordEncryptionKeychain)) { + xauth_id = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecXAuthPassword); + if (xauth_id != NULL) { + CFRetain(xauth_id); + } + } + } + + if (xauth_id == NULL) { + CFStringRef unique_id; + + unique_id = getUserPasswordID(config, userPreferences); + xauth_id = CFStringCreateMutableCopy(NULL, 0, unique_id); + CFStringAppend(xauth_id, CFSTR(".XAUTH")); + } + + return xauth_id; +} + + static Boolean checkUserPreferencesPassword(SCUserPreferencesRef userPreferences, SCNetworkInterfaceRef interface, @@ -1376,6 +1525,17 @@ checkUserPreferencesPassword(SCUserPreferencesRef userPreferences, return FALSE; } + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFStringRef interfaceType; + + interfaceType = SCNetworkInterfaceGetInterfaceType(interface); + if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + break; + } + default : break; } @@ -1441,7 +1601,31 @@ SCUserPreferencesCheckInterfacePassword(SCUserPreferencesRef userPreferences, NULL); if (config != NULL) CFRelease(config); - CFRelease(shared_id); + CFRelease(shared_id); + break; + } + + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFDictionaryRef config; + CFStringRef xauth_id; + + // get configuration + config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface); + + // get XAuth ID + xauth_id = copyUserXAuthID(config, userPreferences); + + // check + exists = __extract_password(NULL, + config, + kSCPropNetIPSecXAuthPassword, + kSCPropNetIPSecXAuthPasswordEncryption, + kSCValNetIPSecXAuthPasswordEncryptionKeychain, + xauth_id, + NULL); + + if (config != NULL) CFRelease(config); + CFRelease(xauth_id); break; } @@ -1511,7 +1695,31 @@ SCUserPreferencesCopyInterfacePassword(SCUserPreferencesRef userPreferences, &password); if (config != NULL) CFRelease(config); - CFRelease(shared_id); + CFRelease(shared_id); + break; + } + + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFDictionaryRef config; + CFStringRef xauth_id; + + // get configuration + config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface); + + // get XAuth ID + xauth_id = copyUserXAuthID(config, userPreferences); + + // extract + (void) __extract_password(NULL, + config, + kSCPropNetIPSecXAuthPassword, + kSCPropNetIPSecXAuthPasswordEncryption, + kSCValNetIPSecXAuthPasswordEncryptionKeychain, + xauth_id, + &password); + + if (config != NULL) CFRelease(config); + CFRelease(xauth_id); break; } @@ -1538,6 +1746,7 @@ SCUserPreferencesRemoveInterfacePassword(SCUserPreferencesRef userPreferences, switch (passwordType) { case kSCNetworkInterfacePasswordTypePPP : { CFDictionaryRef config; + CFDictionaryRef newConfig = NULL; CFStringRef unique_id; // get configuration @@ -1547,25 +1756,25 @@ SCUserPreferencesRemoveInterfacePassword(SCUserPreferencesRef userPreferences, unique_id = getUserPasswordID(config, userPreferences); // remove password - ok = _SCSecKeychainPasswordItemRemove(NULL, unique_id); + ok = __remove_password(NULL, + config, + kSCPropNetPPPAuthPassword, + kSCPropNetPPPAuthPasswordEncryption, + kSCValNetPPPAuthPasswordEncryptionKeychain, + unique_id, + &newConfig); if (ok) { - CFDictionaryRef config; - CFMutableDictionaryRef newConfig; - - config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface); - if (config != NULL) { - newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config); - CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPassword); - CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPasswordEncryption); - ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig); - CFRelease(newConfig); - } + ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig); + if (newConfig != NULL) CFRelease(newConfig); } + + if (config != NULL) CFRelease(config); break; } case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : { CFDictionaryRef config; + CFDictionaryRef newConfig = NULL; CFStringRef shared_id; // get configuration @@ -1577,27 +1786,55 @@ SCUserPreferencesRemoveInterfacePassword(SCUserPreferencesRef userPreferences, shared_id = copyUserSharedSecretID(config, userPreferences); // remove password - ok = _SCSecKeychainPasswordItemRemove(NULL, shared_id); + ok = __remove_password(NULL, + config, + kSCPropNetIPSecSharedSecret, + kSCPropNetIPSecSharedSecretEncryption, + kSCValNetIPSecSharedSecretEncryptionKeychain, + shared_id, + &newConfig); if (ok) { - CFMutableDictionaryRef newConfig; - - if (config != NULL) { - newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config); - CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecret); - CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecretEncryption); - ok = SCUserPreferencesSetExtendedInterfaceConfiguration(userPreferences, - interface, - kSCEntNetIPSec, - newConfig); - CFRelease(newConfig); - } + ok = SCUserPreferencesSetExtendedInterfaceConfiguration(userPreferences, + interface, + kSCEntNetIPSec, + newConfig); + if (newConfig != NULL) CFRelease(newConfig); } - if (config != NULL) CFRelease(config); + if (config != NULL) CFRelease(config); CFRelease(shared_id); break; } + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFDictionaryRef config; + CFDictionaryRef newConfig = NULL; + CFStringRef xauth_id; + + // get configuration + config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface); + + // get XAuth ID + xauth_id = copyUserXAuthID(config, userPreferences); + + // remove password + ok = __remove_password(NULL, + config, + kSCPropNetIPSecXAuthPassword, + kSCPropNetIPSecXAuthPasswordEncryption, + kSCValNetIPSecXAuthPasswordEncryptionKeychain, + xauth_id, + &newConfig); + if (ok) { + ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig); + if (newConfig != NULL) CFRelease(newConfig); + } + + if (config != NULL) CFRelease(config); + CFRelease(xauth_id); + break; + } + default : _SCErrorSet(kSCStatusInvalidArgument); return FALSE; @@ -1648,7 +1885,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef userPreferences, // "PPP Password" --> keychain "Kind" if (bundle != NULL) { description = CFBundleCopyLocalizedString(bundle, - CFSTR("KEYCHAIN_PPP_PASSWORD"), + CFSTR("KEYCHAIN_KIND_PPP_PASSWORD"), CFSTR("PPP Password"), NULL); } @@ -1656,7 +1893,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef userPreferences, // store password ok = _SCSecKeychainPasswordItemSet(NULL, unique_id, - (label != NULL) ? label : CFSTR("PPP"), + (label != NULL) ? label : CFSTR("Network Connection"), (description != NULL) ? description : CFSTR("PPP Password"), account, password, @@ -1705,7 +1942,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef userPreferences, // "IPSec Shared Secret" --> keychain "Kind" if (bundle != NULL) { description = CFBundleCopyLocalizedString(bundle, - CFSTR("KEYCHAIN_IPSEC_SHARED_SECRET"), + CFSTR("KEYCHAIN_KIND_IPSEC_SHARED_SECRET"), CFSTR("IPSec Shared Secret"), NULL); } @@ -1713,7 +1950,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef userPreferences, // set password ok = _SCSecKeychainPasswordItemSet(NULL, shared_id, - (label != NULL) ? label : CFSTR("PPP"), + (label != NULL) ? label : CFSTR("VPN Connection"), (description != NULL) ? description : CFSTR("IPSec Shared Secret"), NULL, password, @@ -1749,6 +1986,67 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef userPreferences, break; } + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFStringRef xauth_id; + + // get configuration + config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface); + + // get XAuth ID + xauth_id = copyUserXAuthID(config, userPreferences); + + // User prefs XAuth name --> keychain "Account" + if (config != NULL) { + account = CFDictionaryGetValue(config, kSCPropNetIPSecXAuthName); + } + + // User prefs "name" --> keychain "Name" + label = SCUserPreferencesCopyName(userPreferences); + + // "IPSec XAuth Password" --> keychain "Kind" + if (bundle != NULL) { + description = CFBundleCopyLocalizedString(bundle, + CFSTR("KEYCHAIN_KIND_IPSEC_XAUTH_PASSWORD"), + CFSTR("IPSec XAuth Password"), + NULL); + } + + // store password + ok = _SCSecKeychainPasswordItemSet(NULL, + xauth_id, + (label != NULL) ? label : CFSTR("VPN Connection"), + (description != NULL) ? description : CFSTR("IPSec XAuth Password"), + account, + password, + options); + if (ok) { + CFMutableDictionaryRef newConfig; + + if (config != NULL) { + newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config); + } else { + newConfig = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } + CFDictionarySetValue(newConfig, + kSCPropNetIPSecXAuthPassword, + xauth_id); + CFDictionarySetValue(newConfig, + kSCPropNetIPSecXAuthPasswordEncryption, + kSCValNetIPSecXAuthPasswordEncryptionKeychain); + ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig); + CFRelease(newConfig); + } + + if (config != NULL) CFRelease(config); + if (description != NULL) CFRelease(description); + if (label != NULL) CFRelease(label); + CFRelease(xauth_id); + break; + } + default : _SCErrorSet(kSCStatusInvalidArgument); return FALSE; diff --git a/SystemConfiguration.fproj/SCNetworkConnectionPrivate.h b/SystemConfiguration.fproj/SCNetworkConnectionPrivate.h index 0618c99..fe17873 100644 --- a/SystemConfiguration.fproj/SCNetworkConnectionPrivate.h +++ b/SystemConfiguration.fproj/SCNetworkConnectionPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,14 +24,12 @@ #ifndef _SCNETWORKCONNECTIONPRIVATE_H #define _SCNETWORKCONNECTIONPRIVATE_H -#include +#include #include #include #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - typedef const struct __SCUserPreferencesRef * SCUserPreferencesRef; @@ -44,25 +42,103 @@ __BEGIN_DECLS CFArrayRef /* of SCNetworkServiceRef's */ -SCNetworkConnectionCopyAvailableServices (SCNetworkSetRef set) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCNetworkConnectionCopyAvailableServices (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); SCNetworkConnectionRef SCNetworkConnectionCreateWithService (CFAllocatorRef allocator, SCNetworkServiceRef service, SCNetworkConnectionCallBack callout, - SCNetworkConnectionContext *context) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkConnectionContext *context) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); SCNetworkServiceRef -SCNetworkConnectionGetService (SCNetworkConnectionRef connection) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCNetworkConnectionGetService (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFArrayRef /* of SCUserPreferencesRef's */ -SCNetworkConnectionCopyAllUserPreferences (SCNetworkConnectionRef connection) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCNetworkConnectionCopyAllUserPreferences (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); SCUserPreferencesRef -SCNetworkConnectionCopyCurrentUserPreferences (SCNetworkConnectionRef connection) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCNetworkConnectionCopyCurrentUserPreferences (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); SCUserPreferencesRef -SCNetworkConnectionCreateUserPreferences (SCNetworkConnectionRef connection) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCNetworkConnectionCreateUserPreferences (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); + + +#pragma mark - +#pragma mark SCNetworkConnection "VPN on Demand" SPIs + + +/* VPN On Demand + * + * in the SCDynamicStore we will have : + * + * State:/Network/Global/OnDemand + * + * Triggers + * + * + * ServiceID + * A740678C-1983-492B-BF64-B825AAE7101E + * Status + * 8 + * RemoteAddress + * vpn.mycompany.com + * OnDemandMatchDomainsAlways + * + * internal.mycompany.com + * + * OnDemandMatchDomainsOnRetry + * + * mycompany.com + * + * kSCNetworkConnectionOnDemandMatchDomainsNever + * + * external.mycompany.com + * + * + * + * + */ + +// notify(3) key +#define kSCNETWORKCONNECTION_ONDEMAND_NOTIFY_KEY "com.apple.system.SCNetworkConnectionOnDemand" + +// a CFArray[CFDictionary] of VPN on Demand "trigger" configurations +#define kSCNetworkConnectionOnDemandTriggers CFSTR("Triggers") + +// VPN service ID +#define kSCNetworkConnectionOnDemandServiceID CFSTR("ServiceID") + +// VPN service status (idle, connecting, connected, disconnecting) +#define kSCNetworkConnectionOnDemandStatus CFSTR("Status") + +// VPN server address +#define kSCNetworkConnectionOnDemandRemoteAddress CFSTR("RemoteAddress") + +// a CFArray[CFString] representing those domain (or host) names that, if +// matched to a target hostname, should result in our first establishing +// the VPN connection before any DNS queries are issued. +#define kSCNetworkConnectionOnDemandMatchDomainsAlways CFSTR("OnDemandMatchDomainsAlways") + +// a CFArray[CFString] representing those domain (or host) names that, if +// matched to a target hostname, should result in a DNS query regardless of +// whether the VPN connection has been established. If the DNS query returns +// an [EAI_NONAME] error then we should establish the VPN connection and +// re-issue / retry the query. +#define kSCNetworkConnectionOnDemandMatchDomainsOnRetry CFSTR("OnDemandMatchDomainsOnRetry") + +// a CFArray[CFString] representing those domain (or host) names that should +// be excluded from those that would be used to establish tje VPN connection. +#define kSCNetworkConnectionOnDemandMatchDomainsNever CFSTR("OnDemandMatchDomainsNever") + + +__private_extern__ +Boolean +__SCNetworkConnectionCopyOnDemandInfoWithName (SCDynamicStoreRef *storeP, + CFStringRef nodeName, + Boolean onDemandRetry, + CFStringRef *connectionServiceID, + SCNetworkConnectionStatus *connectionStatus, + CFStringRef *vpnRemoteAddress) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0); #pragma mark - @@ -70,58 +146,53 @@ SCNetworkConnectionCreateUserPreferences (SCNetworkConnectionRef connection) A Boolean -SCUserPreferencesRemove (SCUserPreferencesRef userPreferences) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCUserPreferencesRemove (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean -SCUserPreferencesSetCurrent (SCUserPreferencesRef userPreferences) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCUserPreferencesSetCurrent (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFStringRef -SCUserPreferencesCopyName (SCUserPreferencesRef userPreferences) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCUserPreferencesCopyName (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFTypeID -SCUserPreferencesGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCUserPreferencesGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFStringRef -SCUserPreferencesGetUniqueID (SCUserPreferencesRef userPreferences) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCUserPreferencesGetUniqueID (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean -SCUserPreferencesIsForced (SCUserPreferencesRef userPreferences) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +SCUserPreferencesIsForced (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean SCUserPreferencesSetName (SCUserPreferencesRef userPreferences, - CFStringRef newName) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; - -Boolean -SCNetworkConnectionSelectService (CFDictionaryRef selectionOptions, - SCNetworkServiceRef *service, - SCUserPreferencesRef *userPreferences) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFStringRef newName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean SCNetworkConnectionStartWithUserPreferences (SCNetworkConnectionRef connection, SCUserPreferencesRef userPreferences, - Boolean linger) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + Boolean linger) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFDictionaryRef SCUserPreferencesCopyInterfaceConfiguration (SCUserPreferencesRef userPreferences, - SCNetworkInterfaceRef interface) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean SCUserPreferencesSetInterfaceConfiguration (SCUserPreferencesRef userPreferences, SCNetworkInterfaceRef interface, - CFDictionaryRef newOptions) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFDictionaryRef SCUserPreferencesCopyExtendedInterfaceConfiguration (SCUserPreferencesRef userPreferences, SCNetworkInterfaceRef interface, - CFStringRef extendedType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFStringRef extendedType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean SCUserPreferencesSetExtendedInterfaceConfiguration (SCUserPreferencesRef userPreferences, SCNetworkInterfaceRef interface, CFStringRef extendedType, - CFDictionaryRef newOptions) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); #pragma mark - @@ -131,27 +202,25 @@ SCUserPreferencesSetExtendedInterfaceConfiguration Boolean SCUserPreferencesCheckInterfacePassword (SCUserPreferencesRef userPreferences, SCNetworkInterfaceRef interface, - SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFDataRef SCUserPreferencesCopyInterfacePassword (SCUserPreferencesRef userPreferences, SCNetworkInterfaceRef interface, - SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean SCUserPreferencesRemoveInterfacePassword (SCUserPreferencesRef userPreferences, SCNetworkInterfaceRef interface, - SCNetworkInterfacePasswordType passwordType) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean SCUserPreferencesSetInterfacePassword (SCUserPreferencesRef userPreferences, SCNetworkInterfaceRef interface, SCNetworkInterfacePasswordType passwordType, CFDataRef password, - CFDictionaryRef options) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; + CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); __END_DECLS -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ - #endif /* _SCNETWORKCONNECTIONPRIVATE_H */ diff --git a/SystemConfiguration.fproj/SCNetworkInterface.c b/SystemConfiguration.fproj/SCNetworkInterface.c index dd83453..4424aaa 100644 --- a/SystemConfiguration.fproj/SCNetworkInterface.c +++ b/SystemConfiguration.fproj/SCNetworkInterface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -33,18 +33,27 @@ */ +#include +#include #include #include #include #include "SCNetworkConfigurationInternal.h" #include #include -#include -#include #include "SCPreferencesInternal.h" #include "SCHelper_client.h" +#if !TARGET_OS_IPHONE #include +#else // !TARGET_OS_IPHONE +#ifndef kEAPClientPropUserName +#define kEAPClientPropUserName CFSTR("UserName") +#endif +#ifndef kEAPClientPropUserPasswordKeychainItemID +#define kEAPClientPropUserPasswordKeychainItemID CFSTR("UserPasswordKeychainItemID") +#endif +#endif // !TARGET_OS_IPHONE #include #include @@ -54,12 +63,18 @@ #include // for kIOEthernetInterfaceClass #include #include +#include + #include "dy_framework.h" #ifndef kIODeviceSupportsHoldKey #define kIODeviceSupportsHoldKey "V92Modem" #endif +#ifndef kUSBProductString +#define kUSBProductString "USB Product Name" +#endif + #include #include #include @@ -74,11 +89,6 @@ #include -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040 -#error MAC_OS_X_VERSION_MIN_REQUIRED < 1040, Check MACOSX_DEPLOYMENT_TARGET -#endif - - static CFStringRef copy_interface_string (CFBundleRef bundle, CFStringRef key, Boolean localized); static CFStringRef __SCNetworkInterfaceCopyDescription (CFTypeRef cf); static void __SCNetworkInterfaceDeallocate (CFTypeRef cf); @@ -94,30 +104,41 @@ enum { kSortIrDA, kSortSerialPort, kSortWWAN, + kSortEthernetPPP, + kSortAirportPPP, kSortEthernet, kSortFireWire, kSortAirPort, kSortOtherWireless, + kSortTethered, + kSortWWANEthernet, kSortBluetoothPAN, +#if !TARGET_OS_IPHONE kSortBond, kSortVLAN, +#endif // !TARGET_OS_IPHONE kSortUnknown }; const CFStringRef kSCNetworkInterfaceType6to4 = CFSTR("6to4"); const CFStringRef kSCNetworkInterfaceTypeBluetooth = CFSTR("Bluetooth"); +#if !TARGET_OS_IPHONE const CFStringRef kSCNetworkInterfaceTypeBond = CFSTR("Bond"); +#endif // !TARGET_OS_IPHONE const CFStringRef kSCNetworkInterfaceTypeEthernet = CFSTR("Ethernet"); const CFStringRef kSCNetworkInterfaceTypeFireWire = CFSTR("FireWire"); const CFStringRef kSCNetworkInterfaceTypeIEEE80211 = CFSTR("IEEE80211"); // IEEE 802.11, AirPort +const CFStringRef kSCNetworkInterfaceTypeIPSec = CFSTR("IPSec"); const CFStringRef kSCNetworkInterfaceTypeIrDA = CFSTR("IrDA"); const CFStringRef kSCNetworkInterfaceTypeL2TP = CFSTR("L2TP"); const CFStringRef kSCNetworkInterfaceTypeModem = CFSTR("Modem"); const CFStringRef kSCNetworkInterfaceTypePPP = CFSTR("PPP"); const CFStringRef kSCNetworkInterfaceTypePPTP = CFSTR("PPTP"); const CFStringRef kSCNetworkInterfaceTypeSerial = CFSTR("Serial"); +#if !TARGET_OS_IPHONE const CFStringRef kSCNetworkInterfaceTypeVLAN = CFSTR("VLAN"); +#endif // !TARGET_OS_IPHONE const CFStringRef kSCNetworkInterfaceTypeWWAN = CFSTR("WWAN"); const CFStringRef kSCNetworkInterfaceTypeIPv4 = CFSTR("IPv4"); @@ -135,6 +156,7 @@ static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4 = { NULL, // serviceID NULL, // unsaved NULL, // entity_device + NULL, // entity_device_unique NULL, // entity_type NULL, // entity_subtype NULL, // supported_interface_types @@ -142,17 +164,20 @@ static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4 = { NULL, // address NULL, // addressString FALSE, // builtin + NULL, // configurationAction NULL, // location NULL, // path NULL, // overrides FALSE, // modemIsV92 - FALSE, // supportsBond - FALSE, // supportsVLAN NULL, // type NULL, // unit kSortUnknown, // sort_order +#if !TARGET_OS_IPHONE + FALSE, // supportsBond { NULL, NULL}, // bond { interfaces, options } + FALSE, // supportsVLAN { NULL, NULL, NULL } // vlan { interface, tag, options } +#endif // !TARGET_OS_IPHONE }; const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4 = (SCNetworkInterfaceRef)&__kSCNetworkInterfaceIPv4; @@ -166,13 +191,23 @@ const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4 = (SCNetworkInterfaceRef #define doL2TP 1<<1 #define doPPP 1<<2 #define doPPTP 1<<3 +#define doIPSec 1<<4 +#define doOverIP do6to4|doL2TP|doPPTP|doIPSec +#if !TARGET_OS_IPHONE #define doAppleTalk 1<<0 +#else // !TARGET_OS_IPHONE +#define doAppleTalk 0 +#endif // !TARGET_OS_IPHONE #define doDNS 1<<1 #define doIPv4 1<<2 #define doIPv6 1<<3 #define doProxies 1<<4 +#if !TARGET_OS_IPHONE #define doSMB 1<<5 +#else // !TARGET_OS_IPHONE +#define doSMB 0 +#endif // !TARGET_OS_IPHONE static const struct { const CFStringRef *interface_type; @@ -182,24 +217,29 @@ static const struct { const CFStringRef *ppp_subtype; uint32_t supported_protocols; } configurations[] = { - // interface type entity_hardware if config? interface types PPP sub-type interface protocols - // ===================================== ================= ========== ======================= ======================================= ========================================= - { &kSCNetworkInterfaceType6to4 , &kSCEntNet6to4 , FALSE, doNone, NULL, doIPv6 }, - { &kSCNetworkInterfaceTypeBluetooth , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, - { &kSCNetworkInterfaceTypeBond , &kSCEntNetEthernet, TRUE , doNone, NULL, doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB }, - { &kSCNetworkInterfaceTypeEthernet , &kSCEntNetEthernet, TRUE , doPPP, &kSCValNetInterfaceSubTypePPPoE, doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB }, - { &kSCNetworkInterfaceTypeFireWire , &kSCEntNetFireWire, TRUE , doNone, NULL, doDNS|doIPv4|doIPv6|doProxies|doSMB }, - { &kSCNetworkInterfaceTypeIEEE80211 , &kSCEntNetAirPort , TRUE , doPPP, &kSCValNetInterfaceSubTypePPPoE, doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB }, - { &kSCNetworkInterfaceTypeIrDA , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, - { &kSCNetworkInterfaceTypeL2TP , NULL , FALSE, doPPP, &kSCValNetInterfaceSubTypeL2TP, doNone }, - { &kSCNetworkInterfaceTypeModem , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, - { &kSCNetworkInterfaceTypePPP , &kSCEntNetPPP , FALSE, doNone, NULL, doDNS|doIPv4|doIPv6|doProxies|doSMB }, - { &kSCNetworkInterfaceTypePPTP , NULL , FALSE, doPPP, &kSCValNetInterfaceSubTypePPTP, doNone }, - { &kSCNetworkInterfaceTypeSerial , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, - { &kSCNetworkInterfaceTypeVLAN , &kSCEntNetEthernet, TRUE , doNone, NULL, doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB }, - { &kSCNetworkInterfaceTypeWWAN , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, - // ===================================== ================= ========== ======================= ======================================= ========================================= - { &kSCNetworkInterfaceTypeIPv4 , NULL , FALSE, do6to4|doL2TP|doPPTP, NULL, doNone } + // interface type entity_hardware if config? interface types PPP sub-type interface protocols + // ===================================== ================= ========== =============== ======================================= ========================================= + { &kSCNetworkInterfaceType6to4 , &kSCEntNet6to4 , FALSE, doNone, NULL, doIPv6 }, + { &kSCNetworkInterfaceTypeBluetooth , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, +#if !TARGET_OS_IPHONE + { &kSCNetworkInterfaceTypeBond , &kSCEntNetEthernet, TRUE , doNone, NULL, doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB }, +#endif // !TARGET_OS_IPHONE + { &kSCNetworkInterfaceTypeEthernet , &kSCEntNetEthernet, TRUE , doPPP, &kSCValNetInterfaceSubTypePPPoE, doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB }, + { &kSCNetworkInterfaceTypeFireWire , &kSCEntNetFireWire, TRUE , doNone, NULL, doDNS|doIPv4|doIPv6|doProxies|doSMB }, + { &kSCNetworkInterfaceTypeIEEE80211 , &kSCEntNetAirPort , TRUE , doPPP, &kSCValNetInterfaceSubTypePPPoE, doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB }, + { &kSCNetworkInterfaceTypeIPSec , &kSCEntNetIPSec , FALSE, doNone, NULL, doDNS|doIPv4|doIPv6|doProxies|doSMB }, + { &kSCNetworkInterfaceTypeIrDA , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, + { &kSCNetworkInterfaceTypeL2TP , NULL , FALSE, doPPP, &kSCValNetInterfaceSubTypeL2TP, doNone }, + { &kSCNetworkInterfaceTypeModem , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, + { &kSCNetworkInterfaceTypePPP , &kSCEntNetPPP , FALSE, doNone, NULL, doDNS|doIPv4|doIPv6|doProxies|doSMB }, + { &kSCNetworkInterfaceTypePPTP , NULL , FALSE, doPPP, &kSCValNetInterfaceSubTypePPTP, doNone }, + { &kSCNetworkInterfaceTypeSerial , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, +#if !TARGET_OS_IPHONE + { &kSCNetworkInterfaceTypeVLAN , &kSCEntNetEthernet, TRUE , doNone, NULL, doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB }, +#endif // !TARGET_OS_IPHONE + { &kSCNetworkInterfaceTypeWWAN , &kSCEntNetModem , FALSE, doPPP, &kSCValNetInterfaceSubTypePPPSerial, doNone }, + // ===================================== ================= ========== =============== ======================================= ========================================= + { &kSCNetworkInterfaceTypeIPv4 , NULL , FALSE, doOverIP, NULL, doNone } }; @@ -241,6 +281,9 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf) CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); CFStringAppendFormat(result, NULL, CFSTR("type = %@"), interfacePrivate->interface_type); CFStringAppendFormat(result, NULL, CFSTR(", entity_device = %@"), interfacePrivate->entity_device); + if (interfacePrivate->entity_device_unique != NULL) { + CFStringAppendFormat(result, NULL, CFSTR("+%@"), interfacePrivate->entity_device_unique); + } CFStringAppendFormat(result, NULL, CFSTR(", entity_type = %@"), interfacePrivate->entity_type); if (interfacePrivate->entity_subtype != NULL) { CFStringAppendFormat(result, NULL, CFSTR(" / %@"), interfacePrivate->entity_subtype); @@ -290,6 +333,9 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf) if (interfacePrivate->path != NULL) { CFStringAppendFormat(result, NULL, CFSTR(", path = %@"), interfacePrivate->path); } + if (interfacePrivate->configurationAction != NULL) { + CFStringAppendFormat(result, NULL, CFSTR(", action = %@"), interfacePrivate->configurationAction); + } if (interfacePrivate->overrides != NULL) { CFStringAppendFormat(result, NULL, CFSTR(", overrides = %p"), interfacePrivate->overrides); } @@ -306,6 +352,7 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf) if (interfacePrivate->unsaved != NULL) { CFStringAppendFormat(result, NULL, CFSTR(", unsaved = %@"), interfacePrivate->unsaved); } +#if !TARGET_OS_IPHONE if (interfacePrivate->bond.interfaces != NULL) { CFIndex i; CFIndex n; @@ -341,6 +388,7 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf) if (interfacePrivate->vlan.options != NULL) { CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), interfacePrivate->vlan.options); } +#endif // !TARGET_OS_IPHONE CFStringAppendFormat(result, NULL, CFSTR("}")); return result; @@ -381,6 +429,9 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf) if (interfacePrivate->entity_device != NULL) CFRelease(interfacePrivate->entity_device); + if (interfacePrivate->entity_device_unique != NULL) + CFRelease(interfacePrivate->entity_device_unique); + if (interfacePrivate->supported_interface_types != NULL) CFRelease(interfacePrivate->supported_interface_types); @@ -399,6 +450,9 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf) if (interfacePrivate->path != NULL) CFRelease(interfacePrivate->path); + if (interfacePrivate->configurationAction != NULL) + CFRelease(interfacePrivate->configurationAction); + if (interfacePrivate->overrides != NULL) CFRelease(interfacePrivate->overrides); @@ -408,6 +462,7 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf) if (interfacePrivate->unit != NULL) CFRelease(interfacePrivate->unit); +#if !TARGET_OS_IPHONE if (interfacePrivate->bond.interfaces != NULL) CFRelease(interfacePrivate->bond.interfaces); @@ -425,6 +480,7 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf) if (interfacePrivate->vlan.options != NULL) CFRelease(interfacePrivate->vlan.options); +#endif // !TARGET_OS_IPHONE return; } @@ -447,6 +503,11 @@ __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 !TARGET_OS_IPHONE if (CFEqual(if1->interface_type, kSCNetworkInterfaceTypeBond)) { if (!_SC_CFEqual(if1->bond.interfaces, if2->bond.interfaces)) { return FALSE; // if not the same interfaces @@ -464,8 +525,9 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2) return FALSE; // if not the same tag } } +#endif // !TARGET_OS_IPHONE - if (!CFEqual(if1->interface, if2->interface)) { + if (!_SC_CFEqual(if1->interface, if2->interface)) { return FALSE; // if not the same layering } @@ -476,13 +538,24 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2) static CFHashCode __SCNetworkInterfaceHash(CFTypeRef cf) { + CFHashCode hash = 0; SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)cf; if (interfacePrivate->entity_device != NULL) { - return CFHash(interfacePrivate->entity_device); + if (interfacePrivate->entity_device_unique == NULL) { + hash = CFHash(interfacePrivate->entity_device); + } else { + CFStringRef str; + + str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@+%@"), + interfacePrivate->entity_device, + interfacePrivate->entity_device_unique); + hash = CFHash(str); + CFRelease(str); + } } - return 0; + return hash; } @@ -549,6 +622,7 @@ __SCNetworkInterfaceCreatePrivate(CFAllocatorRef allocator, interfacePrivate->serviceID = (serviceID != NULL) ? CFRetain(serviceID) : NULL; interfacePrivate->unsaved = NULL; interfacePrivate->entity_device = NULL; + interfacePrivate->entity_device_unique = NULL; interfacePrivate->entity_type = NULL; interfacePrivate->entity_subtype = NULL; interfacePrivate->supported_interface_types = NULL; @@ -556,27 +630,31 @@ __SCNetworkInterfaceCreatePrivate(CFAllocatorRef allocator, interfacePrivate->address = NULL; interfacePrivate->addressString = NULL; interfacePrivate->builtin = FALSE; + interfacePrivate->configurationAction = NULL; interfacePrivate->path = (path != NULL) ? CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8) : NULL; interfacePrivate->location = NULL; interfacePrivate->overrides = NULL; interfacePrivate->modemIsV92 = FALSE; - interfacePrivate->supportsBond = FALSE; - interfacePrivate->supportsVLAN = FALSE; interfacePrivate->type = NULL; interfacePrivate->unit = NULL; interfacePrivate->sort_order = kSortUnknown; +#if !TARGET_OS_IPHONE + interfacePrivate->supportsBond = FALSE; interfacePrivate->bond.interfaces = NULL; interfacePrivate->bond.mode = NULL; interfacePrivate->bond.options = NULL; + interfacePrivate->supportsVLAN = FALSE; interfacePrivate->vlan.interface = NULL; interfacePrivate->vlan.tag = NULL; interfacePrivate->vlan.options = NULL; +#endif // !TARGET_OS_IPHONE return interfacePrivate; } +#if !TARGET_OS_IPHONE __private_extern__ Boolean __SCNetworkInterfaceSupportsVLAN(CFStringRef bsd_if) @@ -654,7 +732,7 @@ _SCBondInterfaceCreatePrivate(CFAllocatorRef allocator, } interfacePrivate->interface_type = kSCNetworkInterfaceTypeBond; - interfacePrivate->entity_type = kSCEntNetEthernet; + interfacePrivate->entity_type = kSCValNetInterfaceTypeEthernet; interfacePrivate->entity_device = CFStringCreateCopy(allocator, bond_if); interfacePrivate->builtin = TRUE; interfacePrivate->supportsVLAN = __SCNetworkInterfaceSupportsVLAN(bond_if); @@ -684,7 +762,7 @@ _SCVLANInterfaceCreatePrivate(CFAllocatorRef allocator, } interfacePrivate->interface_type = kSCNetworkInterfaceTypeVLAN; - interfacePrivate->entity_type = kSCEntNetEthernet; + interfacePrivate->entity_type = kSCValNetInterfaceTypeEthernet; interfacePrivate->entity_device = CFStringCreateCopy(allocator, vlan_if); interfacePrivate->builtin = TRUE; interfacePrivate->sort_order = kSortVLAN; @@ -698,6 +776,7 @@ _SCVLANInterfaceCreatePrivate(CFAllocatorRef allocator, return interfacePrivate; } +#endif // !TARGET_OS_IPHONE #pragma mark - @@ -851,9 +930,20 @@ _SCNetworkInterfaceCompare(const void *val1, const void *val2, void *context) } } - /* ... and lastly, sort by BSD interface name */ + /* ... and, then sort by BSD interface name */ if ((dev1->entity_device != NULL) && (dev2->entity_device != NULL)) { res = CFStringCompare(dev1->entity_device, dev2->entity_device, 0); + if (res != kCFCompareEqualTo) { + return (res); + } + } + + /* ... and lastly, sort by BSD interface unique identifier */ + if ((dev1->entity_device_unique != NULL) && (dev2->entity_device_unique != NULL)) { + res = CFStringCompare(dev1->entity_device_unique, dev2->entity_device_unique, 0); +// if (res != kCFCompareEqualTo) { +// return (res); +// } } return res; @@ -920,7 +1010,7 @@ IOStringValueHasPrefix(CFTypeRef ioVal, CFStringRef prefix) { Boolean match = FALSE; CFIndex prefixLen = CFStringGetLength(prefix); - CFStringRef str = ioVal; + CFStringRef str = NULL; if (!isA_CFString(ioVal)) { if (isA_CFData(ioVal)) { @@ -928,21 +1018,22 @@ IOStringValueHasPrefix(CFTypeRef ioVal, CFStringRef prefix) (const char *)CFDataGetBytePtr(ioVal), kCFStringEncodingUTF8, kCFAllocatorNull); + ioVal = str; } else { return FALSE; } } - if ((str != NULL) && - (CFStringGetLength(str) >= prefixLen) && - (CFStringCompareWithOptions(str, + if ((ioVal != NULL) && + (CFStringGetLength(ioVal) >= prefixLen) && + (CFStringCompareWithOptions(ioVal, prefix, CFRangeMake(0, prefixLen), kCFCompareCaseInsensitive) == kCFCompareEqualTo)) { match = TRUE; } - if (str != ioVal) CFRelease(str); + if (str != NULL) CFRelease(str); return match; } @@ -1126,6 +1217,7 @@ pci_port(CFTypeRef slot_name, CFStringRef bsdName) &child_iterator); if (kr != kIOReturnSuccess) { SCLog(TRUE, LOG_DEBUG, CFSTR("pci_port IORegistryEntryCreateIterator() failed, kr = 0x%x"), kr); + CFRelease(port_names); return MACH_PORT_NULL; } @@ -1208,6 +1300,51 @@ isBuiltin(io_registry_entry_t interface) } +static Boolean +isBluetoothBuiltin(Boolean *haveController) +{ + Boolean builtin = FALSE; + io_object_t hciController; + io_iterator_t iter = MACH_PORT_NULL; + kern_return_t kr; + + kr = IOServiceGetMatchingServices(masterPort, + IOServiceMatching("IOBluetoothHCIController"), + &iter); + if ((kr != kIOReturnSuccess) || (iter == MACH_PORT_NULL)) { + if (kr != kIOReturnSuccess) { + SCLog(TRUE, LOG_DEBUG, CFSTR("isBluetoothBuiltin IOServiceGetMatchingServices() failed, kr = 0x%x"), kr); + } + *haveController = FALSE; + return FALSE; + } + *haveController = TRUE; + + hciController = IOIteratorNext(iter); + IOObjectRelease(iter); + if(hciController != MACH_PORT_NULL) { + CFNumberRef idVendor; + + idVendor = IORegistryEntryCreateCFProperty(hciController, CFSTR(kUSBVendorID), NULL, 0); + if (idVendor != NULL) { + int idVendorVal; + + if (isA_CFNumber(idVendor) && + CFNumberGetValue(idVendor, kCFNumberIntType, &idVendorVal) && + (idVendorVal == kIOUSBVendorIDAppleComputer)) { + builtin = TRUE; + } + + CFRelease(idVendor); + } + + IOObjectRelease(hciController); + } + + return builtin; +} + + #pragma mark - #pragma mark Interface enumeration @@ -1230,12 +1367,12 @@ processNetworkInterface(SCNetworkInterfacePrivateRef interfacePrivate, io_registry_entry_t bus, CFDictionaryRef bus_dict) { - CFBooleanRef bVal; CFDataRef data; int ift = -1; int iVal; CFNumberRef num; CFStringRef str; + CFBooleanRef val; // interface type num = CFDictionaryGetValue(interface_dict, CFSTR(kIOInterfaceType)); @@ -1255,44 +1392,60 @@ processNetworkInterface(SCNetworkInterfacePrivateRef interfacePrivate, (IOObjectConformsTo(controller, "AirPortPCI" )) || (IOObjectConformsTo(controller, "AirPortDriver" ))) { interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211; - interfacePrivate->entity_type = kSCEntNetEthernet; + interfacePrivate->entity_type = kSCValNetInterfaceTypeEthernet; interfacePrivate->sort_order = kSortAirPort; } else if (IOObjectConformsTo(controller, "IOBluetoothBNEPDriver")) { interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet; - interfacePrivate->entity_type = kSCEntNetEthernet; + interfacePrivate->entity_type = kSCValNetInterfaceTypeEthernet; interfacePrivate->sort_order = kSortBluetoothPAN; } else { str = IODictionaryCopyCFStringValue(bus_dict, CFSTR("name")); if ((str != NULL) && CFEqual(str, CFSTR("radio"))) { interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet; // ?? - interfacePrivate->entity_type = kSCEntNetEthernet; + interfacePrivate->entity_type = kSCValNetInterfaceTypeEthernet; interfacePrivate->sort_order = kSortOtherWireless; } else { interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet; - interfacePrivate->entity_type = kSCEntNetEthernet; + interfacePrivate->entity_type = kSCValNetInterfaceTypeEthernet; interfacePrivate->sort_order = kSortEthernet; +#if !TARGET_OS_IPHONE // BOND support only enabled for ethernet devices interfacePrivate->supportsBond = TRUE; +#endif // !TARGET_OS_IPHONE } if (str != NULL) CFRelease(str); } + // check if WWAN Ethernet + if (IOObjectConformsTo(controller, "AppleUSBEthernetHost")) { + interfacePrivate->sort_order = kSortTethered; + } else if (IOObjectConformsTo(controller, "AppleUSBCDCECMData")) { + interfacePrivate->sort_order = kSortWWANEthernet; + } + // built-in - bVal = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOBuiltin))); - if (bVal == NULL) { - bVal = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOPrimaryInterface))); + val = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOBuiltin))); + if (val == NULL) { + val = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOPrimaryInterface))); } - if (bVal != NULL) { - interfacePrivate->builtin = CFBooleanGetValue(bVal); + if (val != NULL) { + interfacePrivate->builtin = CFBooleanGetValue(val); } else { interfacePrivate->builtin = isBuiltin(interface); } + if (!interfacePrivate->builtin && + CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211)) { + // always treat AirPort interfaces as built-in + interfacePrivate->builtin = TRUE; + } + // location interfacePrivate->location = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOLocation)); +#if !TARGET_OS_IPHONE // VLAN support num = CFDictionaryGetValue(controller_dict, CFSTR(kIOFeatures)); if (isA_CFNumber(num) && @@ -1301,6 +1454,7 @@ processNetworkInterface(SCNetworkInterfacePrivateRef interfacePrivate, interfacePrivate->supportsVLAN = TRUE; } } +#endif // !TARGET_OS_IPHONE // localized name if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211)) { @@ -1342,15 +1496,22 @@ processNetworkInterface(SCNetworkInterfacePrivateRef interfacePrivate, interfacePrivate->localized_arg2 = port_name; } } - } else if (CFEqual(provider, CFSTR("IOUSBDevice"))) { - CFTypeRef val; - + } else if (CFEqual(provider, CFSTR("IOUSBDevice")) || + CFEqual(provider, CFSTR("IOUSBInterface"))) { // check if a "Product Name" has been provided val = IORegistryEntrySearchCFProperty(interface, kIOServicePlane, CFSTR(kIOPropertyProductNameKey), NULL, kIORegistryIterateRecursively | kIORegistryIterateParents); + if (val == NULL) { + // check if a "USB Product Name" has been provided + val = IORegistryEntrySearchCFProperty(interface, + kIOServicePlane, + CFSTR(kUSBProductString), + NULL, + kIORegistryIterateRecursively | kIORegistryIterateParents); + } if (val != NULL) { CFStringRef productName; @@ -1393,7 +1554,7 @@ processNetworkInterface(SCNetworkInterfacePrivateRef interfacePrivate, interfacePrivate->interface_type = kSCNetworkInterfaceTypeFireWire; // Entity - interfacePrivate->entity_type = kSCEntNetFireWire; + interfacePrivate->entity_type = kSCValNetInterfaceTypeFireWire; // built-in interfacePrivate->builtin = isBuiltin(interface); @@ -1561,10 +1722,12 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, io_registry_entry_t bus, CFDictionaryRef bus_dict) { + CFStringRef base = NULL; CFStringRef ift; Boolean isModem = FALSE; + Boolean isWWAN = FALSE; CFStringRef modemCCL = NULL; - CFStringRef str; + Boolean ok = FALSE; CFTypeRef val; // check if hidden @@ -1578,12 +1741,44 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, return FALSE; // if this interface should not be exposed } - // Type - str = CFDictionaryGetValue(interface_dict, CFSTR(kIOTTYBaseNameKey)); - if (str == NULL) { + // check if initializing + val = IORegistryEntrySearchCFProperty(interface, + kIOServicePlane, + CFSTR("Initializing"), + NULL, + kIORegistryIterateRecursively | kIORegistryIterateParents); + if (val != NULL) { + Boolean initializing; + + initializing = isA_CFBoolean(val) && CFBooleanGetValue(val); + CFRelease(val); + if (initializing) { + return FALSE; // if this interface is still initializing + } + } + + // check if WWAN + val = IORegistryEntrySearchCFProperty(interface, + kIOServicePlane, + CFSTR("WWAN"), + NULL, + kIORegistryIterateRecursively | kIORegistryIterateParents); + if (val != NULL) { + isWWAN = isA_CFBoolean(val) && CFBooleanGetValue(val); + CFRelease(val); + } + + // Entity (Device) + interfacePrivate->entity_device = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOTTYDeviceKey)); + if (interfacePrivate->entity_device == NULL) { return FALSE; } + base = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOTTYBaseNameKey)); + if (base == NULL) { + base = CFRetain(interfacePrivate->entity_device); + } + /* * From MoreSCF: * @@ -1592,21 +1787,28 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, * that only the rev A actually had an IrDA port, and Mac OS X doesn't * even support it, these ports definitely shouldn't be listed. */ - if (CFStringCompare(str, + if (CFStringCompare(base, CFSTR("irda"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { - return FALSE; + goto done; } - if (IOStringValueHasPrefix(str, CFSTR("bluetooth"))) { + if (IOStringValueHasPrefix(base, CFSTR("bluetooth"))) { + Boolean haveController = FALSE; + // Bluetooth interfacePrivate->interface_type = kSCNetworkInterfaceTypeBluetooth; interfacePrivate->sort_order = kSortBluetooth; - } else if (IOStringValueHasPrefix(str, CFSTR("irda-ircomm"))) { + interfacePrivate->builtin = isBluetoothBuiltin(&haveController); + if (!haveController) { + // if device with no controller present + goto done; + } + } else if (IOStringValueHasPrefix(base, CFSTR("irda-ircomm"))) { // IrDA interfacePrivate->interface_type = kSCNetworkInterfaceTypeIrDA; interfacePrivate->sort_order = kSortIrDA; - } else if (IOStringValueHasPrefix(str, CFSTR("wwan"))) { + } else if (isWWAN) { // WWAN interfacePrivate->interface_type = kSCNetworkInterfaceTypeWWAN; interfacePrivate->sort_order = kSortWWAN; @@ -1638,29 +1840,26 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, // Entity (Hardware) ift = CFDictionaryGetValue(interface_dict, CFSTR(kIOSerialBSDTypeKey)); if (!isA_CFString(ift)) { - return FALSE; + goto done; } if (CFEqual(ift, CFSTR(kIOSerialBSDModemType))) { // if modem isModem = TRUE; - if (CFEqual(str, CFSTR("modem"))) { + if (CFEqual(base, CFSTR("modem"))) { interfacePrivate->builtin = TRUE; interfacePrivate->sort_order = kSortInternalModem; - } else if (CFEqual(str, CFSTR("usbmodem"))) { + } else if (CFEqual(base, CFSTR("usbmodem"))) { interfacePrivate->sort_order = kSortUSBModem; } } else if (CFEqual(ift, CFSTR(kIOSerialBSDRS232Type))) { // if serial port interfacePrivate->sort_order = kSortSerialPort; } else { - return FALSE; + goto done; } - // Entity (Device) - interfacePrivate->entity_device = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOTTYDeviceKey)); - // configuration template overrides val = IORegistryEntrySearchCFProperty(interface, kIOServicePlane, @@ -1687,6 +1886,8 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, kIORegistryIterateRecursively | kIORegistryIterateParents); if (val != NULL) { if (isA_CFDictionary(val)) { + CFStringRef uniqueID; + if (interfacePrivate->overrides == NULL) { interfacePrivate->overrides = CFDictionaryCreateMutable(NULL, 0, @@ -1697,11 +1898,20 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, modemCCL = CFDictionaryGetValue(val, kSCPropNetModemConnectionScript); modemCCL = isA_CFString(modemCCL); + + uniqueID = CFDictionaryGetValue(val, CFSTR("UniqueIdentifier")); + uniqueID = isA_CFString(uniqueID); + if (uniqueID != NULL) { + // retain the device's base name and the unique id + CFRelease(interfacePrivate->entity_device); + interfacePrivate->entity_device = CFRetain(base); + interfacePrivate->entity_device_unique = CFStringCreateCopy(NULL, uniqueID); + } } CFRelease(val); } - // modem CCL + // if not part of the DeviceModemOverrides, look harder for the modem CCL if (modemCCL == NULL) { val = IORegistryEntrySearchCFProperty(interface, kIOServicePlane, @@ -1729,7 +1939,7 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, CFStringRef name = NULL; CFMutableStringRef port; - port = CFStringCreateMutableCopy(NULL, 0, str); + port = CFStringCreateMutableCopy(NULL, 0, base); CFStringLowercase(port, NULL); if (!isModem) { @@ -1747,10 +1957,10 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, } else { // if no [English] localization available, use TTY base name CFRelease(name); - interfacePrivate->name = CFStringCreateCopy(NULL, str); + interfacePrivate->name = CFStringCreateCopy(NULL, base); } } else { - interfacePrivate->name = CFStringCreateCopy(NULL, str); + interfacePrivate->name = CFStringCreateCopy(NULL, base); } // set localized name @@ -1764,13 +1974,13 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, } else { // if no localization available, use TTY base name CFRelease(localized); - interfacePrivate->localized_name = CFStringCreateCopy(NULL, str); + interfacePrivate->localized_name = CFStringCreateCopy(NULL, base); } } else { - interfacePrivate->localized_name = CFStringCreateCopy(NULL, str); + interfacePrivate->localized_name = CFStringCreateCopy(NULL, base); } - if (!isModem || !CFEqual(str, CFSTR("modem"))) { + if (!isModem || !CFEqual(base, CFSTR("modem"))) { CFStringRef productName; // check if a "Product Name" has been provided @@ -1779,6 +1989,14 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, CFSTR(kIOPropertyProductNameKey), NULL, kIORegistryIterateRecursively | kIORegistryIterateParents); + if (val == NULL) { + // check if a "USB Product Name" has been provided + val = IORegistryEntrySearchCFProperty(interface, + kIOServicePlane, + CFSTR(kUSBProductString), + NULL, + kIORegistryIterateRecursively | kIORegistryIterateParents); + } if (val != NULL) { productName = IOCopyCFStringValue(val); CFRelease(val); @@ -1800,7 +2018,6 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, if ((modemCCL == NULL) && is_valid_connection_script(productName)) { set_connection_script(interfacePrivate, productName); - modemCCL = productName; } } @@ -1812,7 +2029,17 @@ processSerialInterface(SCNetworkInterfacePrivateRef interfacePrivate, CFRelease(port); } - return TRUE; + ok = TRUE; + + done : + + if (!ok && (interfacePrivate->entity_device != NULL)) { + CFRelease(interfacePrivate->entity_device); + interfacePrivate->entity_device = NULL; + } + if (base != NULL) CFRelease(base); + + return ok; } @@ -1870,7 +2097,22 @@ createInterface(io_registry_entry_t interface, processInterface func) interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, path); - if (!(*func)(interfacePrivate, interface, interface_dict, controller, controller_dict, bus, bus_dict)) { + if ((*func)(interfacePrivate, interface, interface_dict, controller, controller_dict, bus, bus_dict)) { + CFTypeRef val; + + /* check user-notification / auto-configuration preferences */ + val = IORegistryEntrySearchCFProperty(interface, + kIOServicePlane, + kSCNetworkInterfaceConfigurationActionKey, + NULL, + kIORegistryIterateRecursively | kIORegistryIterateParents); + if (val != NULL) { + if (isA_CFString(val)) { + interfacePrivate->configurationAction = CFRetain(val); + } + CFRelease(val); + } + } else { CFRelease(interfacePrivate); interfacePrivate = NULL; } @@ -1981,6 +2223,7 @@ __SCNetworkInterfaceIsValidExtendedConfigurationType(SCNetworkInterfaceRef inter CFIndex extendedIndex; CFIndex interfaceIndex; SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + Boolean isL2TP = FALSE; Boolean ok = FALSE; defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface); @@ -2001,18 +2244,35 @@ __SCNetworkInterfaceIsValidExtendedConfigurationType(SCNetworkInterfaceRef inter goto done; } -// It turns out that, for PPP interfaces, we want to be able to store -// some extended interface configuration (e.g. IPSec [for L2TP]). For -// now, I'm commenting out the following test. -// -// if (requirePerInterface && !configurations[interfaceIndex].per_interface_config) { -// // we don't allow per-service extended configurations -// goto done; -// } + if (CFEqual(extendedType, kSCEntNetIPSec)) { + CFStringRef interfaceType; + + interfaceType = SCNetworkInterfaceGetInterfaceType(interface); + if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { + SCNetworkInterfaceRef child; + + child = SCNetworkInterfaceGetInterface(interface); + if (child != NULL) { + interfaceType = SCNetworkInterfaceGetInterfaceType(child); + if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) { + isL2TP = TRUE; + } + } + } + } + + if (requirePerInterface && + !configurations[interfaceIndex].per_interface_config && + !isL2TP) { + // we don't allow per-service extended configurations (except + // that we do allow IPSec as an extended type for PPP->L2TP) + goto done; + } extendedIndex = findConfiguration(extendedType); - if (extendedIndex != kCFNotFound) { - // extended type cannot match a known interface type + if ((extendedIndex != kCFNotFound) && !isL2TP) { + // extended type cannot match a known interface type (except + // that we do allow IPSec as an extended type for PPP->L2TP) goto done; } @@ -2269,6 +2529,11 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface) kSCPropNetInterfaceDeviceName, interfacePrivate->entity_device); } + if (interfacePrivate->entity_device_unique != NULL) { + CFDictionarySetValue(entity, + CFSTR("DeviceUniqueIdentifier"), + interfacePrivate->entity_device_unique); + } // match the "hardware" with the lowest layer while (TRUE) { @@ -2283,6 +2548,10 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface) } interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + if (CFEqual(interface, kSCNetworkInterfaceIPv4)) { + return entity; + } + interfaceIndex = findConfiguration(interfacePrivate->interface_type); if (interfaceIndex != kCFNotFound) { if (configurations[interfaceIndex].entity_hardware != NULL) { @@ -2319,6 +2588,7 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface) } +#if !TARGET_OS_IPHONE static SCNetworkInterfaceRef findInterface(CFArrayRef interfaces, CFStringRef match_if) { @@ -2378,6 +2648,7 @@ findVLANInterface(SCPreferencesRef prefs, CFStringRef ifDevice) } return interface; } +#endif // !TARGET_OS_IPHONE SCNetworkInterfaceRef @@ -2393,12 +2664,14 @@ _SCNetworkInterfaceCreateWithBSDName(CFAllocatorRef allocator, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionarySetValue(entity, kSCPropNetInterfaceDeviceName, bsdName); - if ((flags & kIncludeVLANInterfaces) == 0) { - CFDictionarySetValue(entity, CFSTR("_NO_VLAN_INTERFACES_"), kCFBooleanTrue); - } +#if !TARGET_OS_IPHONE if ((flags & kIncludeBondInterfaces) == 0) { CFDictionarySetValue(entity, CFSTR("_NO_BOND_INTERFACES_"), kCFBooleanTrue); } + if ((flags & kIncludeVLANInterfaces) == 0) { + CFDictionarySetValue(entity, CFSTR("_NO_VLAN_INTERFACES_"), kCFBooleanTrue); + } +#endif // !TARGET_OS_IPHONE interface = _SCNetworkInterfaceCreateWithEntity(NULL, entity, NULL); CFRelease(entity); @@ -2406,6 +2679,75 @@ _SCNetworkInterfaceCreateWithBSDName(CFAllocatorRef allocator, } +static void +__SCNetworkInterfaceSetService(SCNetworkInterfaceRef interface, + SCNetworkServiceRef service) +{ + SCNetworkInterfacePrivateRef interfacePrivate; + SCNetworkServicePrivateRef servicePrivate; + + interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + if (interfacePrivate->prefs != NULL) { + CFRelease(interfacePrivate->prefs); + interfacePrivate->prefs = NULL; + } + if (interfacePrivate->serviceID != NULL) { + CFRelease(interfacePrivate->serviceID); + interfacePrivate->serviceID = NULL; + } + + servicePrivate = (SCNetworkServicePrivateRef)service; + if (servicePrivate->prefs != NULL) { + interfacePrivate->prefs = CFRetain(servicePrivate->prefs); + } + if (servicePrivate->serviceID != NULL) { + interfacePrivate->serviceID = CFRetain(servicePrivate->serviceID); + } + + return; +} + + +static Boolean +_SCNetworkInterfaceMatchesName(CFStringRef name, CFStringRef key) +{ + Boolean match; + CFStringRef str; + + if (bundle == NULL) { + // if no bundle + return FALSE; + } + + if (!isA_CFString(name)) { + // if no interface "name" + return FALSE; + } + + // check non-localized name for a match + str = copy_interface_string(bundle, key, FALSE); + if (str != NULL) { + match = CFEqual(name, str); + CFRelease(str); + if (match) { + return TRUE; + } + } + + // check localized name for a match + str = copy_interface_string(bundle, key, TRUE); + if (str != NULL) { + match = CFEqual(name, str); + CFRelease(str); + if (match) { + return TRUE; + } + } + + return FALSE; +} + + SCNetworkInterfaceRef _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, CFDictionaryRef interface_entity, @@ -2413,6 +2755,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, { SCNetworkInterfacePrivateRef interfacePrivate = NULL; CFStringRef ifDevice; + CFStringRef ifUnique; CFStringRef ifSubType; CFStringRef ifType; CFArrayRef matching_interfaces = NULL; @@ -2445,6 +2788,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, } ifDevice = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceDeviceName); + ifUnique = CFDictionaryGetValue(interface_entity, CFSTR("DeviceUniqueIdentifier")); if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet) || CFEqual(ifType, kSCValNetInterfaceTypeFireWire) || @@ -2481,7 +2825,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, match_keys[0] = CFSTR(kIOProviderClassKey); match_vals[0] = CFSTR(kIOSerialBSDServiceValue); - match_keys[1] = CFSTR(kIOTTYDeviceKey); + match_keys[1] = CFSTR(kIOTTYBaseNameKey); match_vals[1] = ifDevice; matching = CFDictionaryCreate(NULL, @@ -2512,6 +2856,9 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4, kSCNetworkInterfaceType6to4); + } else if (CFEqual(ifType, kSCValNetInterfaceTypeIPSec)) { + interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4, + kSCNetworkInterfaceTypeIPSec); } else if ((CFStringFind(ifType, CFSTR("."), 0).location != kCFNotFound) && (ifDevice == NULL)) { interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4, ifType); @@ -2523,6 +2870,16 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, n = CFArrayGetCount(matching_interfaces); switch (n) { + case 1 : + interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, 0); + if (_SC_CFEqual(ifUnique, interfacePrivate->entity_device_unique)) { + // if the unique ID's match + CFRetain(interfacePrivate); + break; + } + + interfacePrivate = NULL; + // fall through case 0 : if (!CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) { break; @@ -2531,6 +2888,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, if (prefs == NULL) { break; } +#if !TARGET_OS_IPHONE if (!CFDictionaryContainsKey(interface_entity, CFSTR("_NO_VLAN_INTERFACES_"))) { interfacePrivate = (SCNetworkInterfacePrivateRef)findVLANInterface(prefs, ifDevice); } @@ -2538,17 +2896,33 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, && !CFDictionaryContainsKey(interface_entity, CFSTR("_NO_BOND_INTERFACES_"))) { interfacePrivate = (SCNetworkInterfacePrivateRef)findBondInterface(prefs, ifDevice); } +#endif // !TARGET_OS_IPHONE CFRelease(prefs); break; - case 1 : - interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, 0); + default : + if (ifUnique != NULL) { + CFIndex i; + + for (i = 0; i < n; i++) { + SCNetworkInterfacePrivateRef scan; + + scan = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, i); + if (_SC_CFEqual(ifUnique, scan->entity_device_unique)) { + if (interfacePrivate != NULL) { + // if we've matched more than one interface + interfacePrivate = NULL; + break; + } + interfacePrivate = scan; + } + } + } + if (interfacePrivate == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("_SCNetworkInterfaceCreateWithEntity() failed, more than one interface matches %@"), ifDevice); + interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, 0); + } CFRetain(interfacePrivate); break; - default : - SCLog(TRUE, LOG_DEBUG, CFSTR("_SCNetworkInterfaceCreateWithEntity() failed, more than one interface matches %@"), ifDevice); - CFRelease(matching_interfaces); - _SCErrorSet(kSCStatusFailed); - return NULL; } CFRelease(matching_interfaces); } @@ -2560,34 +2934,62 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, * if device not present on this system */ interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, NULL); - interfacePrivate->entity_type = ifType; - interfacePrivate->entity_subtype = ifSubType; - interfacePrivate->entity_device = (ifDevice != NULL) ? CFStringCreateCopy(NULL, ifDevice) : NULL; + interfacePrivate->entity_type = ifType; + interfacePrivate->entity_subtype = ifSubType; + interfacePrivate->entity_device = (ifDevice != NULL) ? CFStringCreateCopy(NULL, ifDevice) : NULL; + interfacePrivate->entity_device_unique = (ifUnique != NULL) ? CFStringCreateCopy(NULL, ifUnique) : NULL; if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) { CFStringRef entity_hardware; entity_hardware = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceHardware); - if ((entity_hardware != NULL) && + if (isA_CFString((entity_hardware)) && CFEqual(entity_hardware, kSCEntNetAirPort)) { interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211; + interfacePrivate->sort_order = kSortAirPort; } else { + CFStringRef name; + interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet; + + name = CFDictionaryGetValue(interface_entity, kSCPropUserDefinedName); + if (_SCNetworkInterfaceMatchesName(name, CFSTR("iPhone"))) { + interfacePrivate->sort_order = kSortTethered; + } else if (_SCNetworkInterfaceMatchesName(name, CFSTR("bluetooth-pan"))) { + interfacePrivate->sort_order = kSortBluetoothPAN; + } else { + interfacePrivate->sort_order = kSortEthernet; + } } } else if (CFEqual(ifType, kSCValNetInterfaceTypeFireWire)) { interfacePrivate->interface_type = kSCNetworkInterfaceTypeFireWire; + interfacePrivate->sort_order = kSortFireWire; } else if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) { if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPoE)) { - interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet; + CFStringRef entity_hardware; + + entity_hardware = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceHardware); + if (isA_CFString((entity_hardware)) && + CFEqual(entity_hardware, kSCEntNetAirPort)) { + interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211; + interfacePrivate->sort_order = kSortAirPort; + } else { + interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet; + interfacePrivate->sort_order = kSortEthernet; + } } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) { if (CFStringHasPrefix(ifDevice, CFSTR("Bluetooth"))) { interfacePrivate->interface_type = kSCNetworkInterfaceTypeBluetooth; + interfacePrivate->sort_order = kSortBluetooth; } else if (CFStringHasPrefix(ifDevice, CFSTR("irda"))) { interfacePrivate->interface_type = kSCNetworkInterfaceTypeIrDA; + interfacePrivate->sort_order = kSortIrDA; } else if (CFStringHasPrefix(ifDevice, CFSTR("wwan"))) { interfacePrivate->interface_type = kSCNetworkInterfaceTypeWWAN; + interfacePrivate->sort_order = kSortWWAN; } else { interfacePrivate->interface_type = kSCNetworkInterfaceTypeModem; + interfacePrivate->sort_order = kSortModem; } } else { // PPTP, L2TP, ... @@ -2606,20 +3008,38 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef allocator, } if ((interfacePrivate != NULL) && (service != NULL)) { - SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - - if (interfacePrivate->prefs != NULL) - CFRelease(interfacePrivate->prefs); - if (interfacePrivate->serviceID != NULL) - CFRelease(interfacePrivate->serviceID); + __SCNetworkInterfaceSetService((SCNetworkInterfaceRef)interfacePrivate, + service); +#if !TARGET_OS_IPHONE + // set prefs & serviceID to VLANs and Bonds + if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeBond)) { + CFIndex i; + CFArrayRef members; + CFIndex n; + + members = SCBondInterfaceGetMemberInterfaces((SCNetworkInterfaceRef)interfacePrivate); + n = (members != NULL) ? CFArrayGetCount(members) : 0; + for (i = 0; i < n; i++) { + SCNetworkInterfaceRef member; + + member = CFArrayGetValueAtIndex(members, i); + __SCNetworkInterfaceSetService(member, service); + } + } else if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeVLAN)) { + SCNetworkInterfaceRef vlan_physical; - interfacePrivate->prefs = CFRetain(servicePrivate->prefs); - interfacePrivate->serviceID = CFRetain(servicePrivate->serviceID); + vlan_physical = SCVLANInterfaceGetPhysicalInterface((SCNetworkInterfaceRef)interfacePrivate); + if (vlan_physical != NULL) { + __SCNetworkInterfaceSetService(vlan_physical, service); + } + } +#endif // !TARGET_OS_IPHONE } if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) { SCNetworkInterfaceRef parent; + // create parent parent = SCNetworkInterfaceCreateWithInterface((SCNetworkInterfaceRef)interfacePrivate, kSCNetworkInterfaceTypePPP); CFRelease(interfacePrivate); @@ -2750,6 +3170,7 @@ __waitForInterfaces() } while (TRUE) { + CFArrayRef changedKeys; CFDictionaryRef dict; Boolean quiet = FALSE; @@ -2773,6 +3194,11 @@ __waitForInterfaces() CFSTR("SCDynamicStoreNotifyWait() failed: %s"), SCErrorString(SCError())); goto done; } + + changedKeys = SCDynamicStoreCopyNotifiedKeys(store); + if (changedKeys != NULL) { + CFRelease(changedKeys); + } } done : @@ -2788,7 +3214,9 @@ SCNetworkInterfaceCopyAll() { CFMutableArrayRef all_interfaces; CFArrayRef new_interfaces; +#if !TARGET_OS_IPHONE SCPreferencesRef prefs; +#endif // !TARGET_OS_IPHONE /* initialize runtime */ pthread_once(&initialized, __SCNetworkInterfaceInitialize); @@ -2819,6 +3247,7 @@ SCNetworkInterfaceCopyAll() CFRelease(new_interfaces); } +#if !TARGET_OS_IPHONE // get virtual network interfaces (Bond, VLAN) prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkInterfaceCopyAll"), NULL); if (prefs != NULL) { @@ -2836,6 +3265,7 @@ SCNetworkInterfaceCopyAll() CFRelease(prefs); } +#endif // !TARGET_OS_IPHONE // all interfaces have been identified, order and return sort_interfaces(all_interfaces); @@ -2875,6 +3305,9 @@ SCNetworkInterfaceGetSupportedInterfaceTypes(SCNetworkInterfaceRef interface) if (configurations[i].supported_interfaces & doPPTP) { CFArrayAppendValue(interfacePrivate->supported_interface_types, kSCNetworkInterfaceTypePPTP); } + if (configurations[i].supported_interfaces & doIPSec) { + CFArrayAppendValue(interfacePrivate->supported_interface_types, kSCNetworkInterfaceTypeIPSec); + } } } @@ -2903,9 +3336,11 @@ SCNetworkInterfaceGetSupportedProtocolTypes(SCNetworkInterfaceRef interface) if (i != kCFNotFound) { if (configurations[i].supported_protocols != doNone) { interfacePrivate->supported_protocol_types = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); +#if !TARGET_OS_IPHONE if (configurations[i].supported_protocols & doAppleTalk) { CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeAppleTalk); } +#endif // !TARGET_OS_IPHONE if (configurations[i].supported_protocols & doDNS) { CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeDNS); } @@ -2918,9 +3353,11 @@ SCNetworkInterfaceGetSupportedProtocolTypes(SCNetworkInterfaceRef interface) if (configurations[i].supported_protocols & doProxies) { CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeProxies); } +#if !TARGET_OS_IPHONE if (configurations[i].supported_protocols & doSMB) { CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeSMB); } +#endif // !TARGET_OS_IPHONE } } @@ -2961,7 +3398,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { parentPrivate->interface_type = kSCNetworkInterfaceTypePPP; - parentPrivate->entity_type = kSCEntNetPPP; + parentPrivate->entity_type = kSCValNetInterfaceTypePPP; // entity subtype if (childIndex != kCFNotFound) { @@ -2979,6 +3416,10 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i if (childPrivate->entity_device != NULL) { parentPrivate->entity_device = CFStringCreateCopy(NULL, childPrivate->entity_device); } + + if (childPrivate->entity_device_unique != NULL) { + parentPrivate->entity_device_unique = CFStringCreateCopy(NULL, childPrivate->entity_device_unique); + } } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) { if ((childIndex == kCFNotFound) || ((configurations[childIndex].supported_interfaces & doL2TP) != doL2TP)) { @@ -2987,7 +3428,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i } parentPrivate->interface_type = kSCNetworkInterfaceTypeL2TP; parentPrivate->localized_key = CFSTR("l2tp"); - parentPrivate->entity_type = kSCValNetInterfaceSubTypeL2TP; // interface config goes into "L2TP" + parentPrivate->entity_type = kSCEntNetL2TP; // interface config goes into "L2TP" } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) { if ((childIndex == kCFNotFound) || ((configurations[childIndex].supported_interfaces & doPPTP) != doPPTP)) { @@ -2996,7 +3437,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i } parentPrivate->interface_type = kSCNetworkInterfaceTypePPTP; parentPrivate->localized_key = CFSTR("pptp"); - parentPrivate->entity_type = kSCValNetInterfaceSubTypePPTP; // interface config goes into "PPTP" + parentPrivate->entity_type = kSCEntNetPPTP; // interface config goes into "PPTP" } else if (CFEqual(interfaceType, kSCNetworkInterfaceType6to4)) { if ((childIndex == kCFNotFound) || ((configurations[childIndex].supported_interfaces & do6to4) != do6to4)) { @@ -3006,8 +3447,17 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i parentPrivate->interface_type = kSCNetworkInterfaceType6to4; parentPrivate->localized_key = CFSTR("6to4"); - parentPrivate->entity_type = kSCEntNet6to4; + parentPrivate->entity_type = kSCValNetInterfaceType6to4; parentPrivate->entity_device = CFRetain(CFSTR("stf0")); + } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) { + if ((childIndex == kCFNotFound) || + ((configurations[childIndex].supported_interfaces & doIPSec) != doIPSec)) { + // if the child interface does not support IPSec + goto fail; + } + parentPrivate->interface_type = kSCNetworkInterfaceTypeIPSec; + parentPrivate->localized_key = CFSTR("ipsec"); + parentPrivate->entity_type = kSCValNetInterfaceTypeIPSec; } else if (CFStringFind(interfaceType, CFSTR("."), 0).location != kCFNotFound) { // if custom interface type parentPrivate->interface_type = interfaceType; @@ -3021,8 +3471,23 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i if (childPrivate->overrides != NULL) { parentPrivate->overrides = CFDictionaryCreateMutableCopy(NULL, 0, childPrivate->overrides); - }; - parentPrivate->sort_order = childPrivate->sort_order; + } + + // The following change handles the case where a user has both an Ethernet and + // PPPoE network service. Because a PPPoE service is typically associated with + // an ISP we want it to be sorted higher in the service order. + if ((parentPrivate->entity_subtype != NULL) && + (CFEqual(parentPrivate->entity_subtype, kSCValNetInterfaceSubTypePPPoE))) { + if ((childPrivate->interface_type != NULL) && + (CFEqual(childPrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211))) { + parentPrivate->sort_order = kSortAirportPPP; + } else { + parentPrivate->sort_order = kSortEthernetPPP; + } + } else { + // set sort order of the parent to match the child interface + parentPrivate->sort_order = childPrivate->sort_order; + } return (SCNetworkInterfaceRef)parentPrivate; @@ -3034,6 +3499,51 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i } +__private_extern__ +CFDictionaryRef +__SCNetworkInterfaceGetDefaultConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface) +{ + CFDictionaryRef config = NULL; + CFStringRef defaultType; + SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + + /* initialize runtime (and kSCNetworkInterfaceIPv4) */ + pthread_once(&initialized, __SCNetworkInterfaceInitialize); + + defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface); + if (defaultType != NULL) { + if (set != NULL) { + CFStringRef path; + + path = SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(NULL, // allocator + SCNetworkSetGetSetID(set), // set + interfacePrivate->entity_device, // interface + defaultType); // entity + if (path != NULL) { + config = __getPrefsConfiguration(interfacePrivate->prefs, path); + CFRelease(path); + + if (config == NULL) { + // if the "set" does not have a saved configuration, use + // the [template] "interface" configuration + if (interfacePrivate->unsaved != NULL) { + config = CFDictionaryGetValue(interfacePrivate->unsaved, defaultType); + if (config == (CFDictionaryRef)kCFNull) { + config = NULL; + } + } + } + if (isA_CFDictionary(config) && (CFDictionaryGetCount(config) == 0)) { + config = NULL; + } + } + } + } + + return config; +} + + static CFDictionaryRef __SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef interface, CFStringRef extendedType) @@ -3241,7 +3751,7 @@ copy_interface_string(CFBundleRef bundle, CFStringRef key, Boolean localized) static CFStringRef -copy_display_name(SCNetworkInterfaceRef interface, Boolean localized) +copy_display_name(SCNetworkInterfaceRef interface, Boolean localized, Boolean oldLocalization) { CFMutableStringRef local; CFStringRef name; @@ -3260,8 +3770,13 @@ copy_display_name(SCNetworkInterfaceRef interface, Boolean localized) if ((bundle != NULL) && (interfacePrivate->localized_key != NULL)) { CFStringRef fmt; + CFStringRef key = interfacePrivate->localized_key; - fmt = copy_interface_string(bundle, interfacePrivate->localized_key, localized); + if (oldLocalization) { + key = CFStringCreateWithFormat(NULL, NULL, CFSTR("X-%@"), + interfacePrivate->localized_key); + } + fmt = copy_interface_string(bundle, key, localized); if (fmt != NULL) { CFStringAppendFormat(local, NULL, @@ -3271,6 +3786,9 @@ copy_display_name(SCNetworkInterfaceRef interface, Boolean localized) CFRelease(fmt); added = TRUE; } + if (oldLocalization) { + CFRelease(key); + } } if (!added && @@ -3325,20 +3843,52 @@ copy_display_name(SCNetworkInterfaceRef interface, Boolean localized) __private_extern__ CFStringRef -__SCNetworkInterfaceGetNonLocalizedDisplayName(SCNetworkInterfaceRef interface) +__SCNetworkInterfaceCopyXLocalizedDisplayName(SCNetworkInterfaceRef interface) { - SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + CFStringRef name; if (!isA_SCNetworkInterface(interface)) { _SCErrorSet(kSCStatusInvalidArgument); return NULL; } - if (interfacePrivate->name == NULL) { - interfacePrivate->name = copy_display_name(interface, FALSE); - } - - return interfacePrivate->name; + name = copy_display_name(interface, TRUE, TRUE); + return name; +} + + +__private_extern__ +CFStringRef +__SCNetworkInterfaceCopyXNonLocalizedDisplayName(SCNetworkInterfaceRef interface) +{ + CFStringRef localized_name; + + if (!isA_SCNetworkInterface(interface)) { + _SCErrorSet(kSCStatusInvalidArgument); + return NULL; + } + + localized_name = copy_display_name(interface, FALSE, TRUE); + return localized_name; +} + + +__private_extern__ +CFStringRef +__SCNetworkInterfaceGetNonLocalizedDisplayName(SCNetworkInterfaceRef interface) +{ + SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + + if (!isA_SCNetworkInterface(interface)) { + _SCErrorSet(kSCStatusInvalidArgument); + return NULL; + } + + if (interfacePrivate->name == NULL) { + interfacePrivate->name = copy_display_name(interface, FALSE, FALSE); + } + + return interfacePrivate->name; } @@ -3353,7 +3903,7 @@ SCNetworkInterfaceGetLocalizedDisplayName(SCNetworkInterfaceRef interface) } if (interfacePrivate->localized_name == NULL) { - interfacePrivate->localized_name = copy_display_name(interface, TRUE); + interfacePrivate->localized_name = copy_display_name(interface, TRUE, FALSE); } return interfacePrivate->localized_name; @@ -3383,6 +3933,76 @@ SCNetworkInterfaceGetTypeID(void) } +__private_extern__ +Boolean +__SCNetworkInterfaceSetDefaultConfiguration(SCNetworkSetRef set, + SCNetworkInterfaceRef interface, + CFStringRef defaultType, + CFDictionaryRef config, + Boolean okToHold) +{ + SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + Boolean ok = FALSE; + + /* initialize runtime (and kSCNetworkInterfaceIPv4) */ + pthread_once(&initialized, __SCNetworkInterfaceInitialize); + + if (defaultType == NULL) { + defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface); + if (defaultType == NULL) { + return FALSE; + } + } + + if (isA_CFDictionary(config) && (CFDictionaryGetCount(config) == 0)) { + config = NULL; + } + + if (set != NULL) { + CFStringRef path; + + path = SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(NULL, // allocator + SCNetworkSetGetSetID(set), // set + interfacePrivate->entity_device, // interface + defaultType); // entity + if (path != NULL) { + ok = __setPrefsConfiguration(interfacePrivate->prefs, path, config, FALSE); + CFRelease(path); + if (ok) { + // if configuration has been saved + if (interfacePrivate->unsaved != NULL) { + CFDictionaryRemoveValue(interfacePrivate->unsaved, defaultType); + if (CFDictionaryGetCount(interfacePrivate->unsaved) == 0) { + CFRelease(interfacePrivate->unsaved); + interfacePrivate->unsaved = NULL; + } + } + } + } else { + if (okToHold) { + if (config == NULL) { + // remember that we are clearing the configuration + config = (CFDictionaryRef)kCFNull; + } + + if (interfacePrivate->unsaved == NULL) { + interfacePrivate->unsaved = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } + CFDictionarySetValue(interfacePrivate->unsaved, defaultType, config); + ok = TRUE; + } else { + _SCErrorSet(kSCStatusNoKey); + } + } + } + + return ok; +} + + __private_extern__ Boolean __SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef interface, @@ -3658,7 +4278,7 @@ getPasswordID(CFDictionaryRef config, CFStringRef serviceID) static CFStringRef copySharedSecretID(CFDictionaryRef config, CFStringRef serviceID) { - CFMutableStringRef sharedSecret = NULL; + CFMutableStringRef shared_id = NULL; if (config != NULL) { CFStringRef encryption; @@ -3666,22 +4286,52 @@ copySharedSecretID(CFDictionaryRef config, CFStringRef serviceID) encryption = CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecretEncryption); if (isA_CFString(encryption) && CFEqual(encryption, kSCValNetIPSecSharedSecretEncryptionKeychain)) { - sharedSecret = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecret); - if (sharedSecret != NULL) { - CFRetain(sharedSecret); + shared_id = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecret); + if (shared_id != NULL) { + CFRetain(shared_id); + } + } + } + + if (shared_id == NULL) { + CFStringRef unique_id; + + unique_id = getPasswordID(config, serviceID); + shared_id = CFStringCreateMutableCopy(NULL, 0, unique_id); + CFStringAppend(shared_id, CFSTR(".SS")); + } + + return shared_id; +} + + +static CFStringRef +copyXAuthID(CFDictionaryRef config, CFStringRef serviceID) +{ + CFMutableStringRef xauth_id = NULL; + + if (config != NULL) { + CFStringRef encryption; + + encryption = CFDictionaryGetValue(config, kSCPropNetIPSecXAuthPasswordEncryption); + if (isA_CFString(encryption) && + CFEqual(encryption, kSCValNetIPSecXAuthPasswordEncryptionKeychain)) { + xauth_id = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecXAuthPassword); + if (xauth_id != NULL) { + CFRetain(xauth_id); } } } - if (sharedSecret == NULL) { + if (xauth_id == NULL) { CFStringRef unique_id; unique_id = getPasswordID(config, serviceID); - sharedSecret = CFStringCreateMutableCopy(NULL, 0, unique_id); - CFStringAppend(sharedSecret, CFSTR(".SS")); + xauth_id = CFStringCreateMutableCopy(NULL, 0, unique_id); + CFStringAppend(xauth_id, CFSTR(".XAUTH")); } - return sharedSecret; + return xauth_id; } @@ -3694,20 +4344,17 @@ checkInterfacePassword(SCNetworkInterfaceRef interface, SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; if (!isA_SCNetworkInterface(interface)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + goto error; } *serviceID = interfacePrivate->serviceID; if (*serviceID == NULL) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + goto error; } *prefs = interfacePrivate->prefs; if (*prefs == NULL) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + goto error; } switch (passwordType) { @@ -3715,45 +4362,61 @@ checkInterfacePassword(SCNetworkInterfaceRef interface, CFStringRef interfaceType; interfaceType = SCNetworkInterfaceGetInterfaceType(interface); - if (!CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { + // if PPP + break; } - break; + + goto error; } case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : { - CFStringRef interfaceType; + CFStringRef interfaceType; interfaceType = SCNetworkInterfaceGetInterfaceType(interface); - if (!CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - interface = SCNetworkInterfaceGetInterface(interface); - if (interface == NULL) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { + interface = SCNetworkInterfaceGetInterface(interface); + if (interface != NULL) { + interfaceType = SCNetworkInterfaceGetInterfaceType(interface); + if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) { + // if PPP->L2TP interface + break; + } + } + } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) { + // if IPSec interface + break; } - interfaceType = SCNetworkInterfaceGetInterfaceType(interface); - if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - break; + goto error; } case kSCNetworkInterfacePasswordTypeEAPOL : { break; } + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFStringRef interfaceType; + + interfaceType = SCNetworkInterfaceGetInterfaceType(interface); + if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) { + // if IPSec interface + break; + } + + goto error; + } + default : break; } return TRUE; + + error : + + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; } @@ -3793,10 +4456,16 @@ SCNetworkInterfaceCheckPassword(SCNetworkInterfaceRef interface, case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : { CFDictionaryRef config; + Boolean extended; CFStringRef shared_id; // get configuration - config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + extended = CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypePPP); + if (extended) { + config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + } else { + config = SCNetworkInterfaceGetConfiguration(interface); + } // get sharedSecret ID shared_id = copySharedSecretID(config, serviceID); @@ -3833,6 +4502,28 @@ SCNetworkInterfaceCheckPassword(SCNetworkInterfaceRef interface, break; } + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFDictionaryRef config; + CFStringRef xauth_id; + + // get configuration + config = SCNetworkInterfaceGetConfiguration(interface); + + // get XAuth ID + xauth_id = copyXAuthID(config, serviceID); + + // check + exists = __extract_password(prefs, + config, + kSCPropNetIPSecXAuthPassword, + kSCPropNetIPSecXAuthPasswordEncryption, + kSCValNetIPSecXAuthPasswordEncryptionKeychain, + xauth_id, + NULL); + CFRelease(xauth_id); + break; + } + default : _SCErrorSet(kSCStatusInvalidArgument); return FALSE; @@ -3878,10 +4569,16 @@ SCNetworkInterfaceCopyPassword(SCNetworkInterfaceRef interface, case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : { CFDictionaryRef config; + Boolean extended; CFStringRef shared_id; // get configuration - config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + extended = CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypePPP); + if (extended) { + config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + } else { + config = SCNetworkInterfaceGetConfiguration(interface); + } // get sharedSecret ID shared_id = copySharedSecretID(config, serviceID); @@ -3920,6 +4617,28 @@ SCNetworkInterfaceCopyPassword(SCNetworkInterfaceRef interface, break; } + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFDictionaryRef config; + CFStringRef xauth_id; + + // get configuration + config = SCNetworkInterfaceGetConfiguration(interface); + + // get XAuth ID + xauth_id = copyXAuthID(config, serviceID); + + // extract + (void) __extract_password(prefs, + config, + kSCPropNetIPSecXAuthPassword, + kSCPropNetIPSecXAuthPasswordEncryption, + kSCValNetIPSecXAuthPasswordEncryptionKeychain, + xauth_id, + &password); + CFRelease(xauth_id); + break; + } + default : _SCErrorSet(kSCStatusInvalidArgument); return NULL; @@ -3944,6 +4663,7 @@ SCNetworkInterfaceRemovePassword(SCNetworkInterfaceRef interface, switch (passwordType) { case kSCNetworkInterfacePasswordTypePPP : { CFDictionaryRef config; + CFDictionaryRef newConfig = NULL; CFStringRef unique_id; // get configuration @@ -3953,45 +4673,56 @@ SCNetworkInterfaceRemovePassword(SCNetworkInterfaceRef interface, unique_id = getPasswordID(config, serviceID); // remove password - ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id); + ok = __remove_password(prefs, + config, + kSCPropNetPPPAuthPassword, + kSCPropNetPPPAuthPasswordEncryption, + kSCValNetPPPAuthPasswordEncryptionKeychain, + unique_id, + &newConfig); if (ok) { - CFMutableDictionaryRef newConfig; - - if (config != NULL) { - newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config); - CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPassword); - CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPasswordEncryption); - ok = SCNetworkInterfaceSetConfiguration(interface, newConfig); - CFRelease(newConfig); - } + ok = SCNetworkInterfaceSetConfiguration(interface, newConfig); + if (newConfig != NULL) CFRelease(newConfig); } + break; } case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : { CFDictionaryRef config; + Boolean extended; + CFDictionaryRef newConfig = NULL; CFStringRef shared_id; // get configuration - config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + extended = CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypePPP); + if (extended) { + config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + } else { + config = SCNetworkInterfaceGetConfiguration(interface); + } // get sharedSecret ID shared_id = copySharedSecretID(config, serviceID); // remove password - ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, shared_id); + ok = __remove_password(prefs, + config, + kSCPropNetIPSecSharedSecret, + kSCPropNetIPSecSharedSecretEncryption, + kSCValNetIPSecSharedSecretEncryptionKeychain, + shared_id, + &newConfig); if (ok) { - CFMutableDictionaryRef newConfig; - - if (config != NULL) { - newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config); - CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecret); - CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecretEncryption); + if (extended) { ok = SCNetworkInterfaceSetExtendedConfiguration(interface, kSCEntNetIPSec, newConfig); - CFRelease(newConfig); + } else { + ok = SCNetworkInterfaceSetConfiguration(interface, + newConfig); } + if (newConfig != NULL) CFRelease(newConfig); } CFRelease(shared_id); @@ -4019,6 +4750,34 @@ SCNetworkInterfaceRemovePassword(SCNetworkInterfaceRef interface, break; } + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + CFDictionaryRef config; + CFDictionaryRef newConfig = NULL; + CFStringRef xauth_id; + + // get configuration + config = SCNetworkInterfaceGetConfiguration(interface); + + // get XAuth ID + xauth_id = copyXAuthID(config, serviceID); + + // remove password + ok = __remove_password(prefs, + config, + kSCPropNetIPSecXAuthPassword, + kSCPropNetIPSecXAuthPasswordEncryption, + kSCValNetIPSecXAuthPasswordEncryptionKeychain, + xauth_id, + &newConfig); + if (ok) { + ok = SCNetworkInterfaceSetConfiguration(interface, newConfig); + if (newConfig != NULL) CFRelease(newConfig); + } + + CFRelease(xauth_id); + break; + } + default : _SCErrorSet(kSCStatusInvalidArgument); return FALSE; @@ -4083,7 +4842,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, if (bundle != NULL) { // "PPP Password" --> keychain "Kind" description = CFBundleCopyLocalizedString(bundle, - CFSTR("KEYCHAIN_PPP_PASSWORD"), + CFSTR("KEYCHAIN_KIND_PPP_PASSWORD"), CFSTR("PPP Password"), NULL); } @@ -4091,7 +4850,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, // store password ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs, unique_id, - (label != NULL) ? label : CFSTR("PPP"), + (label != NULL) ? label : CFSTR("Network Connection"), (description != NULL) ? description : CFSTR("PPP Password"), account, password, @@ -4123,19 +4882,47 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, } case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : { - SCNetworkServiceRef service = NULL; + CFDictionaryRef baseConfig = NULL; + Boolean extended; + SCNetworkServiceRef service = NULL; CFStringRef shared_id; // get configuration - config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + extended = CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypePPP); + config = SCNetworkInterfaceGetConfiguration(interface); + if (extended) { + baseConfig = config; + config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + } // get sharedSecret ID shared_id = copySharedSecretID(config, serviceID); - // get "Name", "Kind" + // get "Account", "Name", "Kind" if (config != NULL) { + CFStringRef localIdentifier; + CFStringRef localIdentifierType; + + if (CFDictionaryGetValueIfPresent(config, + kSCPropNetIPSecLocalIdentifierType, + (const void **)&localIdentifierType) + && CFEqual(localIdentifierType, kSCValNetIPSecLocalIdentifierTypeKeyID) + && CFDictionaryGetValueIfPresent(config, + kSCPropNetIPSecLocalIdentifier, + (const void **)&localIdentifier) + && isA_CFString(localIdentifier)) { + // local identifier --> keychain "Account" + account = localIdentifier; + } + // PPP [user defined] "name" --> keychain "Name" - label = CFDictionaryGetValue(config, kSCPropUserDefinedName); + if (!extended) { + label = CFDictionaryGetValue(config, kSCPropUserDefinedName); + } else { + if (baseConfig != NULL) { + label = CFDictionaryGetValue(baseConfig, kSCPropUserDefinedName); + } + } } if (label == NULL) { @@ -4155,7 +4942,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, if (bundle != NULL) { // "IPSec Shared Secret" --> keychain "Kind" description = CFBundleCopyLocalizedString(bundle, - CFSTR("KEYCHAIN_IPSEC_SHARED_SECRET"), + CFSTR("KEYCHAIN_KIND_IPSEC_SHARED_SECRET"), CFSTR("IPSec Shared Secret"), NULL); } @@ -4163,9 +4950,9 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, // set password ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs, shared_id, - (label != NULL) ? label : CFSTR("PPP"), + (label != NULL) ? label : CFSTR("VPN Connection"), (description != NULL) ? description : CFSTR("IPSec Shared Secret"), - NULL, + account, password, options); if (ok) { @@ -4185,9 +4972,13 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, CFDictionarySetValue(newConfig, kSCPropNetIPSecSharedSecretEncryption, kSCValNetIPSecSharedSecretEncryptionKeychain); - ok = SCNetworkInterfaceSetExtendedConfiguration(interface, - kSCEntNetIPSec, - newConfig); + if (extended) { + ok = SCNetworkInterfaceSetExtendedConfiguration(interface, + kSCEntNetIPSec, + newConfig); + } else { + ok = SCNetworkInterfaceSetConfiguration(interface, newConfig); + } CFRelease(newConfig); } @@ -4198,6 +4989,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, } case kSCNetworkInterfacePasswordTypeEAPOL : { + CFStringRef account = NULL; CFStringRef unique_id = NULL; // get configuration @@ -4217,26 +5009,46 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, CFRelease(uuid); } + // 802.1x UserName --> keychain "Account" + if (config != NULL) { + account = CFDictionaryGetValue(config, kEAPClientPropUserName); + } + // get "Name", "Kind" if (bundle != NULL) { - // "802.1X Password" --> keychain "Name" - label = CFBundleCopyLocalizedString(bundle, - CFSTR("KEYCHAIN_EAPOL_PASSWORD"), - CFSTR("802.1X Password"), - NULL); - // "Internet Connect" --> keychain "Kind" + CFStringRef interface_name; + + // "Network Connection (%@)" --> keychain "Name" + interface_name = SCNetworkInterfaceGetLocalizedDisplayName(interface); + if (interface_name != NULL) { + CFStringRef label_fmt; + + label_fmt = CFBundleCopyLocalizedString(bundle, + CFSTR("KEYCHAIN_DESCRIPTION_EAPOL_INTERFACE"), + CFSTR("Network Connection (%@)"), + NULL); + label = CFStringCreateWithFormat(NULL, NULL, label_fmt, interface_name); + CFRelease(label_fmt); + } else { + label = CFBundleCopyLocalizedString(bundle, + CFSTR("KEYCHAIN_DESCRIPTION_EAPOL"), + CFSTR("Network Connection"), + NULL); + } + + // "802.1X Password" --> keychain "Kind" description = CFBundleCopyLocalizedString(bundle, - CFSTR("KEYCHAIN_INTERNET_CONNECT"), - CFSTR("Internet Connect"), + CFSTR("KEYCHAIN_KIND_EAPOL"), + CFSTR("802.1X Password"), NULL); } // set password ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs, unique_id, - (label != NULL) ? label : CFSTR("802.1X Password"), - (description != NULL) ? description : CFSTR("Internet Connect"), - NULL, + (label != NULL) ? label : CFSTR("Network Connection"), + (description != NULL) ? description : CFSTR("802.1X Password"), + account, password, options); if (ok) { @@ -4265,6 +5077,82 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, break; } + case kSCNetworkInterfacePasswordTypeIPSecXAuth : { + SCNetworkServiceRef service = NULL; + CFStringRef xauth_id; + + // get configuration + config = SCNetworkInterfaceGetConfiguration(interface); + + // get XAuth ID + xauth_id = copyXAuthID(config, serviceID); + + // get "Account", "Name", "Kind" + if (config != NULL) { + // auth name --> keychain "Account" + account = CFDictionaryGetValue(config, kSCPropNetIPSecXAuthName); + + // IPSec [user defined] "name" --> keychain "Name" + label = CFDictionaryGetValue(config, kSCPropUserDefinedName); + } + + if (label == NULL) { + // service name --> keychain "Name" + service = (SCNetworkServiceRef)__SCNetworkServiceCreatePrivate(NULL, + prefs, + serviceID, + interface); + + label = SCNetworkServiceGetName(service); + if (label == NULL) { + // interface name --> keychain "Name" + label = SCNetworkInterfaceGetLocalizedDisplayName(interface); + } + } + + if (bundle != NULL) { + // "IPSec XAuth Password" --> keychain "Kind" + description = CFBundleCopyLocalizedString(bundle, + CFSTR("KEYCHAIN_KIND_IPSEC_XAUTH_PASSWORD"), + CFSTR("IPSec XAuth Password"), + NULL); + } + + // store password + ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs, + xauth_id, + (label != NULL) ? label : CFSTR("VPN Connection"), + (description != NULL) ? description : CFSTR("IPSec XAuth Password"), + account, + password, + options); + if (ok) { + CFMutableDictionaryRef newConfig; + + if (config != NULL) { + newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config); + } else { + newConfig = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } + CFDictionarySetValue(newConfig, + kSCPropNetIPSecXAuthPassword, + xauth_id); + CFDictionarySetValue(newConfig, + kSCPropNetIPSecXAuthPasswordEncryption, + kSCValNetIPSecXAuthPasswordEncryptionKeychain); + ok = SCNetworkInterfaceSetConfiguration(interface, newConfig); + CFRelease(newConfig); + } + + CFRelease(xauth_id); + if (description != NULL) CFRelease(description); + if (service != NULL) CFRelease(service); + break; + } + default : _SCErrorSet(kSCStatusInvalidArgument); break; @@ -4281,16 +5169,30 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef interface, SCNetworkInterfaceRef _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(io_object_t if_obj) { - SCNetworkInterfaceRef interface; + SCNetworkInterfaceRef interface = NULL; /* initialize runtime */ pthread_once(&initialized, __SCNetworkInterfaceInitialize); - interface = createInterface(if_obj, processNetworkInterface); + if (IOObjectConformsTo(if_obj, kIONetworkInterfaceClass)) { + interface = createInterface(if_obj, processNetworkInterface); + } else if (IOObjectConformsTo(if_obj, kIOSerialBSDServiceValue)) { + interface = createInterface(if_obj, processSerialInterface); + } + return interface; } +CFStringRef +_SCNetworkInterfaceGetConfigurationAction(SCNetworkInterfaceRef interface) +{ + SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + + return interfacePrivate->configurationAction; +} + + CFDataRef _SCNetworkInterfaceGetHardwareAddress(SCNetworkInterfaceRef interface) { @@ -4339,6 +5241,109 @@ _SCNetworkInterfaceIsBuiltin(SCNetworkInterfaceRef interface) #pragma mark - #pragma mark SCNetworkInterface SPIs + +CFStringRef +_SCNetworkInterfaceCopySlashDevPath(SCNetworkInterfaceRef interface) +{ + io_registry_entry_t device; + io_iterator_t device_iterator = MACH_PORT_NULL; + CFStringRef device_path = NULL; + SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + kern_return_t kr; + CFStringRef match_keys[2]; + CFTypeRef match_vals[2]; + CFDictionaryRef match_dict; + CFDictionaryRef matching; + + if (interfacePrivate->entity_device == NULL) { + return NULL; + } + + if (interfacePrivate->entity_device_unique == NULL) { + goto done; + } + + match_keys[0] = CFSTR(kIOTTYBaseNameKey); + match_vals[0] = interfacePrivate->entity_device; + match_dict = CFDictionaryCreate(NULL, + (const void **)match_keys, + (const void **)match_vals, + 1, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + match_keys[0] = CFSTR(kIOProviderClassKey); + match_vals[0] = CFSTR(kIOSerialBSDServiceValue); + match_keys[1] = CFSTR(kIOPropertyMatchKey); + match_vals[1] = match_dict; + matching = CFDictionaryCreate(NULL, + (const void **)match_keys, + (const void **)match_vals, + sizeof(match_keys)/sizeof(match_keys[0]), + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFRelease(match_dict); + + // note: this "matching" dictionary will be consumed by the call to IOServiceGetMatchingServices + kr = IOServiceGetMatchingServices(masterPort, matching, &device_iterator); + if (kr != kIOReturnSuccess) { + SCLog(TRUE, LOG_DEBUG, CFSTR("IOServiceGetMatchingServices() failed, kr = 0x%x"), kr); + goto done; + } + + while ((device_path == NULL) && + ((device = IOIteratorNext(device_iterator)) != MACH_PORT_NULL)) { + CFDictionaryRef overrides; + + overrides = IORegistryEntrySearchCFProperty(device, + kIOServicePlane, + CFSTR("DeviceModemOverrides"), + NULL, + kIORegistryIterateRecursively | kIORegistryIterateParents); + if (overrides != NULL) { + if (isA_CFDictionary(overrides)) { + CFStringRef matchIdentifier; + + matchIdentifier = CFDictionaryGetValue(overrides, CFSTR("UniqueIdentifier")); + if (isA_CFString(matchIdentifier) && + CFEqual(interfacePrivate->entity_device_unique, matchIdentifier)) { + device_path = IORegistryEntryCreateCFProperty(device, + CFSTR(kIOTTYDeviceKey), + NULL, + 0); + } + } + CFRelease(overrides); + } + IOObjectRelease(device); + } + + IOObjectRelease(device_iterator); + + done : + + if (device_path == NULL) { + // if we haven't found an exact match to our UniqueIdentifier + // so we simply return the base name. + device_path = SCNetworkInterfaceGetBSDName(interface); + if (device_path != NULL) { + CFRetain(device_path); + } + } + + return device_path; +} + + +Boolean +_SCNetworkInterfaceIsBluetoothPAN(SCNetworkInterfaceRef interface) +{ + SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + + return (interfacePrivate->sort_order == kSortBluetoothPAN); +} + + Boolean _SCNetworkInterfaceIsModemV92(SCNetworkInterfaceRef interface) { @@ -4348,6 +5353,15 @@ _SCNetworkInterfaceIsModemV92(SCNetworkInterfaceRef interface) } +Boolean +_SCNetworkInterfaceIsTethered(SCNetworkInterfaceRef interface) +{ + SCNetworkInterfacePrivateRef interfacePrivate = (SCNetworkInterfacePrivateRef)interface; + + return (interfacePrivate->sort_order == kSortTethered); +} + + #pragma mark - #pragma mark SCNetworkInterface [internal] SPIs @@ -4365,6 +5379,10 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef allocator, /* initialize runtime (and kSCNetworkInterfaceIPv4) */ pthread_once(&initialized, __SCNetworkInterfaceInitialize); + if (interface == kSCNetworkInterfaceIPv4) { + return (SCNetworkInterfacePrivateRef)CFRetain(interface); + } + newPrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, prefs, serviceID, NULL); newPrivate->interface_type = oldPrivate->interface_type; if (oldPrivate->interface != NULL) { @@ -4392,6 +5410,9 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef allocator, if (oldPrivate->entity_device != NULL) { newPrivate->entity_device = CFRetain(oldPrivate->entity_device); } + if (oldPrivate->entity_device_unique != NULL) { + newPrivate->entity_device_unique = CFRetain(oldPrivate->entity_device_unique); + } newPrivate->entity_type = oldPrivate->entity_type; newPrivate->entity_subtype = oldPrivate->entity_subtype; if (oldPrivate->supported_interface_types != NULL) { @@ -4404,6 +5425,9 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef allocator, newPrivate->address = CFRetain(oldPrivate->address); } newPrivate->builtin = oldPrivate->builtin; + if (oldPrivate->configurationAction != NULL) { + newPrivate->configurationAction = CFRetain(oldPrivate->configurationAction); + } if (oldPrivate->location != NULL) { newPrivate->location = CFRetain(oldPrivate->location); } @@ -4414,8 +5438,6 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef allocator, newPrivate->overrides = CFDictionaryCreateMutableCopy(NULL, 0, oldPrivate->overrides); } newPrivate->modemIsV92 = oldPrivate->modemIsV92; - newPrivate->supportsBond = oldPrivate->supportsBond; - newPrivate->supportsVLAN = oldPrivate->supportsVLAN; if (oldPrivate->type != NULL) { newPrivate->type = CFRetain(oldPrivate->type); } @@ -4423,6 +5445,8 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef allocator, newPrivate->unit = CFRetain(oldPrivate->unit); } newPrivate->sort_order = oldPrivate->sort_order; +#if !TARGET_OS_IPHONE + newPrivate->supportsBond = oldPrivate->supportsBond; if (oldPrivate->bond.interfaces != NULL) { newPrivate->bond.interfaces = CFRetain(oldPrivate->bond.interfaces); } @@ -4432,6 +5456,7 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef allocator, if (oldPrivate->bond.options != NULL) { newPrivate->bond.options = CFRetain(oldPrivate->bond.options); } + newPrivate->supportsVLAN = oldPrivate->supportsVLAN; if (oldPrivate->vlan.interface != NULL) { newPrivate->vlan.interface = CFRetain(oldPrivate->vlan.interface); } @@ -4441,6 +5466,7 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef allocator, if (oldPrivate->vlan.options != NULL) { newPrivate->vlan.options = CFRetain(oldPrivate->vlan.options); } +#endif // !TARGET_OS_IPHONE return newPrivate; } @@ -4448,7 +5474,7 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef allocator, __private_extern__ CFArrayRef -__SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface) +__SCNetworkInterfaceCopyDeepConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface) { CFMutableArrayRef configs; @@ -4468,7 +5494,11 @@ __SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface) CFDictionaryRef config; CFArrayRef extendedTypes; - config = __SCNetworkInterfaceGetConfiguration(interface, defaultType); + if (set == NULL) { + config = __SCNetworkInterfaceGetConfiguration(interface, defaultType); + } else { + config = __SCNetworkInterfaceGetDefaultConfiguration(set, interface); + } if (config == NULL) { config = (CFDictionaryRef)kCFNull; } @@ -4507,9 +5537,9 @@ __SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface) __private_extern__ void -__SCNetworkInterfaceSetDeepConfiguration(SCNetworkInterfaceRef interface, CFArrayRef configs) +__SCNetworkInterfaceSetDeepConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface, CFArrayRef configs) { - CFIndex i; + CFIndex i; for (i = 0; interface != NULL; i++) { CFStringRef defaultType; @@ -4527,11 +5557,22 @@ __SCNetworkInterfaceSetDeepConfiguration(SCNetworkInterfaceRef interface, CFArra if (config == (CFDictionaryRef)kCFNull) { config = NULL; } - if (!__SCNetworkInterfaceSetConfiguration(interface, defaultType, config, TRUE)) { - SCLog(TRUE, LOG_DEBUG, - CFSTR("__SCNetworkInterfaceSetDeepConfiguration __SCNetworkInterfaceSetConfiguration() failed, interface=%@, type=%@"), - interface, - defaultType); + if (set == NULL) { + // if service is not associated with the set + if (!__SCNetworkInterfaceSetConfiguration(interface, defaultType, config, TRUE)) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("__SCNetworkInterfaceSetDeepConfiguration __SCNetworkInterfaceSetConfiguration() failed, interface=%@, type=%@"), + interface, + defaultType); + } + } else { + // apply default configuration to this set + if (!__SCNetworkInterfaceSetDefaultConfiguration(set, interface, defaultType, config, TRUE)) { + SCLog(TRUE, LOG_DEBUG, + CFSTR("__SCNetworkInterfaceSetDeepConfiguration __SCNetworkInterfaceSetDefaultConfiguration() failed, interface=%@, type=%@"), + interface, + defaultType); + } } extendedTypes = extendedConfigurationTypes(interface); diff --git a/SystemConfiguration.fproj/SCNetworkProtocol.c b/SystemConfiguration.fproj/SCNetworkProtocol.c index c0d5757..921908a 100644 --- a/SystemConfiguration.fproj/SCNetworkProtocol.c +++ b/SystemConfiguration.fproj/SCNetworkProtocol.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -45,12 +45,16 @@ static Boolean __SCNetworkProtocolEqual (CFTypeRef cf1, CFTypeRef cf2); static CFHashCode __SCNetworkProtocolHash (CFTypeRef cf); +#if !TARGET_OS_IPHONE const CFStringRef kSCNetworkProtocolTypeAppleTalk = CFSTR("AppleTalk"); +#endif // !TARGET_OS_IPHONE const CFStringRef kSCNetworkProtocolTypeDNS = CFSTR("DNS"); const CFStringRef kSCNetworkProtocolTypeIPv4 = CFSTR("IPv4"); const CFStringRef kSCNetworkProtocolTypeIPv6 = CFSTR("IPv6"); const CFStringRef kSCNetworkProtocolTypeProxies = CFSTR("Proxies"); +#if !TARGET_OS_IPHONE const CFStringRef kSCNetworkProtocolTypeSMB = CFSTR("SMB"); +#endif // !TARGET_OS_IPHONE static CFTypeID __kSCNetworkProtocolTypeID = _kCFRuntimeNotATypeID; @@ -177,12 +181,16 @@ __SCNetworkProtocolIsValidType(CFStringRef protocolType) { int i; static const CFStringRef *valid_types[] = { +#if !TARGET_OS_IPHONE &kSCNetworkProtocolTypeAppleTalk, +#endif // !TARGET_OS_IPHONE &kSCNetworkProtocolTypeDNS, &kSCNetworkProtocolTypeIPv4, &kSCNetworkProtocolTypeIPv6, &kSCNetworkProtocolTypeProxies, - &kSCNetworkProtocolTypeSMB +#if !TARGET_OS_IPHONE + &kSCNetworkProtocolTypeSMB, +#endif // !TARGET_OS_IPHONE }; for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++) { diff --git a/SystemConfiguration.fproj/SCNetworkReachability.c b/SystemConfiguration.fproj/SCNetworkReachability.c index 532c671..658d9e4 100644 --- a/SystemConfiguration.fproj/SCNetworkReachability.c +++ b/SystemConfiguration.fproj/SCNetworkReachability.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2008 Apple Inc. All rights reserved. + * Copyright (c) 2003-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -31,14 +31,24 @@ * - add advanced reachability APIs */ +#include +#include +#include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE +#include +#include #include #include #include - -#include #include #include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE + #include #include #include @@ -51,6 +61,7 @@ #include #include #include +#include #define KERNEL_PRIVATE #include #undef KERNEL_PRIVATE @@ -63,8 +74,7 @@ - -#define kSCNetworkFlagsFirstResolvePending (1<<31) +#define kSCNetworkReachabilityFlagsFirstResolvePending (1<<31) #define N_QUICK 32 @@ -79,6 +89,31 @@ typedef enum { static CFStringRef __SCNetworkReachabilityCopyDescription (CFTypeRef cf); static void __SCNetworkReachabilityDeallocate (CFTypeRef cf); +static void rlsPerform(void *info); + + +static Boolean +__SCNetworkReachabilityScheduleWithRunLoop (SCNetworkReachabilityRef target, + CFRunLoopRef runLoop, + CFStringRef runLoopMode, +#if !TARGET_OS_IPHONE + dispatch_queue_t queue, +#else // !TARGET_OS_IPHONE + void *queue, +#endif // !TARGET_OS_IPHONE + Boolean onDemand); +static Boolean +__SCNetworkReachabilityUnscheduleFromRunLoop (SCNetworkReachabilityRef target, + CFRunLoopRef runLoop, + CFStringRef runLoopMode, + Boolean onDemand); + + +typedef struct { + SCNetworkReachabilityFlags flags; + uint16_t if_index; + Boolean sleeping; +} ReachabilityInfo; typedef struct { @@ -96,6 +131,7 @@ typedef struct { const char *name; const char *serv; struct addrinfo hints; + Boolean needResolve; CFArrayRef resolvedAddress; /* CFArray[CFData] */ int resolvedAddressError; @@ -104,21 +140,39 @@ typedef struct { struct sockaddr *remoteAddress; /* current reachability flags */ - SCNetworkConnectionFlags flags; - uint16_t if_index; + ReachabilityInfo info; + ReachabilityInfo last_notify; /* run loop source, callout, context, rl scheduling info */ + Boolean scheduled; CFRunLoopSourceRef rls; SCNetworkReachabilityCallBack rlsFunction; SCNetworkReachabilityContext rlsContext; CFMutableArrayRef rlList; +#if !TARGET_OS_IPHONE + dispatch_queue_t dispatchQueue; // SCNetworkReachabilitySetDispatchQueue + dispatch_queue_t asyncDNSQueue; + dispatch_source_t asyncDNSSource; +#endif // !TARGET_OS_IPHONE + /* [async] DNS query info */ Boolean haveDNS; + mach_port_t dnsMP; CFMachPortRef dnsPort; CFRunLoopSourceRef dnsRLS; struct timeval dnsQueryStart; + /* on demand info */ + Boolean onDemandBypass; + CFStringRef onDemandName; + CFStringRef onDemandRemoteAddress; + SCNetworkReachabilityRef onDemandServer; + CFStringRef onDemandServiceID; + + /* logging */ + char log_prefix[32]; + } SCNetworkReachabilityPrivate, *SCNetworkReachabilityPrivateRef; @@ -139,17 +193,31 @@ static const CFRuntimeClass __SCNetworkReachabilityClass = { static pthread_once_t initialized = PTHREAD_ONCE_INIT; +static ReachabilityInfo NOT_REACHABLE = { 0, 0, FALSE }; +static ReachabilityInfo NOT_REPORTED = { 0xFFFFFFFF, 0, FALSE }; static int rtm_seq = 0; +#if !TARGET_OS_IPHONE +/* + * Power capabilities (sleep/wake) + */ +static IOPMSystemPowerStateCapabilities power_capabilities = kIOPMSytemPowerStateCapabilitiesMask; +#endif // !TARGET_OS_IPHONE + + /* * host "something has changed" notifications */ static pthread_mutex_t hn_lock = PTHREAD_MUTEX_INITIALIZER; static SCDynamicStoreRef hn_store = NULL; +#if !TARGET_OS_IPHONE +static dispatch_queue_t hn_dispatchQueue = NULL; +#else // !TARGET_OS_IPHONE static CFRunLoopSourceRef hn_storeRLS = NULL; static CFMutableArrayRef hn_rlList = NULL; +#endif // !TARGET_OS_IPHONE static CFMutableSetRef hn_targets = NULL; @@ -177,10 +245,11 @@ isA_SCNetworkReachability(CFTypeRef obj) static void -__log_query_time(Boolean found, Boolean async, struct timeval *start) +__log_query_time(SCNetworkReachabilityRef target, Boolean found, Boolean async, struct timeval *start) { - struct timeval dnsQueryComplete; - struct timeval dnsQueryElapsed; + struct timeval dnsQueryComplete; + struct timeval dnsQueryElapsed; + SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; if (!_sc_debug) { return; @@ -192,8 +261,9 @@ __log_query_time(Boolean found, Boolean async, struct timeval *start) (void) gettimeofday(&dnsQueryComplete, NULL); timersub(&dnsQueryComplete, start, &dnsQueryElapsed); - SCLog(TRUE, LOG_DEBUG, - CFSTR("%ssync DNS complete%s (query time = %d.%3.3d)"), + SCLog(TRUE, LOG_INFO, + CFSTR("%s%ssync DNS complete%s (query time = %d.%3.3d)"), + targetPrivate->log_prefix, async ? "a" : "", found ? "" : ", host not found", dnsQueryElapsed.tv_sec, @@ -207,7 +277,9 @@ static int updatePPPStatus(SCDynamicStoreRef *storeP, const struct sockaddr *sa, const char *if_name, - SCNetworkConnectionFlags *flags) + SCNetworkReachabilityFlags *flags, + CFStringRef *ppp_server, + const char *log_prefix) { CFDictionaryRef dict = NULL; CFStringRef entity; @@ -217,7 +289,7 @@ updatePPPStatus(SCDynamicStoreRef *storeP, CFIndex n; CFStringRef ppp_if; int sc_status = kSCStatusReachabilityUnknown; - SCDynamicStoreRef store = (storeP != NULL) ? *storeP : NULL; + SCDynamicStoreRef store = *storeP; const void * values_q[N_QUICK]; const void ** values = values_q; @@ -235,14 +307,13 @@ updatePPPStatus(SCDynamicStoreRef *storeP, if (store == NULL) { store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL); if (store == NULL) { - SCLog(_sc_verbose, LOG_INFO, CFSTR("updatePPPStatus SCDynamicStoreCreate() failed")); + SCLog(TRUE, LOG_ERR, CFSTR("updatePPPStatus SCDynamicStoreCreate() failed")); goto done; } + *storeP = store; } - /* - * grab a snapshot of the PPP configuration from the dynamic store - */ + // grab a snapshot of the PPP configuration from the dynamic store { CFStringRef pattern; CFMutableArrayRef patterns; @@ -270,15 +341,13 @@ updatePPPStatus(SCDynamicStoreRef *storeP, CFRelease(patterns); } if (dict == NULL) { - /* if we could not access the dynamic store */ + // if we could not access the dynamic store goto done; } sc_status = kSCStatusOK; - /* - * look for the service which matches the provided interface - */ + // look for the service which matches the provided interface n = CFDictionaryGetCount(dict); if (n <= 0) { goto done; @@ -301,6 +370,7 @@ updatePPPStatus(SCDynamicStoreRef *storeP, CFNumberRef num; CFDictionaryRef p_setup; CFDictionaryRef p_state; + int32_t ppp_demand; int32_t ppp_status; CFStringRef service = NULL; CFStringRef s_key = (CFStringRef) keys[i]; @@ -324,14 +394,13 @@ updatePPPStatus(SCDynamicStoreRef *storeP, continue; // if not this interface } - /* - * extract service ID, get PPP "state" entity (for status), and get - * the "setup" entity (for dial-on-traffic flag) - */ + // extract the service ID, get the PPP "state" entity for + // the "Status", and get the PPP "setup" entity for the + // the "DialOnDemand" flag components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/")); if (CFArrayGetCount(components) != 5) { CFRelease(components); - continue; + break; } service = CFArrayGetValueAtIndex(components, 3); key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, @@ -348,52 +417,63 @@ updatePPPStatus(SCDynamicStoreRef *storeP, CFRelease(key); CFRelease(components); - // get PPP status + // ensure that this is a PPP service if (!isA_CFDictionary(p_state)) { - continue; + break; } - num = CFDictionaryGetValue(p_state, kSCPropNetPPPStatus); - if (!isA_CFNumber(num)) { - continue; + + *flags |= kSCNetworkReachabilityFlagsTransientConnection; + + // get PPP server + if (ppp_server != NULL) { + *ppp_server = CFDictionaryGetValue(s_dict, CFSTR("ServerAddress")); + *ppp_server = isA_CFString(*ppp_server); + if (*ppp_server != NULL) { + CFRetain(*ppp_server); + } } - if (!CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_status)) { - continue; + // get PPP status + if (!CFDictionaryGetValueIfPresent(p_state, + kSCPropNetPPPStatus, + (const void **)&num) || + !isA_CFNumber(num) || + !CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_status)) { + break; } switch (ppp_status) { case PPP_RUNNING : - /* if we're really UP and RUNNING */ + // if we're really UP and RUNNING break; case PPP_ONHOLD : - /* if we're effectively UP and RUNNING */ + // if we're effectively UP and RUNNING break; case PPP_IDLE : case PPP_STATERESERVED : - /* if we're not connected at all */ - SCLog(_sc_debug, LOG_INFO, CFSTR(" PPP link idle, dial-on-traffic to connect")); - *flags |= kSCNetworkFlagsConnectionRequired; + // if we're not connected at all + SCLog(_sc_debug, LOG_INFO, CFSTR("%s PPP link idle, dial-on-traffic to connect"), + log_prefix); + *flags |= kSCNetworkReachabilityFlagsConnectionRequired; break; default : - /* if we're in the process of [dis]connecting */ - SCLog(_sc_debug, LOG_INFO, CFSTR(" PPP link, connection in progress")); - *flags |= kSCNetworkFlagsConnectionRequired; + // if we're in the process of [dis]connecting + SCLog(_sc_debug, LOG_INFO, CFSTR("%s PPP link, connection in progress"), + log_prefix); + *flags |= kSCNetworkReachabilityFlagsConnectionRequired; break; } - // check PPP dial-on-traffic status - if (isA_CFDictionary(p_setup)) { - num = CFDictionaryGetValue(p_setup, kSCPropNetPPPDialOnDemand); - if (isA_CFNumber(num)) { - int32_t ppp_demand; - - if (CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_demand)) { - if (ppp_demand) { - *flags |= kSCNetworkFlagsConnectionAutomatic; - if (ppp_status == PPP_IDLE) { - *flags |= kSCNetworkFlagsInterventionRequired; - } - } - } + // get PPP dial-on-traffic status + if (isA_CFDictionary(p_setup) && + CFDictionaryGetValueIfPresent(p_setup, + kSCPropNetPPPDialOnDemand, + (const void **)&num) && + isA_CFNumber(num) && + CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_demand) && + (ppp_demand != 0)) { + *flags |= kSCNetworkReachabilityFlagsConnectionOnTraffic; + if (ppp_status == PPP_IDLE) { + *flags |= kSCNetworkReachabilityFlagsInterventionRequired; } } @@ -409,7 +489,6 @@ updatePPPStatus(SCDynamicStoreRef *storeP, done : if (dict != NULL) CFRelease(dict); - if (storeP != NULL) *storeP = store; return sc_status; } @@ -417,7 +496,8 @@ updatePPPStatus(SCDynamicStoreRef *storeP, static int updatePPPAvailable(SCDynamicStoreRef *storeP, const struct sockaddr *sa, - SCNetworkConnectionFlags *flags) + SCNetworkReachabilityFlags *flags, + const char *log_prefix) { CFDictionaryRef dict = NULL; CFStringRef entity; @@ -426,7 +506,7 @@ updatePPPAvailable(SCDynamicStoreRef *storeP, const void ** keys = keys_q; CFIndex n; int sc_status = kSCStatusReachabilityUnknown; - SCDynamicStoreRef store = (storeP != NULL) ? *storeP : NULL; + SCDynamicStoreRef store = *storeP; const void * values_q[N_QUICK]; const void ** values = values_q; @@ -448,14 +528,13 @@ updatePPPAvailable(SCDynamicStoreRef *storeP, if (store == NULL) { store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL); if (store == NULL) { - SCLog(_sc_debug, LOG_INFO, CFSTR(" status = unknown (could not access SCDynamicStore")); + SCLog(TRUE, LOG_ERR, CFSTR("updatePPPAvailable SCDynamicStoreCreate() failed")); goto done; } + *storeP = store; } - /* - * grab a snapshot of the PPP configuration from the dynamic store - */ + // grab a snapshot of the PPP configuration from the dynamic store { CFStringRef pattern; CFMutableArrayRef patterns; @@ -467,6 +546,12 @@ updatePPPAvailable(SCDynamicStoreRef *storeP, entity); CFArrayAppendValue(patterns, pattern); CFRelease(pattern); + pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainSetup, + kSCCompAnyRegex, + kSCEntNetInterface); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainSetup, kSCCompAnyRegex, @@ -477,16 +562,14 @@ updatePPPAvailable(SCDynamicStoreRef *storeP, CFRelease(patterns); } if (dict == NULL) { - /* if we could not access the dynamic store */ + // if we could not access the dynamic store goto done; } sc_status = kSCStatusOK; - /* - * look for an available service which will provide connectivity - * for the requested address family. - */ + // look for an available service which will provide connectivity + // for the requested address family. n = CFDictionaryGetCount(dict); if (n <= 0) { goto done; @@ -501,6 +584,8 @@ updatePPPAvailable(SCDynamicStoreRef *storeP, for (i = 0; i < n; i++) { CFArrayRef components; Boolean found = FALSE; + CFStringRef i_key; + CFDictionaryRef i_dict; CFStringRef p_key; CFDictionaryRef p_dict; CFStringRef service; @@ -523,7 +608,7 @@ updatePPPAvailable(SCDynamicStoreRef *storeP, } service = CFArrayGetValueAtIndex(components, 3); - // check for PPP entity + // check for [non-VPN] PPP entity p_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainSetup, service, @@ -531,35 +616,43 @@ updatePPPAvailable(SCDynamicStoreRef *storeP, p_dict = CFDictionaryGetValue(dict, p_key); CFRelease(p_key); - if (isA_CFDictionary(p_dict)) { + i_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainSetup, + service, + kSCEntNetInterface); + i_dict = CFDictionaryGetValue(dict, i_key); + CFRelease(i_key); + + if (isA_CFDictionary(p_dict) && + isA_CFDictionary(i_dict) && + CFDictionaryContainsKey(i_dict, kSCPropNetInterfaceDeviceName)) { CFNumberRef num; - /* - * we have a PPP service for this address family - */ + // we have a PPP service for this address family found = TRUE; - *flags |= kSCNetworkFlagsReachable; - *flags |= kSCNetworkFlagsTransientConnection; - *flags |= kSCNetworkFlagsConnectionRequired; + *flags |= kSCNetworkReachabilityFlagsReachable; + *flags |= kSCNetworkReachabilityFlagsTransientConnection; + *flags |= kSCNetworkReachabilityFlagsConnectionRequired; - /* - * get PPP dial-on-traffic status - */ + // get PPP dial-on-traffic status num = CFDictionaryGetValue(p_dict, kSCPropNetPPPDialOnDemand); if (isA_CFNumber(num)) { int32_t ppp_demand; if (CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_demand)) { if (ppp_demand) { - *flags |= kSCNetworkFlagsConnectionAutomatic; + *flags |= kSCNetworkReachabilityFlagsConnectionOnTraffic; } } } if (_sc_debug) { - SCLog(TRUE, LOG_INFO, CFSTR(" status = isReachable (after connect)")); - SCLog(TRUE, LOG_INFO, CFSTR(" service = %@"), service); + SCLog(TRUE, LOG_INFO, CFSTR("%s status = isReachable (after connect)"), + log_prefix); + SCLog(TRUE, LOG_INFO, CFSTR("%s service = %@"), + log_prefix, + service); } } @@ -579,11 +672,170 @@ updatePPPAvailable(SCDynamicStoreRef *storeP, done : if (dict != NULL) CFRelease(dict); - if (storeP != NULL) *storeP = store; return sc_status; } +static int +updateIPSecStatus(SCDynamicStoreRef *storeP, + const struct sockaddr *sa, + const char *if_name, + SCNetworkReachabilityFlags *flags, + CFStringRef *ipsec_server) +{ + CFDictionaryRef dict = NULL; + CFStringRef entity; + CFIndex i; + CFStringRef ipsec_if; + const void * keys_q[N_QUICK]; + const void ** keys = keys_q; + CFIndex n; + int sc_status = kSCStatusReachabilityUnknown; + SCDynamicStoreRef store = *storeP; + const void * values_q[N_QUICK]; + const void ** values = values_q; + + switch (sa->sa_family) { + case AF_INET : + entity = kSCEntNetIPv4; + break; + case AF_INET6 : + entity = kSCEntNetIPv6; + break; + default : + goto done; + } + + if (store == NULL) { + store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL); + if (store == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("updateIPSecStatus SCDynamicStoreCreate() failed")); + goto done; + } + *storeP = store; + } + + // grab a snapshot of the IPSec configuration from the dynamic store + { + CFStringRef pattern; + CFMutableArrayRef patterns; + + patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainState, + kSCCompAnyRegex, + entity); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainSetup, + kSCCompAnyRegex, + kSCEntNetIPSec); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + dict = SCDynamicStoreCopyMultiple(store, NULL, patterns); + CFRelease(patterns); + } + if (dict == NULL) { + // if we could not access the dynamic store + goto done; + } + + sc_status = kSCStatusOK; + + // look for the service which matches the provided interface + n = CFDictionaryGetCount(dict); + if (n <= 0) { + goto done; + } + + ipsec_if = CFStringCreateWithCStringNoCopy(NULL, + if_name, + kCFStringEncodingASCII, + kCFAllocatorNull); + + if (n > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) { + keys = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0); + values = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0); + } + CFDictionaryGetKeysAndValues(dict, keys, values); + + for (i=0; i < n; i++) { + CFArrayRef components; + CFStringRef key; + CFDictionaryRef i_setup; + CFStringRef service = NULL; + CFStringRef s_key = (CFStringRef) keys[i]; + CFDictionaryRef s_dict = (CFDictionaryRef)values[i]; + CFStringRef s_if; + + if (!isA_CFString(s_key) || !isA_CFDictionary(s_dict)) { + continue; + } + + if (!CFStringHasSuffix(s_key, entity)) { + continue; // if not an IPv4 or IPv6 entity + } + + s_if = CFDictionaryGetValue(s_dict, kSCPropInterfaceName); + if (!isA_CFString(s_if)) { + continue; // if no interface + } + + if (!CFEqual(ipsec_if, s_if)) { + continue; // if not this interface + } + + // extract the service ID and get the IPSec "setup" entity + // to confirm that we're looking at what we're expecting + components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/")); + if (CFArrayGetCount(components) != 5) { + CFRelease(components); + break; + } + service = CFArrayGetValueAtIndex(components, 3); + key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainSetup, + service, + kSCEntNetIPSec); + i_setup = CFDictionaryGetValue(dict, key); + CFRelease(key); + CFRelease(components); + + // ensure that this is an IPSec service + if (!isA_CFDictionary(i_setup)) { + break; + } + + *flags |= kSCNetworkReachabilityFlagsTransientConnection; + + // get IPSec server + if (ipsec_server != NULL) { + *ipsec_server = CFDictionaryGetValue(s_dict, CFSTR("ServerAddress")); + *ipsec_server = isA_CFString(*ipsec_server); + if (*ipsec_server != NULL) { + CFRetain(*ipsec_server); + } + } + + break; + } + + CFRelease(ipsec_if); + if (keys != keys_q) { + CFAllocatorDeallocate(NULL, keys); + CFAllocatorDeallocate(NULL, values); + } + + done : + + if (dict != NULL) CFRelease(dict); + return sc_status; +} + + + + #define ROUNDUP(a, size) \ (((a) & ((size)-1)) ? (1 + ((a) | ((size)-1))) : (a)) @@ -609,76 +861,50 @@ get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info) #define BUFLEN (sizeof(struct rt_msghdr) + 512) /* 8 * sizeof(struct sockaddr_in6) = 192 */ -static Boolean -checkAddress(SCDynamicStoreRef *storeP, - const struct sockaddr *address, - SCNetworkConnectionFlags *flags, - uint16_t *if_index) -{ + +typedef struct { char buf[BUFLEN]; - struct ifreq ifr; - char if_name[IFNAMSIZ + 1]; - int isock; + int error; + struct sockaddr *rti_info[RTAX_MAX]; + struct rt_msghdr *rtm; + struct sockaddr_dl *sdl; +} route_info, *route_info_p; + + +/* + * route_get() + * returns zero if route exists an data returned, EHOSTUNREACH + * if no route, or errno for any other error. + */ +static int +route_get(const struct sockaddr *address, + route_info *info) +{ int n; pid_t pid = getpid(); int rsock; - struct sockaddr *rti_info[RTAX_MAX]; - struct rt_msghdr *rtm; struct sockaddr *sa; - int sc_status = kSCStatusReachabilityUnknown; - struct sockaddr_dl *sdl; int32_t seq = OSAtomicIncrement32Barrier(&rtm_seq); - SCDynamicStoreRef store = (storeP != NULL) ? *storeP : NULL; - char *statusMessage = NULL; #ifndef RTM_GET_SILENT #warning Note: Using RTM_GET (and not RTM_GET_SILENT) static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; int sosize = 48 * 1024; #endif - *flags = 0; - if (if_index != NULL) { - *if_index = 0; - } - - if (address == NULL) { - /* special case: check only for available paths off the system */ - goto checkAvailable; - } - - switch (address->sa_family) { - case AF_INET : - case AF_INET6 : - if (_sc_debug) { - _SC_sockaddr_to_string(address, buf, sizeof(buf)); - SCLog(TRUE, LOG_INFO, CFSTR("checkAddress(%s)"), buf); - } - break; - default : - /* - * if no code for this address family (yet) - */ - SCLog(_sc_verbose, LOG_ERR, - CFSTR("checkAddress(): unexpected address family %d"), - address->sa_family); - sc_status = kSCStatusInvalidArgument; - goto done; - } - - bzero(&buf, sizeof(buf)); + bzero(info, sizeof(*info)); - rtm = (struct rt_msghdr *)&buf; - rtm->rtm_msglen = sizeof(struct rt_msghdr); - rtm->rtm_version = RTM_VERSION; + info->rtm = (struct rt_msghdr *)&info->buf; + info->rtm->rtm_msglen = sizeof(struct rt_msghdr); + info->rtm->rtm_version = RTM_VERSION; #ifdef RTM_GET_SILENT - rtm->rtm_type = RTM_GET_SILENT; + info->rtm->rtm_type = RTM_GET_SILENT; #else - rtm->rtm_type = RTM_GET; + info->rtm->rtm_type = RTM_GET; #endif - rtm->rtm_flags = RTF_STATIC|RTF_UP|RTF_HOST|RTF_GATEWAY; - rtm->rtm_addrs = RTA_DST|RTA_IFP; /* Both destination and device */ - rtm->rtm_pid = pid; - rtm->rtm_seq = seq; + info->rtm->rtm_flags = RTF_STATIC|RTF_UP|RTF_HOST|RTF_GATEWAY; + info->rtm->rtm_addrs = RTA_DST|RTA_IFP; /* Both destination and device */ + info->rtm->rtm_pid = pid; + info->rtm->rtm_seq = seq; switch (address->sa_family) { case AF_INET6: { @@ -695,52 +921,54 @@ checkAddress(SCDynamicStoreRef *storeP, } } - sa = (struct sockaddr *) (rtm + 1); + sa = (struct sockaddr *) (info->rtm + 1); bcopy(address, sa, address->sa_len); n = ROUNDUP(sa->sa_len, sizeof(uint32_t)); - rtm->rtm_msglen += n; + info->rtm->rtm_msglen += n; - sdl = (struct sockaddr_dl *) ((void *)sa + n); - sdl->sdl_family = AF_LINK; - sdl->sdl_len = sizeof (struct sockaddr_dl); - n = ROUNDUP(sdl->sdl_len, sizeof(uint32_t)); - rtm->rtm_msglen += n; + info->sdl = (struct sockaddr_dl *) ((void *)sa + n); + info->sdl->sdl_family = AF_LINK; + info->sdl->sdl_len = sizeof (struct sockaddr_dl); + n = ROUNDUP(info->sdl->sdl_len, sizeof(uint32_t)); + info->rtm->rtm_msglen += n; #ifndef RTM_GET_SILENT pthread_mutex_lock(&lock); #endif rsock = socket(PF_ROUTE, SOCK_RAW, 0); if (rsock == -1) { + int error = errno; + #ifndef RTM_GET_SILENT pthread_mutex_unlock(&lock); #endif - SCLog(TRUE, LOG_ERR, CFSTR("socket(PF_ROUTE) failed: %s"), strerror(errno)); - sc_status = kSCStatusFailed; - goto done; + SCLog(TRUE, LOG_ERR, CFSTR("socket(PF_ROUTE) failed: %s"), strerror(error)); + return error; } #ifndef RTM_GET_SILENT if (setsockopt(rsock, SOL_SOCKET, SO_RCVBUF, &sosize, sizeof(sosize)) == -1) { + int error = errno; + (void)close(rsock); pthread_mutex_unlock(&lock); - SCLog(TRUE, LOG_ERR, CFSTR("setsockopt(SO_RCVBUF) failed: %s"), strerror(errno)); - sc_status = kSCStatusFailed; - goto done; + SCLog(TRUE, LOG_ERR, CFSTR("setsockopt(SO_RCVBUF) failed: %s"), strerror(error)); + return error; } #endif - if (write(rsock, &buf, rtm->rtm_msglen) == -1) { - int err = errno; + if (write(rsock, &info->buf, info->rtm->rtm_msglen) == -1) { + int error = errno; (void)close(rsock); #ifndef RTM_GET_SILENT pthread_mutex_unlock(&lock); #endif - if (err != ESRCH) { - SCLog(TRUE, LOG_ERR, CFSTR("write() failed: %s"), strerror(err)); - goto done; + if (error != ESRCH) { + SCLog(TRUE, LOG_ERR, CFSTR("write() failed: %s"), strerror(error)); + return error; } - goto checkAvailable; + return EHOSTUNREACH; } /* @@ -750,113 +978,190 @@ checkAddress(SCDynamicStoreRef *storeP, do { int n; - n = read(rsock, (void *)&buf, sizeof(buf)); + n = read(rsock, (void *)&info->buf, sizeof(info->buf)); if (n == -1) { - int err = errno; + if (errno != EINTR) { + int error = errno; - if (err != EINTR) { (void)close(rsock); - SCLog(TRUE, LOG_ERR, CFSTR("read() failed: %s"), strerror(err)); #ifndef RTM_GET_SILENT pthread_mutex_unlock(&lock); #endif - goto done; + SCLog(TRUE, LOG_ERR, CFSTR("read() failed: %s"), strerror(error)); + return error; } } - } while (rtm->rtm_type != RTM_GET || - rtm->rtm_seq != seq || - rtm->rtm_pid != pid); + } while ((info->rtm->rtm_type != RTM_GET) || + (info->rtm->rtm_seq != seq) || + (info->rtm->rtm_pid != pid)); (void)close(rsock); #ifndef RTM_GET_SILENT pthread_mutex_unlock(&lock); #endif - get_rtaddrs(rtm->rtm_addrs, sa, rti_info); + get_rtaddrs(info->rtm->rtm_addrs, sa, info->rti_info); -#ifdef DEBUG -{ - int i; - char buf[200]; +#ifdef LOG_RTADDRS + { + int i; - SCLog(_sc_debug, LOG_DEBUG, CFSTR("rtm_flags = 0x%8.8x"), rtm->rtm_flags); + SCLog(_sc_debug, LOG_DEBUG, CFSTR("rtm_flags = 0x%8.8x"), info->rtm->rtm_flags); - if ((rti_info[RTAX_NETMASK] != NULL) && (rti_info[RTAX_DST] != NULL)) { - rti_info[RTAX_NETMASK]->sa_family = rti_info[RTAX_DST]->sa_family; - } + if ((info->rti_info[RTAX_NETMASK] != NULL) && (info->rti_info[RTAX_DST] != NULL)) { + info->rti_info[RTAX_NETMASK]->sa_family = info->rti_info[RTAX_DST]->sa_family; + } - for (i = 0; i < RTAX_MAX; i++) { - if (rti_info[i] != NULL) { - _SC_sockaddr_to_string(rti_info[i], buf, sizeof(buf)); - SCLog(_sc_debug, LOG_DEBUG, CFSTR("%d: %s"), i, buf); + for (i = 0; i < RTAX_MAX; i++) { + if (info->rti_info[i] != NULL) { + char addr[128]; + + _SC_sockaddr_to_string(info->rti_info[i], addr, sizeof(addr)); + SCLog(_sc_debug, LOG_DEBUG, CFSTR("%d: %s"), i, addr); + } } } -} -#endif /* DEBUG */ +#endif /* LOG_RTADDRS */ - if ((rti_info[RTAX_IFP] == NULL) || - (rti_info[RTAX_IFP]->sa_family != AF_LINK)) { + if ((info->rti_info[RTAX_IFP] == NULL) || + (info->rti_info[RTAX_IFP]->sa_family != AF_LINK)) { /* no interface info */ - goto done; + SCLog(TRUE, LOG_DEBUG, CFSTR("route_get() no interface info")); + return EINVAL; } - sdl = (struct sockaddr_dl *) rti_info[RTAX_IFP]; - if ((sdl->sdl_nlen == 0) || (sdl->sdl_nlen > IFNAMSIZ)) { + info->sdl = (struct sockaddr_dl *) info->rti_info[RTAX_IFP]; + if ((info->sdl->sdl_nlen == 0) || (info->sdl->sdl_nlen > IFNAMSIZ)) { /* no interface name */ - goto checkAvailable; + return EHOSTUNREACH; } - /* get the interface flags */ + return 0; +} - bzero(&ifr, sizeof(ifr)); - bcopy(sdl->sdl_data, ifr.ifr_name, sdl->sdl_nlen); + +static Boolean +checkAddress(SCDynamicStoreRef *storeP, + const struct sockaddr *address, + ReachabilityInfo *reach_info, + const char *log_prefix) +{ + route_info info; + struct ifreq ifr; + char if_name[IFNAMSIZ + 1]; + int isock = -1; + int ret; + int sc_status = kSCStatusReachabilityUnknown; + CFStringRef server = NULL; + char *statusMessage = NULL; + struct sockaddr_in v4mapped; + + *reach_info = NOT_REACHABLE; + + if (address == NULL) { + /* special case: check only for available paths off the system */ + goto checkAvailable; + } + + switch (address->sa_family) { + case AF_INET : + case AF_INET6 : + if (_sc_debug) { + char addr[128]; + + _SC_sockaddr_to_string(address, addr, sizeof(addr)); + SCLog(TRUE, LOG_INFO, CFSTR("%scheckAddress(%s)"), + log_prefix, + addr); + } + break; + default : + /* + * if no code for this address family (yet) + */ + SCLog(TRUE, LOG_INFO, + CFSTR("checkAddress(): unexpected address family %d"), + address->sa_family); + sc_status = kSCStatusInvalidArgument; + goto done; + } + + if (address->sa_family == AF_INET6) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)address; + + if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { + bzero(&v4mapped, sizeof(v4mapped)); + v4mapped.sin_len = sizeof(v4mapped); + v4mapped.sin_family = AF_INET; + v4mapped.sin_port = sin6->sin6_port; + v4mapped.sin_addr.s_addr = sin6->sin6_addr.__u6_addr.__u6_addr32[3]; + address = (struct sockaddr *)&v4mapped; + } + } + + ret = route_get(address, &info); + switch (ret) { + case 0 : + break; + case EHOSTUNREACH : + // if no route + goto checkAvailable; + default : + // if error + sc_status = ret; + goto done; + } + + /* get the interface flags */ isock = socket(AF_INET, SOCK_DGRAM, 0); if (isock == -1) { - SCLog(TRUE, LOG_NOTICE, CFSTR("socket() failed: %s"), strerror(errno)); + SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno)); goto done; } + bzero(&ifr, sizeof(ifr)); + bcopy(info.sdl->sdl_data, ifr.ifr_name, info.sdl->sdl_nlen); + if (ioctl(isock, SIOCGIFFLAGS, (char *)&ifr) == -1) { - SCLog(TRUE, LOG_NOTICE, CFSTR("ioctl() failed: %s"), strerror(errno)); - (void)close(isock); + SCLog(TRUE, LOG_ERR, CFSTR("ioctl() failed: %s"), strerror(errno)); goto done; } - (void)close(isock); if (!(ifr.ifr_flags & IFF_UP)) { goto checkAvailable; } statusMessage = "isReachable"; - *flags |= kSCNetworkFlagsReachable; + reach_info->flags |= kSCNetworkReachabilityFlagsReachable; - if (rtm->rtm_flags & RTF_LOCAL) { + if (info.rtm->rtm_flags & RTF_LOCAL) { statusMessage = "isReachable (is a local address)"; - *flags |= kSCNetworkFlagsIsLocalAddress; + reach_info->flags |= kSCNetworkReachabilityFlagsIsLocalAddress; } else if (ifr.ifr_flags & IFF_LOOPBACK) { statusMessage = "isReachable (is loopback network)"; - *flags |= kSCNetworkFlagsIsLocalAddress; - } else if (rti_info[RTAX_IFA]) { + reach_info->flags |= kSCNetworkReachabilityFlagsIsLocalAddress; + } else if ((info.rti_info[RTAX_IFA] != NULL) && + (info.rti_info[RTAX_IFA]->sa_family != AF_LINK)) { void *addr1 = (void *)address; - void *addr2 = (void *)rti_info[RTAX_IFA]; + void *addr2 = (void *)info.rti_info[RTAX_IFA]; size_t len = address->sa_len; - if ((address->sa_family != rti_info[RTAX_IFA]->sa_family) && - (address->sa_len != rti_info[RTAX_IFA]->sa_len)) { + if ((address->sa_family != info.rti_info[RTAX_IFA]->sa_family) && + (address->sa_len != info.rti_info[RTAX_IFA]->sa_len)) { SCLog(TRUE, LOG_NOTICE, CFSTR("address family/length mismatch: %d/%d != %d/%d"), address->sa_family, address->sa_len, - rti_info[RTAX_IFA]->sa_family, - rti_info[RTAX_IFA]->sa_len); + info.rti_info[RTAX_IFA]->sa_family, + info.rti_info[RTAX_IFA]->sa_len); goto done; } switch (address->sa_family) { case AF_INET : addr1 = &((struct sockaddr_in *)address)->sin_addr; - addr2 = &((struct sockaddr_in *)rti_info[RTAX_IFA])->sin_addr; + addr2 = &((struct sockaddr_in *)info.rti_info[RTAX_IFA])->sin_addr; len = sizeof(struct in_addr); /* @@ -864,76 +1169,83 @@ checkAddress(SCDynamicStoreRef *storeP, */ if (((struct sockaddr_in *)address)->sin_addr.s_addr == 0) { statusMessage = "isReachable (this host)"; - *flags |= kSCNetworkFlagsIsLocalAddress; + reach_info->flags |= kSCNetworkReachabilityFlagsIsLocalAddress; } break; case AF_INET6 : addr1 = &((struct sockaddr_in6 *)address)->sin6_addr; - addr2 = &((struct sockaddr_in6 *)rti_info[RTAX_IFA])->sin6_addr; + addr2 = &((struct sockaddr_in6 *)info.rti_info[RTAX_IFA])->sin6_addr; len = sizeof(struct in6_addr); break; default : break; } - if (memcmp(addr1, addr2, len) == 0) { + if (bcmp(addr1, addr2, len) == 0) { statusMessage = "isReachable (is interface address)"; - *flags |= kSCNetworkFlagsIsLocalAddress; + reach_info->flags |= kSCNetworkReachabilityFlagsIsLocalAddress; } } - if (!(rtm->rtm_flags & RTF_GATEWAY) && - (rti_info[RTAX_GATEWAY] != NULL) && - (rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) && + if (!(info.rtm->rtm_flags & RTF_GATEWAY) && + (info.rti_info[RTAX_GATEWAY] != NULL) && + (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) && !(ifr.ifr_flags & IFF_POINTOPOINT)) { - *flags |= kSCNetworkFlagsIsDirect; + reach_info->flags |= kSCNetworkReachabilityFlagsIsDirect; } bzero(&if_name, sizeof(if_name)); - bcopy(sdl->sdl_data, + bcopy(info.sdl->sdl_data, if_name, - (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ); + (info.sdl->sdl_nlen <= IFNAMSIZ) ? info.sdl->sdl_nlen : IFNAMSIZ); - if (if_index != NULL) { - *if_index = sdl->sdl_index; - } + reach_info->if_index = info.sdl->sdl_index; if (_sc_debug) { - SCLog(TRUE, LOG_INFO, CFSTR(" status = %s"), statusMessage); - SCLog(TRUE, LOG_INFO, CFSTR(" device = %s (%hu)"), if_name, sdl->sdl_index); - SCLog(TRUE, LOG_INFO, CFSTR(" ifr_flags = 0x%04hx"), ifr.ifr_flags); - SCLog(TRUE, LOG_INFO, CFSTR(" rtm_flags = 0x%08x"), rtm->rtm_flags); + SCLog(TRUE, LOG_INFO, CFSTR("%s status = %s"), log_prefix, statusMessage); + SCLog(TRUE, LOG_INFO, CFSTR("%s device = %s (%hu)"), log_prefix, if_name, info.sdl->sdl_index); + SCLog(TRUE, LOG_INFO, CFSTR("%s sdl_type = 0x%x"), log_prefix, info.sdl->sdl_type); + SCLog(TRUE, LOG_INFO, CFSTR("%s ifr_flags = 0x%04hx"), log_prefix, ifr.ifr_flags); + SCLog(TRUE, LOG_INFO, CFSTR("%s rtm_flags = 0x%08x"), log_prefix, info.rtm->rtm_flags); } sc_status = kSCStatusOK; if (ifr.ifr_flags & IFF_POINTOPOINT) { + reach_info->flags |= kSCNetworkReachabilityFlagsTransientConnection; + } + + if (info.sdl->sdl_type == IFT_PPP) { /* - * We have an interface which "claims" to be a valid path - * off of the system. + * 1. check if PPP service + * 2. check for dial-on-demand PPP link that is not yet connected + * 3. get PPP server address */ - *flags |= kSCNetworkFlagsTransientConnection; - + sc_status = updatePPPStatus(storeP, address, if_name, &reach_info->flags, &server, log_prefix); + } else if (info.sdl->sdl_type == IFT_OTHER) { /* - * Check if this is a dial-on-demand PPP link that isn't - * connected yet. + * 1. check if IPSec service + * 2. get IPSec server address */ - sc_status = updatePPPStatus(&store, address, if_name, flags); + sc_status = updateIPSecStatus(storeP, address, if_name, &reach_info->flags, &server); } + goto done; checkAvailable : - sc_status = updatePPPAvailable(&store, address, flags); + + sc_status = updatePPPAvailable(storeP, address, &reach_info->flags, log_prefix); done : - if (*flags == 0) { - SCLog(_sc_debug, LOG_INFO, CFSTR(" cannot be reached")); + if (reach_info->flags == 0) { + SCLog(_sc_debug, LOG_INFO, CFSTR("%s cannot be reached"), log_prefix); } - if (storeP != NULL) *storeP = store; + if (isock != -1) (void)close(isock); + if (server != NULL) CFRelease(server); if (sc_status != kSCStatusOK) { _SCErrorSet(sc_status); return FALSE; @@ -943,6 +1255,10 @@ checkAddress(SCDynamicStoreRef *storeP, } +#pragma mark - +#pragma mark SCNetworkReachability APIs + + static CFStringRef __SCNetworkReachabilityCopyDescription(CFTypeRef cf) { @@ -1014,12 +1330,12 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf) break; } } - if (targetPrivate->rls != NULL) { + if (targetPrivate->scheduled) { CFStringAppendFormat(result, NULL, - CFSTR(", flags = %8.8x, if_index = %hu"), - targetPrivate->flags, - targetPrivate->if_index); + CFSTR(", flags = 0x%08x, if_index = %hu"), + targetPrivate->info.flags, + targetPrivate->info.if_index); } CFStringAppendFormat(result, NULL, CFSTR("}")); @@ -1055,6 +1371,22 @@ __SCNetworkReachabilityDeallocate(CFTypeRef cf) (*targetPrivate->rlsContext.release)(targetPrivate->rlsContext.info); } + if (targetPrivate->onDemandName != NULL) { + CFRelease(targetPrivate->onDemandName); + } + + if (targetPrivate->onDemandRemoteAddress != NULL) { + CFRelease(targetPrivate->onDemandRemoteAddress); + } + + if (targetPrivate->onDemandServer != NULL) { + CFRelease(targetPrivate->onDemandServer); + } + + if (targetPrivate->onDemandServiceID != NULL) { + CFRelease(targetPrivate->onDemandServiceID); + } + return; } @@ -1067,6 +1399,29 @@ __SCNetworkReachabilityInitialize(void) } +static void +__SCNetworkReachabilityPerform(SCNetworkReachabilityRef target) +{ + SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; + +#if !TARGET_OS_IPHONE + if (targetPrivate->dispatchQueue != NULL) { + CFRetain(target); + dispatch_async(targetPrivate->dispatchQueue, + ^{ + rlsPerform((void *)target); + CFRelease(target); + }); + } else +#endif // !TARGET_OS_IPHONE + if (targetPrivate->rls != NULL) { + CFRunLoopSourceSignal(targetPrivate->rls); + _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList); + } + + return; +} + static SCNetworkReachabilityPrivateRef __SCNetworkReachabilityCreatePrivate(CFAllocatorRef allocator) { @@ -1096,15 +1451,17 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef allocator) targetPrivate->hints.ai_flags |= AI_PARALLEL; #endif /* AI_PARALLEL */ + targetPrivate->needResolve = FALSE; targetPrivate->resolvedAddress = NULL; targetPrivate->resolvedAddressError = NETDB_SUCCESS; targetPrivate->localAddress = NULL; targetPrivate->remoteAddress = NULL; - targetPrivate->flags = 0; - targetPrivate->if_index = 0; + targetPrivate->info = NOT_REACHABLE; + targetPrivate->last_notify = NOT_REPORTED; + targetPrivate->scheduled = FALSE; targetPrivate->rls = NULL; targetPrivate->rlsFunction = NULL; targetPrivate->rlsContext.info = NULL; @@ -1114,9 +1471,24 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef allocator) targetPrivate->rlList = NULL; targetPrivate->haveDNS = FALSE; + targetPrivate->dnsMP = MACH_PORT_NULL; targetPrivate->dnsPort = NULL; targetPrivate->dnsRLS = NULL; + targetPrivate->onDemandBypass = FALSE; + targetPrivate->onDemandName = NULL; + targetPrivate->onDemandRemoteAddress = NULL; + targetPrivate->onDemandServer = NULL; + targetPrivate->onDemandServiceID = NULL; + + targetPrivate->log_prefix[0] = '\0'; + if (_sc_log > 0) { + snprintf(targetPrivate->log_prefix, + sizeof(targetPrivate->log_prefix), + "[%p] ", + targetPrivate); + } + return targetPrivate; } @@ -1248,11 +1620,12 @@ SCNetworkReachabilityCreateWithName(CFAllocatorRef allocator, targetPrivate->type = reachabilityTypeName; - targetPrivate->flags |= kSCNetworkFlagsFirstResolvePending; - targetPrivate->name = CFAllocatorAllocate(NULL, nodenameLen + 1, 0); strlcpy((char *)targetPrivate->name, nodename, nodenameLen + 1); + targetPrivate->needResolve = TRUE; + targetPrivate->info.flags |= kSCNetworkReachabilityFlagsFirstResolvePending; + return (SCNetworkReachabilityRef)targetPrivate; } @@ -1261,8 +1634,10 @@ SCNetworkReachabilityRef SCNetworkReachabilityCreateWithOptions(CFAllocatorRef allocator, CFDictionaryRef options) { + CFBooleanRef bypass; CFDataRef data; struct addrinfo *hints = NULL; + const char *name; CFStringRef nodename; CFStringRef servname; SCNetworkReachabilityPrivateRef targetPrivate; @@ -1300,25 +1675,34 @@ SCNetworkReachabilityCreateWithOptions(CFAllocatorRef allocator, return NULL; } } + bypass = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionConnectionOnDemandByPass); + if ((bypass != NULL) && !isA_CFBoolean(bypass)) { + _SCErrorSet(kSCStatusInvalidArgument); + return NULL; + } if ((nodename == NULL) && (servname == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return NULL; } - targetPrivate = __SCNetworkReachabilityCreatePrivate(allocator); + name = _SC_cfstring_to_cstring(nodename, NULL, 0, kCFStringEncodingUTF8); + targetPrivate = (SCNetworkReachabilityPrivateRef)SCNetworkReachabilityCreateWithName(allocator, name); + CFAllocatorDeallocate(NULL, (void *)name); if (targetPrivate == NULL) { return NULL; } - targetPrivate->type = reachabilityTypeName; - targetPrivate->flags |= kSCNetworkFlagsFirstResolvePending; - if (nodename != NULL) { - targetPrivate->name = _SC_cfstring_to_cstring(nodename, NULL, 0, kCFStringEncodingUTF8); - } - if (servname != NULL) { - targetPrivate->serv = _SC_cfstring_to_cstring(servname, NULL, 0, kCFStringEncodingUTF8); + + if (targetPrivate->type == reachabilityTypeName) { + if (servname != NULL) { + targetPrivate->serv = _SC_cfstring_to_cstring(servname, NULL, 0, kCFStringEncodingUTF8); + } + if (hints != NULL) { + bcopy(hints, &targetPrivate->hints, sizeof(targetPrivate->hints)); + } } - if (hints != NULL) { - bcopy(hints, &targetPrivate->hints, sizeof(targetPrivate->hints)); + + if (bypass != NULL) { + targetPrivate->onDemandBypass = CFBooleanGetValue(bypass); } return (SCNetworkReachabilityRef)targetPrivate; @@ -1333,7 +1717,7 @@ SCNetworkReachabilityGetTypeID(void) } -CFArrayRef +CFArrayRef /* CFArray[CFData], where each CFData is a (struct sockaddr *) */ SCNetworkReachabilityCopyResolvedAddress(SCNetworkReachabilityRef target, int *error_num) { @@ -1382,16 +1766,20 @@ __SCNetworkReachabilitySetResolvedAddress(int32_t status, } if ((status == 0) && (res != NULL)) { - CFMutableArrayRef addresses; addresses = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); for (resP = res; resP; resP = resP->ai_next) { + CFIndex n; CFDataRef newAddress; newAddress = CFDataCreate(NULL, (void *)resP->ai_addr, resP->ai_addr->sa_len); - CFArrayAppendValue(addresses, newAddress); + n = CFArrayGetCount(addresses); + if ((n == 0) || + !CFArrayContainsValue(addresses, CFRangeMake(0, n), newAddress)) { + CFArrayAppendValue(addresses, newAddress); + } CFRelease(newAddress); } @@ -1399,19 +1787,20 @@ __SCNetworkReachabilitySetResolvedAddress(int32_t status, targetPrivate->resolvedAddress = addresses; targetPrivate->resolvedAddressError = NETDB_SUCCESS; } else { - SCLog(_sc_debug, LOG_INFO, CFSTR("getaddrinfo() failed: %s"), gai_strerror(status)); + SCLog(_sc_debug, LOG_INFO, CFSTR("%sgetaddrinfo() failed: %s"), + targetPrivate->log_prefix, + gai_strerror(status)); /* save the error associated with the attempt to resolve the name */ targetPrivate->resolvedAddress = CFRetain(kCFNull); targetPrivate->resolvedAddressError = status; } + targetPrivate->needResolve = FALSE; if (res != NULL) freeaddrinfo(res); - if (targetPrivate->rls != NULL) { - SCLog(_sc_debug, LOG_INFO, CFSTR("DNS request completed")); - CFRunLoopSourceSignal(targetPrivate->rls); - _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList); + if (targetPrivate->scheduled) { + __SCNetworkReachabilityPerform(target); } return; @@ -1424,7 +1813,8 @@ __SCNetworkReachabilityCallbackSetResolvedAddress(int32_t status, struct addrinf SCNetworkReachabilityRef target = (SCNetworkReachabilityRef)context; SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; - __log_query_time(((status == 0) && (res != NULL)), // if successful query + __log_query_time(target, + ((status == 0) && (res != NULL)), // if successful query TRUE, // async &targetPrivate->dnsQueryStart); // start time @@ -1440,42 +1830,223 @@ __SCNetworkReachabilityCallbackSetResolvedAddress(int32_t status, struct addrinf * Reachable == 2 */ static int -rankReachability(SCNetworkConnectionFlags flags) +rankReachability(SCNetworkReachabilityFlags flags) { int rank = 0; - if (flags & kSCNetworkFlagsReachable) rank = 2; - if (flags & kSCNetworkFlagsConnectionRequired) rank = 1; + if (flags & kSCNetworkReachabilityFlagsReachable) rank = 2; + if (flags & kSCNetworkReachabilityFlagsConnectionRequired) rank = 1; return rank; } +#pragma mark - +#pragma mark DNS name resolution + + +static CFStringRef +replyMPCopyDescription(const void *info) +{ + SCNetworkReachabilityRef target = (SCNetworkReachabilityRef)info; + SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; + + return CFStringCreateWithFormat(NULL, + NULL, + CFSTR(" {%s%s%s%s%s, target = %p}"), + targetPrivate->name != NULL ? "name = " : "", + targetPrivate->name != NULL ? targetPrivate->name : "", + targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "", + targetPrivate->serv != NULL ? "serv = " : "", + targetPrivate->serv != NULL ? targetPrivate->serv : "", + target); +} + + +static void +processAsyncDNSReply(mach_port_t mp, void *msg, SCNetworkReachabilityRef target); + + static void getaddrinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info) +{ + mach_port_t mp = CFMachPortGetPort(port); + SCNetworkReachabilityRef target = (SCNetworkReachabilityRef)info; + + processAsyncDNSReply(mp, msg, target); + return; +} + + +#if !TARGET_OS_IPHONE +static boolean_t +SCNetworkReachabilityNotifyMIGCallback(mach_msg_header_t *message, mach_msg_header_t *reply) +{ + mach_port_t mp = message->msgh_local_port; + SCNetworkReachabilityRef target = dispatch_get_context(dispatch_get_current_queue()); + + processAsyncDNSReply(mp, message, target); + reply->msgh_remote_port = MACH_PORT_NULL; + return false; +} +#endif // !TARGET_OS_IPHONE + + +static Boolean +enqueueAsyncDNSQuery(SCNetworkReachabilityRef target, mach_port_t mp) +{ + CFMachPortContext context = { 0 + , (void *)target + , CFRetain + , CFRelease + , replyMPCopyDescription + }; + SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; + + targetPrivate->dnsMP = mp; + targetPrivate->dnsPort = CFMachPortCreateWithPort(NULL, + mp, + getaddrinfo_async_handleCFReply, + &context, + NULL); +#if !TARGET_OS_IPHONE + if (targetPrivate->dispatchQueue != NULL) { + dispatch_queue_attr_t attr; + long res; + + attr = dispatch_queue_attr_create(); + res = dispatch_queue_attr_set_finalizer(attr, + ^(dispatch_queue_t dq) { + SCNetworkReachabilityRef target; + + target = (SCNetworkReachabilityRef)dispatch_get_context(dq); + CFRelease(target); + }); + if (res != 0) { + SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkReachability dispatch_queue_attr_set_finalizer() failed")); + dispatch_release(attr); + goto fail; + } + targetPrivate->asyncDNSQueue = dispatch_queue_create("com.apple.SCNetworkReachabilty.async_DNS_query", attr); + dispatch_release(attr); + if (targetPrivate->asyncDNSQueue == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkReachability dispatch_queue_create() failed")); + goto fail; + } + CFRetain(target); // Note: will be released when the dispatch queue is released + dispatch_set_context(targetPrivate->asyncDNSQueue, (void *)target); + targetPrivate->asyncDNSSource = dispatch_source_mig_create(mp, + sizeof(mach_msg_header_t), + NULL, + targetPrivate->asyncDNSQueue, + SCNetworkReachabilityNotifyMIGCallback); + if (targetPrivate->asyncDNSSource == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkReachability dispatch_source_mig_create() failed")); + goto fail; + } + } else +#endif // !TARGET_OS_IPHONE + if (targetPrivate->rls != NULL) { + CFIndex i; + CFIndex n; + + targetPrivate->dnsRLS = CFMachPortCreateRunLoopSource(NULL, targetPrivate->dnsPort, 0); + + n = CFArrayGetCount(targetPrivate->rlList); + for (i = 0; i < n; i += 3) { + CFRunLoopRef rl = (CFRunLoopRef)CFArrayGetValueAtIndex(targetPrivate->rlList, i+1); + CFStringRef rlMode = (CFStringRef) CFArrayGetValueAtIndex(targetPrivate->rlList, i+2); + + CFRunLoopAddSource(rl, targetPrivate->dnsRLS, rlMode); + } + } + + return TRUE; + +#if !TARGET_OS_IPHONE + fail : + + if (targetPrivate->asyncDNSSource != NULL) { + dispatch_cancel(targetPrivate->asyncDNSSource); + dispatch_release(targetPrivate->asyncDNSSource); + targetPrivate->asyncDNSSource = NULL; + } + if (targetPrivate->asyncDNSQueue != NULL) { + dispatch_release(targetPrivate->asyncDNSQueue); + targetPrivate->asyncDNSQueue = NULL; + } + + CFMachPortInvalidate(targetPrivate->dnsPort); + CFRelease(targetPrivate->dnsPort); + targetPrivate->dnsPort = NULL; + targetPrivate->dnsMP = MACH_PORT_NULL; + + _SCErrorSet(kSCStatusFailed); + return FALSE; +#endif // !TARGET_OS_IPHONE +} + + +static void +dequeueAsyncDNSQuery(SCNetworkReachabilityRef target) +{ + SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; + +#if !TARGET_OS_IPHONE + if (targetPrivate->asyncDNSSource != NULL) { + dispatch_cancel(targetPrivate->asyncDNSSource); + dispatch_release(targetPrivate->asyncDNSSource); + targetPrivate->asyncDNSSource = NULL; + } + if (targetPrivate->asyncDNSQueue != NULL) { + dispatch_release(targetPrivate->asyncDNSQueue); + targetPrivate->asyncDNSQueue = NULL; + } +#endif // !TARGET_OS_IPHONE + + if (targetPrivate->dnsRLS != NULL) { + CFRelease(targetPrivate->dnsRLS); + targetPrivate->dnsRLS = NULL; + } + + CFMachPortInvalidate(targetPrivate->dnsPort); + CFRelease(targetPrivate->dnsPort); + targetPrivate->dnsPort = NULL; + targetPrivate->dnsMP = MACH_PORT_NULL; + + return; +} + + +static void +processAsyncDNSReply(mach_port_t mp, void *msg, SCNetworkReachabilityRef target) { int32_t status; - SCNetworkReachabilityRef target = (SCNetworkReachabilityRef)info; SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; pthread_mutex_lock(&targetPrivate->lock); + if (mp != targetPrivate->dnsMP) { + // we've received a callback on the async DNS port but since the + // associated CFMachPort doesn't match than the request must have + // already been cancelled. + SCLog(TRUE, LOG_ERR, CFSTR("processAsyncDNSReply(): mp != targetPrivate->dnsMP")); + pthread_mutex_unlock(&targetPrivate->lock); + return; + } + + dequeueAsyncDNSQuery(target); status = getaddrinfo_async_handle_reply(msg); if ((status == 0) && (targetPrivate->resolvedAddress == NULL) && (targetPrivate->resolvedAddressError == NETDB_SUCCESS)) { - // if request has been re-queued - goto again; - } + Boolean ok; - if (port == targetPrivate->dnsPort) { - CFRunLoopSourceInvalidate(targetPrivate->dnsRLS); - CFRelease(targetPrivate->dnsRLS); - targetPrivate->dnsRLS = NULL; - CFRelease(targetPrivate->dnsPort); - targetPrivate->dnsPort = NULL; + // if the request is not complete and needs to be re-queued + ok = enqueueAsyncDNSQuery(target, mp); + if (!ok) { + SCLog(TRUE, LOG_ERR, CFSTR("processAsyncDNSReply enqueueAsyncDNSQuery() failed")); + } } - again : - pthread_mutex_unlock(&targetPrivate->lock); return; @@ -1485,18 +2056,19 @@ getaddrinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, voi static Boolean check_resolver_reachability(SCDynamicStoreRef *storeP, dns_resolver_t *resolver, - SCNetworkConnectionFlags *flags, - Boolean *haveDNS) + SCNetworkReachabilityFlags *flags, + Boolean *haveDNS, + const char *log_prefix) { int i; Boolean ok = TRUE; - *flags = kSCNetworkFlagsReachable; + *flags = kSCNetworkReachabilityFlagsReachable; *haveDNS = FALSE; for (i = 0; i < resolver->n_nameserver; i++) { - struct sockaddr *address = resolver->nameserver[i]; - SCNetworkConnectionFlags ns_flags = 0; + struct sockaddr *address = resolver->nameserver[i]; + ReachabilityInfo ns_info; *haveDNS = TRUE; @@ -1509,15 +2081,15 @@ check_resolver_reachability(SCDynamicStoreRef *storeP, continue; } - ok = checkAddress(storeP, address, &ns_flags, NULL); + ok = checkAddress(storeP, address, &ns_info, log_prefix); if (!ok) { /* not today */ goto done; } - if (rankReachability(ns_flags) < rankReachability(*flags)) { + if (rankReachability(ns_info.flags) < rankReachability(*flags)) { /* return the worst case result */ - *flags = ns_flags; + *flags = ns_info.flags; } } @@ -1531,8 +2103,9 @@ static Boolean check_matching_resolvers(SCDynamicStoreRef *storeP, dns_config_t *dns_config, const char *fqdn, - SCNetworkConnectionFlags *flags, - Boolean *haveDNS) + SCNetworkReachabilityFlags *flags, + Boolean *haveDNS, + const char *log_prefix) { int i; Boolean matched = FALSE; @@ -1560,7 +2133,7 @@ check_matching_resolvers(SCDynamicStoreRef *storeP, * if name matches domain */ matched = TRUE; - ok = check_resolver_reachability(storeP, resolver, flags, haveDNS); + ok = check_resolver_reachability(storeP, resolver, flags, haveDNS, log_prefix); if (!ok) { /* not today */ return FALSE; @@ -1715,12 +2288,13 @@ dns_configuration_unwatch() } -Boolean -_SC_checkResolverReachability(SCDynamicStoreRef *storeP, - SCNetworkConnectionFlags *flags, - Boolean *haveDNS, - const char * nodename, - const char * servname) +static Boolean +_SC_R_checkResolverReachability(SCDynamicStoreRef *storeP, + SCNetworkReachabilityFlags *flags, + Boolean *haveDNS, + const char *nodename, + const char *servname, + const char *log_prefix) { dns_resolver_t *default_resolver; dns_configuration_t *dns; @@ -1730,6 +2304,7 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, Boolean isFQDN = FALSE; uint32_t len; Boolean ok = TRUE; + Boolean useDefault = FALSE; /* * We first assume that all of the configured DNS servers @@ -1739,7 +2314,7 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, * proceed if we know that our query can be answered. */ - *flags = kSCNetworkFlagsReachable; + *flags = kSCNetworkReachabilityFlagsReachable; *haveDNS = FALSE; len = (nodename != NULL) ? strlen(nodename) : 0; @@ -1754,15 +2329,17 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, dns = dns_configuration_retain(); if (dns == NULL) { // if error + SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS: no configuration"), log_prefix); goto done; } if (dns->config->n_resolver == 0) { // if no resolver configuration + SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS: no resolvers"), log_prefix); goto done; } - *flags = kSCNetworkFlagsReachable; + *flags = kSCNetworkReachabilityFlagsReachable; if (fqdn[len - 1] == '.') { isFQDN = TRUE; @@ -1779,12 +2356,54 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, default_resolver = dns->config->resolver[0]; /* - * try the provided name + * check if the provided name matches a supplemental domain */ - found = check_matching_resolvers(storeP, dns->config, fqdn, flags, haveDNS); - if (!found && !isFQDN && (dns->config->n_resolver > 1)) { + found = check_matching_resolvers(storeP, dns->config, fqdn, flags, haveDNS, log_prefix); + + if (!found && !isFQDN) { + /* + * if we did not match a supplemental domain name and if the + * provided name has enough "."s then the first query will be + * directed to the default resolver. + */ + char *cp; + int dots; + int ndots = 1; + +#define NDOTS_OPT "ndots=" +#define NDOTS_OPT_LEN (sizeof("ndots=") - 1) + + if (default_resolver->options != NULL) { + cp = strstr(default_resolver->options, NDOTS_OPT); + if ((cp != NULL) && + ((cp == default_resolver->options) || isspace(cp[-1])) && + ((cp[NDOTS_OPT_LEN] != '\0') && isdigit(cp[NDOTS_OPT_LEN]))) { + char *end; + long val; + + cp += NDOTS_OPT_LEN; + errno = 0; + val = strtol(cp, &end, 10); + if ((*cp != '\0') && (cp != end) && (errno == 0) && + ((*end == '\0') || isspace(*end))) { + ndots = val; + } + } + } + + dots = 0; + for (cp = fqdn; *cp != '\0'; cp++) { + if (*cp == '.') dots++; + } + + if (dots > ndots) { + useDefault = TRUE; + } + } + + if (!found && !isFQDN && !useDefault && (dns->config->n_resolver > 1)) { /* - * FQDN not specified, try w/search or default domain(s) too + * FQDN not specified, try matching w/search domains */ if (default_resolver->n_search > 0) { for (i = 0; !found && (i < default_resolver->n_search); i++) { @@ -1797,7 +2416,12 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, } // try the provided name with the search domain appended - found = check_matching_resolvers(storeP, dns->config, search_fqdn, flags, haveDNS); + found = check_matching_resolvers(storeP, + dns->config, + search_fqdn, + flags, + haveDNS, + log_prefix); free(search_fqdn); } } else if (default_resolver->domain != NULL) { @@ -1833,7 +2457,12 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, } // try the provided name with the [default] domain appended - found = check_matching_resolvers(storeP, dns->config, search_fqdn, flags, haveDNS); + found = check_matching_resolvers(storeP, + dns->config, + search_fqdn, + flags, + haveDNS, + log_prefix); free(search_fqdn); // move to the next component of the [default] domain @@ -1846,7 +2475,7 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, /* * check the reachability of the default resolver */ - ok = check_resolver_reachability(storeP, default_resolver, flags, haveDNS); + ok = check_resolver_reachability(storeP, default_resolver, flags, haveDNS, log_prefix); } if (fqdn != nodename) free(fqdn); @@ -1861,6 +2490,17 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, } +Boolean +_SC_checkResolverReachability(SCDynamicStoreRef *storeP, + SCNetworkReachabilityFlags *flags, + Boolean *haveDNS, + const char *nodename, + const char *servname) +{ + return _SC_R_checkResolverReachability(storeP, flags, haveDNS, nodename, servname, ""); +} + + /* * _SC_checkResolverReachabilityByAddress() * @@ -1868,10 +2508,10 @@ _SC_checkResolverReachability(SCDynamicStoreRef *storeP, * using the current network configuration. */ Boolean -_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef *storeP, - SCNetworkConnectionFlags *flags, - Boolean *haveDNS, - struct sockaddr *sa) +_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef *storeP, + SCNetworkReachabilityFlags *flags, + Boolean *haveDNS, + struct sockaddr *sa) { int i; Boolean ok = FALSE; @@ -1942,7 +2582,7 @@ _SC_checkResolverReachabilityByAddress(SCDynamicStoreRef *storeP, goto done; } - ok = _SC_checkResolverReachability(storeP, flags, haveDNS, ptr_name, NULL); + ok = _SC_R_checkResolverReachability(storeP, flags, haveDNS, ptr_name, NULL, ""); done : @@ -1950,41 +2590,16 @@ _SC_checkResolverReachabilityByAddress(SCDynamicStoreRef *storeP, } -static CFStringRef -replyMPCopyDescription(const void *info) -{ - SCNetworkReachabilityRef target = (SCNetworkReachabilityRef)info; - SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; - - return CFStringCreateWithFormat(NULL, - NULL, - CFSTR(" {%s%s%s%s%s, target = %p}"), - targetPrivate->name != NULL ? "name = " : "", - targetPrivate->name != NULL ? targetPrivate->name : "", - targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "", - targetPrivate->serv != NULL ? "serv = " : "", - targetPrivate->serv != NULL ? targetPrivate->serv : "", - target); -} - - static Boolean startAsyncDNSQuery(SCNetworkReachabilityRef target) { - CFMachPortContext context = { 0 - , (void *)target - , CFRetain - , CFRelease - , replyMPCopyDescription - }; int error; - CFIndex i; - CFIndex n; - mach_port_t port; + mach_port_t mp; + Boolean ok; SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; (void) gettimeofday(&targetPrivate->dnsQueryStart, NULL); - error = getaddrinfo_async_start(&port, + error = getaddrinfo_async_start(&mp, targetPrivate->name, targetPrivate->serv, &targetPrivate->hints, @@ -1996,64 +2611,273 @@ startAsyncDNSQuery(SCNetworkReachabilityRef target) { return FALSE; } - targetPrivate->dnsPort = CFMachPortCreateWithPort(NULL, - port, - getaddrinfo_async_handleCFReply, - &context, - NULL); - targetPrivate->dnsRLS = CFMachPortCreateRunLoopSource(NULL, targetPrivate->dnsPort, 0); - - n = CFArrayGetCount(targetPrivate->rlList); - for (i = 0; i < n; i += 3) { - CFRunLoopRef rl = (CFRunLoopRef)CFArrayGetValueAtIndex(targetPrivate->rlList, i+1); - CFStringRef rlMode = (CFStringRef) CFArrayGetValueAtIndex(targetPrivate->rlList, i+2); + ok = enqueueAsyncDNSQuery(target, mp); + return ok; +} - CFRunLoopAddSource(rl, targetPrivate->dnsRLS, rlMode); - } - return TRUE; -} +#pragma mark - +#pragma mark OnDemand -static Boolean -__SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, - SCNetworkReachabilityRef target, - SCNetworkConnectionFlags *flags, - uint16_t *if_index, - Boolean async) +SCNetworkServiceRef +SCNetworkReachabilityCopyOnDemandService(SCNetworkReachabilityRef target, + CFDictionaryRef *userOptions) { - CFMutableArrayRef addresses = NULL; + SCNetworkServiceRef service = NULL; SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; - SCNetworkConnectionFlags my_flags = 0; - uint16_t my_index = 0; - Boolean ok = TRUE; - - *flags = 0; - if (if_index != NULL) { - *if_index = 0; - } if (!isA_SCNetworkReachability(target)) { _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + return NULL; } - switch (targetPrivate->type) { - case reachabilityTypeAddress : - case reachabilityTypeAddressPair : { - /* - * Check "local" address - */ - if (targetPrivate->localAddress != NULL) { - /* + if (targetPrivate->onDemandServiceID != NULL) { + service = _SCNetworkServiceCopyActive(NULL, targetPrivate->onDemandServiceID); + } + + if (userOptions != NULL) { + if (targetPrivate->onDemandName != NULL) { + *userOptions = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName, targetPrivate->onDemandName); + } else { + *userOptions = NULL; + } + } + + return service; +} + + +static void +__SCNetworkReachabilityOnDemandCheckCallback(SCNetworkReachabilityRef onDemandServer, + SCNetworkReachabilityFlags onDemandFlags, + void *info) +{ + SCNetworkReachabilityRef target = (SCNetworkReachabilityRef)info; + SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; + + pthread_mutex_lock(&targetPrivate->lock); + + if (!targetPrivate->scheduled) { + // if not currently scheduled + pthread_mutex_unlock(&targetPrivate->lock); + return; + } + + SCLog(_sc_debug, LOG_INFO, CFSTR("%sOnDemand \"server\" status changed"), + targetPrivate->log_prefix); + __SCNetworkReachabilityPerform(target); + + pthread_mutex_unlock(&targetPrivate->lock); + + return; +} + + +static Boolean +__SCNetworkReachabilityOnDemandCheck(SCDynamicStoreRef *storeP, + SCNetworkReachabilityRef target, + Boolean onDemandRetry, + SCNetworkReachabilityFlags *flags) +{ + Boolean ok; + Boolean onDemand = FALSE; + CFStringRef onDemandRemoteAddress = NULL; + CFStringRef onDemandServiceID = NULL; + SCNetworkConnectionStatus onDemandStatus; + SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; + +// SCLog(_sc_debug, LOG_INFO, +// CFSTR("%s__SCNetworkReachabilityOnDemandCheck %s"), +// targetPrivate->log_prefix, +// onDemandRetry ? "after" : "before"); + + if (targetPrivate->onDemandName == NULL) { + targetPrivate->onDemandName = CFStringCreateWithCString(NULL, targetPrivate->name, kCFStringEncodingUTF8); + } + + /* + * check if an OnDemand VPN configuration matches the name. + */ + ok = __SCNetworkConnectionCopyOnDemandInfoWithName(storeP, + targetPrivate->onDemandName, + onDemandRetry, + &onDemandServiceID, + &onDemandStatus, + &onDemandRemoteAddress); + if (!_SC_CFEqual(targetPrivate->onDemandRemoteAddress, onDemandRemoteAddress) || + !_SC_CFEqual(targetPrivate->onDemandServiceID, onDemandServiceID)) { + if (targetPrivate->onDemandRemoteAddress != NULL) { + CFRelease(targetPrivate->onDemandRemoteAddress); + targetPrivate->onDemandRemoteAddress = NULL; + } + + if (targetPrivate->onDemandServer != NULL) { +#if !TARGET_OS_IPHONE + if (targetPrivate->dispatchQueue != NULL) { + // unschedule + __SCNetworkReachabilityUnscheduleFromRunLoop(targetPrivate->onDemandServer, NULL, NULL, TRUE); + } else +#endif // !TARGET_OS_IPHONE + if (targetPrivate->rls != NULL) { + CFIndex i; + CFIndex n; + + // unschedule + n = CFArrayGetCount(targetPrivate->rlList); + for (i = 0; i < n; i += 3) { + CFRunLoopRef rl = (CFRunLoopRef)CFArrayGetValueAtIndex(targetPrivate->rlList, i+1); + CFStringRef rlMode = (CFStringRef) CFArrayGetValueAtIndex(targetPrivate->rlList, i+2); + + __SCNetworkReachabilityUnscheduleFromRunLoop(targetPrivate->onDemandServer, rl, rlMode, TRUE); + } + } + + CFRelease(targetPrivate->onDemandServer); + targetPrivate->onDemandServer = NULL; + } + + if (targetPrivate->onDemandServiceID != NULL) { + CFRelease(targetPrivate->onDemandServiceID); + targetPrivate->onDemandServiceID = NULL; + } + } + if (ok) { + if (onDemandStatus != kSCNetworkConnectionConnected) { + /* + * if we have a VPN configuration matching the name *and* we need to + * bring the VPN up. Combine our flags with those of the VPN server. + */ + if (targetPrivate->onDemandServer == NULL) { + CFMutableDictionaryRef options; + + options = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFDictionarySetValue(options, kSCNetworkReachabilityOptionNodeName, onDemandRemoteAddress); + CFDictionarySetValue(options, kSCNetworkReachabilityOptionConnectionOnDemandByPass, kCFBooleanTrue); + targetPrivate->onDemandServer = SCNetworkReachabilityCreateWithOptions(NULL, options); + CFRelease(options); + + if (targetPrivate->scheduled) { + SCNetworkReachabilityContext context = { 0, NULL, CFRetain, CFRelease, CFCopyDescription }; + + context.info = (void *)target; + SCNetworkReachabilitySetCallback(targetPrivate->onDemandServer, + __SCNetworkReachabilityOnDemandCheckCallback, + &context); + + // schedule server reachability to match that of the target +#if !TARGET_OS_IPHONE + if (targetPrivate->dispatchQueue != NULL) { + __SCNetworkReachabilityScheduleWithRunLoop(targetPrivate->onDemandServer, NULL, NULL, targetPrivate->dispatchQueue, TRUE); + } else +#endif // !TARGET_OS_IPHONE + { + CFIndex i; + CFIndex n; + + n = CFArrayGetCount(targetPrivate->rlList); + for (i = 0; i < n; i += 3) { + CFRunLoopRef rl = (CFRunLoopRef)CFArrayGetValueAtIndex(targetPrivate->rlList, i+1); + CFStringRef rlMode = (CFStringRef) CFArrayGetValueAtIndex(targetPrivate->rlList, i+2); + + __SCNetworkReachabilityScheduleWithRunLoop(targetPrivate->onDemandServer, rl, rlMode, NULL, TRUE); + } + } + } + } + + ok = SCNetworkReachabilityGetFlags(targetPrivate->onDemandServer, flags); + SCLog(_sc_debug, LOG_INFO, CFSTR("%s status * = 0x%08x"), + targetPrivate->log_prefix, + *flags); + if (ok && (*flags & kSCNetworkReachabilityFlagsReachable)) { + if (!(*flags & kSCNetworkReachabilityFlagsTransientConnection)) { + // start clean if not already layered on a transient network + *flags = 0; + } + *flags |= kSCNetworkReachabilityFlagsReachable; + *flags |= kSCNetworkReachabilityFlagsTransientConnection; + *flags |= kSCNetworkReachabilityFlagsConnectionRequired; + *flags |= kSCNetworkReachabilityFlagsConnectionOnDemand; + + if (_sc_debug) { + SCLog(TRUE, LOG_INFO, CFSTR("%s service * = %@"), + targetPrivate->log_prefix, + onDemandServiceID); + SCLog(TRUE, LOG_INFO, CFSTR("%s status = isReachable (after OnDemand connect)"), + targetPrivate->log_prefix); + } + + onDemand = TRUE; + } + } + + if (onDemandRemoteAddress != NULL) { + if (targetPrivate->onDemandRemoteAddress == NULL) { + targetPrivate->onDemandRemoteAddress = onDemandRemoteAddress; + } else { + CFRelease(onDemandRemoteAddress); + } + } + + if (onDemandServiceID != NULL) { + if (targetPrivate->onDemandServiceID == NULL) { + targetPrivate->onDemandServiceID = onDemandServiceID; + } else { + CFRelease(onDemandServiceID); + } + } + } + + return onDemand; +} + + +#pragma mark - +#pragma mark Reachability Flags + + +static Boolean +__SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, + SCNetworkReachabilityRef target, + ReachabilityInfo *reach_info, + Boolean async) +{ + CFMutableArrayRef addresses = NULL; + SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; + ReachabilityInfo my_info = NOT_REACHABLE; + Boolean ok = TRUE; + + *reach_info = NOT_REACHABLE; + + if (!isA_SCNetworkReachability(target)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + switch (targetPrivate->type) { + case reachabilityTypeAddress : + case reachabilityTypeAddressPair : { + /* + * Check "local" address + */ + if (targetPrivate->localAddress != NULL) { + /* * Check "local" address */ - ok = checkAddress(storeP, targetPrivate->localAddress, &my_flags, &my_index); + ok = checkAddress(storeP, + targetPrivate->localAddress, + &my_info, + targetPrivate->log_prefix); if (!ok) { goto error; /* not today */ } - if (!(my_flags & kSCNetworkFlagsIsLocalAddress)) { + if (!(my_info.flags & kSCNetworkReachabilityFlagsIsLocalAddress)) { goto error; /* not reachable, non-"local" address */ } } @@ -2066,13 +2890,15 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, * in cases where we have "local" and "remote" addresses * we need to re-initialize the to-be-returned flags. */ - my_flags = 0; - my_index = 0; + my_info = NOT_REACHABLE; /* * Check "remote" address */ - ok = checkAddress(storeP, targetPrivate->remoteAddress, &my_flags, &my_index); + ok = checkAddress(storeP, + targetPrivate->remoteAddress, + &my_info, + targetPrivate->log_prefix); if (!ok) { goto error; /* not today */ } @@ -2085,40 +2911,68 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, case reachabilityTypeName : { struct timeval dnsQueryStart; int error; - SCNetworkConnectionFlags ns_flags; + SCNetworkReachabilityFlags ns_flags; struct addrinfo *res; addresses = (CFMutableArrayRef)SCNetworkReachabilityCopyResolvedAddress(target, &error); if ((addresses != NULL) || (error != NETDB_SUCCESS)) { /* if resolved or an error had been detected */ - goto checkResolvedAddress; + if (!async) { + /* if not an async request */ + goto checkResolvedAddress; + } else if ((targetPrivate->dnsPort == NULL) && !targetPrivate->needResolve) { + /* if async request, no query active, and no query needed */ + goto checkResolvedAddress; + } + } + + if (!targetPrivate->onDemandBypass) { + Boolean onDemand; + + /* + * before we attempt our initial DNS query, check if there is + * an OnDemand configuration that we should be using. + */ + onDemand = __SCNetworkReachabilityOnDemandCheck(storeP, target, FALSE, &my_info.flags); + if (onDemand) { + /* if OnDemand connection is needed */ + goto done; + } } /* check the reachability of the DNS servers */ - ok = _SC_checkResolverReachability(storeP, - &ns_flags, - &targetPrivate->haveDNS, - targetPrivate->name, - targetPrivate->serv); + ok = _SC_R_checkResolverReachability(storeP, + &ns_flags, + &targetPrivate->haveDNS, + targetPrivate->name, + targetPrivate->serv, + targetPrivate->log_prefix); if (!ok) { /* if we could not get DNS server info */ + SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server reachability unknown"), + targetPrivate->log_prefix); goto error; - } - - if (rankReachability(ns_flags) < 2) { + } else if (rankReachability(ns_flags) < 2) { /* * if DNS servers are not (or are no longer) reachable, set * flags based on the availability of configured (but not * active) services. */ - SCLog(_sc_debug, LOG_INFO, CFSTR("DNS server(s) not available")); + SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server(s) not available"), + targetPrivate->log_prefix); - if (!checkAddress(storeP, NULL, &my_flags, &my_index)) { + ok = checkAddress(storeP, + NULL, + &my_info, + targetPrivate->log_prefix); + if (!ok) { + SCLog(_sc_debug, LOG_INFO, CFSTR("%sNo available networks"), + targetPrivate->log_prefix); goto error; } - if (async && (targetPrivate->rls != NULL)) { + if (async && targetPrivate->scheduled) { /* * return "host not found", set flags appropriately, * and schedule notification. @@ -2126,27 +2980,34 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, __SCNetworkReachabilityCallbackSetResolvedAddress(EAI_NONAME, NULL, (void *)target); - my_flags |= (targetPrivate->flags & kSCNetworkFlagsFirstResolvePending); + my_info.flags |= (targetPrivate->info.flags & kSCNetworkReachabilityFlagsFirstResolvePending); - SCLog(_sc_debug, LOG_INFO, CFSTR("no DNS servers are reachable")); - CFRunLoopSourceSignal(targetPrivate->rls); - _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList); + SCLog(_sc_debug, LOG_INFO, CFSTR("%sno DNS servers are reachable"), + targetPrivate->log_prefix); + __SCNetworkReachabilityPerform(target); } break; } if (async) { /* for async requests we return the last known status */ - my_flags = targetPrivate->flags; - my_index = targetPrivate->if_index; + my_info = targetPrivate->info; if (targetPrivate->dnsPort != NULL) { /* if request already in progress */ + SCLog(_sc_debug, LOG_INFO, + CFSTR("%swaiting for DNS reply"), + targetPrivate->log_prefix); + if ((addresses != NULL) || (error != NETDB_SUCCESS)) { + /* updated reachability based on the previous reply */ + goto checkResolvedAddress; + } break; } SCLog(_sc_debug, LOG_INFO, - CFSTR("start DNS query for %s%s%s%s%s"), + CFSTR("%sstart DNS query for %s%s%s%s%s"), + targetPrivate->log_prefix, targetPrivate->name != NULL ? "name = " : "", targetPrivate->name != NULL ? targetPrivate->name : "", targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "", @@ -2166,7 +3027,8 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, } SCLog(_sc_debug, LOG_INFO, - CFSTR("check DNS for %s%s%s%s%s"), + CFSTR("%scheck DNS for %s%s%s%s%s"), + targetPrivate->log_prefix, targetPrivate->name != NULL ? "name = " : "", targetPrivate->name != NULL ? targetPrivate->name : "", targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "", @@ -2186,9 +3048,10 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, &targetPrivate->hints, &res); - __log_query_time(((error == 0) && (res != NULL)),// if successful query - FALSE, // sync - &dnsQueryStart); // start time + __log_query_time(target, + ((error == 0) && (res != NULL)), // if successful query + FALSE, // sync + &dnsQueryStart); // start time __SCNetworkReachabilitySetResolvedAddress(error, res, target); @@ -2201,63 +3064,84 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, * Then, check each address for accessibility and return the * best status available. */ - my_flags = 0; - my_index = 0; + my_info = NOT_REACHABLE; if (isA_CFArray(addresses)) { CFIndex i; CFIndex n = CFArrayGetCount(addresses); for (i = 0; i < n; i++) { - SCNetworkConnectionFlags ns_flags = 0; - uint16_t ns_if_index = 0; - struct sockaddr *sa; + ReachabilityInfo ns_info = NOT_REACHABLE; + struct sockaddr *sa; sa = (struct sockaddr *)CFDataGetBytePtr(CFArrayGetValueAtIndex(addresses, i)); - ok = checkAddress(storeP, sa, &ns_flags, &ns_if_index); + ok = checkAddress(storeP, + sa, + &ns_info, + targetPrivate->log_prefix); if (!ok) { goto error; /* not today */ } - if (rankReachability(ns_flags) > rankReachability(my_flags)) { + if (rankReachability(ns_info.flags) > rankReachability(my_info.flags)) { /* return the best case result */ - my_flags = ns_flags; - my_index = ns_if_index; - if (rankReachability(my_flags) == 2) { + my_info = ns_info; + if (rankReachability(my_info.flags) == 2) { /* we're in luck */ break; } } } } else { - if (((error == EAI_NONAME) + if ((error == EAI_NONAME) #if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) || (error == EAI_NODATA) #endif - ) && !targetPrivate->haveDNS) { + ) { /* - * No DNS servers are defined. Set flags based on - * the availability of configured (but not active) - * services. + * the target host name could not be resolved */ - ok = checkAddress(storeP, NULL, &my_flags, &my_index); - if (!ok) { - goto error; /* not today */ - } + if (!targetPrivate->onDemandBypass) { + Boolean onDemand; - if ((my_flags & kSCNetworkFlagsReachable) && - (my_flags & kSCNetworkFlagsConnectionRequired)) { /* - * Since we might pick up a set of DNS servers when this connection - * is established, don't reply with a "HOST NOT FOUND" error just yet. + * our initial DNS query failed, check again to see if there + * there is an OnDemand configuration that we should be using. */ - break; + onDemand = __SCNetworkReachabilityOnDemandCheck(storeP, target, TRUE, &my_info.flags); + if (onDemand) { + /* if OnDemand connection is needed */ + goto done; + } } - /* Host not found, not reachable! */ - my_flags = 0; - my_index = 0; + if (!targetPrivate->haveDNS) { + /* + * No DNS servers are defined. Set flags based on + * the availability of configured (but not active) + * services. + */ + ok = checkAddress(storeP, + NULL, + &my_info, + targetPrivate->log_prefix); + if (!ok) { + goto error; /* not today */ + } + + if ((my_info.flags & kSCNetworkReachabilityFlagsReachable) && + (my_info.flags & kSCNetworkReachabilityFlagsConnectionRequired)) { + /* + * Since we might pick up a set of DNS servers when this connection + * is established, don't reply with a "HOST NOT FOUND" error just yet. + */ + break; + } + + /* Host not found, not reachable! */ + my_info = NOT_REACHABLE; + } } } @@ -2265,10 +3149,9 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, } } - *flags = my_flags; - if (if_index != NULL) { - *if_index = my_index; - } + done: + + *reach_info = my_info; error : @@ -2278,8 +3161,8 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef *storeP, Boolean -SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target, - SCNetworkConnectionFlags *flags) +SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target, + SCNetworkReachabilityFlags *flags) { Boolean ok = TRUE; SCDynamicStoreRef store = NULL; @@ -2292,15 +3175,15 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target, pthread_mutex_lock(&targetPrivate->lock); - if (targetPrivate->rlList != NULL) { + if (targetPrivate->scheduled) { // if being watched, return the last known (and what should be current) status - *flags = targetPrivate->flags & ~kSCNetworkFlagsFirstResolvePending; + *flags = targetPrivate->info.flags & ~kSCNetworkReachabilityFlagsFirstResolvePending; goto done; } - ok = __SCNetworkReachabilityGetFlags(&store, target, flags, NULL, FALSE); - *flags &= ~kSCNetworkFlagsFirstResolvePending; + ok = __SCNetworkReachabilityGetFlags(&store, target, &targetPrivate->info, FALSE); + *flags = targetPrivate->info.flags & ~kSCNetworkReachabilityFlagsFirstResolvePending; if (store != NULL) CFRelease(store); done : @@ -2310,6 +3193,10 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target, } +#pragma mark - +#pragma mark Notifications + + static void __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef store) { @@ -2328,6 +3215,7 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef store) CFArrayAppendValue(keys, key); CFRelease(key); + // State:/Network/Global/DNS key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetDNS); @@ -2341,6 +3229,13 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef store) CFArrayAppendValue(keys, key); CFRelease(key); + // State:/Network/Global/OnDemand + key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, + kSCDynamicStoreDomainState, + kSCEntNetOnDemand); + CFArrayAppendValue(keys, key); + CFRelease(key); + // Setup: per-service IPv4 info pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainSetup, @@ -2365,6 +3260,22 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef store) CFArrayAppendValue(patterns, pattern); CFRelease(pattern); + // State: per-service PPP info (for kSCPropNetPPPStatus) + pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainState, + kSCCompAnyRegex, + kSCEntNetPPP); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + + // Setup: per-service IPSec info + pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainSetup, + kSCCompAnyRegex, + kSCEntNetIPSec); + CFArrayAppendValue(patterns, pattern); + CFRelease(pattern); + // State: per-interface IPv4 info pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, @@ -2381,6 +3292,16 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef store) CFArrayAppendValue(patterns, pattern); CFRelease(pattern); +#if !TARGET_OS_IPHONE + // State: Power Management Capabilities + key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@%@"), + kSCDynamicStoreDomainState, + CFSTR(kIOPMSystemPowerCapabilitiesKeySuffix)); + CFArrayAppendValue(keys, key); + CFRelease(key); +#endif // TARGET_OS_IPHONE + + (void)SCDynamicStoreSetNotificationKeys(store, keys, patterns); CFRelease(keys); CFRelease(patterns); @@ -2390,43 +3311,98 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef store) static void -__SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef store, - CFArrayRef changedKeys, - void *info) +__SCNetworkReachabilityHandleChanges(SCDynamicStoreRef store, + CFArrayRef changedKeys, + void *info) { Boolean dnsConfigChanged = FALSE; CFIndex i; CFStringRef key; + CFIndex nChanges = CFArrayGetCount(changedKeys); CFIndex nTargets; +#if !TARGET_OS_IPHONE + Boolean powerStatusChanged = FALSE; +#endif // !TARGET_OS_IPHONE const void * targets_q[N_QUICK]; const void ** targets = targets_q; + if (nChanges == 0) { + /* if no changes */ + return; + } + pthread_mutex_lock(&hn_lock); - nTargets = CFSetGetCount(hn_targets); + nTargets = (hn_targets != NULL) ? CFSetGetCount(hn_targets) : 0; if (nTargets == 0) { /* if no addresses being monitored */ goto done; } - if (CFArrayGetCount(changedKeys) == 0) { - /* if no changes */ - goto done; - } +#if !TARGET_OS_IPHONE + key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@%@"), + kSCDynamicStoreDomainState, + CFSTR(kIOPMSystemPowerCapabilitiesKeySuffix)); + if (CFArrayContainsValue(changedKeys, CFRangeMake(0, nChanges), key)) { + CFNumberRef num; + + num = SCDynamicStoreCopyValue(store, key); + if (num != NULL) { + if (isA_CFNumber(num) && + CFNumberGetValue(num, kCFNumberSInt32Type, &power_capabilities)) { + powerStatusChanged = TRUE; + } - SCLog(_sc_debug, LOG_INFO, CFSTR("process configuration change")); + CFRelease(num); + } + } + CFRelease(key); +#endif // !TARGET_OS_IPHONE key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetDNS); - if (CFArrayContainsValue(changedKeys, - CFRangeMake(0, CFArrayGetCount(changedKeys)), - key)) { + if (CFArrayContainsValue(changedKeys, CFRangeMake(0, nChanges), key)) { dnsConfigChanged = TRUE; /* the DNS server(s) have changed */ } CFRelease(key); - SCLog(_sc_debug && dnsConfigChanged, LOG_INFO, CFSTR(" DNS configuration changed")); + if (_sc_debug) { + int changes = 0; + const char *str; + +#if !TARGET_OS_IPHONE + if (powerStatusChanged) { + changes |= 4; + nChanges -= 1; + } +#endif // !TARGET_OS_IPHONE + + if (dnsConfigChanged) { + changes |= 2; + nChanges -= 1; + } + + if (nChanges > 0) { + changes |= 1; + } + + switch (changes) { + case 0 : str = ""; break; + case 1 : str = "network "; break; + case 2 : str = "DNS "; break; + case 3 : str = "network and DNS "; break; +#if !TARGET_OS_IPHONE + case 4 : str = "power "; break; + case 5 : str = "network and power "; break; + case 6 : str = "DNS and power "; break; + case 7 : str = "network, DNS, and power "; break; +#endif // !TARGET_OS_IPHONE + default : str = "??? "; + } + + SCLog(TRUE, LOG_INFO, CFSTR("process %sconfiguration change"), str); + } if (nTargets > (CFIndex)(sizeof(targets_q) / sizeof(CFTypeRef))) targets = CFAllocatorAllocate(NULL, nTargets * sizeof(CFTypeRef), 0); @@ -2445,44 +3421,56 @@ __SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef store, * if the DNS configuration didn't change we still need to * check that the DNS servers are accessible. */ - SCNetworkConnectionFlags ns_flags; + SCNetworkReachabilityFlags ns_flags; Boolean ok; /* check the reachability of the DNS servers */ - ok = _SC_checkResolverReachability(&store, - &ns_flags, - &targetPrivate->haveDNS, - targetPrivate->name, - targetPrivate->serv); - if (!ok || (rankReachability(ns_flags) < 2)) { - /* if DNS servers are not reachable */ + ok = _SC_R_checkResolverReachability(&store, + &ns_flags, + &targetPrivate->haveDNS, + targetPrivate->name, + targetPrivate->serv, + targetPrivate->log_prefix); + if (!ok) { + /* if we could not get DNS server info */ + SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server reachability unknown"), + targetPrivate->log_prefix); + dnsChanged = TRUE; + } else if (rankReachability(ns_flags) < 2) { + /* + * if DNS servers are not (or are no longer) reachable, set + * flags based on the availability of configured (but not + * active) services. + */ + SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server(s) not available"), + targetPrivate->log_prefix); dnsChanged = TRUE; } } if (dnsChanged) { if (targetPrivate->dnsPort != NULL) { + mach_port_t mp = CFMachPortGetPort(targetPrivate->dnsPort); + /* cancel the outstanding DNS query */ - getaddrinfo_async_cancel(CFMachPortGetPort(targetPrivate->dnsPort)); - CFRunLoopSourceInvalidate(targetPrivate->dnsRLS); - CFRelease(targetPrivate->dnsRLS); - targetPrivate->dnsRLS = NULL; - CFRelease(targetPrivate->dnsPort); - targetPrivate->dnsPort = NULL; + SCLog(_sc_debug, LOG_INFO, + CFSTR("%scancel DNS query for %s%s%s%s%s"), + targetPrivate->log_prefix, + targetPrivate->name != NULL ? "name = " : "", + targetPrivate->name != NULL ? targetPrivate->name : "", + targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "", + targetPrivate->serv != NULL ? "serv = " : "", + targetPrivate->serv != NULL ? targetPrivate->serv : ""); + dequeueAsyncDNSQuery(target); + getaddrinfo_async_cancel(mp); } /* schedule request to resolve the name again */ - if (targetPrivate->resolvedAddress != NULL) { - CFRelease(targetPrivate->resolvedAddress); - targetPrivate->resolvedAddress = NULL; - } - targetPrivate->resolvedAddress = NULL; - targetPrivate->resolvedAddressError = NETDB_SUCCESS; + targetPrivate->needResolve = TRUE; } } - CFRunLoopSourceSignal(targetPrivate->rls); - _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList); + __SCNetworkReachabilityPerform(target); pthread_mutex_unlock(&targetPrivate->lock); } @@ -2495,50 +3483,127 @@ __SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef store, } +#if !TARGET_OS_IPHONE +static __inline__ Boolean +systemIsAwake(IOPMSystemPowerStateCapabilities power_capabilities) +{ + +#define POWER_CAPABILITIES_NEED (kIOPMSystemPowerStateCapabilityCPU \ + | kIOPMSystemPowerStateCapabilityNetwork \ + | kIOPMSystemPowerStateCapabilityDisk) + + if ((power_capabilities & POWER_CAPABILITIES_NEED) != POWER_CAPABILITIES_NEED) { + /* + * we're not awake (from a networking point of view) unless we + * have the CPU, disk, *and* network. + */ + return FALSE; + } + + if ((power_capabilities & kIOPMSytemPowerStateCapabilitiesMask) == POWER_CAPABILITIES_NEED) { + /* + * if all we have is the CPU, disk, and network than this must + * be a "maintenance" wake. + */ + return FALSE; + } + + return TRUE; +} +#endif // !TARGET_OS_IPHONE + + static void rlsPerform(void *info) { void *context_info; void (*context_release)(const void *); - SCNetworkConnectionFlags flags; - uint16_t if_index; + Boolean defer = FALSE; Boolean ok; + ReachabilityInfo reach_info = NOT_REACHABLE; SCNetworkReachabilityCallBack rlsFunction; SCDynamicStoreRef store = NULL; SCNetworkReachabilityRef target = (SCNetworkReachabilityRef)info; SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; - SCLog(_sc_debug, LOG_DEBUG, CFSTR("process reachability change")); + SCLog(_sc_debug, LOG_INFO, CFSTR("%schecking target reachability"), + targetPrivate->log_prefix); pthread_mutex_lock(&targetPrivate->lock); + if (!targetPrivate->scheduled) { + // if not currently scheduled + pthread_mutex_unlock(&targetPrivate->lock); + return; + } + /* update reachability, notify if status changed */ - ok = __SCNetworkReachabilityGetFlags(&store, target, &flags, &if_index, TRUE); + ok = __SCNetworkReachabilityGetFlags(&store, target, &reach_info, TRUE); if (store != NULL) CFRelease(store); if (!ok) { /* if reachability status not available */ - flags = 0; - if_index = 0; + SCLog(_sc_debug, LOG_INFO, CFSTR("%flags not available"), + targetPrivate->log_prefix); + reach_info = NOT_REACHABLE; } - if ((targetPrivate->flags == flags) && (targetPrivate->if_index == if_index)) { - /* if reachability flags and interface have not changed */ +#if !TARGET_OS_IPHONE + /* + * We want to defer the notification if this is a maintenance wake *and* + * the reachability flags that we would be reporting to the application + * are better than those that we last reported. + */ + if (!systemIsAwake(power_capabilities)) { + /* if this is a maintenace wake */ + reach_info.sleeping = TRUE; + + if (rankReachability(reach_info.flags) >= rankReachability(targetPrivate->info.flags)) { + /* + * don't report the change if the new reachability flags are + * the same or "better" + */ + defer = TRUE; + } else if (bcmp(&targetPrivate->last_notify, &reach_info, sizeof(reach_info)) == 0) { + /* if we have already posted this change */ + defer = TRUE; + } + } +#endif // !TARGET_OS_IPHONE + + if (bcmp(&targetPrivate->info, &reach_info, sizeof(reach_info)) == 0) { + SCLog(_sc_debug, LOG_INFO, + CFSTR("%sflags/interface match (now 0x%08x/%hu%s)"), + targetPrivate->log_prefix, + reach_info.flags, + reach_info.if_index, + reach_info.sleeping ? "*" : ""); pthread_mutex_unlock(&targetPrivate->lock); - SCLog(_sc_debug, LOG_DEBUG, - CFSTR("flags/interface match (now %8.8x/%hu)"), - flags, if_index); return; - } else { - SCLog(_sc_debug, LOG_DEBUG, - CFSTR("flags/interface have changed (was %8.8x/%hu, now %8.8x/%hu)"), - targetPrivate->flags, targetPrivate->if_index, - flags, if_index); } + SCLog(_sc_debug, LOG_INFO, + CFSTR("%sflags/interface have changed (was 0x%08x/%hu%s, now 0x%08x/%hu%s)%s"), + targetPrivate->log_prefix, + targetPrivate->info.flags, + targetPrivate->info.if_index, + targetPrivate->info.sleeping ? "*" : "", + reach_info.flags, + reach_info.if_index, + reach_info.sleeping ? "*" : "", + defer ? ", deferred" : ""); + /* update flags / interface */ - targetPrivate->flags = flags; - targetPrivate->if_index = if_index; + targetPrivate->info = reach_info; + + /* as needed, defer the notification */ + if (defer) { + pthread_mutex_unlock(&targetPrivate->lock); + return; + } + + /* save last notification info */ + targetPrivate->last_notify = reach_info; /* callout */ rlsFunction = targetPrivate->rlsFunction; @@ -2553,7 +3618,7 @@ rlsPerform(void *info) pthread_mutex_unlock(&targetPrivate->lock); if (rlsFunction != NULL) { - (*rlsFunction)(target, flags, context_info); + (*rlsFunction)(target, reach_info.flags, context_info); } if (context_release != NULL) { @@ -2608,26 +3673,37 @@ reachRLSCopyDescription(const void *info) } -Boolean -SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef target, - CFRunLoopRef runLoop, - CFStringRef runLoopMode) +static Boolean +__SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef target, + CFRunLoopRef runLoop, + CFStringRef runLoopMode, +#if !TARGET_OS_IPHONE + dispatch_queue_t queue, +#else // !TARGET_OS_IPHONE + void *queue, +#endif // !TARGET_OS_IPHONE + Boolean onDemand) { SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; Boolean init = FALSE; Boolean ok = FALSE; - if (!isA_SCNetworkReachability(target) || runLoop == NULL || runLoopMode == NULL) { + if (!onDemand) { + pthread_mutex_lock(&hn_lock); + } + pthread_mutex_lock(&targetPrivate->lock); + +#if !TARGET_OS_IPHONE + if ((targetPrivate->dispatchQueue != NULL) || // if we are already scheduled with a dispatch queue + ((queue != NULL) && targetPrivate->scheduled)) { // if we are already scheduled on a CFRunLoop _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + goto done; } +#endif // !TARGET_OS_IPHONE /* schedule the SCNetworkReachability run loop source */ - pthread_mutex_lock(&hn_lock); - pthread_mutex_lock(&targetPrivate->lock); - - if (hn_store == NULL) { + if (!onDemand && (hn_store == NULL)) { /* * if we are not monitoring any hosts, start watching */ @@ -2639,21 +3715,64 @@ SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef target, hn_store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), - __SCNetworkReachabilityReachabilityHandleChanges, + __SCNetworkReachabilityHandleChanges, NULL); if (hn_store == NULL) { - SCLog(_sc_verbose, LOG_INFO, CFSTR("SCDynamicStoreCreate() failed")); + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCreate() failed")); goto done; } __SCNetworkReachabilityReachabilitySetNotifications(hn_store); +#if !TARGET_OS_IPHONE + dispatch_queue_attr_t attr; + long res; + + attr = dispatch_queue_attr_create(); + res = dispatch_queue_attr_set_finalizer(attr, + ^(dispatch_queue_t dq) { + SCDynamicStoreRef hn_store; + + hn_store = (SCDynamicStoreRef)dispatch_get_context(dq); + CFRelease(hn_store); + }); + if (res != 0) { + SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkReachabilityScheduleWithRunLoop dispatch_queue_attr_set_finalizer() failed")); + dispatch_release(attr); + CFRelease(hn_store); + hn_store = NULL; + _SCErrorSet(kSCStatusFailed); + goto done; + } + hn_dispatchQueue = dispatch_queue_create("com.apple.SCNetworkReachabilty.network_changes", attr); + dispatch_release(attr); + if (hn_dispatchQueue == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkReachabilityScheduleWithRunLoop dispatch_queue_create() failed")); + _SCErrorSet(kSCStatusFailed); + CFRelease(hn_store); + hn_store = NULL; + goto done; + } + CFRetain(hn_store); // Note: will be released when the dispatch queue is released + dispatch_set_context(hn_dispatchQueue, (void *)hn_store); + + ok = SCDynamicStoreSetDispatchQueue(hn_store, hn_dispatchQueue); + if (!ok) { + SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetDispatchQueue() failed")); + dispatch_release(hn_dispatchQueue); + hn_dispatchQueue = NULL; + CFRelease(hn_store); + hn_store = NULL; + goto done; + } +#else // !TARGET_OS_IPHONE hn_storeRLS = SCDynamicStoreCreateRunLoopSource(NULL, hn_store, 0); hn_rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); +#endif // !TARGET_OS_IPHONE hn_targets = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks); } - if (targetPrivate->rls == NULL) { + if (!targetPrivate->scheduled) { CFRunLoopSourceContext context = { 0 // version , (void *)target // info , CFRetain // retain @@ -2666,178 +3785,323 @@ SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef target, , rlsPerform // perform }; - targetPrivate->rls = CFRunLoopSourceCreate(NULL, 0, &context); - targetPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + if (runLoop != NULL) { + targetPrivate->rls = CFRunLoopSourceCreate(NULL, 0, &context); + targetPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + } + + targetPrivate->scheduled = TRUE; + if (targetPrivate->type == reachabilityTypeName) { + targetPrivate->needResolve = TRUE; + } init = TRUE; } - if (!_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) { - /* - * if we do not already have host notifications scheduled with - * this runLoop / runLoopMode - */ - CFRunLoopAddSource(runLoop, targetPrivate->rls, runLoopMode); +#if !TARGET_OS_IPHONE + if (queue != NULL) { + targetPrivate->dispatchQueue = queue; + dispatch_retain(targetPrivate->dispatchQueue); + } else +#endif // !TARGET_OS_IPHONE + { + if (!_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) { + /* + * if we do not already have host notifications scheduled with + * this runLoop / runLoopMode + */ + CFRunLoopAddSource(runLoop, targetPrivate->rls, runLoopMode); - if (targetPrivate->dnsRLS != NULL) { - /* if we have an active async DNS query too */ - CFRunLoopAddSource(runLoop, targetPrivate->dnsRLS, runLoopMode); + if (targetPrivate->dnsRLS != NULL) { + /* if we have an active async DNS query too */ + CFRunLoopAddSource(runLoop, targetPrivate->dnsRLS, runLoopMode); + } } - } - _SC_schedule(target, runLoop, runLoopMode, targetPrivate->rlList); + _SC_schedule(target, runLoop, runLoopMode, targetPrivate->rlList); - /* schedule the SCNetworkReachability run loop source */ +#if TARGET_OS_IPHONE + if (!onDemand) { + /* schedule the global SCDynamicStore run loop source */ - if (!_SC_isScheduled(NULL, runLoop, runLoopMode, hn_rlList)) { - /* - * if we do not already have SC notifications scheduled with - * this runLoop / runLoopMode - */ - CFRunLoopAddSource(runLoop, hn_storeRLS, runLoopMode); + if (!_SC_isScheduled(NULL, runLoop, runLoopMode, hn_rlList)) { + /* + * if we do not already have SC notifications scheduled with + * this runLoop / runLoopMode + */ + CFRunLoopAddSource(runLoop, hn_storeRLS, runLoopMode); + } + + _SC_schedule(target, runLoop, runLoopMode, hn_rlList); + } +#endif // TARGET_OS_IPHONE } - _SC_schedule(target, runLoop, runLoopMode, hn_rlList); CFSetAddValue(hn_targets, target); if (init) { - SCNetworkConnectionFlags flags; - uint16_t if_index; - SCDynamicStoreRef store = NULL; + ReachabilityInfo reach_info = NOT_REACHABLE; + SCDynamicStoreRef store = NULL; /* * if we have yet to schedule SC notifications for this address * - initialize current reachability status */ - if (__SCNetworkReachabilityGetFlags(&store, target, &flags, &if_index, TRUE)) { + if (__SCNetworkReachabilityGetFlags(&store, target, &reach_info, TRUE)) { /* * if reachability status available * - set flags * - schedule notification to report status via callback */ - targetPrivate->flags = flags; - targetPrivate->if_index = if_index; - CFRunLoopSourceSignal(targetPrivate->rls); - _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList); + targetPrivate->info = reach_info; + __SCNetworkReachabilityPerform(target); } else { /* if reachability status not available, async lookup started */ - targetPrivate->flags = 0; - targetPrivate->if_index = 0; + targetPrivate->info = NOT_REACHABLE; } if (store != NULL) CFRelease(store); } + if (targetPrivate->onDemandServer != NULL) { + __SCNetworkReachabilityScheduleWithRunLoop(targetPrivate->onDemandServer, runLoop, runLoopMode, queue, TRUE); + } + ok = TRUE; done : pthread_mutex_unlock(&targetPrivate->lock); - pthread_mutex_unlock(&hn_lock); + if (!onDemand) { + pthread_mutex_unlock(&hn_lock); + } return ok; } -Boolean -SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef target, - CFRunLoopRef runLoop, - CFStringRef runLoopMode) +static Boolean +__SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef target, + CFRunLoopRef runLoop, + CFStringRef runLoopMode, + Boolean onDemand) { SCNetworkReachabilityPrivateRef targetPrivate = (SCNetworkReachabilityPrivateRef)target; - CFIndex n; + CFIndex n = 0; Boolean ok = FALSE; - if (!isA_SCNetworkReachability(target) || runLoop == NULL || runLoopMode == NULL) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + if (!onDemand) { + pthread_mutex_lock(&hn_lock); } - - pthread_mutex_lock(&hn_lock); pthread_mutex_lock(&targetPrivate->lock); - if (targetPrivate->rls == NULL) { - /* if not currently scheduled */ +#if !TARGET_OS_IPHONE + if (((runLoop == NULL) && (targetPrivate->dispatchQueue == NULL)) || // if we should be scheduled on a dispatch queue (but are not) + ((runLoop != NULL) && (targetPrivate->dispatchQueue != NULL))) { // if we should be scheduled on a CFRunLoop (but are not) _SCErrorSet(kSCStatusInvalidArgument); goto done; } +#endif // !TARGET_OS_IPHONE - if (!_SC_unschedule(NULL, runLoop, runLoopMode, targetPrivate->rlList, FALSE)) { - /* if not currently scheduled */ + if (!targetPrivate->scheduled) { + // if not currently scheduled _SCErrorSet(kSCStatusInvalidArgument); goto done; } - n = CFArrayGetCount(targetPrivate->rlList); - if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) { - /* - * if this host is no longer scheduled for this runLoop / runLoopMode - */ - CFRunLoopRemoveSource(runLoop, targetPrivate->rls, runLoopMode); + // first, unschedule the target specific sources +#if !TARGET_OS_IPHONE + if (targetPrivate->dispatchQueue != NULL) { + if (targetPrivate->onDemandServer != NULL) { + __SCNetworkReachabilityUnscheduleFromRunLoop(targetPrivate->onDemandServer, NULL, NULL, TRUE); + } + } else +#endif // !TARGET_OS_IPHONE + { + if (!_SC_unschedule(target, runLoop, runLoopMode, targetPrivate->rlList, FALSE)) { + // if not currently scheduled + _SCErrorSet(kSCStatusInvalidArgument); + goto done; + } - if (targetPrivate->dnsRLS != NULL) { - /* if we have an active async DNS query too */ - CFRunLoopRemoveSource(runLoop, targetPrivate->dnsRLS, runLoopMode); + if (targetPrivate->onDemandServer != NULL) { + __SCNetworkReachabilityUnscheduleFromRunLoop(targetPrivate->onDemandServer, runLoop, runLoopMode, TRUE); } - if (n == 0) { - /* - * if this host is no longer scheduled - */ - CFRunLoopSourceInvalidate(targetPrivate->rls); /* cleanup SCNetworkReachability resources */ - CFRelease(targetPrivate->rls); - targetPrivate->rls = NULL; - CFRelease(targetPrivate->rlList); - targetPrivate->rlList = NULL; - CFSetRemoveValue(hn_targets, target); /* cleanup notification resources */ - - if (targetPrivate->dnsPort != NULL) { - /* if we have an active async DNS query too */ - getaddrinfo_async_cancel(CFMachPortGetPort(targetPrivate->dnsPort)); - CFRunLoopSourceInvalidate(targetPrivate->dnsRLS); - CFRelease(targetPrivate->dnsRLS); - targetPrivate->dnsRLS = NULL; - CFRelease(targetPrivate->dnsPort); - targetPrivate->dnsPort = NULL; + n = CFArrayGetCount(targetPrivate->rlList); + if ((n == 0) || !_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) { + // if target is no longer scheduled for this runLoop / runLoopMode + CFRunLoopRemoveSource(runLoop, targetPrivate->rls, runLoopMode); + + if (targetPrivate->dnsRLS != NULL) { + // if we have an active async DNS query too + CFRunLoopRemoveSource(runLoop, targetPrivate->dnsRLS, runLoopMode); + } + + if (n == 0) { + // if *all* notifications have been unscheduled + CFRelease(targetPrivate->rlList); + targetPrivate->rlList = NULL; + CFRunLoopSourceInvalidate(targetPrivate->rls); + CFRelease(targetPrivate->rls); + targetPrivate->rls = NULL; } } } - (void)_SC_unschedule(target, runLoop, runLoopMode, hn_rlList, FALSE); + if (n == 0) { + // if *all* notifications have been unscheduled + targetPrivate->scheduled = FALSE; - n = CFArrayGetCount(hn_rlList); - if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, hn_rlList)) { - /* - * if we no longer have any addresses scheduled for - * this runLoop / runLoopMode - */ - CFRunLoopRemoveSource(runLoop, hn_storeRLS, runLoopMode); + if (!onDemand) { + CFSetRemoveValue(hn_targets, target); // cleanup notification resources + } - if (n == 0) { - /* - * if we are no longer monitoring any addresses - */ - CFRelease(hn_targets); - hn_targets = NULL; - CFRelease(hn_rlList); - hn_rlList = NULL; - CFRunLoopSourceInvalidate(hn_storeRLS); - CFRelease(hn_storeRLS); - hn_storeRLS = NULL; - CFRelease(hn_store); - hn_store = NULL; + if (targetPrivate->dnsPort != NULL) { + mach_port_t mp = CFMachPortGetPort(targetPrivate->dnsPort); + + // if we have an active async DNS query + dequeueAsyncDNSQuery(target); + getaddrinfo_async_cancel(mp); + } + } + +#if !TARGET_OS_IPHONE + if (runLoop == NULL) { + dispatch_release(targetPrivate->dispatchQueue); + targetPrivate->dispatchQueue = NULL; + } +#endif // !TARGET_OS_IPHONE + // now, unschedule the global dynamic store source +#if TARGET_OS_IPHONE + if (!onDemand) { + (void)_SC_unschedule(target, runLoop, runLoopMode, hn_rlList, FALSE); + + n = CFArrayGetCount(hn_rlList); + if ((n == 0) || !_SC_isScheduled(NULL, runLoop, runLoopMode, hn_rlList)) { /* - * until we start monitoring again, ensure that - * any resources associated with tracking the - * DNS configuration have been released. + * if we no longer have any addresses scheduled for + * this runLoop / runLoopMode */ - dns_configuration_unwatch(); + CFRunLoopRemoveSource(runLoop, hn_storeRLS, runLoopMode); + + if (n > 0) { + if (CFEqual(runLoopMode, kCFRunLoopCommonModes)) { + CFArrayRef modes; + + modes = CFRunLoopCopyAllModes(runLoop); + if (modes != NULL) { + CFIndex i; + CFIndex n = CFArrayGetCount(modes); + + for (i = 0; i < n; i++) { + CFStringRef mode; + + mode = CFArrayGetValueAtIndex(modes, i); + if (_SC_isScheduled(NULL, runLoop, mode, hn_rlList)) { + /* + * removing kCFRunLoopCommonModes cleaned up more + * than we wanted. Add back the modes that were + * expect to be present. + */ + CFRunLoopAddSource(runLoop, hn_storeRLS, mode); + } + } + + CFRelease(modes); + } + } else if (_SC_isScheduled(NULL, runLoop, kCFRunLoopCommonModes, hn_rlList)) { + /* + * if we are still scheduling kCFRunLoopCommonModes, make sure that + * none of the common modes were inadvertently removed. + */ + CFRunLoopAddSource(runLoop, hn_storeRLS, kCFRunLoopCommonModes); + } + } } } +#endif // TARGET_OS_IPHONE + + n = CFSetGetCount(hn_targets); + if (n == 0) { + // if we are no longer monitoring any targets +#if !TARGET_OS_IPHONE + SCDynamicStoreSetDispatchQueue(hn_store, NULL); + dispatch_release(hn_dispatchQueue); + hn_dispatchQueue = NULL; +#else // !TARGET_OS_IPHONE + CFRunLoopSourceInvalidate(hn_storeRLS); + CFRelease(hn_storeRLS); + hn_storeRLS = NULL; + CFRelease(hn_rlList); + hn_rlList = NULL; +#endif // !TARGET_OS_IPHONE + CFRelease(hn_store); + hn_store = NULL; + CFRelease(hn_targets); + hn_targets = NULL; + + /* + * until we start monitoring again, ensure that + * any resources associated with tracking the + * DNS configuration have been released. + */ + dns_configuration_unwatch(); + } ok = TRUE; done : pthread_mutex_unlock(&targetPrivate->lock); - pthread_mutex_unlock(&hn_lock); + if (!onDemand) { + pthread_mutex_unlock(&hn_lock); + } + return ok; +} + +Boolean +SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef target, + CFRunLoopRef runLoop, + CFStringRef runLoopMode) +{ + if (!isA_SCNetworkReachability(target) || (runLoop == NULL) || (runLoopMode == NULL)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + return __SCNetworkReachabilityScheduleWithRunLoop(target, runLoop, runLoopMode, NULL, FALSE); +} + +Boolean +SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef target, + CFRunLoopRef runLoop, + CFStringRef runLoopMode) +{ + if (!isA_SCNetworkReachability(target) || (runLoop == NULL) || (runLoopMode == NULL)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + return __SCNetworkReachabilityUnscheduleFromRunLoop(target, runLoop, runLoopMode, FALSE); +} + +#if !TARGET_OS_IPHONE +Boolean +SCNetworkReachabilitySetDispatchQueue(SCNetworkReachabilityRef target, + dispatch_queue_t queue) +{ + Boolean ok = FALSE; + + if (!isA_SCNetworkReachability(target)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + if (queue != NULL) { + ok = __SCNetworkReachabilityScheduleWithRunLoop(target, NULL, NULL, queue, FALSE); + } else { + ok = __SCNetworkReachabilityUnscheduleFromRunLoop(target, NULL, NULL, FALSE); + } + return ok; } +#endif // !TARGET_OS_IPHONE diff --git a/SystemConfiguration.fproj/SCNetworkReachability.h b/SystemConfiguration.fproj/SCNetworkReachability.h index be2f3f7..7d00c23 100644 --- a/SystemConfiguration.fproj/SCNetworkReachability.h +++ b/SystemConfiguration.fproj/SCNetworkReachability.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2003-2005, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,14 +24,16 @@ #ifndef _SCNETWORKREACHABILITY_H #define _SCNETWORKREACHABILITY_H -#include +#include +#include #include #include #include #include #include - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE /*! @header SCNetworkReachability @@ -80,19 +82,102 @@ typedef struct { CFStringRef (*copyDescription)(const void *info); } SCNetworkReachabilityContext; +/*! + @enum SCNetworkReachabilityFlags + @discussion Flags that indicate whether the specified network + nodename or address is reachable, whether a connection is + required, and whether some user intervention may be required + when establishing a connection. + @constant kSCNetworkReachabilityFlagsTransientConnection + This flag indicates that the specified nodename or address can + be reached via a transient connection, such as PPP. + @constant kSCNetworkReachabilityFlagsReachable + This flag indicates that the specified nodename or address can + be reached using the current network configuration. + @constant kSCNetworkReachabilityFlagsConnectionRequired + This flag indicates that the specified nodename or address can + be reached using the current network configuration, but a + connection must first be established. + + As an example, this status would be returned for a dialup + connection that was not currently active, but could handle + network traffic for the target system. + @constant kSCNetworkReachabilityFlagsConnectionOnTraffic + This flag indicates that the specified nodename or address can + be reached using the current network configuration, but a + connection must first be established. Any traffic directed + to the specified name or address will initiate the connection. + + Note: this flag was previously named kSCNetworkReachabilityFlagsConnectionAutomatic + @constant kSCNetworkReachabilityFlagsInterventionRequired + This flag indicates that the specified nodename or address can + be reached using the current network configuration, but a + connection must first be established. In addition, some + form of user intervention will be required to establish this + connection, such as providing a password, an authentication + token, etc. + + Note: At the present time, this flag will only be returned + in the case where you have a dial-on-traffic configuration + (ConnectionOnTraffic), where an attempt to connect has + already been made, and where some error (e.g. no dial tone, + no answer, bad password, ...) was encountered during the + automatic connection attempt. In this case the PPP controller + will stop attempting to establish a connection until the user + has intervened. + @constant kSCNetworkReachabilityFlagsConnectionOnDemand + This flag indicates that the specified nodename or address can + be reached using the current network configuration, but a + connection must first be established. + The connection will be established "On Demand" by the + CFSocketStream APIs. + Other APIs will not establish the connection. + @constant kSCNetworkReachabilityFlagsIsLocalAddress + This flag indicates that the specified nodename or address + is one associated with a network interface on the current + system. + @constant kSCNetworkReachabilityFlagsIsDirect + This flag indicates that network traffic to the specified + nodename or address will not go through a gateway, but is + routed directly to one of the interfaces in the system. +#if TARGET_OS_IPHONE + @constant kSCNetworkReachabilityFlagsIsWWAN + This flag indicates that the specified nodename or address can + be reached via an EDGE, GPRS, or other "cell" connection. +#endif // TARGET_OS_IPHONE + */ +enum { + kSCNetworkReachabilityFlagsTransientConnection = 1<<0, + kSCNetworkReachabilityFlagsReachable = 1<<1, + kSCNetworkReachabilityFlagsConnectionRequired = 1<<2, + kSCNetworkReachabilityFlagsConnectionOnTraffic = 1<<3, + kSCNetworkReachabilityFlagsInterventionRequired = 1<<4, +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) || TARGET_IPHONE_SIMULATOR + kSCNetworkReachabilityFlagsConnectionOnDemand = 1<<5, +#endif + kSCNetworkReachabilityFlagsIsLocalAddress = 1<<16, + kSCNetworkReachabilityFlagsIsDirect = 1<<17, +#if TARGET_OS_IPHONE + kSCNetworkReachabilityFlagsIsWWAN = 1<<18, +#endif // TARGET_OS_IPHONE + + kSCNetworkReachabilityFlagsConnectionAutomatic = kSCNetworkReachabilityFlagsConnectionOnTraffic +}; +typedef uint32_t SCNetworkReachabilityFlags; + /*! @typedef SCNetworkReachabilityCallBack @discussion Type of the callback function used when the reachability of a network address or name changes. @param target The SCNetworkReachability reference being monitored for changes. - @param flags The new SCNetworkConnectionFlags representing the + @param flags The new SCNetworkReachabilityFlags representing the reachability status of the network address/name. @param info A C pointer to a user-specified block of data. */ typedef void (*SCNetworkReachabilityCallBack) ( SCNetworkReachabilityRef target, - SCNetworkConnectionFlags flags, + SCNetworkReachabilityFlags flags, void *info ); @@ -112,7 +197,7 @@ SCNetworkReachabilityRef SCNetworkReachabilityCreateWithAddress ( CFAllocatorRef allocator, const struct sockaddr *address - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0); /*! @function SCNetworkReachabilityCreateWithAddressPair @@ -132,7 +217,7 @@ SCNetworkReachabilityCreateWithAddressPair ( CFAllocatorRef allocator, const struct sockaddr *localAddress, const struct sockaddr *remoteAddress - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0); /*! @function SCNetworkReachabilityCreateWithName @@ -150,7 +235,7 @@ SCNetworkReachabilityRef SCNetworkReachabilityCreateWithName ( CFAllocatorRef allocator, const char *nodename - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0); /*! @function SCNetworkReachabilityGetTypeID @@ -158,7 +243,7 @@ SCNetworkReachabilityCreateWithName ( instances. */ CFTypeID -SCNetworkReachabilityGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; +SCNetworkReachabilityGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0); /*! @@ -168,7 +253,7 @@ SCNetworkReachabilityGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_L @param target The network reference associated with the address or name to be checked for reachability. @param flags A pointer to memory that will be filled with the - SCNetworkConnectionFlags detailing the reachability + SCNetworkReachabilityFlags detailing the reachability of the specified target. @result Returns TRUE if the network connection flags are valid; FALSE if the status could not be determined. @@ -176,8 +261,8 @@ SCNetworkReachabilityGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_L Boolean SCNetworkReachabilityGetFlags ( SCNetworkReachabilityRef target, - SCNetworkConnectionFlags *flags - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + SCNetworkReachabilityFlags *flags + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0); /*! @function SCNetworkReachabilitySetCallback @@ -197,7 +282,7 @@ SCNetworkReachabilitySetCallback ( SCNetworkReachabilityRef target, SCNetworkReachabilityCallBack callout, SCNetworkReachabilityContext *context - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0); /*! @function SCNetworkReachabilityScheduleWithRunLoop @@ -216,7 +301,7 @@ SCNetworkReachabilityScheduleWithRunLoop ( SCNetworkReachabilityRef target, CFRunLoopRef runLoop, CFStringRef runLoopMode - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0); /*! @function SCNetworkReachabilityUnscheduleFromRunLoop @@ -236,10 +321,26 @@ SCNetworkReachabilityUnscheduleFromRunLoop ( SCNetworkReachabilityRef target, CFRunLoopRef runLoop, CFStringRef runLoopMode - ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0); -__END_DECLS +#if !TARGET_OS_IPHONE +/*! + @function SCNetworkReachabilitySetDispatchQueue + @discussion Schedules callbacks for the given target on the given + dispatch queue. + @param target The address or name that is set up for asynchronous + notifications. Must be non-NULL. + @param queue A libdispatch queue to run the callback on. Pass NULL to disable notifications, and release queue. + @result Returns TRUE if the target is unscheduled successfully; + FALSE otherwise. + */ +Boolean +SCNetworkReachabilitySetDispatchQueue ( + SCNetworkReachabilityRef target, + dispatch_queue_t queue + ) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA); +#endif // !TARGET_OS_IPHONE -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ +__END_DECLS #endif /* _SCNETWORKREACHABILITY_H */ diff --git a/SystemConfiguration.fproj/SCNetworkService.c b/SystemConfiguration.fproj/SCNetworkService.c index 43725da..d01acc0 100644 --- a/SystemConfiguration.fproj/SCNetworkService.c +++ b/SystemConfiguration.fproj/SCNetworkService.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -45,7 +45,7 @@ static Boolean __SCNetworkServiceEqual (CFTypeRef cf1, CFTypeRef cf2); static CFHashCode __SCNetworkServiceHash (CFTypeRef cf); -static CFTypeID __kSCNetworkServiceTypeID = _kCFRuntimeNotATypeID; +static CFTypeID __kSCNetworkServiceTypeID = _kCFRuntimeNotATypeID; static const CFRuntimeClass __SCNetworkServiceClass = { @@ -61,7 +61,7 @@ static const CFRuntimeClass __SCNetworkServiceClass = { }; -static pthread_once_t initialized = PTHREAD_ONCE_INIT; +static pthread_once_t initialized = PTHREAD_ONCE_INIT; static CFStringRef @@ -74,7 +74,11 @@ __SCNetworkServiceCopyDescription(CFTypeRef cf) result = CFStringCreateMutable(allocator, 0); CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); CFStringAppendFormat(result, NULL, CFSTR("id = %@"), servicePrivate->serviceID); - CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), servicePrivate->prefs); + if (servicePrivate->prefs != NULL) { + CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), servicePrivate->prefs); + } else if (servicePrivate->store != NULL) { + CFStringAppendFormat(result, NULL, CFSTR(", store = %p"), servicePrivate->store); + } if (servicePrivate->name != NULL) { CFStringAppendFormat(result, NULL, CFSTR(", name = %@"), servicePrivate->name); } @@ -93,7 +97,8 @@ __SCNetworkServiceDeallocate(CFTypeRef cf) CFRelease(servicePrivate->serviceID); if (servicePrivate->interface != NULL) CFRelease(servicePrivate->interface); - CFRelease(servicePrivate->prefs); + if (servicePrivate->prefs != NULL) CFRelease(servicePrivate->prefs); + if (servicePrivate->store != NULL) CFRelease(servicePrivate->store); if (servicePrivate->name != NULL) CFRelease(servicePrivate->name); return; @@ -158,7 +163,7 @@ __SCNetworkServiceCreatePrivate(CFAllocatorRef allocator, return NULL; } - servicePrivate->prefs = CFRetain(prefs); + servicePrivate->prefs = (prefs != NULL) ? CFRetain(prefs): NULL; servicePrivate->serviceID = CFStringCreateCopy(NULL, serviceID); servicePrivate->interface = (interface != NULL) ? CFRetain(interface) : NULL; servicePrivate->name = NULL; @@ -217,7 +222,7 @@ SCNetworkServiceAddProtocolType(SCNetworkServiceRef service, CFStringRef protoco SCNetworkProtocolRef protocol; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } @@ -408,6 +413,24 @@ SCNetworkServiceCopy(SCPreferencesRef prefs, CFStringRef serviceID) } +SCNetworkServiceRef +_SCNetworkServiceCopyActive(SCDynamicStoreRef store, CFStringRef serviceID) +{ + SCNetworkServicePrivateRef servicePrivate; + + if (!isA_CFString(serviceID)) { + _SCErrorSet(kSCStatusInvalidArgument); + return NULL; + } + + servicePrivate = __SCNetworkServiceCreatePrivate(NULL, NULL, serviceID, NULL); + if (store != NULL) { + servicePrivate->store = CFRetain(store); + } + return (SCNetworkServiceRef)servicePrivate; +} + + SCNetworkProtocolRef SCNetworkServiceCopyProtocol(SCNetworkServiceRef service, CFStringRef protocolType) { @@ -417,7 +440,7 @@ SCNetworkServiceCopyProtocol(SCNetworkServiceRef service, CFStringRef protocolTy SCNetworkProtocolPrivateRef protocolPrivate = NULL; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return NULL; } @@ -433,7 +456,7 @@ SCNetworkServiceCopyProtocol(SCNetworkServiceRef service, CFStringRef protocolTy protocols = SCPreferencesPathGetValue(servicePrivate->prefs, path); CFRelease(path); - if ((protocols != NULL) && !isA_CFDictionary(protocols)) { + if (!isA_CFDictionary(protocols)) { // if corrupt prefs _SCErrorSet(kSCStatusFailed); return NULL; @@ -472,7 +495,7 @@ SCNetworkServiceCopyProtocols(SCNetworkServiceRef service) CFDictionaryRef protocols; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return NULL; } @@ -484,6 +507,8 @@ SCNetworkServiceCopyProtocols(SCNetworkServiceRef service) CFRelease(path); if (!isA_CFDictionary(protocols)) { + // if corrupt prefs + _SCErrorSet(kSCStatusFailed); return NULL; } @@ -642,7 +667,6 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface) CFEqual(interfaceType, kSCNetworkInterfaceTypeSerial ) || CFEqual(interfaceType, kSCNetworkInterfaceTypeWWAN )) { CFDictionaryRef overrides; - CFStringRef script; overrides = __SCNetworkInterfaceGetTemplateOverrides(interface, kSCNetworkInterfaceTypeModem); @@ -661,26 +685,6 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface) config = newConfig; } - // update template for v.92 modems - if ((overrides == NULL) && - CFDictionaryGetValueIfPresent(config, - kSCPropNetModemConnectionScript, - (const void **)&script) && - CFEqual(script, CFSTR("v.34 Personality")) && - _SCNetworkInterfaceIsModemV92(interface)) { - CFMutableDictionaryRef newConfig; - - newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config); - CFDictionarySetValue(newConfig, - kSCPropNetModemConnectionPersonality, - CFSTR("v.92 Personality")); - CFDictionarySetValue(newConfig, - kSCPropNetModemDeviceModel, - CFSTR("Apple Modem (v.92)")); - CFRelease(config); - config = newConfig; - } - if (overrides != NULL) { CFMutableDictionaryRef newConfig; @@ -717,8 +721,8 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface) servicePrivate->interface); // push the [deep] interface configuration into the service. - interface_config = __SCNetworkInterfaceCopyDeepConfiguration(servicePrivate->interface); - __SCNetworkInterfaceSetDeepConfiguration(servicePrivate->interface, interface_config); + interface_config = __SCNetworkInterfaceCopyDeepConfiguration(NULL, servicePrivate->interface); + __SCNetworkInterfaceSetDeepConfiguration(NULL, servicePrivate->interface, interface_config); if (interface_config != NULL) CFRelease(interface_config); // set the service name to match that of the associated interface @@ -745,10 +749,16 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface) Boolean SCNetworkServiceEstablishDefaultConfiguration(SCNetworkServiceRef service) { - CFIndex i; - SCNetworkInterfaceRef interface; - CFIndex n; - CFArrayRef protocolTypes; + CFIndex i; + SCNetworkInterfaceRef interface; + CFIndex n; + CFArrayRef protocolTypes; + SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; + + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } interface = SCNetworkServiceGetInterface(service); if (interface == NULL) { @@ -808,7 +818,7 @@ SCNetworkServiceGetEnabled(SCNetworkServiceRef service) CFStringRef path; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } @@ -828,7 +838,7 @@ SCNetworkServiceGetInterface(SCNetworkServiceRef service) { SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return NULL; } @@ -857,11 +867,11 @@ SCNetworkServiceGetName(SCNetworkServiceRef service) { CFDictionaryRef entity; SCNetworkInterfaceRef interface; - SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; CFStringRef name = NULL; CFStringRef path; + SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return NULL; } @@ -888,7 +898,7 @@ SCNetworkServiceGetName(SCNetworkServiceRef service) SCNetworkInterfaceRef childInterface; childInterface = SCNetworkInterfaceGetInterface(interface); - if (childInterface == NULL) { + if ((childInterface == NULL) || CFEqual(childInterface, kSCNetworkInterfaceIPv4)) { break; } @@ -896,17 +906,52 @@ SCNetworkServiceGetName(SCNetworkServiceRef service) } if (interface != NULL) { - CFStringRef interface_name; + int i; + CFStringRef interface_name = NULL; CFStringRef suffix = NULL; - if (servicePrivate->name != NULL) { - interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface); + // + // check if the [stored] service name matches the non-localized interface + // name. If so, return the localized name. + // + // Also, the older "Built-in XXX" interface names are too long for the + // current UI. If we find that the [stored] service name matches the older + // name, return the newer (and shorter) localized name. + // + // Note: the user/admin will no longer be able to set the service name + // to "Built-in Ethernet". + // + for (i = 0; i < 3; i++) { + if (servicePrivate->name == NULL) { + // if no [stored] service name to compare + break; + } + + switch (i) { + case 0 : + // compare the non-localized interface name + interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface); + if (interface_name != NULL) { + CFRetain(interface_name); + } + break; + case 1 : + // compare the older "Built-in XXX" localized name + interface_name = __SCNetworkInterfaceCopyXLocalizedDisplayName(interface); + break; + case 2 : + // compare the older "Built-in XXX" non-localized name + interface_name = __SCNetworkInterfaceCopyXNonLocalizedDisplayName(interface); + break; + } + if (interface_name != NULL) { + Boolean match = FALSE; + if (CFEqual(name, interface_name)) { - // if service name matches the [non-]localized + // if service name matches the OLD localized // interface name - CFRelease(servicePrivate->name); - servicePrivate->name = NULL; + match = TRUE; } else if (CFStringHasPrefix(name, interface_name)) { CFIndex prefixLen = CFStringGetLength(interface_name); CFIndex suffixLen = CFStringGetLength(name); @@ -914,12 +959,21 @@ SCNetworkServiceGetName(SCNetworkServiceRef service) suffix = CFStringCreateWithSubstring(NULL, name, CFRangeMake(prefixLen, suffixLen - prefixLen)); + match = TRUE; + } + CFRelease(interface_name); + + if (match) { CFRelease(servicePrivate->name); servicePrivate->name = NULL; + break; } } } + // + // if the service name has not been set, use the localized interface name + // if (servicePrivate->name == NULL) { interface_name = SCNetworkInterfaceGetLocalizedDisplayName(interface); if (interface_name != NULL) { @@ -967,11 +1021,11 @@ Boolean SCNetworkServiceRemove(SCNetworkServiceRef service) { Boolean ok = FALSE; + CFStringRef path; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; CFArrayRef sets; - CFStringRef path; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } @@ -1017,7 +1071,7 @@ SCNetworkServiceRemoveProtocolType(SCNetworkServiceRef service, CFStringRef prot CFStringRef path; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } @@ -1054,7 +1108,7 @@ SCNetworkServiceSetEnabled(SCNetworkServiceRef service, Boolean enabled) CFStringRef path; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } @@ -1078,7 +1132,7 @@ SCNetworkServiceSetName(SCNetworkServiceRef service, CFStringRef name) CFStringRef saveName = NULL; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } @@ -1213,18 +1267,18 @@ SCNetworkServiceSetName(SCNetworkServiceRef service, CFStringRef name) servicePrivate->serviceID, // service NULL); // entity entity = SCPreferencesPathGetValue(servicePrivate->prefs, path); - if ((entity == NULL) && (name != NULL)) { - entity = CFDictionaryCreate(NULL, - NULL, - NULL, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - } - if (isA_CFDictionary(entity)) { + if (isA_CFDictionary(entity) || + ((entity == NULL) && (name != NULL))) { CFMutableDictionaryRef newEntity; - newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity); + if (entity != NULL) { + newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity); + } else { + newEntity = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } if (saveName != NULL) { CFDictionarySetValue(newEntity, kSCPropUserDefinedName, saveName); } else { @@ -1242,3 +1296,215 @@ SCNetworkServiceSetName(SCNetworkServiceRef service, CFStringRef name) return ok; } + + +#pragma mark - +#pragma mark SCNetworkService SPIs + + +static Boolean +str_to_rank(CFStringRef rankStr, SCNetworkServicePrimaryRank *rank) +{ + if (isA_CFString(rankStr)) { + if (CFEqual(rankStr, kSCValNetServicePrimaryRankFirst)) { + *rank = kSCNetworkServicePrimaryRankFirst; + } else if (CFEqual(rankStr, kSCValNetServicePrimaryRankLast)) { + *rank = kSCNetworkServicePrimaryRankLast; + } else if (CFEqual(rankStr, kSCValNetServicePrimaryRankNever)) { + *rank = kSCNetworkServicePrimaryRankNever; + } else { + return FALSE; + } + } else if (rankStr == NULL) { + *rank = kSCNetworkServicePrimaryRankDefault; + } else { + return FALSE; + } + + return TRUE; +} + + +SCNetworkServicePrimaryRank +SCNetworkServiceGetPrimaryRank(SCNetworkServiceRef service) +{ + CFDictionaryRef entity; + Boolean ok = TRUE; + CFStringRef path; + SCNetworkServicePrimaryRank rank = kSCNetworkServicePrimaryRankDefault; + CFStringRef rankStr = NULL; + SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; + + if (!isA_SCNetworkService(service)) { + _SCErrorSet(kSCStatusInvalidArgument); + return rank; + } + + if (servicePrivate->prefs != NULL) { + path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL, + servicePrivate->serviceID, + NULL); + entity = SCPreferencesPathGetValue(servicePrivate->prefs, path); + CFRelease(path); + if (isA_CFDictionary(entity)) { + rankStr = CFDictionaryGetValue(entity, kSCPropNetServicePrimaryRank); + ok = str_to_rank(rankStr, &rank); + } + } else if (servicePrivate->store != NULL) { + path = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainState, + servicePrivate->serviceID, + NULL); + entity = SCDynamicStoreCopyValue(servicePrivate->store, path); + CFRelease(path); + if (entity != NULL) { + if (isA_CFDictionary(entity)) { + rankStr = CFDictionaryGetValue(entity, kSCPropNetServicePrimaryRank); + ok = str_to_rank(rankStr, &rank); + } + CFRelease(entity); + } + } else { + _SCErrorSet(kSCStatusInvalidArgument); + return rank; + } + + if (!ok) { + rank = kSCNetworkServicePrimaryRankDefault; + _SCErrorSet(kSCStatusInvalidArgument); + } else if (rank == kSCNetworkServicePrimaryRankDefault) { + _SCErrorSet(kSCStatusOK); + } + + return rank; +} + + +static Boolean +rank_to_str(SCNetworkServicePrimaryRank rank, CFStringRef *rankStr) +{ + switch (rank) { + case kSCNetworkServicePrimaryRankDefault : + *rankStr = NULL; + break; + case kSCNetworkServicePrimaryRankFirst : + *rankStr = kSCValNetServicePrimaryRankFirst; + break; + case kSCNetworkServicePrimaryRankLast : + *rankStr = kSCValNetServicePrimaryRankLast; + break; + case kSCNetworkServicePrimaryRankNever : + *rankStr = kSCValNetServicePrimaryRankNever; + break; + default : + return FALSE; + } + + return TRUE; +} + + +Boolean +SCNetworkServiceSetPrimaryRank(SCNetworkServiceRef service, + SCNetworkServicePrimaryRank newRank) +{ + Boolean ok; + CFDictionaryRef entity; + CFMutableDictionaryRef newEntity; + CFStringRef path = NULL; + CFStringRef rankStr = NULL; + SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; + + if (!isA_SCNetworkService(service)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + ok = rank_to_str(newRank, &rankStr); + if (!ok) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + if (servicePrivate->prefs != NULL) { + if ((newRank == kSCNetworkServicePrimaryRankDefault) || (newRank == kSCNetworkServicePrimaryRankNever)) { + path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL, + servicePrivate->serviceID, + NULL); + entity = SCPreferencesPathGetValue(servicePrivate->prefs, path); + if (entity != NULL) { + if (!isA_CFDictionary(entity)) { + // if corrupt prefs + _SCErrorSet(kSCStatusFailed); + goto done; + } + newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity); + } else { + newEntity = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } + if (rankStr != NULL) { + CFDictionarySetValue(newEntity, kSCPropNetServicePrimaryRank, rankStr); + } else { + CFDictionaryRemoveValue(newEntity, kSCPropNetServicePrimaryRank); + } + if (CFDictionaryGetCount(newEntity) > 0) { + ok = SCPreferencesPathSetValue(servicePrivate->prefs, path, newEntity); + } else { + ok = SCPreferencesPathRemoveValue(servicePrivate->prefs, path); + } + CFRelease(newEntity); + if (!ok) { + goto done; + } + } else { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + } else if (servicePrivate->store != NULL) { + path = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, + kSCDynamicStoreDomainState, + servicePrivate->serviceID, + NULL); + entity = SCDynamicStoreCopyValue(servicePrivate->store, path); + if (entity != NULL) { + if (!isA_CFDictionary(entity)) { + // if corrupt prefs + CFRelease(entity); + _SCErrorSet(kSCStatusFailed); + goto done; + } + newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity); + CFRelease(entity); + } else { + newEntity = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } + if (rankStr != NULL) { + CFDictionarySetValue(newEntity, kSCPropNetServicePrimaryRank, rankStr); + } else { + CFDictionaryRemoveValue(newEntity, kSCPropNetServicePrimaryRank); + } + if (CFDictionaryGetCount(newEntity) > 0) { + ok = SCDynamicStoreSetValue(servicePrivate->store, path, newEntity); + } else { + ok = SCDynamicStoreRemoveValue(servicePrivate->store, path); + } + CFRelease(newEntity); + if (!ok) { + goto done; + } + } else { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + done : + + if (path != NULL) CFRelease(path); + return ok; +} diff --git a/SystemConfiguration.fproj/SCNetworkSet.c b/SystemConfiguration.fproj/SCNetworkSet.c index 1b29b18..7ff5750 100644 --- a/SystemConfiguration.fproj/SCNetworkSet.c +++ b/SystemConfiguration.fproj/SCNetworkSet.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -160,6 +160,7 @@ __SCNetworkSetCreatePrivate(CFAllocatorRef allocator, setPrivate->setID = CFStringCreateCopy(NULL, setID); setPrivate->prefs = CFRetain(prefs); setPrivate->name = NULL; + setPrivate->established = FALSE; // "new" (not yet established) set return setPrivate; } @@ -169,7 +170,7 @@ __SCNetworkSetCreatePrivate(CFAllocatorRef allocator, static Boolean -_serviceIsPPP(SCNetworkServiceRef service) +_serviceIsVPN(SCNetworkServiceRef service) { SCNetworkInterfaceRef interface; CFStringRef interfaceType; @@ -180,33 +181,26 @@ _serviceIsPPP(SCNetworkServiceRef service) } interfaceType = SCNetworkInterfaceGetInterfaceType(interface); - return CFEqual(interfaceType, kSCNetworkInterfaceTypePPP); -} - - -static Boolean -_serviceIsVPN(SCNetworkServiceRef service) -{ - SCNetworkInterfaceRef interface; - CFStringRef interfaceType; - -// if (!_serviceIsPPP(service)) { -// return FALSE; -// } - - interface = SCNetworkServiceGetInterface(service); -// if (interface == NULL) { -// return FALSE; -// } + if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { + interface = SCNetworkInterfaceGetInterface(interface); + if (interface == NULL) { + return FALSE; + } - interface = SCNetworkInterfaceGetInterface(interface); - if (interface == NULL) { + interfaceType = SCNetworkInterfaceGetInterfaceType(interface); + if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) { + return TRUE; + } + if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) { + return TRUE; + } return FALSE; } + if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) { + return TRUE; + } - interfaceType = SCNetworkInterfaceGetInterfaceType(interface); - return (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP) || - CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)); + return FALSE; } @@ -216,8 +210,8 @@ _serviceOrder(SCNetworkServiceRef service) SCNetworkInterfaceRef interface; interface = SCNetworkServiceGetInterface(service); - if (interface == NULL) { - return 100000; // sort last + if ((interface == NULL) || _serviceIsVPN(service)) { + return 100000; // if unknown or VPN interface, sort last } return __SCNetworkInterfaceOrder(interface); @@ -232,6 +226,7 @@ _serviceOrder_add(SCNetworkSetRef set, SCNetworkServiceRef service) CFMutableArrayRef newOrder; CFArrayRef order; CFStringRef serviceID; + CFIndex serviceOrder; SCNetworkSetPrivateRef setPrivate = (SCNetworkSetPrivateRef)set; CFIndex slot; @@ -249,51 +244,33 @@ _serviceOrder_add(SCNetworkSetRef set, SCNetworkServiceRef service) goto done; } - if (_serviceIsPPP(service) && !_serviceIsVPN(service)) { - int serviceOrder; + serviceOrder = _serviceOrder(service); - /* - * we add [non-VPN] PPP interfaces to the head of the - * service order but ensure that "modem" devices are - * in front of "Bluetooth" & "IrDA" devices. - */ - slot = 0; - - serviceOrder = _serviceOrder(service); - - for (i = 0; i < n; i++) { - int slotOrder; - CFStringRef slotServiceID; - SCNetworkServiceRef slotService; - - slotServiceID = CFArrayGetValueAtIndex(newOrder, i); - if (!isA_CFString(slotServiceID)) { - // if bad prefs - continue; - } + slot = 0; + for (i = 0; i < n; i++) { + int slotOrder; + SCNetworkServiceRef slotService; + CFStringRef slotServiceID; - slotService = SCNetworkServiceCopy(setPrivate->prefs, slotServiceID); - if (slotService == NULL) { - // if serviceID not valid - continue; - } + slotServiceID = CFArrayGetValueAtIndex(newOrder, i); + if (!isA_CFString(slotServiceID)) { + // if bad prefs + continue; + } - if (_serviceIsPPP(slotService)) { - // if PPP service - slotOrder = _serviceOrder(slotService); - if (serviceOrder >= slotOrder) { - // add the service *after* this one - slot = i + 1; - } - } + slotService = SCNetworkServiceCopy(setPrivate->prefs, slotServiceID); + if (slotService == NULL) { + // if serviceID not valid + continue; + } - CFRelease(slotService); + slotOrder = _serviceOrder(slotService); + if (serviceOrder >= slotOrder) { + // add the service *after* this one + slot = i + 1; } - } else { - /* - * non-PPP interfaces are added to the end of the list. - */ - slot = n; + + CFRelease(slotService); } CFArrayInsertValueAtIndex(newOrder, slot, serviceID); @@ -364,7 +341,7 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service) return FALSE; } - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } @@ -441,7 +418,7 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service) // get the [deep] interface configuration settings interface = SCNetworkServiceGetInterface(service); if (interface != NULL) { - interface_config = __SCNetworkInterfaceCopyDeepConfiguration(interface); + interface_config = __SCNetworkInterfaceCopyDeepConfiguration(set, interface); } // create the link between "set" and the "service" @@ -461,12 +438,15 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service) // push the [deep] interface configuration into all sets which contain this service. if (interface != NULL) { - __SCNetworkInterfaceSetDeepConfiguration(interface, interface_config); + __SCNetworkInterfaceSetDeepConfiguration(set, interface, interface_config); } // add service to ServiceOrder _serviceOrder_add(set, service); + // mark set as no longer "new" + setPrivate->established = TRUE; + done : if (interface_config != NULL) CFRelease(interface_config); @@ -496,6 +476,10 @@ SCNetworkSetCopy(SCPreferencesRef prefs, CFStringRef setID) } setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID); + + // mark set as "old" (already established) + setPrivate->established = TRUE; + return (SCNetworkSetRef)setPrivate; } @@ -586,6 +570,10 @@ SCNetworkSetCopyAll(SCPreferencesRef prefs) } setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, keys[i]); + + // mark set as "old" (already established) + setPrivate->established = TRUE; + CFArrayAppendValue(array, (SCNetworkSetRef)setPrivate); CFRelease(setPrivate); } @@ -620,6 +608,9 @@ SCNetworkSetCopyCurrent(SCPreferencesRef prefs) path = SCPreferencesPathKeyCreateSet(NULL, setID); if (CFEqual(path, currentID)) { setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID); + + // mark set as "old" (already established) + setPrivate->established = TRUE; } else { SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkSetCopyCurrent(): preferences are non-conformant")); } @@ -738,6 +729,9 @@ SCNetworkSetCreate(SCPreferencesRef prefs) setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID); CFRelease(components); + // mark set as "new" (not yet established) + setPrivate->established = FALSE; + return (SCNetworkSetRef)setPrivate; } @@ -889,6 +883,7 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service) CFArrayRef interface_config = NULL; Boolean ok; CFStringRef path; + int sc_status = kSCStatusOK; SCNetworkServicePrivateRef servicePrivate = (SCNetworkServicePrivateRef)service; SCNetworkSetPrivateRef setPrivate = (SCNetworkSetPrivateRef)set; @@ -897,7 +892,7 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service) return FALSE; } - if (!isA_SCNetworkService(service)) { + if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) { _SCErrorSet(kSCStatusInvalidArgument); return FALSE; } @@ -908,10 +903,10 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service) // get the [deep] interface configuration settings interface = SCNetworkServiceGetInterface(service); if (interface != NULL) { - interface_config = __SCNetworkInterfaceCopyDeepConfiguration(interface); + interface_config = __SCNetworkInterfaceCopyDeepConfiguration(set, interface); if (interface_config != NULL) { // remove the interface configuration from all sets which contain this service. - __SCNetworkInterfaceSetDeepConfiguration(interface, NULL); + __SCNetworkInterfaceSetDeepConfiguration(set, interface, NULL); } } @@ -921,19 +916,20 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service) servicePrivate->serviceID, NULL); ok = SCPreferencesPathRemoveValue(setPrivate->prefs, path); - CFRelease(path); if (!ok) { - goto done; + sc_status = SCError(); // preserve the error } + CFRelease(path); // push the [deep] interface configuration [back] into all sets which contain the service. if (interface_config != NULL) { - __SCNetworkInterfaceSetDeepConfiguration(interface, interface_config); + __SCNetworkInterfaceSetDeepConfiguration(set, interface, interface_config); } - done : - if (interface_config != NULL) CFRelease(interface_config); + if (!ok) { + _SCErrorSet(sc_status); + } return ok; } @@ -1058,18 +1054,18 @@ SCNetworkSetSetName(SCNetworkSetRef set, CFStringRef name) path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID); entity = SCPreferencesPathGetValue(setPrivate->prefs, path); - if ((entity == NULL) && (name != NULL)) { - entity = CFDictionaryCreate(NULL, - NULL, - NULL, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - } - if (isA_CFDictionary(entity)) { + if (isA_CFDictionary(entity) || + ((entity == NULL) && (name != NULL))) { CFMutableDictionaryRef newEntity; - newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity); + if (entity != NULL) { + newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity); + } else { + newEntity = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } if (name != NULL) { CFDictionarySetValue(newEntity, kSCPropUserDefinedName, name); } else { @@ -1234,11 +1230,10 @@ __SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CF // for those interfaces that are not represented in the // current set. services = SCNetworkSetCopyServices(set); - if ((services != NULL) && (CFArrayGetCount(services) > 0)) { - // but, if we are starting off with a non-empty - // set than we only want to add new services for - // those interfaces that are not represented in - // *any* set. + if ((services != NULL) && setPrivate->established) { + // but, if we are given an existing (or "established") set + // than we only want to add new services for those interfaces + // that are not represented in *any* set. CFRelease(services); services = SCNetworkServiceCopyAll(setPrivate->prefs); } diff --git a/SystemConfiguration.fproj/SCNetworkSignature.c b/SystemConfiguration.fproj/SCNetworkSignature.c index 0c7d4c9..274bc15 100644 --- a/SystemConfiguration.fproj/SCNetworkSignature.c +++ b/SystemConfiguration.fproj/SCNetworkSignature.c @@ -21,11 +21,11 @@ * @APPLE_LICENSE_HEADER_END@ */ -/* +/* * SCNetworkSignature.c * - implementation of SCNetworkSignatureRef API that allows access to network identification information - * + * */ /* * Modification History @@ -46,10 +46,6 @@ #include "SCNetworkSignature.h" #include "SCNetworkSignaturePrivate.h" -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -#error MAC_OS_X_VERSION_MIN_REQUIRED < 1050, Check MACOSX_DEPLOYMENT_TARGET -#endif - const char * kSCNetworkSignatureActiveChangedNotifyName = NETWORK_ID_KEY ".active"; @@ -67,7 +63,7 @@ store_copy_id_dict(CFAllocatorRef alloc, SCDynamicStoreRef store) { CFDictionaryRef id_dict = NULL; Boolean release_store = FALSE; - + if (store == NULL) { store = store_create(alloc); if (store == NULL) { @@ -75,7 +71,7 @@ store_copy_id_dict(CFAllocatorRef alloc, SCDynamicStoreRef store) } release_store = TRUE; } - id_dict = SCDynamicStoreCopyValue(store, + id_dict = SCDynamicStoreCopyValue(store, kSCNetworkIdentificationStoreKey); if (isA_CFDictionary(id_dict) == NULL) { if (id_dict != NULL) { @@ -91,7 +87,7 @@ store_copy_id_dict(CFAllocatorRef alloc, SCDynamicStoreRef store) return (id_dict); } -#pragma - +#pragma - #pragma mark SCNetworkSignature APIs @@ -106,7 +102,7 @@ SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc, /* only accept 0.0.0.0 (i.e. default) for now */ sin_p = (struct sockaddr_in *)addr; - if (addr == NULL + if (addr == NULL || addr->sa_family != AF_INET || addr->sa_len != sizeof(struct sockaddr_in) || sin_p->sin_addr.s_addr != 0) { @@ -161,7 +157,7 @@ SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc) } } CFRetain(active); - + done: if (id_dict != NULL) { CFRelease(id_dict); diff --git a/SystemConfiguration.fproj/SCNetworkSignature.h b/SystemConfiguration.fproj/SCNetworkSignature.h index d8d7a42..c065caa 100644 --- a/SystemConfiguration.fproj/SCNetworkSignature.h +++ b/SystemConfiguration.fproj/SCNetworkSignature.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,16 +24,14 @@ #ifndef _SCNETWORKSIGNATURE_H #define _SCNETWORKSIGNATURE_H -#include -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - +#include #include #include #include /*! @header SCNetworkSignature - @discussion The SCNetworkSignature API provides access to the + @discussion The SCNetworkSignature API provides access to the network identification information. Each routable network has an associated signature that is assigned a unique identifier. The unique identifier allows an application @@ -61,7 +59,7 @@ extern const char * kSCNetworkSignatureActiveChangedNotifyName; NULL if no networks are currently active. */ CFArrayRef /* of CFStringRef's */ -SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc); +SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCNetworkSignatureCopyActiveIdentifierForAddress @@ -81,8 +79,6 @@ SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc); */ CFStringRef SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc, - const struct sockaddr * addr); - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ + const struct sockaddr * addr) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); #endif /* _SCNETWORKSIGNATURE_H */ diff --git a/SystemConfiguration.fproj/SCP.c b/SystemConfiguration.fproj/SCP.c index 2f8d071..1acfe1d 100644 --- a/SystemConfiguration.fproj/SCP.c +++ b/SystemConfiguration.fproj/SCP.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2007, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -52,7 +52,8 @@ __SCPSignatureFromStatbuf(const struct stat *statBuf) sig = (SCPSignatureDataRef)CFDataGetBytePtr(signature); sig->st_dev = statBuf->st_dev; sig->st_ino = statBuf->st_ino; - sig->st_mtimespec = statBuf->st_mtimespec; + sig->tv_sec = statBuf->st_mtimespec.tv_sec; + sig->tv_nsec = statBuf->st_mtimespec.tv_nsec; sig->st_size = statBuf->st_size; return signature; } diff --git a/SystemConfiguration.fproj/SCPCommit.c b/SystemConfiguration.fproj/SCPCommit.c index 8e73cf3..c380dc0 100644 --- a/SystemConfiguration.fproj/SCPCommit.c +++ b/SystemConfiguration.fproj/SCPCommit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -106,7 +106,7 @@ __SCPreferencesCommitChanges_helper(SCPreferencesRef prefs) static ssize_t -writen(int ref, void *data, size_t len) +writen(int ref, const void *data, size_t len) { size_t left = len; ssize_t n; @@ -210,7 +210,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs) (void) close(fd); goto done; } - if (writen(fd, (void *)CFDataGetBytePtr(newPrefs), CFDataGetLength(newPrefs)) == -1) { + if (writen(fd, (const void *)CFDataGetBytePtr(newPrefs), CFDataGetLength(newPrefs)) == -1) { _SCErrorSet(errno); SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges write() failed: %s"), strerror(errno)); SCLog(_sc_verbose, LOG_ERR, CFSTR(" path = %s"), thePath); @@ -221,6 +221,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs) goto done; } +#if !TARGET_OS_IPHONE /* synchronize the file's in-core state with that on disk */ if (fsync(fd) == -1) { _SCErrorSet(errno); @@ -239,6 +240,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs) * Note: at present, this only works on HFS filesystems */ (void) fcntl(fd, F_FULLFSYNC, 0); +#endif // !TARGET_OS_IPHONE /* new preferences have been written */ if (close(fd) == -1) { diff --git a/SystemConfiguration.fproj/SCPLock.c b/SystemConfiguration.fproj/SCPLock.c index 0e6fcb3..3bffe8b 100644 --- a/SystemConfiguration.fproj/SCPLock.c +++ b/SystemConfiguration.fproj/SCPLock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -38,12 +38,23 @@ #include #include +#include #include #include #include +#if TARGET_OS_IPHONE +__private_extern__ int +getgrnam_r(const char *name, __unused struct group *grp, __unused char *buf, __unused size_t bufsize, struct group **grpP) +{ + *grpP = getgrnam(name); + return (*grpP == NULL) ? -1 : 0; +} +#endif /* TARGET_OS_IPHONE */ + + static Boolean __SCPreferencesLock_helper(SCPreferencesRef prefs, Boolean wait) { @@ -194,10 +205,43 @@ createParentDirectory(const char *path) } +static void +reportDelay(SCPreferencesRef prefs, struct timeval *delay, Boolean isStale) +{ + aslmsg m; + SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; + char str[256]; + + m = asl_new(ASL_TYPE_MSG); + asl_set(m, "com.apple.message.domain", "com.apple.SystemConfiguration.SCPreferencesLock"); + (void) _SC_cfstring_to_cstring(prefsPrivate->name, str, sizeof(str), kCFStringEncodingUTF8); + asl_set(m, "com.apple.message.signature", str); + (void) _SC_cfstring_to_cstring(prefsPrivate->prefsID, str, sizeof(str), kCFStringEncodingUTF8); + asl_set(m, "com.apple.message.signature2", str); + (void) snprintf(str, sizeof(str), + "%d.%3.3d", + (int)delay->tv_sec, + delay->tv_usec / 1000); + asl_set(m, "com.apple.message.value", str); + SCLOG(NULL, m, ASL_LEVEL_DEBUG, + CFSTR("SCPreferences(%@:%@) lock delayed for %d.%3.3d seconds%s"), + prefsPrivate->name, + prefsPrivate->prefsID, + (int)delay->tv_sec, + delay->tv_usec / 1000, + isStale ? " (stale)" : ""); + asl_free(m); + + return; +} + + Boolean SCPreferencesLock(SCPreferencesRef prefs, Boolean wait) { char buf[32]; + struct timeval lockStart; + struct timeval lockElapsed; SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; int sc_status = kSCStatusFailed; struct stat statBuf; @@ -241,6 +285,8 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait) snprintf(prefsPrivate->lockPath, pathLen, "%s-lock", path); } + (void)gettimeofday(&lockStart, NULL); + retry : prefsPrivate->lockFD = open(prefsPrivate->lockPath, @@ -301,6 +347,9 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait) locked : + (void)gettimeofday(&prefsPrivate->lockTime, NULL); + timersub(&prefsPrivate->lockTime, &lockStart, &lockElapsed); + if (prefsPrivate->accessed) { CFDataRef currentSignature; Boolean match; @@ -317,9 +366,7 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait) SCLog(TRUE, LOG_DEBUG, CFSTR("SCPreferencesLock stat() failed: %s"), strerror(errno)); - sc_status = kSCStatusStale; - unlink(prefsPrivate->lockPath); - goto error; + goto stale; } } @@ -332,9 +379,7 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait) * session was accessed so we've got no choice * but to deny the lock request. */ - sc_status = kSCStatusStale; - unlink(prefsPrivate->lockPath); - goto error; + goto stale; } // } else { // /* @@ -344,10 +389,25 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait) // */ } + if (lockElapsed.tv_sec > 0) { + // if we waited more than 1 second to acquire the lock + reportDelay(prefs, &lockElapsed, FALSE); + } + prefsPrivate->locked = TRUE; pthread_mutex_unlock(&prefsPrivate->lock); return TRUE; + stale : + + sc_status = kSCStatusStale; + unlink(prefsPrivate->lockPath); + + if (lockElapsed.tv_sec > 0) { + // if we waited more than 1 second to acquire the lock + reportDelay(prefs, &lockElapsed, TRUE); + } + error : if (prefsPrivate->lockFD != -1) { diff --git a/SystemConfiguration.fproj/SCPOpen.c b/SystemConfiguration.fproj/SCPOpen.c index 7ea1968..9dfde1d 100644 --- a/SystemConfiguration.fproj/SCPOpen.c +++ b/SystemConfiguration.fproj/SCPOpen.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2000-2007 Apple Inc. All rights reserved. + * Copyright(c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -34,13 +34,18 @@ * - initial revision */ +#include +#include +#include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE #include #include #include #include "SCPreferencesInternal.h" #include "SCHelper_client.h" -#include #include "dy_framework.h" #include @@ -49,6 +54,13 @@ #include +static __inline__ CFTypeRef +isA_SCPreferences(CFTypeRef obj) +{ + return (isA_CFType(obj, SCPreferencesGetTypeID())); +} + + static CFStringRef __SCPreferencesCopyDescription(CFTypeRef cf) { CFAllocatorRef allocator = CFGetAllocator(cf); @@ -174,6 +186,7 @@ __SCPreferencesCreatePrivate(CFAllocatorRef allocator) prefsPrivate->session = NULL; prefsPrivate->sessionKeyCommit = NULL; prefsPrivate->sessionKeyApply = NULL; + prefsPrivate->scheduled = FALSE; prefsPrivate->rls = NULL; prefsPrivate->rlsFunction = NULL; prefsPrivate->rlsContext.info = NULL; @@ -181,6 +194,9 @@ __SCPreferencesCreatePrivate(CFAllocatorRef allocator) prefsPrivate->rlsContext.release = NULL; prefsPrivate->rlsContext.copyDescription = NULL; prefsPrivate->rlList = NULL; +#if !TARGET_OS_IPHONE + prefsPrivate->dispatchQueue = NULL; +#endif // !TARGET_OS_IPHONE prefsPrivate->prefs = NULL; prefsPrivate->accessed = FALSE; prefsPrivate->changed = FALSE; @@ -196,9 +212,12 @@ __private_extern__ Boolean __SCPreferencesCreate_helper(SCPreferencesRef prefs) { CFDataRef data = NULL; + CFMutableDictionaryRef info; + CFNumberRef num; Boolean ok; SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; uint32_t status = kSCStatusOK; + uint32_t pid = getpid(); // start helper prefsPrivate->helper = _SCHelperOpen(prefsPrivate->authorizationData); @@ -206,12 +225,24 @@ __SCPreferencesCreate_helper(SCPreferencesRef prefs) goto fail; } - // serialize the "prefsID" + // create a dictionary of information to pass to the helper + info = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); if (prefsPrivate->prefsID != NULL) { - ok = _SCSerializeString(prefsPrivate->prefsID, &data, NULL, NULL); - if (!ok) { - goto fail; - } + CFDictionarySetValue(info, CFSTR("prefsID"), prefsPrivate->prefsID); + } + CFDictionarySetValue(info, CFSTR("name"), prefsPrivate->name); + num = CFNumberCreate(NULL, kCFNumberSInt32Type, &pid); + CFDictionarySetValue(info, CFSTR("PID"), num); + CFRelease(num); + + // serialize the info + ok = _SCSerialize(info, &data, NULL, NULL); + CFRelease(info); + if (data == NULL || !ok) { + goto fail; } // have the helper "open" the prefs @@ -406,13 +437,14 @@ __SCPreferencesCreate(CFAllocatorRef allocator, goto done; } + SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesCreate open() failed: %s"), strerror(errno)); sc_status = kSCStatusAccessError; break; default : + SCLog(TRUE, LOG_ERR, CFSTR("__SCPreferencesCreate open() failed: %s"), strerror(errno)); sc_status = kSCStatusFailed; break; } - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesCreate open() failed: %s"), strerror(errno)); goto error; } @@ -533,14 +565,13 @@ __SCPreferencesAccess(SCPreferencesRef prefs) if (fd != -1) { (void) close(fd); - fd = -1; } if (prefsPrivate->prefs == NULL) { /* * new file, create empty preferences */ - SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess(): creating new preferences file.")); +// SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess(): creating new preferences file.")); prefsPrivate->prefs = CFDictionaryCreateMutable(allocator, 0, &kCFTypeDictionaryKeyCallBacks, @@ -571,10 +602,12 @@ SCPreferencesCreateWithAuthorization(CFAllocatorRef allocator, CFStringRef prefsID, AuthorizationRef authorization) { - CFDataRef authorizationData; + CFDataRef authorizationData = NULL; + SCPreferencesPrivateRef prefsPrivate; + +#if !TARGET_OS_IPHONE AuthorizationExternalForm extForm; OSStatus os_status; - SCPreferencesPrivateRef prefsPrivate; os_status = AuthorizationMakeExternalForm(authorization, &extForm); if (os_status != errAuthorizationSuccess) { @@ -584,6 +617,41 @@ SCPreferencesCreateWithAuthorization(CFAllocatorRef allocator, } authorizationData = CFDataCreate(NULL, (const UInt8 *)extForm.bytes, sizeof(extForm.bytes)); +#else // !TARGET_OS_IPHONE + CFBundleRef bundle; + CFStringRef bundleID = NULL; + + /* get the application/executable/bundle name */ + bundle = CFBundleGetMainBundle(); + if (bundle != NULL) { + bundleID = CFBundleGetIdentifier(bundle); + if (bundleID != NULL) { + CFRetain(bundleID); + } else { + CFURLRef url; + + url = CFBundleCopyExecutableURL(bundle); + if (url != NULL) { + bundleID = CFURLCopyPath(url); + CFRelease(url); + } + } + + if (bundleID != NULL) { + if (CFEqual(bundleID, CFSTR("/"))) { + CFRelease(bundleID); + bundleID = NULL; + } + } + } + if (bundleID == NULL) { + bundleID = CFStringCreateWithFormat(NULL, NULL, CFSTR("Unknown(%d)"), getpid()); + } + + _SCSerializeString(bundleID, &authorizationData, NULL, NULL); + CFRelease(bundleID); +#endif // !TARGET_OS_IPHONE + prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, authorizationData); CFRelease(authorizationData); @@ -670,7 +738,7 @@ __SCPreferencesAddSession(SCPreferencesRef prefs) /* establish a dynamic store session */ prefsPrivate->session = SCDynamicStoreCreate(allocator, - CFSTR("SCPreferences"), + prefsPrivate->name, prefsNotify, &context); if (prefsPrivate->session == NULL) { @@ -699,7 +767,7 @@ SCPreferencesSetCallback(SCPreferencesRef prefs, { SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; - if (prefs == NULL) { + if (!isA_SCPreferences(prefs)) { /* sorry, you must provide a session */ _SCErrorSet(kSCStatusNoPrefsSession); return FALSE; @@ -730,26 +798,38 @@ SCPreferencesSetCallback(SCPreferencesRef prefs, } -Boolean -SCPreferencesScheduleWithRunLoop(SCPreferencesRef prefs, - CFRunLoopRef runLoop, - CFStringRef runLoopMode) +static Boolean +__SCPreferencesScheduleWithRunLoop(SCPreferencesRef prefs, + CFRunLoopRef runLoop, + CFStringRef runLoopMode, +#if !TARGET_OS_IPHONE + dispatch_queue_t queue +#else // !TARGET_OS_IPHONE + void *queue +#endif // !TARGET_OS_IPHONE + ) { + Boolean ok = FALSE; SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; - if (prefs == NULL) { - /* sorry, you must provide a session */ - _SCErrorSet(kSCStatusNoPrefsSession); - return FALSE; - } - pthread_mutex_lock(&prefsPrivate->lock); - if (prefsPrivate->rls == NULL) { +#if !TARGET_OS_IPHONE + if ((prefsPrivate->dispatchQueue != NULL) || // if we are already scheduled on a dispatch queue + ((queue != NULL) && prefsPrivate->scheduled)) { // if we are already scheduled on a CFRunLoop + _SCErrorSet(kSCStatusInvalidArgument); + goto done; + } +#endif // !TARGET_OS_IPHONE + + if (!prefsPrivate->scheduled) { CFMutableArrayRef keys; if (prefsPrivate->session == NULL) { - __SCPreferencesAddSession(prefs); + ok = __SCPreferencesAddSession(prefs); + if (!ok) { + goto done; + } } CFRetain(prefs); // hold a reference to the prefs @@ -760,83 +840,123 @@ SCPreferencesScheduleWithRunLoop(SCPreferencesRef prefs, (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, keys, NULL); CFRelease(keys); - prefsPrivate->rls = SCDynamicStoreCreateRunLoopSource(NULL, prefsPrivate->session, 0); - prefsPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + if (runLoop != NULL) { + prefsPrivate->rls = SCDynamicStoreCreateRunLoopSource(NULL, prefsPrivate->session, 0); + prefsPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + } + + prefsPrivate->scheduled = TRUE; } - if (!_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) { - /* - * if we do not already have notifications scheduled with - * this runLoop / runLoopMode - */ - CFRunLoopAddSource(runLoop, prefsPrivate->rls, runLoopMode); +#if !TARGET_OS_IPHONE + if (queue != NULL) { + ok = SCDynamicStoreSetDispatchQueue(prefsPrivate->session, queue); + if (!ok) { + prefsPrivate->scheduled = FALSE; + (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, NULL, NULL); + CFRelease(prefs); + goto done; + } + + prefsPrivate->dispatchQueue = queue; + dispatch_retain(prefsPrivate->dispatchQueue); + } else +#endif // !TARGET_OS_IPHONE + { + if (!_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) { + /* + * if we do not already have notifications scheduled with + * this runLoop / runLoopMode + */ + CFRunLoopAddSource(runLoop, prefsPrivate->rls, runLoopMode); + } + + _SC_schedule(prefs, runLoop, runLoopMode, prefsPrivate->rlList); } - _SC_schedule(prefs, runLoop, runLoopMode, prefsPrivate->rlList); + ok = TRUE; + + done : pthread_mutex_unlock(&prefsPrivate->lock); - return TRUE; + return ok; } -Boolean -SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef prefs, - CFRunLoopRef runLoop, - CFStringRef runLoopMode) +static Boolean +__SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef prefs, + CFRunLoopRef runLoop, + CFStringRef runLoopMode) { SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; - CFIndex n; + CFIndex n = 0; Boolean ok = FALSE; - if (prefs == NULL) { - /* sorry, you must provide a session */ - _SCErrorSet(kSCStatusNoPrefsSession); - return FALSE; - } - pthread_mutex_lock(&prefsPrivate->lock); - if (prefsPrivate->rls == NULL) { - /* if not currently scheduled */ + if ((runLoop != NULL) && !prefsPrivate->scheduled) { // if we should be scheduled (but are not) + _SCErrorSet(kSCStatusInvalidArgument); goto done; } - if (!_SC_unschedule(NULL, runLoop, runLoopMode, prefsPrivate->rlList, FALSE)) { - /* if not currently scheduled */ +#if !TARGET_OS_IPHONE + if (((runLoop == NULL) && (prefsPrivate->dispatchQueue == NULL)) || // if we should be scheduled on a dispatch queue (but are not) + ((runLoop != NULL) && (prefsPrivate->dispatchQueue != NULL))) { // if we should be scheduled on a CFRunLoop (but are scheduled on a dispatch queue) + _SCErrorSet(kSCStatusInvalidArgument); goto done; } +#endif // !TARGET_OS_IPHONE + +#if !TARGET_OS_IPHONE + if (runLoop == NULL) { + SCDynamicStoreSetDispatchQueue(prefsPrivate->session, NULL); + dispatch_release(prefsPrivate->dispatchQueue); + prefsPrivate->dispatchQueue = NULL; + } else +#endif // !TARGET_OS_IPHONE + { + if (!_SC_unschedule(prefs, runLoop, runLoopMode, prefsPrivate->rlList, FALSE)) { + // if not currently scheduled on this runLoop / runLoopMode + _SCErrorSet(kSCStatusInvalidArgument); + goto done; + } - n = CFArrayGetCount(prefsPrivate->rlList); - if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) { - /* - * if we are no longer scheduled to receive notifications for - * this runLoop / runLoopMode - */ - CFRunLoopRemoveSource(runLoop, prefsPrivate->rls, runLoopMode); - - if (n == 0) { - CFArrayRef changedKeys; - + n = CFArrayGetCount(prefsPrivate->rlList); + if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) { /* - * if *all* notifications have been unscheduled + * if we are no longer scheduled to receive notifications for + * this runLoop / runLoopMode */ - CFRunLoopSourceInvalidate(prefsPrivate->rls); - CFRelease(prefsPrivate->rls); - prefsPrivate->rls = NULL; - CFRelease(prefsPrivate->rlList); - prefsPrivate->rlList = NULL; + CFRunLoopRemoveSource(runLoop, prefsPrivate->rls, runLoopMode); + + if (n == 0) { + // if *all* notifications have been unscheduled + CFRelease(prefsPrivate->rlList); + prefsPrivate->rlList = NULL; + CFRunLoopSourceInvalidate(prefsPrivate->rls); + CFRelease(prefsPrivate->rls); + prefsPrivate->rls = NULL; + } + } + } - CFRelease(prefs); // release our reference to the prefs + if (n == 0) { + CFArrayRef changedKeys; - // no need to track changes - (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, NULL, NULL); + // if *all* notifications have been unscheduled + prefsPrivate->scheduled = FALSE; - // clear out any pending notifications - changedKeys = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session); - if (changedKeys != NULL) { - CFRelease(changedKeys); - } + // no need to track changes + (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, NULL, NULL); + + // clear out any pending notifications + changedKeys = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session); + if (changedKeys != NULL) { + CFRelease(changedKeys); } + + // release our reference to the prefs + CFRelease(prefs); } ok = TRUE; @@ -847,6 +967,55 @@ SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef prefs, return ok; } +Boolean +SCPreferencesScheduleWithRunLoop(SCPreferencesRef prefs, + CFRunLoopRef runLoop, + CFStringRef runLoopMode) +{ + if (!isA_SCPreferences(prefs) || (runLoop == NULL) || (runLoopMode == NULL)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + return __SCPreferencesScheduleWithRunLoop(prefs, runLoop, runLoopMode, NULL); +} + +Boolean +SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef prefs, + CFRunLoopRef runLoop, + CFStringRef runLoopMode) +{ + if (!isA_SCPreferences(prefs) || (runLoop == NULL) || (runLoopMode == NULL)) { + _SCErrorSet(kSCStatusInvalidArgument); + return FALSE; + } + + return __SCPreferencesUnscheduleFromRunLoop(prefs, runLoop, runLoopMode); +} + +#if !TARGET_OS_IPHONE +Boolean +SCPreferencesSetDispatchQueue(SCPreferencesRef prefs, + dispatch_queue_t queue) +{ + Boolean ok = FALSE; + + if (!isA_SCPreferences(prefs)) { + /* sorry, you must provide a session */ + _SCErrorSet(kSCStatusNoPrefsSession); + return FALSE; + } + + if (queue != NULL) { + ok = __SCPreferencesScheduleWithRunLoop(prefs, NULL, NULL, queue); + } else { + ok = __SCPreferencesUnscheduleFromRunLoop(prefs, NULL, NULL); + } + + return ok; +} +#endif // !TARGET_OS_IPHONE + static void __SCPreferencesSynchronize_helper(SCPreferencesRef prefs) @@ -854,12 +1023,12 @@ __SCPreferencesSynchronize_helper(SCPreferencesRef prefs) Boolean ok; SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; uint32_t status = kSCStatusOK; - + if (prefsPrivate->helper == -1) { // if no helper return; } - + // have the helper "synchronize" the prefs ok = _SCHelperExec(prefsPrivate->helper, SCHELPER_MSG_PREFS_SYNCHRONIZE, @@ -873,17 +1042,17 @@ __SCPreferencesSynchronize_helper(SCPreferencesRef prefs) prefsPrivate->helper = -1; } } - + return; } void -SCPreferencesSynchronize(SCPreferencesRef prefs) +SCPreferencesSynchronize(SCPreferencesRef prefs) { SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; - if (prefs == NULL) { + if (!isA_SCPreferences(prefs)) { /* sorry, you must provide a session */ _SCErrorSet(kSCStatusNoPrefsSession); return; @@ -892,7 +1061,6 @@ SCPreferencesSynchronize(SCPreferencesRef prefs) if (prefsPrivate->authorizationData != NULL) { __SCPreferencesSynchronize_helper(prefs); } - if (prefsPrivate->prefs != NULL) { CFRelease(prefsPrivate->prefs); prefsPrivate->prefs = NULL; @@ -903,5 +1071,6 @@ SCPreferencesSynchronize(SCPreferencesRef prefs) } prefsPrivate->accessed = FALSE; prefsPrivate->changed = FALSE; + return; } diff --git a/SystemConfiguration.fproj/SCPPath.c b/SystemConfiguration.fproj/SCPPath.c index 5711b84..c3d5b5f 100644 --- a/SystemConfiguration.fproj/SCPPath.c +++ b/SystemConfiguration.fproj/SCPPath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -142,6 +142,7 @@ getPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef *entity) } newElements = CFArrayCreateMutableCopy(NULL, 0, linkElements); + CFRelease(linkElements); CFArrayAppendArray(newElements, elements, CFRangeMake(i + 1, nElements-i - 1)); @@ -267,6 +268,7 @@ setPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef entity) } newElements = CFArrayCreateMutableCopy(NULL, 0, linkElements); + CFRelease(linkElements); CFArrayAppendArray(newElements, elements, CFRangeMake(i + 1, nElements-i - 1)); diff --git a/SystemConfiguration.fproj/SCPUnlock.c b/SystemConfiguration.fproj/SCPUnlock.c index 80c47c8..2419fb8 100644 --- a/SystemConfiguration.fproj/SCPUnlock.c +++ b/SystemConfiguration.fproj/SCPUnlock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -87,9 +87,41 @@ __SCPreferencesUnlock_helper(SCPreferencesRef prefs) } +static void +reportDelay(SCPreferencesRef prefs, struct timeval *delay) +{ + aslmsg m; + SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; + char str[256]; + + m = asl_new(ASL_TYPE_MSG); + asl_set(m, "com.apple.message.domain", "com.apple.SystemConfiguration.SCPreferencesUnlock"); + (void) _SC_cfstring_to_cstring(prefsPrivate->name, str, sizeof(str), kCFStringEncodingUTF8); + asl_set(m, "com.apple.message.signature", str); + (void) _SC_cfstring_to_cstring(prefsPrivate->prefsID, str, sizeof(str), kCFStringEncodingUTF8); + asl_set(m, "com.apple.message.signature2", str); + (void) snprintf(str, sizeof(str), + "%d.%3.3d", + (int)delay->tv_sec, + delay->tv_usec / 1000); + asl_set(m, "com.apple.message.value", str); + SCLOG(NULL, m, ASL_LEVEL_DEBUG, + CFSTR("SCPreferences(%@:%@) lock held for %d.%3.3d seconds"), + prefsPrivate->name, + prefsPrivate->prefsID, + (int)delay->tv_sec, + delay->tv_usec / 1000); + asl_free(m); + + return; +} + + Boolean SCPreferencesUnlock(SCPreferencesRef prefs) { + struct timeval lockElapsed; + struct timeval lockEnd; SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; if (prefs == NULL) { @@ -118,6 +150,13 @@ SCPreferencesUnlock(SCPreferencesRef prefs) prefsPrivate->lockFD = -1; } + (void)gettimeofday(&lockEnd, NULL); + timersub(&lockEnd, &prefsPrivate->lockTime, &lockElapsed); + if (lockElapsed.tv_sec > 0) { + // if we held the lock for more than 1 second + reportDelay(prefs, &lockElapsed); + } + prefsPrivate->locked = FALSE; pthread_mutex_unlock(&prefsPrivate->lock); diff --git a/SystemConfiguration.fproj/SCPreferences.h b/SystemConfiguration.fproj/SCPreferences.h index 20bf2df..f05a427 100644 --- a/SystemConfiguration.fproj/SCPreferences.h +++ b/SystemConfiguration.fproj/SCPreferences.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2005, 2007-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,13 +22,26 @@ */ #ifndef _SCPREFERENCES_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCPREFERENCES_H -#include +#include +#include #include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE #include #include + +#if !TARGET_OS_IPHONE #include +#else // !TARGET_OS_IPHONE +typedef const struct AuthorizationOpaqueRef * AuthorizationRef; +#endif // !TARGET_OS_IPHONE + /*! @header SCPreferences @@ -62,8 +75,6 @@ */ typedef const struct __SCPreferences * SCPreferencesRef; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - /*! @enum SCPreferencesNotification @discussion Used with the SCPreferencesCallBack callback @@ -74,10 +85,13 @@ typedef const struct __SCPreferences * SCPreferencesRef; request has been made to apply the currently saved preferences to the active system configuration. */ +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ enum { kSCPreferencesNotificationCommit = 1<<0, kSCPreferencesNotificationApply = 1<<1 }; +#endif (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + typedef uint32_t SCPreferencesNotification; /*! @@ -122,8 +136,6 @@ typedef void (*SCPreferencesCallBack) ( void *info ); -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ - __BEGIN_DECLS @@ -132,7 +144,7 @@ __BEGIN_DECLS @discussion Returns the type identifier of all SCPreferences instances. */ CFTypeID -SCPreferencesGetTypeID (void); +SCPreferencesGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesCreate @@ -152,13 +164,12 @@ SCPreferencesGetTypeID (void); You must release the returned value. */ SCPreferencesRef -SCPreferencesCreate ( - CFAllocatorRef allocator, - CFStringRef name, - CFStringRef prefsID - ); +SCPreferencesCreate ( + CFAllocatorRef allocator, + CFStringRef name, + CFStringRef prefsID + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 /*! @function SCPreferencesCreateWithAuthorization @@ -186,9 +197,7 @@ SCPreferencesCreateWithAuthorization ( CFStringRef name, CFStringRef prefsID, AuthorizationRef authorization - ) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ + ) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesLock @@ -206,10 +215,10 @@ SCPreferencesCreateWithAuthorization ( FALSE if an error occurred. */ Boolean -SCPreferencesLock ( - SCPreferencesRef prefs, - Boolean wait - ); +SCPreferencesLock ( + SCPreferencesRef prefs, + Boolean wait + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesCommitChanges @@ -229,9 +238,9 @@ SCPreferencesLock ( FALSE if an error occurred. */ Boolean -SCPreferencesCommitChanges ( - SCPreferencesRef prefs - ); +SCPreferencesCommitChanges ( + SCPreferencesRef prefs + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesApplyChanges @@ -242,9 +251,9 @@ SCPreferencesCommitChanges ( FALSE if an error occurred. */ Boolean -SCPreferencesApplyChanges ( - SCPreferencesRef prefs - ); +SCPreferencesApplyChanges ( + SCPreferencesRef prefs + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesUnlock @@ -258,9 +267,9 @@ SCPreferencesApplyChanges ( FALSE if an error occurred. */ Boolean -SCPreferencesUnlock ( - SCPreferencesRef prefs - ); +SCPreferencesUnlock ( + SCPreferencesRef prefs + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesGetSignature @@ -271,9 +280,9 @@ SCPreferencesUnlock ( preferences at the time of the call to the SCPreferencesCreate function. */ CFDataRef -SCPreferencesGetSignature ( - SCPreferencesRef prefs - ); +SCPreferencesGetSignature ( + SCPreferencesRef prefs + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesCopyKeyList @@ -283,9 +292,9 @@ SCPreferencesGetSignature ( You must release the returned value. */ CFArrayRef -SCPreferencesCopyKeyList ( - SCPreferencesRef prefs - ); +SCPreferencesCopyKeyList ( + SCPreferencesRef prefs + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesGetValue @@ -302,10 +311,10 @@ SCPreferencesCopyKeyList ( NULL if no value was located. */ CFPropertyListRef -SCPreferencesGetValue ( - SCPreferencesRef prefs, - CFStringRef key - ); +SCPreferencesGetValue ( + SCPreferencesRef prefs, + CFStringRef key + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesAddValue @@ -323,11 +332,11 @@ SCPreferencesGetValue ( if an error occurred. */ Boolean -SCPreferencesAddValue ( - SCPreferencesRef prefs, - CFStringRef key, - CFPropertyListRef value - ); +SCPreferencesAddValue ( + SCPreferencesRef prefs, + CFStringRef key, + CFPropertyListRef value + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesSetValue @@ -344,11 +353,11 @@ SCPreferencesAddValue ( FALSE if an error occurred. */ Boolean -SCPreferencesSetValue ( - SCPreferencesRef prefs, - CFStringRef key, - CFPropertyListRef value - ); +SCPreferencesSetValue ( + SCPreferencesRef prefs, + CFStringRef key, + CFPropertyListRef value + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesRemoveValue @@ -363,12 +372,10 @@ SCPreferencesSetValue ( FALSE if the key did not exist or if an error occurred. */ Boolean -SCPreferencesRemoveValue ( - SCPreferencesRef prefs, - CFStringRef key - ); - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 +SCPreferencesRemoveValue ( + SCPreferencesRef prefs, + CFStringRef key + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesSetCallback @@ -388,7 +395,7 @@ SCPreferencesSetCallback ( SCPreferencesRef prefs, SCPreferencesCallBack callout, SCPreferencesContext *context - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesScheduleWithRunLoop @@ -408,7 +415,7 @@ SCPreferencesScheduleWithRunLoop ( SCPreferencesRef prefs, CFRunLoopRef runLoop, CFStringRef runLoopMode - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesUnscheduleFromRunLoop @@ -428,7 +435,24 @@ SCPreferencesUnscheduleFromRunLoop ( SCPreferencesRef prefs, CFRunLoopRef runLoop, CFStringRef runLoopMode - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); + +#if !TARGET_OS_IPHONE +/*! + @function SCPreferencesSetDispatchQueue + @discussion Schedule commit and apply notifications for the specified + preferences session. + @param prefs The preferences session. + @param queue The dispatch queue to run the callback function on. + @result Returns TRUE if the notifications are successfully scheduled; + FALSE otherwise. + */ +Boolean +SCPreferencesSetDispatchQueue ( + SCPreferencesRef prefs, + dispatch_queue_t queue + ) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA); +#endif // !TARGET_OS_IPHONE /*! @function SCPreferencesSynchronize @@ -444,10 +468,9 @@ SCPreferencesUnscheduleFromRunLoop ( void SCPreferencesSynchronize ( SCPreferencesRef prefs - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/); __END_DECLS +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #endif /* _SCPREFERENCES_H */ diff --git a/SystemConfiguration.fproj/SCPreferencesInternal.h b/SystemConfiguration.fproj/SCPreferencesInternal.h index fb95d00..b86c07b 100644 --- a/SystemConfiguration.fproj/SCPreferencesInternal.h +++ b/SystemConfiguration.fproj/SCPreferencesInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -31,6 +31,9 @@ #include #include #include +#if !TARGET_OS_IPHONE +#include +#endif // !TARGET_OS_IPHONE #define PREFS_DEFAULT_DIR CFSTR("/Library/Preferences/SystemConfiguration") @@ -65,6 +68,7 @@ typedef struct { Boolean locked; int lockFD; char *lockPath; + struct timeval lockTime; /* configuration file signature */ CFDataRef signature; @@ -77,10 +81,14 @@ typedef struct { CFStringRef sessionKeyApply; /* run loop source, callout, context, rl scheduling info */ + Boolean scheduled; CFRunLoopSourceRef rls; SCPreferencesCallBack rlsFunction; SCPreferencesContext rlsContext; CFMutableArrayRef rlList; +#if !TARGET_OS_IPHONE + dispatch_queue_t dispatchQueue; // SCPreferencesSetDispatchQueue +#endif // !TARGET_OS_IPHONE /* preferences */ CFMutableDictionaryRef prefs; @@ -99,10 +107,11 @@ typedef struct { /* Define signature data */ typedef struct { - dev_t st_dev; /* inode's device */ - ino_t st_ino; /* inode's number */ - struct timespec st_mtimespec; /* time of last data modification */ - off_t st_size; /* file size, in bytes */ + int64_t st_dev; /* inode's device */ + uint64_t st_ino; /* inode's number */ + uint64_t tv_sec; /* time of last data modification */ + uint64_t tv_nsec; + off_t st_size; /* file size, in bytes */ } SCPSignatureData, *SCPSignatureDataRef; diff --git a/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c b/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c index afdce88..c154f8d 100644 --- a/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c +++ b/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2006, 2007 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -31,17 +31,18 @@ * - created (for EAP) */ +#include +#include #include - #include #include // for _CFBundleCopyMainBundleExecutableURL #include // for _SCErrorSet -#include #include "dy_framework.h" #include "SCPreferencesInternal.h" +#if !TARGET_OS_IPHONE static CFDataRef copyMyExecutablePath(void) { @@ -265,11 +266,13 @@ _SCSecAccessCreateForExecutables(CFStringRef label, return access; } +#endif // !TARGET_OS_IPHONE SecKeychainRef _SCSecKeychainCopySystemKeychain(void) { +#if !TARGET_OS_IPHONE SecPreferencesDomain domain; SecKeychainRef keychain = NULL; OSStatus status; @@ -302,9 +305,14 @@ _SCSecKeychainCopySystemKeychain(void) } return keychain; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return NULL; +#endif // !TARGET_OS_IPHONE } +#if !TARGET_OS_IPHONE static OSStatus findKeychainItem(SecKeychainRef keychain, UInt32 serviceNameLength, @@ -333,12 +341,14 @@ findKeychainItem(SecKeychainRef keychain, return status; } +#endif // !TARGET_OS_IPHONE CFDataRef _SCSecKeychainPasswordItemCopy(SecKeychainRef keychain, CFStringRef unique_id) { +#if !TARGET_OS_IPHONE SecKeychainItemRef item = NULL; CFDataRef keychain_password = NULL; const char *keychain_serviceName; @@ -366,12 +376,17 @@ _SCSecKeychainPasswordItemCopy(SecKeychainRef keychain, } return keychain_password; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return NULL; +#endif // !TARGET_OS_IPHONE } Boolean _SCSecKeychainPasswordItemExists(SecKeychainRef keychain, CFStringRef unique_id) { +#if !TARGET_OS_IPHONE SecKeychainItemRef item; const char *keychain_serviceName; OSStatus status; @@ -389,12 +404,17 @@ _SCSecKeychainPasswordItemExists(SecKeychainRef keychain, CFStringRef unique_id) CFRelease(item); return TRUE; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return FALSE; +#endif // !TARGET_OS_IPHONE } Boolean _SCSecKeychainPasswordItemRemove(SecKeychainRef keychain, CFStringRef unique_id) { +#if !TARGET_OS_IPHONE SecKeychainItemRef item; const char *keychain_serviceName; OSStatus status; @@ -418,6 +438,10 @@ _SCSecKeychainPasswordItemRemove(SecKeychainRef keychain, CFStringRef unique_id) } return TRUE; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return FALSE; +#endif // !TARGET_OS_IPHONE } @@ -430,6 +454,7 @@ _SCSecKeychainPasswordItemSet(SecKeychainRef keychain, CFDataRef password, CFDictionaryRef options) { +#if !TARGET_OS_IPHONE SecAccessRef access = NULL; CFBooleanRef allowRoot = NULL; CFArrayRef allowedExecutables = NULL; @@ -569,6 +594,10 @@ _SCSecKeychainPasswordItemSet(SecKeychainRef keychain, } return TRUE; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return FALSE; +#endif // !TARGET_OS_IPHONE } @@ -583,6 +612,7 @@ _SCSecKeychainPasswordItemSet(SecKeychainRef keychain, #include +#if !TARGET_OS_IPHONE static CFDataRef __SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef prefs, CFStringRef unique_id) @@ -639,12 +669,14 @@ __SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef prefs, _SCErrorSet(status); return NULL; } +#endif // !TARGET_OS_IPHONE CFDataRef _SCPreferencesSystemKeychainPasswordItemCopy(SCPreferencesRef prefs, CFStringRef unique_id) { +#if !TARGET_OS_IPHONE SecKeychainRef keychain = NULL; CFDataRef password = NULL; SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; @@ -652,12 +684,12 @@ _SCPreferencesSystemKeychainPasswordItemCopy(SCPreferencesRef prefs, if (prefs == NULL) { /* sorry, you must provide a session */ _SCErrorSet(kSCStatusNoPrefsSession); - return FALSE; + return NULL; } if (!isA_CFString(unique_id)) { _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; + return NULL; } if (prefsPrivate->authorizationData != NULL) { @@ -676,6 +708,10 @@ _SCPreferencesSystemKeychainPasswordItemCopy(SCPreferencesRef prefs, if (keychain != NULL) CFRelease(keychain); return password; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return NULL; +#endif // !TARGET_OS_IPHONE } @@ -683,6 +719,7 @@ Boolean _SCPreferencesSystemKeychainPasswordItemExists(SCPreferencesRef prefs, CFStringRef unique_id) { +#if !TARGET_OS_IPHONE SecKeychainRef keychain = NULL; Boolean ok = FALSE; // SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; @@ -714,9 +751,14 @@ _SCPreferencesSystemKeychainPasswordItemExists(SCPreferencesRef prefs, if (keychain != NULL) CFRelease(keychain); return ok; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return FALSE; +#endif // !TARGET_OS_IPHONE } +#if !TARGET_OS_IPHONE static Boolean __SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef prefs, CFStringRef unique_id) @@ -773,12 +815,14 @@ __SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef prefs, _SCErrorSet(status); return FALSE; } +#endif // !TARGET_OS_IPHONE Boolean _SCPreferencesSystemKeychainPasswordItemRemove(SCPreferencesRef prefs, CFStringRef unique_id) { +#if !TARGET_OS_IPHONE SecKeychainRef keychain = NULL; Boolean ok = FALSE; SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; @@ -810,9 +854,14 @@ _SCPreferencesSystemKeychainPasswordItemRemove(SCPreferencesRef prefs, if (keychain != NULL) CFRelease(keychain); return ok; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return FALSE; +#endif // !TARGET_OS_IPHONE } +#if !TARGET_OS_IPHONE static Boolean __SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef prefs, CFStringRef unique_id, @@ -948,6 +997,7 @@ __SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef prefs, _SCErrorSet(status); return FALSE; } +#endif // !TARGET_OS_IPHONE Boolean @@ -959,6 +1009,7 @@ _SCPreferencesSystemKeychainPasswordItemSet(SCPreferencesRef prefs, CFDataRef password, CFDictionaryRef options) { +#if !TARGET_OS_IPHONE SecKeychainRef keychain = NULL; Boolean ok = FALSE; SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; @@ -1007,4 +1058,8 @@ _SCPreferencesSystemKeychainPasswordItemSet(SCPreferencesRef prefs, if (keychain != NULL) CFRelease(keychain); return ok; +#else // !TARGET_OS_IPHONE + _SCErrorSet(kSCStatusAccessError); + return FALSE; +#endif // !TARGET_OS_IPHONE } diff --git a/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.h b/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.h index 76c574b..c45f48b 100644 --- a/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.h +++ b/SystemConfiguration.fproj/SCPreferencesKeychainPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -29,12 +29,16 @@ * - routines to deal with keychain passwords */ +#include +#include +#include #include #include +#if !TARGET_OS_IPHONE #include - -#include -#include +#else // !TARGET_OS_IPHONE +typedef struct OpaqueSecKeychainRef *SecKeychainRef; +#endif // !TARGET_OS_IPHONE #pragma mark - #pragma mark Keychain helper APIs @@ -45,19 +49,19 @@ __BEGIN_DECLS SecKeychainRef -_SCSecKeychainCopySystemKeychain (void); +_SCSecKeychainCopySystemKeychain (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); CFDataRef _SCSecKeychainPasswordItemCopy (SecKeychainRef keychain, - CFStringRef unique_id); + CFStringRef unique_id) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean _SCSecKeychainPasswordItemExists (SecKeychainRef keychain, - CFStringRef unique_id); + CFStringRef unique_id) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean _SCSecKeychainPasswordItemRemove (SecKeychainRef keychain, - CFStringRef unique_id); + CFStringRef unique_id) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean _SCSecKeychainPasswordItemSet (SecKeychainRef keychain, @@ -66,7 +70,7 @@ _SCSecKeychainPasswordItemSet (SecKeychainRef keychain, CFStringRef description, CFStringRef account, CFDataRef password, - CFDictionaryRef options); + CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); #pragma mark - @@ -75,15 +79,15 @@ _SCSecKeychainPasswordItemSet (SecKeychainRef keychain, CFDataRef _SCPreferencesSystemKeychainPasswordItemCopy (SCPreferencesRef prefs, - CFStringRef unique_id); + CFStringRef unique_id) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean _SCPreferencesSystemKeychainPasswordItemExists (SCPreferencesRef prefs, - CFStringRef unique_id); + CFStringRef unique_id) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean _SCPreferencesSystemKeychainPasswordItemRemove (SCPreferencesRef prefs, - CFStringRef unique_id); + CFStringRef unique_id) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); Boolean _SCPreferencesSystemKeychainPasswordItemSet (SCPreferencesRef prefs, @@ -92,7 +96,7 @@ _SCPreferencesSystemKeychainPasswordItemSet (SCPreferencesRef prefs, CFStringRef description, CFStringRef account, CFDataRef password, - CFDictionaryRef options); + CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); __END_DECLS diff --git a/SystemConfiguration.fproj/SCPreferencesPath.h b/SystemConfiguration.fproj/SCPreferencesPath.h index ba887c3..221ac57 100644 --- a/SystemConfiguration.fproj/SCPreferencesPath.h +++ b/SystemConfiguration.fproj/SCPreferencesPath.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,8 +22,12 @@ */ #ifndef _SCPREFERENCESPATH_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCPREFERENCESPATH_H +#include #include #include #include @@ -90,7 +94,7 @@ CFStringRef SCPreferencesPathCreateUniqueChild ( SCPreferencesRef prefs, CFStringRef prefix - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesPathGetValue @@ -105,7 +109,7 @@ CFDictionaryRef SCPreferencesPathGetValue ( SCPreferencesRef prefs, CFStringRef path - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesPathGetLink @@ -120,7 +124,7 @@ CFStringRef SCPreferencesPathGetLink ( SCPreferencesRef prefs, CFStringRef path - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesPathSetValue @@ -136,7 +140,7 @@ SCPreferencesPathSetValue ( SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef value - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesPathSetLink @@ -153,7 +157,7 @@ SCPreferencesPathSetLink ( SCPreferencesRef prefs, CFStringRef path, CFStringRef link - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesPathRemoveValue @@ -166,8 +170,9 @@ Boolean SCPreferencesPathRemoveValue ( SCPreferencesRef prefs, CFStringRef path - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); __END_DECLS +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #endif /* _SCPREFERENCESPATH_H */ diff --git a/SystemConfiguration.fproj/SCPreferencesPathKey.h b/SystemConfiguration.fproj/SCPreferencesPathKey.h index 60b0dd5..e74945c 100644 --- a/SystemConfiguration.fproj/SCPreferencesPathKey.h +++ b/SystemConfiguration.fproj/SCPreferencesPathKey.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004, 2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,12 +24,10 @@ #ifndef _SCPREFERENCESPATHKEY_H #define _SCPREFERENCESPATHKEY_H -#include +#include #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - /*! @header SCPreferencesPathKey */ @@ -50,7 +48,7 @@ SCPreferencesPathKeyCreate ( CFAllocatorRef allocator, CFStringRef fmt, ... - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); /*! @function SCPreferencesPathKeyCreateNetworkServices @@ -58,7 +56,7 @@ SCPreferencesPathKeyCreate ( CFStringRef SCPreferencesPathKeyCreateNetworkServices ( CFAllocatorRef allocator - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); /*! @function SCPreferencesPathKeyCreateNetworkServiceEntity @@ -68,7 +66,7 @@ SCPreferencesPathKeyCreateNetworkServiceEntity ( CFAllocatorRef allocator, CFStringRef service, CFStringRef entity - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); /*! @function SCPreferencesPathKeyCreateSets @@ -76,7 +74,7 @@ SCPreferencesPathKeyCreateNetworkServiceEntity ( CFStringRef SCPreferencesPathKeyCreateSets ( CFAllocatorRef allocator - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); /*! @function SCPreferencesPathKeyCreateSet @@ -85,7 +83,7 @@ CFStringRef SCPreferencesPathKeyCreateSet ( CFAllocatorRef allocator, CFStringRef set - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); /*! @function SCPreferencesPathKeyCreateSetNetworkInterfaceEntity @@ -96,7 +94,7 @@ SCPreferencesPathKeyCreateSetNetworkInterfaceEntity( CFStringRef set, CFStringRef ifname, CFStringRef entity - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); /*! @function SCPreferencesPathKeyCreateSetNetworkGlobalEntity @@ -106,7 +104,7 @@ SCPreferencesPathKeyCreateSetNetworkGlobalEntity( CFAllocatorRef allocator, CFStringRef set, CFStringRef entity - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); /*! @function SCPreferencesPathKeyCreateSetNetworkService @@ -116,7 +114,7 @@ SCPreferencesPathKeyCreateSetNetworkService ( CFAllocatorRef allocator, CFStringRef set, CFStringRef service - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); /*! @function SCPreferencesPathKeyCreateSetNetworkServiceEntity @@ -127,10 +125,8 @@ SCPreferencesPathKeyCreateSetNetworkServiceEntity( CFStringRef set, CFStringRef service, CFStringRef entity - ) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); __END_DECLS -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ - #endif /* _SCPREFERENCESPATHKEY_H */ diff --git a/SystemConfiguration.fproj/SCPreferencesPrivate.h b/SystemConfiguration.fproj/SCPreferencesPrivate.h index 5710af1..7ed9bc6 100644 --- a/SystemConfiguration.fproj/SCPreferencesPrivate.h +++ b/SystemConfiguration.fproj/SCPreferencesPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2005, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2005, 2007, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -25,8 +25,8 @@ #define _SCPREFERENCESPRIVATE_H +#include #include -#include #include #include @@ -70,7 +70,7 @@ SCDynamicStoreKeyCreatePreferences ( CFAllocatorRef allocator, CFStringRef prefsID, SCPreferencesKeyType keyType - ) AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; + ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_2_0,__IPHONE_2_0); __END_DECLS diff --git a/SystemConfiguration.fproj/SCPreferencesSetSpecific.h b/SystemConfiguration.fproj/SCPreferencesSetSpecific.h index 7449ee0..940c04a 100644 --- a/SystemConfiguration.fproj/SCPreferencesSetSpecific.h +++ b/SystemConfiguration.fproj/SCPreferencesSetSpecific.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002, 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2002, 2004, 2005, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,8 +22,12 @@ */ #ifndef _SCPREFERENCESSETSPECIFIC_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #define _SCPREFERENCESSETSPECIFIC_H +#include #include #include #include @@ -61,7 +65,7 @@ SCPreferencesSetComputerName ( SCPreferencesRef prefs, CFStringRef name, CFStringEncoding nameEncoding - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/); /*! @function SCPreferencesSetLocalHostName @@ -82,8 +86,9 @@ Boolean SCPreferencesSetLocalHostName ( SCPreferencesRef prefs, CFStringRef name - ); + ) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/); __END_DECLS +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ #endif /* _SCPREFERENCESSETSPECIFIC_H */ diff --git a/SystemConfiguration.fproj/SCPrivate.h b/SystemConfiguration.fproj/SCPrivate.h index 0741194..4fa55e9 100644 --- a/SystemConfiguration.fproj/SCPrivate.h +++ b/SystemConfiguration.fproj/SCPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2008 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -58,9 +59,11 @@ */ /* framework variables */ -extern Boolean _sc_debug; /* TRUE if debugging enabled */ -extern Boolean _sc_verbose; /* TRUE if verbose logging enabled */ -extern Boolean _sc_log; /* TRUE if SCLog() output goes to syslog */ +extern int _sc_debug; /* non-zero if debugging enabled */ +extern int _sc_verbose; /* non-zero if verbose logging enabled */ +extern int _sc_log; /* 0 if SC messages should be written to stdout/stderr, + 1 if SC messages should be logged w/asl(3), + 2 if SC messages should be written to stdout/stderr AND logged */ /*! @group SCNetworkReachabilityCreateWithOptions #defines @@ -94,6 +97,13 @@ extern Boolean _sc_log; /* TRUE if SCLog() output goes to syslog */ */ #define kSCNetworkReachabilityOptionHints CFSTR("hints") +/*! + @constant kSCNetworkReachabilityOptionConnectionOnDemandByPass + @discussion A CFBoolean that indicates if we should bypass the VPNOnDemand + checks for this target. + */ +#define kSCNetworkReachabilityOptionConnectionOnDemandByPass CFSTR("ConnectionOnDemandByPass") + /*! @group */ @@ -260,6 +270,18 @@ void _SC_sendMachMessage (mach_port_t port, mach_msg_id_t msg_id); +/*! + @function _SCCopyDescription + @discussion Returns a formatted textual description of a CF object. + @param cf The CFType object (a generic reference of type CFTypeRef) from + which to derive a description. + @param formatOptions A dictionary containing formatting options for the object. + @result A string that contains a formatted description of cf. + */ +CFStringRef _SCCopyDescription (CFTypeRef cf, + CFDictionaryRef formatOptions); + + /*! @function SCLog @discussion Conditionally issue a log message. @@ -274,6 +296,28 @@ void SCLog (Boolean condition, CFStringRef formatString, ...); + +/*! + @function SCLOG + @discussion Issue a log message. + @param asl An asl client handle to be used for logging. If NULL, a shared + handle will be used. + @param msg An asl msg structure to be used for logging. If NULL, a default + asl msg will be used. + @param level A asl(3) logging priority. Passing the complement of a logging + priority (e.g. ~ASL_LEVEL_NOTICE) will result in log message lines + NOT being split by a "\n". + @param formatString The format string + @result The specified message will be written to the system message + logger (See syslogd(8)). + */ +void SCLOG (aslclient asl, + aslmsg msg, + int level, + CFStringRef formatString, + ...); + + /*! @function SCPrint @discussion Conditionally issue a debug message. @@ -302,6 +346,28 @@ void SCTrace (Boolean condition, CFStringRef formatString, ...); +/*! + @function SCNetworkReachabilityCopyOnDemandService + @discussion For target hosts that require an OnDemand connection, returns + the SCNetworkService associated with the connection and user + options to use with SCNetworkConnectionStart. + @result The SCNetworkService for the target; NULL if there is + no associated OnDemand service. + */ +SCNetworkServiceRef +SCNetworkReachabilityCopyOnDemandService (SCNetworkReachabilityRef target, + CFDictionaryRef *userOptions); + +/*! + @function SCNetworkReachabilityCopyResolvedAddress + @discussion Return the resolved addresses associated with the + target host. + @result A CFArray[CFData], where each CFData is a (struct sockaddr) + */ +CFArrayRef +SCNetworkReachabilityCopyResolvedAddress (SCNetworkReachabilityRef target, + int *error_num); + /*! @function SCNetworkReachabilityCreateWithOptions @discussion Creates a reference to a specified network host. The @@ -321,6 +387,17 @@ SCNetworkReachabilityRef SCNetworkReachabilityCreateWithOptions (CFAllocatorRef allocator, CFDictionaryRef options); +/*! + @function _SC_checkResolverReachabilityByAddress + @discussion Check the reachability of a reverse DNS query + */ +Boolean +_SC_checkResolverReachabilityByAddress (SCDynamicStoreRef *storeP, + SCNetworkReachabilityFlags *flags, + Boolean *haveDNS, + struct sockaddr *sa); + +#if !TARGET_OS_IPHONE /* * DOS encoding/codepage */ @@ -329,11 +406,7 @@ _SC_dos_encoding_and_codepage (CFStringEncoding macEncoding, UInt32 macRegion, CFStringEncoding *dosEncoding, UInt32 *dosCodepage); - -CFDataRef -_SC_dos_copy_string (CFStringRef str, - CFStringEncoding dosEncoding, - UInt32 dosCodepage); +#endif // !TARGET_OS_IPHONE /* * object / CFRunLoop management @@ -389,6 +462,29 @@ _SC_CFEqual(CFTypeRef val1, CFTypeRef val2) return FALSE; } +/* + * debugging + */ + +#ifdef DEBUG_MACH_PORT_ALLOCATIONS + #define __MACH_PORT_DEBUG(cond, str, port) \ + do { \ + if (cond) _SC_logMachPortReferences(str, port); \ + } while (0) +#else // DEBUG_MACH_PORT_ALLOCATIONS + #define __MACH_PORT_DEBUG(cond, str, port) +#endif // DEBUG_MACH_PORT_ALLOCATIONS + +void +_SC_logMachPortStatus (void); + +void +_SC_logMachPortReferences (const char *str, + mach_port_t port); + +CFStringRef +_SC_copyBacktrace (void); + __END_DECLS #endif /* _SCPRIVATE_H */ diff --git a/SystemConfiguration.fproj/SCProxies.c b/SystemConfiguration.fproj/SCProxies.c index 6dbd370..8cfc5ff 100644 --- a/SystemConfiguration.fproj/SCProxies.c +++ b/SystemConfiguration.fproj/SCProxies.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -56,8 +56,6 @@ validate_proxy_content(CFMutableDictionaryRef proxies, { int enabled = 0; CFNumberRef num; - CFStringRef host; - CFNumberRef port = NULL; num = CFDictionaryGetValue(proxies, proxy_enable); if (num != NULL) { @@ -68,14 +66,20 @@ validate_proxy_content(CFMutableDictionaryRef proxies, } } - host = CFDictionaryGetValue(proxies, proxy_host); - if (((enabled == 0) && (host != NULL)) || - ((enabled != 0) && !isA_CFString(host))) { - // pass only valid proxy hosts and only when enabled - goto disable; + if (proxy_host != NULL) { + CFStringRef host; + + host = CFDictionaryGetValue(proxies, proxy_host); + if (((enabled == 0) && (host != NULL)) || + ((enabled != 0) && !isA_CFString(host))) { + // pass only valid proxy hosts and only when enabled + goto disable; + } } if (proxy_port != NULL) { + CFNumberRef port; + port = CFDictionaryGetValue(proxies, proxy_port); if (((enabled == 0) && (port != NULL)) || ((enabled != 0) && (port != NULL) && !isA_CFNumber(port))) { @@ -107,7 +111,9 @@ validate_proxy_content(CFMutableDictionaryRef proxies, num = CFNumberCreate(NULL, kCFNumberIntType, &enabled); CFDictionarySetValue(proxies, proxy_enable, num); CFRelease(num); - CFDictionaryRemoveValue(proxies, proxy_host); + if (proxy_host != NULL) { + CFDictionaryRemoveValue(proxies, proxy_host); + } if (proxy_port != NULL) { CFDictionaryRemoveValue(proxies, proxy_port); } @@ -204,11 +210,17 @@ SCDynamicStoreCopyProxies(SCDynamicStoreRef store) NULL, NULL, 0); + validate_proxy_content(newProxies, + kSCPropNetProxiesProxyAutoDiscoveryEnable, + NULL, + NULL, + NULL, + 0); // validate FTP passive setting num = CFDictionaryGetValue(newProxies, kSCPropNetProxiesFTPPassive); if (num != NULL) { - int enabled; + int enabled = 0; if (!isA_CFNumber(num) || !CFNumberGetValue(num, kCFNumberIntType, &enabled)) { @@ -222,23 +234,6 @@ SCDynamicStoreCopyProxies(SCDynamicStoreRef store) } } - // validate WPAD setting - num = CFDictionaryGetValue(newProxies, kSCPropNetProxiesProxyAutoDiscoveryEnable); - if (num != NULL) { - int enabled; - - if (!isA_CFNumber(num) || - !CFNumberGetValue(num, kCFNumberIntType, &enabled)) { - // if we don't like the enabled key/value - enabled = 0; - num = CFNumberCreate(NULL, kCFNumberIntType, &enabled); - CFDictionarySetValue(newProxies, - kSCPropNetProxiesProxyAutoDiscoveryEnable, - num); - CFRelease(num); - } - } - // validate proxy exception list array = CFDictionaryGetValue(newProxies, kSCPropNetProxiesExceptionsList); if (array != NULL) { diff --git a/SystemConfiguration.fproj/SCSchemaDefinitions.c b/SystemConfiguration.fproj/SCSchemaDefinitions.c index 177a5c9..ac8b474 100644 --- a/SystemConfiguration.fproj/SCSchemaDefinitions.c +++ b/SystemConfiguration.fproj/SCSchemaDefinitions.c @@ -3,6 +3,8 @@ * DO NOT EDIT! */ +#include +#include #include const CFStringRef kSCResvLink = CFSTR("__LINK__"); @@ -25,7 +27,11 @@ const CFStringRef kSCCompSystem = CFSTR("Syst const CFStringRef kSCCompUsers = CFSTR("Users"); const CFStringRef kSCCompAnyRegex = CFSTR("[^/]+"); const CFStringRef kSCEntNetAirPort = CFSTR("AirPort"); + +#if !TARGET_OS_IPHONE const CFStringRef kSCEntNetAppleTalk = CFSTR("AppleTalk"); +#endif // !TARGET_OS_IPHONE + const CFStringRef kSCEntNetDHCP = CFSTR("DHCP"); const CFStringRef kSCEntNetDNS = CFSTR("DNS"); const CFStringRef kSCEntNetEthernet = CFSTR("Ethernet"); @@ -37,15 +43,27 @@ const CFStringRef kSCEntNetIPv6 = CFSTR("IPv6 const CFStringRef kSCEntNetL2TP = CFSTR("L2TP"); const CFStringRef kSCEntNetLink = CFSTR("Link"); const CFStringRef kSCEntNetModem = CFSTR("Modem"); + +#if !TARGET_OS_IPHONE const CFStringRef kSCEntNetNetInfo = CFSTR("NetInfo"); +#endif // !TARGET_OS_IPHONE + const CFStringRef kSCEntNetPPP = CFSTR("PPP"); const CFStringRef kSCEntNetPPPoE = CFSTR("PPPoE"); const CFStringRef kSCEntNetPPPSerial = CFSTR("PPPSerial"); const CFStringRef kSCEntNetPPTP = CFSTR("PPTP"); const CFStringRef kSCEntNetProxies = CFSTR("Proxies"); + +#if !TARGET_OS_IPHONE const CFStringRef kSCEntNetSMB = CFSTR("SMB"); +#endif // !TARGET_OS_IPHONE + const CFStringRef kSCEntNet6to4 = CFSTR("6to4"); + + const CFStringRef kSCEntNetEAPOL = CFSTR("EAPOL"); +const CFStringRef kSCEntNetOnDemand = CFSTR("OnDemand"); +const CFStringRef kSCEntNetService = CFSTR("__SERVICE__"); const CFStringRef kSCPropNetOverridePrimary = CFSTR("OverridePrimary"); const CFStringRef kSCPropNetServiceOrder = CFSTR("ServiceOrder"); const CFStringRef kSCPropNetPPPOverridePrimary = CFSTR("PPPOverridePrimary"); @@ -65,6 +83,8 @@ const CFStringRef kSCValNetAirPortJoinModeRanked = CFSTR("Rank const CFStringRef kSCValNetAirPortJoinModeRecent = CFSTR("Recent"); const CFStringRef kSCValNetAirPortJoinModeStrongest = CFSTR("Strongest"); const CFStringRef kSCValNetAirPortAuthPasswordEncryptionKeychain = CFSTR("Keychain"); + +#if !TARGET_OS_IPHONE const CFStringRef kSCPropNetAppleTalkComputerName = CFSTR("ComputerName"); const CFStringRef kSCPropNetAppleTalkComputerNameEncoding = CFSTR("ComputerNameEncoding"); const CFStringRef kSCPropNetAppleTalkConfigMethod = CFSTR("ConfigMethod"); @@ -77,6 +97,10 @@ const CFStringRef kSCPropNetAppleTalkSeedZones = CFSTR("Seed const CFStringRef kSCValNetAppleTalkConfigMethodNode = CFSTR("Node"); const CFStringRef kSCValNetAppleTalkConfigMethodRouter = CFSTR("Router"); const CFStringRef kSCValNetAppleTalkConfigMethodSeedRouter = CFSTR("SeedRouter"); +#endif // !TARGET_OS_IPHONE + + + const CFStringRef kSCPropNetDNSDomainName = CFSTR("DomainName"); const CFStringRef kSCPropNetDNSOptions = CFSTR("Options"); const CFStringRef kSCPropNetDNSSearchDomains = CFSTR("SearchDomains"); @@ -99,20 +123,36 @@ const CFStringRef kSCValNetInterfaceTypeEthernet = CFSTR("Ethe const CFStringRef kSCValNetInterfaceTypeFireWire = CFSTR("FireWire"); const CFStringRef kSCValNetInterfaceTypePPP = CFSTR("PPP"); const CFStringRef kSCValNetInterfaceType6to4 = CFSTR("6to4"); +const CFStringRef kSCValNetInterfaceTypeIPSec = CFSTR("IPSec"); const CFStringRef kSCValNetInterfaceSubTypePPPoE = CFSTR("PPPoE"); const CFStringRef kSCValNetInterfaceSubTypePPPSerial = CFSTR("PPPSerial"); const CFStringRef kSCValNetInterfaceSubTypePPTP = CFSTR("PPTP"); const CFStringRef kSCValNetInterfaceSubTypeL2TP = CFSTR("L2TP"); +const CFStringRef kSCPropNetIPSecAuthenticationMethod = CFSTR("AuthenticationMethod"); +const CFStringRef kSCPropNetIPSecLocalCertificate = CFSTR("LocalCertificate"); const CFStringRef kSCPropNetIPSecLocalIdentifier = CFSTR("LocalIdentifier"); const CFStringRef kSCPropNetIPSecLocalIdentifierType = CFSTR("LocalIdentifierType"); -const CFStringRef kSCPropNetIPSecAuthenticationMethod = CFSTR("AuthenticationMethod"); const CFStringRef kSCPropNetIPSecSharedSecret = CFSTR("SharedSecret"); const CFStringRef kSCPropNetIPSecSharedSecretEncryption = CFSTR("SharedSecretEncryption"); -const CFStringRef kSCPropNetIPSecLocalCertificate = CFSTR("LocalCertificate"); +const CFStringRef kSCPropNetIPSecConnectTime = CFSTR("ConnectTime"); +const CFStringRef kSCPropNetIPSecRemoteAddress = CFSTR("RemoteAddress"); +const CFStringRef kSCPropNetIPSecStatus = CFSTR("Status"); +const CFStringRef kSCPropNetIPSecXAuthEnabled = CFSTR("XAuthEnabled"); +const CFStringRef kSCPropNetIPSecXAuthName = CFSTR("XAuthName"); +const CFStringRef kSCPropNetIPSecXAuthPassword = CFSTR("XAuthPassword"); +const CFStringRef kSCPropNetIPSecXAuthPasswordEncryption = CFSTR("XAuthPasswordEncryption"); const CFStringRef kSCValNetIPSecAuthenticationMethodSharedSecret = CFSTR("SharedSecret"); const CFStringRef kSCValNetIPSecAuthenticationMethodCertificate = CFSTR("Certificate"); -const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain = CFSTR("Keychain"); +const CFStringRef kSCValNetIPSecAuthenticationMethodHybrid = CFSTR("Hybrid"); const CFStringRef kSCValNetIPSecLocalIdentifierTypeKeyID = CFSTR("KeyID"); +const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain = CFSTR("Keychain"); +const CFStringRef kSCValNetIPSecXAuthPasswordEncryptionKeychain = CFSTR("Keychain"); +const CFStringRef kSCValNetIPSecXAuthPasswordEncryptionPrompt = CFSTR("Prompt"); +const CFStringRef kSCPropNetIPSecLastCause = CFSTR("LastCause"); +const CFStringRef kSCPropNetIPSecOnDemandEnabled = CFSTR("OnDemandEnabled"); +const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsAlways = CFSTR("OnDemandMatchDomainsAlways"); +const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsOnRetry = CFSTR("OnDemandMatchDomainsOnRetry"); +const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsNever = CFSTR("OnDemandMatchDomainsNever"); const CFStringRef kSCPropNetIPv4Addresses = CFSTR("Addresses"); const CFStringRef kSCPropNetIPv4ConfigMethod = CFSTR("ConfigMethod"); const CFStringRef kSCPropNetIPv4DHCPClientID = CFSTR("DHCPClientID"); @@ -120,6 +160,7 @@ const CFStringRef kSCPropNetIPv4Router = CFSTR("Rout const CFStringRef kSCPropNetIPv4SubnetMasks = CFSTR("SubnetMasks"); const CFStringRef kSCPropNetIPv4DestAddresses = CFSTR("DestAddresses"); const CFStringRef kSCPropNetIPv4BroadcastAddresses = CFSTR("BroadcastAddresses"); +const CFStringRef kSCValNetIPv4ConfigMethodAutomatic = CFSTR("Automatic"); const CFStringRef kSCValNetIPv4ConfigMethodBOOTP = CFSTR("BOOTP"); const CFStringRef kSCValNetIPv4ConfigMethodDHCP = CFSTR("DHCP"); const CFStringRef kSCValNetIPv4ConfigMethodINFORM = CFSTR("INFORM"); @@ -162,6 +203,8 @@ const CFStringRef kSCPropNetModemSpeed = CFSTR("Spee const CFStringRef kSCValNetModemDialModeIgnoreDialTone = CFSTR("IgnoreDialTone"); const CFStringRef kSCValNetModemDialModeManual = CFSTR("Manual"); const CFStringRef kSCValNetModemDialModeWaitForDialTone = CFSTR("WaitForDialTone"); + +#if !TARGET_OS_IPHONE const CFStringRef kSCPropNetNetInfoBindingMethods = CFSTR("BindingMethods"); const CFStringRef kSCPropNetNetInfoServerAddresses = CFSTR("ServerAddresses"); const CFStringRef kSCPropNetNetInfoServerTags = CFSTR("ServerTags"); @@ -170,6 +213,8 @@ const CFStringRef kSCValNetNetInfoBindingMethodsBroadcast = CFSTR("Broa const CFStringRef kSCValNetNetInfoBindingMethodsDHCP = CFSTR("DHCP"); const CFStringRef kSCValNetNetInfoBindingMethodsManual = CFSTR("Manual"); const CFStringRef kSCValNetNetInfoDefaultServerTag = CFSTR("network"); +#endif // !TARGET_OS_IPHONE + const CFStringRef kSCPropNetPPPACSPEnabled = CFSTR("ACSPEnabled"); const CFStringRef kSCPropNetPPPConnectTime = CFSTR("ConnectTime"); const CFStringRef kSCPropNetPPPDeviceLastCause = CFSTR("DeviceLastCause"); @@ -269,6 +314,13 @@ const CFStringRef kSCPropNetProxiesSOCKSProxy = CFSTR("SOCK const CFStringRef kSCPropNetProxiesProxyAutoConfigEnable = CFSTR("ProxyAutoConfigEnable"); const CFStringRef kSCPropNetProxiesProxyAutoConfigURLString = CFSTR("ProxyAutoConfigURLString"); const CFStringRef kSCPropNetProxiesProxyAutoDiscoveryEnable = CFSTR("ProxyAutoDiscoveryEnable"); +const CFStringRef kSCPropNetServicePrimaryRank = CFSTR("PrimaryRank"); +const CFStringRef kSCPropNetServiceUserDefinedName = CFSTR("UserDefinedName"); +const CFStringRef kSCValNetServicePrimaryRankFirst = CFSTR("First"); +const CFStringRef kSCValNetServicePrimaryRankLast = CFSTR("Last"); +const CFStringRef kSCValNetServicePrimaryRankNever = CFSTR("Never"); + +#if !TARGET_OS_IPHONE const CFStringRef kSCPropNetSMBNetBIOSName = CFSTR("NetBIOSName"); const CFStringRef kSCPropNetSMBNetBIOSNodeType = CFSTR("NetBIOSNodeType"); const CFStringRef kSCPropNetSMBNetBIOSScope = CFSTR("NetBIOSScope"); @@ -278,7 +330,13 @@ const CFStringRef kSCValNetSMBNetBIOSNodeTypeBroadcast = CFSTR("Broa const CFStringRef kSCValNetSMBNetBIOSNodeTypePeer = CFSTR("Peer"); const CFStringRef kSCValNetSMBNetBIOSNodeTypeMixed = CFSTR("Mixed"); const CFStringRef kSCValNetSMBNetBIOSNodeTypeHybrid = CFSTR("Hybrid"); +#endif // !TARGET_OS_IPHONE + + +#if !TARGET_OS_IPHONE const CFStringRef kSCEntUsersConsoleUser = CFSTR("ConsoleUser"); +#endif // !TARGET_OS_IPHONE + const CFStringRef kSCPropSystemComputerName = CFSTR("ComputerName"); const CFStringRef kSCPropSystemComputerNameEncoding = CFSTR("ComputerNameEncoding"); const CFStringRef kSCPropSystemComputerNameRegion = CFSTR("ComputerNameRegion"); @@ -294,12 +352,20 @@ const CFStringRef kSCDynamicStorePropNetInterfaces = CFSTR("Inte const CFStringRef kSCDynamicStorePropNetPrimaryInterface = CFSTR("PrimaryInterface"); const CFStringRef kSCDynamicStorePropNetPrimaryService = CFSTR("PrimaryService"); const CFStringRef kSCDynamicStorePropNetServiceIDs = CFSTR("ServiceIDs"); + +#if !TARGET_OS_IPHONE const CFStringRef kSCPropVirtualNetworkInterfacesBondInterfaces = CFSTR("Interfaces"); const CFStringRef kSCPropVirtualNetworkInterfacesBondMode = CFSTR("Mode"); const CFStringRef kSCPropVirtualNetworkInterfacesBondOptions = CFSTR("Options"); const CFStringRef kSCPropVirtualNetworkInterfacesVLANInterface = CFSTR("Interface"); const CFStringRef kSCPropVirtualNetworkInterfacesVLANTag = CFSTR("Tag"); const CFStringRef kSCPropVirtualNetworkInterfacesVLANOptions = CFSTR("Options"); +#endif // !TARGET_OS_IPHONE + + +#if !TARGET_OS_IPHONE const CFStringRef kSCPropUsersConsoleUserName = CFSTR("Name"); const CFStringRef kSCPropUsersConsoleUserUID = CFSTR("UID"); const CFStringRef kSCPropUsersConsoleUserGID = CFSTR("GID"); +#endif // !TARGET_OS_IPHONE + diff --git a/SystemConfiguration.fproj/SCSchemaDefinitions.h b/SystemConfiguration.fproj/SCSchemaDefinitions.h index 24fd3a7..5089eca 100644 --- a/SystemConfiguration.fproj/SCSchemaDefinitions.h +++ b/SystemConfiguration.fproj/SCSchemaDefinitions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -62,7 +62,6 @@ * Network Entity Keys * * kSCEntNetAirPort "AirPort" CFDictionary - * kSCEntNetAppleTalk "AppleTalk" CFDictionary * kSCEntNetDHCP "DHCP" CFDictionary * kSCEntNetDNS "DNS" CFDictionary * kSCEntNetEthernet "Ethernet" CFDictionary @@ -116,23 +115,6 @@ * --- kSCPropNetAirPortPasswordEncryption values --- * kSCValNetAirPortAuthPasswordEncryptionKeychain "Keychain" * - * kSCEntNetAppleTalk Entity Keys - * - * kSCPropNetAppleTalkComputerName "ComputerName" CFString - * kSCPropNetAppleTalkComputerNameEncoding "ComputerNameEncoding" CFNumber - * kSCPropNetAppleTalkConfigMethod "ConfigMethod" CFString - * kSCPropNetAppleTalkDefaultZone "DefaultZone" CFString - * kSCPropNetAppleTalkNetworkID "NetworkID" CFNumber - * kSCPropNetAppleTalkNetworkRange "NetworkRange" CFArray[CFNumber] - * kSCPropNetAppleTalkNodeID "NodeID" CFNumber - * kSCPropNetAppleTalkSeedNetworkRange "SeedNetworkRange" CFArray[CFNumber] - * kSCPropNetAppleTalkSeedZones "SeedZones" CFArray[CFString] - * - * --- kSCPropNetAppleTalkConfigMethod values --- - * kSCValNetAppleTalkConfigMethodNode "Node" - * kSCValNetAppleTalkConfigMethodRouter "Router" - * kSCValNetAppleTalkConfigMethodSeedRouter "SeedRouter" - * * kSCEntNetDNS Entity Keys * * kSCPropNetDNSDomainName "DomainName" CFString @@ -169,6 +151,7 @@ * kSCValNetInterfaceTypeFireWire "FireWire" * kSCValNetInterfaceTypePPP "PPP" * kSCValNetInterfaceType6to4 "6to4" + * kSCValNetInterfaceTypeIPSec "IPSec" * * --- kSCPropNetServiceSubType values (for PPP) --- * kSCValNetInterfaceSubTypePPPoE "PPPoE" @@ -178,22 +161,34 @@ * * kSCEntNetIPSec Entity Keys * + * kSCPropNetIPSecAuthenticationMethod "AuthenticationMethod" CFString + * kSCPropNetIPSecLocalCertificate "LocalCertificate" CFData * kSCPropNetIPSecLocalIdentifier "LocalIdentifier" CFString * kSCPropNetIPSecLocalIdentifierType "LocalIdentifierType" CFString - * kSCPropNetIPSecAuthenticationMethod "AuthenticationMethod" CFString * kSCPropNetIPSecSharedSecret "SharedSecret" CFString * kSCPropNetIPSecSharedSecretEncryption "SharedSecretEncryption" CFString - * kSCPropNetIPSecLocalCertificate "LocalCertificate" CFData + * kSCPropNetIPSecConnectTime "ConnectTime" CFNumber + * kSCPropNetIPSecRemoteAddress "RemoteAddress" CFString + * kSCPropNetIPSecStatus "Status" CFNumber + * kSCPropNetIPSecXAuthEnabled "XAuthEnabled" CFNumber (0 or 1) + * kSCPropNetIPSecXAuthName "XAuthName" CFString + * kSCPropNetIPSecXAuthPassword "XAuthPassword" CFString + * kSCPropNetIPSecXAuthPasswordEncryption "XAuthPasswordEncryption" CFString * * --- kSCPropNetIPSecAuthenticationMethod values --- * kSCValNetIPSecAuthenticationMethodSharedSecret "SharedSecret" * kSCValNetIPSecAuthenticationMethodCertificate "Certificate" + * kSCValNetIPSecAuthenticationMethodHybrid "Hybrid" + * + * --- kSCPropNetIPSecLocalIdentifierType values --- + * kSCValNetIPSecLocalIdentifierTypeKeyID "KeyID" * * --- kSCPropNetIPSecSharedSecretEncryption values --- * kSCValNetIPSecSharedSecretEncryptionKeychain "Keychain" * - * --- kSCPropNetIPSecLocalIdentifierType values --- - * kSCValNetIPSecLocalIdentifierTypeKeyID "KeyID" + * --- kSCPropNetIPSecXAuthPasswordEncryption values --- + * kSCValNetIPSecXAuthPasswordEncryptionKeychain "Keychain" + * kSCValNetIPSecXAuthPasswordEncryptionPrompt "Prompt" * * kSCEntNetIPv4 Entity Keys * @@ -206,6 +201,7 @@ * kSCPropNetIPv4BroadcastAddresses "BroadcastAddresses" CFArray[CFString] * * --- kSCPropNetIPv4ConfigMethod values --- + * kSCValNetIPv4ConfigMethodAutomatic "Automatic" * kSCValNetIPv4ConfigMethodBOOTP "BOOTP" * kSCValNetIPv4ConfigMethodDHCP "DHCP" * kSCValNetIPv4ConfigMethodINFORM "INFORM" @@ -476,18 +472,22 @@ */ -#ifndef _SCSCHEMADEFINITIONS_H -#define _SCSCHEMADEFINITIONS_H +#ifndef _SCSCHEMADEFINITIONS_H +#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS +#include +#else /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ +#define _SCSCHEMADEFINITIONS_H /* -------------------- Macro declarations -------------------- */ -#include +#include +#include /* * let's "do the right thing" for those wishing to build for * Mac OS X 10.1.0 ... 10.2.x */ -#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1020 +#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (__MAC_OS_X_VERSION_MIN_REQUIRED <= 1020) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED) #ifndef SCSTR #include #define SCSTR(s) CFSTR(s) @@ -519,7 +519,7 @@ #define SC_SCHEMA_DECLARATION(k,q) extern NSString * k q; #endif #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED) #ifndef SCSTR #include #define SCSTR(s) CFSTR(s) @@ -663,7 +663,7 @@ extern const CFStringRef kSCEntNetAirPort; /*! @const kSCEntNetAppleTalk - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCEntNetAppleTalk; @@ -911,73 +911,73 @@ extern const CFStringRef kSCValNetAirPortAuthPasswordEncryptionKeychain; /*! @const kSCPropNetAppleTalkComputerName - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkComputerName; /*! @const kSCPropNetAppleTalkComputerNameEncoding - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkComputerNameEncoding; /*! @const kSCPropNetAppleTalkConfigMethod - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkConfigMethod; /*! @const kSCPropNetAppleTalkDefaultZone - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkDefaultZone; /*! @const kSCPropNetAppleTalkNetworkID - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkNetworkID; /*! @const kSCPropNetAppleTalkNetworkRange - @availability Introduced in Mac OS X 10.2. + @availability Introduced in Mac OS X 10.2, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkNetworkRange; /*! @const kSCPropNetAppleTalkNodeID - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkNodeID; /*! @const kSCPropNetAppleTalkSeedNetworkRange - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkSeedNetworkRange; /*! @const kSCPropNetAppleTalkSeedZones - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCPropNetAppleTalkSeedZones; /*! @const kSCValNetAppleTalkConfigMethodNode - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCValNetAppleTalkConfigMethodNode; /*! @const kSCValNetAppleTalkConfigMethodRouter - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCValNetAppleTalkConfigMethodRouter; /*! @const kSCValNetAppleTalkConfigMethodSeedRouter - @availability Introduced in Mac OS X 10.1. + @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6. */ extern const CFStringRef kSCValNetAppleTalkConfigMethodSeedRouter; @@ -1129,6 +1129,12 @@ extern const CFStringRef kSCValNetInterfaceTypePPP; */ extern const CFStringRef kSCValNetInterfaceType6to4; +/*! + @const kSCValNetInterfaceTypeIPSec + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCValNetInterfaceTypeIPSec; + /*! @const kSCValNetInterfaceSubTypePPPoE @availability Introduced in Mac OS X 10.1. @@ -1158,22 +1164,28 @@ extern const CFStringRef kSCValNetInterfaceSubTypeL2TP; */ /*! - @const kSCPropNetIPSecLocalIdentifier + @const kSCPropNetIPSecAuthenticationMethod @availability Introduced in Mac OS X 10.5. */ -extern const CFStringRef kSCPropNetIPSecLocalIdentifier; +extern const CFStringRef kSCPropNetIPSecAuthenticationMethod; /*! - @const kSCPropNetIPSecLocalIdentifierType + @const kSCPropNetIPSecLocalCertificate @availability Introduced in Mac OS X 10.5. */ -extern const CFStringRef kSCPropNetIPSecLocalIdentifierType; +extern const CFStringRef kSCPropNetIPSecLocalCertificate; /*! - @const kSCPropNetIPSecAuthenticationMethod + @const kSCPropNetIPSecLocalIdentifier @availability Introduced in Mac OS X 10.5. */ -extern const CFStringRef kSCPropNetIPSecAuthenticationMethod; +extern const CFStringRef kSCPropNetIPSecLocalIdentifier; + +/*! + @const kSCPropNetIPSecLocalIdentifierType + @availability Introduced in Mac OS X 10.5. + */ +extern const CFStringRef kSCPropNetIPSecLocalIdentifierType; /*! @const kSCPropNetIPSecSharedSecret @@ -1188,10 +1200,46 @@ extern const CFStringRef kSCPropNetIPSecSharedSecret; extern const CFStringRef kSCPropNetIPSecSharedSecretEncryption; /*! - @const kSCPropNetIPSecLocalCertificate - @availability Introduced in Mac OS X 10.5. + @const kSCPropNetIPSecConnectTime + @availability Introduced in Mac OS X 10.6. */ -extern const CFStringRef kSCPropNetIPSecLocalCertificate; +extern const CFStringRef kSCPropNetIPSecConnectTime; + +/*! + @const kSCPropNetIPSecRemoteAddress + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecRemoteAddress; + +/*! + @const kSCPropNetIPSecStatus + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecStatus; + +/*! + @const kSCPropNetIPSecXAuthEnabled + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecXAuthEnabled; + +/*! + @const kSCPropNetIPSecXAuthName + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecXAuthName; + +/*! + @const kSCPropNetIPSecXAuthPassword + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecXAuthPassword; + +/*! + @const kSCPropNetIPSecXAuthPasswordEncryption + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecXAuthPasswordEncryption; /*! @const kSCValNetIPSecAuthenticationMethodSharedSecret @@ -1206,10 +1254,10 @@ extern const CFStringRef kSCValNetIPSecAuthenticationMethodSharedSecret; extern const CFStringRef kSCValNetIPSecAuthenticationMethodCertificate; /*! - @const kSCValNetIPSecSharedSecretEncryptionKeychain + @const kSCValNetIPSecAuthenticationMethodHybrid @availability Introduced in Mac OS X 10.5. */ -extern const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain; +extern const CFStringRef kSCValNetIPSecAuthenticationMethodHybrid; /*! @const kSCValNetIPSecLocalIdentifierTypeKeyID @@ -1217,6 +1265,24 @@ extern const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain; */ extern const CFStringRef kSCValNetIPSecLocalIdentifierTypeKeyID; +/*! + @const kSCValNetIPSecSharedSecretEncryptionKeychain + @availability Introduced in Mac OS X 10.5. + */ +extern const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain; + +/*! + @const kSCValNetIPSecXAuthPasswordEncryptionKeychain + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCValNetIPSecXAuthPasswordEncryptionKeychain; + +/*! + @const kSCValNetIPSecXAuthPasswordEncryptionPrompt + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCValNetIPSecXAuthPasswordEncryptionPrompt; + /*! @group kSCEntNetIPv4 Entity Keys */ @@ -1263,6 +1329,12 @@ extern const CFStringRef kSCPropNetIPv4DestAddresses; */ extern const CFStringRef kSCPropNetIPv4BroadcastAddresses; +/*! + @const kSCValNetIPv4ConfigMethodAutomatic + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCValNetIPv4ConfigMethodAutomatic; + /*! @const kSCValNetIPv4ConfigMethodBOOTP @availability Introduced in Mac OS X 10.1. @@ -2315,2754 +2387,2333 @@ extern const CFStringRef kSCPropUsersConsoleUserGID; /* -------------------- Schema declarations -------------------- */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCResvLink, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCResvLink, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCResvLink \ SC_SCHEMA_KV(kSCResvLink \ ,"__LINK__" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCResvInactive, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCResvInactive, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCResvInactive \ SC_SCHEMA_KV(kSCResvInactive \ ,"__INACTIVE__" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropInterfaceName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropInterfaceName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropInterfaceName \ SC_SCHEMA_KV(kSCPropInterfaceName \ ,"InterfaceName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropMACAddress, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropMACAddress, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropMACAddress \ SC_SCHEMA_KV(kSCPropMACAddress \ ,"MACAddress" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropUserDefinedName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropUserDefinedName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropUserDefinedName \ SC_SCHEMA_KV(kSCPropUserDefinedName \ ,"UserDefinedName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropVersion, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropVersion, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropVersion \ SC_SCHEMA_KV(kSCPropVersion \ ,"Version" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPrefCurrentSet, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPrefCurrentSet, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPrefCurrentSet \ SC_SCHEMA_KV(kSCPrefCurrentSet \ ,"CurrentSet" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPrefNetworkServices, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPrefNetworkServices, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPrefNetworkServices \ SC_SCHEMA_KV(kSCPrefNetworkServices \ ,"NetworkServices" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPrefSets, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPrefSets, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPrefSets \ SC_SCHEMA_KV(kSCPrefSets \ ,"Sets" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPrefSystem, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPrefSystem, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPrefSystem \ SC_SCHEMA_KV(kSCPrefSystem \ ,"System" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCCompNetwork, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCCompNetwork, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCCompNetwork \ SC_SCHEMA_KV(kSCCompNetwork \ ,"Network" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCCompService, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCCompService, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCCompService \ SC_SCHEMA_KV(kSCCompService \ ,"Service" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCCompGlobal, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCCompGlobal, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCCompGlobal \ SC_SCHEMA_KV(kSCCompGlobal \ ,"Global" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCCompHostNames, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCCompHostNames, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCCompHostNames \ SC_SCHEMA_KV(kSCCompHostNames \ ,"HostNames" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCCompInterface, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCCompInterface, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCCompInterface \ SC_SCHEMA_KV(kSCCompInterface \ ,"Interface" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCCompSystem, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCCompSystem, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCCompSystem \ SC_SCHEMA_KV(kSCCompSystem \ ,"System" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCCompUsers, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCCompUsers, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCCompUsers \ SC_SCHEMA_KV(kSCCompUsers \ ,"Users" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCCompAnyRegex, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCCompAnyRegex, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCCompAnyRegex \ SC_SCHEMA_KV(kSCCompAnyRegex \ ,"[^/]+" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetAirPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetAirPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetAirPort \ SC_SCHEMA_KV(kSCEntNetAirPort \ ,"AirPort" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetAppleTalk, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCEntNetAppleTalk, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCEntNetAppleTalk \ SC_SCHEMA_KV(kSCEntNetAppleTalk \ ,"AppleTalk" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetDHCP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#endif // !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCEntNetDHCP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetDHCP \ SC_SCHEMA_KV(kSCEntNetDHCP \ ,"DHCP" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetDNS, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetDNS, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetDNS \ SC_SCHEMA_KV(kSCEntNetDNS \ ,"DNS" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetEthernet, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetEthernet, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetEthernet \ SC_SCHEMA_KV(kSCEntNetEthernet \ ,"Ethernet" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetFireWire, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCEntNetFireWire, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetFireWire \ SC_SCHEMA_KV(kSCEntNetFireWire \ ,"FireWire" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetInterface, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetInterface, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetInterface \ SC_SCHEMA_KV(kSCEntNetInterface \ ,"Interface" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCEntNetIPSec, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCEntNetIPSec, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetIPSec \ SC_SCHEMA_KV(kSCEntNetIPSec \ ,"IPSec" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetIPv4, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetIPv4, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetIPv4 \ SC_SCHEMA_KV(kSCEntNetIPv4 \ ,"IPv4" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetIPv6, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetIPv6, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetIPv6 \ SC_SCHEMA_KV(kSCEntNetIPv6 \ ,"IPv6" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetL2TP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCEntNetL2TP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetL2TP \ SC_SCHEMA_KV(kSCEntNetL2TP \ ,"L2TP" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetLink, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetLink, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetLink \ SC_SCHEMA_KV(kSCEntNetLink \ ,"Link" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetModem, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetModem, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetModem \ SC_SCHEMA_KV(kSCEntNetModem \ ,"Modem" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCEntNetNetInfo, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCEntNetNetInfo, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCEntNetNetInfo \ SC_SCHEMA_KV(kSCEntNetNetInfo \ ,"NetInfo" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetPPP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#endif // !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCEntNetPPP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetPPP \ SC_SCHEMA_KV(kSCEntNetPPP \ ,"PPP" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetPPPoE, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetPPPoE, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetPPPoE \ SC_SCHEMA_KV(kSCEntNetPPPoE \ ,"PPPoE" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetPPPSerial, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCEntNetPPPSerial, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetPPPSerial \ SC_SCHEMA_KV(kSCEntNetPPPSerial \ ,"PPPSerial" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetPPTP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCEntNetPPTP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetPPTP \ SC_SCHEMA_KV(kSCEntNetPPTP \ ,"PPTP" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNetProxies, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCEntNetProxies, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetProxies \ SC_SCHEMA_KV(kSCEntNetProxies \ ,"Proxies" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCEntNetSMB, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCEntNetSMB, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetSMB \ SC_SCHEMA_KV(kSCEntNetSMB \ ,"SMB" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntNet6to4, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) +#endif // !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCEntNet6to4, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNet6to4 \ SC_SCHEMA_KV(kSCEntNet6to4 \ ,"6to4" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetOverridePrimary, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetOverridePrimary, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetOverridePrimary \ SC_SCHEMA_KV(kSCPropNetOverridePrimary \ ,"OverridePrimary" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetServiceOrder, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetServiceOrder, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetServiceOrder \ SC_SCHEMA_KV(kSCPropNetServiceOrder \ ,"ServiceOrder" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPOverridePrimary, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPOverridePrimary, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPOverridePrimary \ SC_SCHEMA_KV(kSCPropNetPPPOverridePrimary \ ,"PPPOverridePrimary" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetInterfaces \ SC_SCHEMA_KV(kSCPropNetInterfaces \ ,"Interfaces" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetLocalHostName, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetLocalHostName, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetLocalHostName \ SC_SCHEMA_KV(kSCPropNetLocalHostName \ ,"LocalHostName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAirPortAllowNetCreation, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetAirPortAllowNetCreation, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetAirPortAllowNetCreation \ SC_SCHEMA_KV(kSCPropNetAirPortAllowNetCreation \ ,"AllowNetCreation" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAirPortAuthPassword, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAirPortAuthPassword, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetAirPortAuthPassword \ SC_SCHEMA_KV(kSCPropNetAirPortAuthPassword \ ,"AuthPassword" \ ,CFData ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAirPortAuthPasswordEncryption, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAirPortAuthPasswordEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetAirPortAuthPasswordEncryption \ SC_SCHEMA_KV(kSCPropNetAirPortAuthPasswordEncryption \ ,"AuthPasswordEncryption" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAirPortJoinMode, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetAirPortJoinMode, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetAirPortJoinMode \ SC_SCHEMA_KV(kSCPropNetAirPortJoinMode \ ,"JoinMode" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAirPortPowerEnabled, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAirPortPowerEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetAirPortPowerEnabled \ SC_SCHEMA_KV(kSCPropNetAirPortPowerEnabled \ ,"PowerEnabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAirPortPreferredNetwork, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAirPortPreferredNetwork, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetAirPortPreferredNetwork \ SC_SCHEMA_KV(kSCPropNetAirPortPreferredNetwork \ ,"PreferredNetwork" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAirPortSavePasswords, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetAirPortSavePasswords, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetAirPortSavePasswords \ SC_SCHEMA_KV(kSCPropNetAirPortSavePasswords \ ,"SavePasswords" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeAutomatic, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeAutomatic, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetAirPortJoinModeAutomatic \ SC_SCHEMA_KV(kSCValNetAirPortJoinModeAutomatic \ ,"Automatic" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModePreferred, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModePreferred, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetAirPortJoinModePreferred \ SC_SCHEMA_KV(kSCValNetAirPortJoinModePreferred \ ,"Preferred" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRanked, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRanked, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetAirPortJoinModeRanked \ SC_SCHEMA_KV(kSCValNetAirPortJoinModeRanked \ ,"Ranked" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRecent, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRecent, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetAirPortJoinModeRecent \ SC_SCHEMA_KV(kSCValNetAirPortJoinModeRecent \ ,"Recent" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeStrongest, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeStrongest, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetAirPortJoinModeStrongest \ SC_SCHEMA_KV(kSCValNetAirPortJoinModeStrongest \ ,"Strongest" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetAirPortAuthPasswordEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetAirPortAuthPasswordEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetAirPortAuthPasswordEncryptionKeychain \ SC_SCHEMA_KV(kSCValNetAirPortAuthPasswordEncryptionKeychain \ ,"Keychain" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkComputerName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkComputerName, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetAppleTalkComputerName \ SC_SCHEMA_KV(kSCPropNetAppleTalkComputerName \ ,"ComputerName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkComputerNameEncoding, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkComputerNameEncoding, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetAppleTalkComputerNameEncoding \ SC_SCHEMA_KV(kSCPropNetAppleTalkComputerNameEncoding \ ,"ComputerNameEncoding" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkConfigMethod, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkConfigMethod, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetAppleTalkConfigMethod \ SC_SCHEMA_KV(kSCPropNetAppleTalkConfigMethod \ ,"ConfigMethod" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkDefaultZone, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkDefaultZone, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetAppleTalkDefaultZone \ SC_SCHEMA_KV(kSCPropNetAppleTalkDefaultZone \ ,"DefaultZone" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNetworkID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNetworkID, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetAppleTalkNetworkID \ SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkID \ ,"NetworkID" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNetworkRange, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNetworkRange, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) #define kSCPropNetAppleTalkNetworkRange \ SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkRange \ ,"NetworkRange" \ ,CFArray[CFNumber] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNodeID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNodeID, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetAppleTalkNodeID \ SC_SCHEMA_KV(kSCPropNetAppleTalkNodeID \ ,"NodeID" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkSeedNetworkRange, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkSeedNetworkRange, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetAppleTalkSeedNetworkRange \ SC_SCHEMA_KV(kSCPropNetAppleTalkSeedNetworkRange \ ,"SeedNetworkRange" \ ,CFArray[CFNumber] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkSeedZones, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkSeedZones, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetAppleTalkSeedZones \ SC_SCHEMA_KV(kSCPropNetAppleTalkSeedZones \ ,"SeedZones" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodNode, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodNode, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCValNetAppleTalkConfigMethodNode \ SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodNode \ ,"Node" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodRouter, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodRouter, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCValNetAppleTalkConfigMethodRouter \ SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodRouter \ ,"Router" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodSeedRouter, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodSeedRouter, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCValNetAppleTalkConfigMethodSeedRouter \ SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodSeedRouter \ ,"SeedRouter" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetDNSDomainName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#endif // !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCPropNetDNSDomainName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSDomainName \ SC_SCHEMA_KV(kSCPropNetDNSDomainName \ ,"DomainName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetDNSOptions, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetDNSOptions, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSOptions \ SC_SCHEMA_KV(kSCPropNetDNSOptions \ ,"Options" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetDNSSearchDomains, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetDNSSearchDomains, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSSearchDomains \ SC_SCHEMA_KV(kSCPropNetDNSSearchDomains \ ,"SearchDomains" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetDNSSearchOrder, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetDNSSearchOrder, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSSearchOrder \ SC_SCHEMA_KV(kSCPropNetDNSSearchOrder \ ,"SearchOrder" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetDNSServerAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetDNSServerAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSServerAddresses \ SC_SCHEMA_KV(kSCPropNetDNSServerAddresses \ ,"ServerAddresses" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetDNSServerPort, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetDNSServerPort, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSServerPort \ SC_SCHEMA_KV(kSCPropNetDNSServerPort \ ,"ServerPort" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetDNSServerTimeout, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetDNSServerTimeout, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSServerTimeout \ SC_SCHEMA_KV(kSCPropNetDNSServerTimeout \ ,"ServerTimeout" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetDNSSortList, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetDNSSortList, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSSortList \ SC_SCHEMA_KV(kSCPropNetDNSSortList \ ,"SortList" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetDNSSupplementalMatchDomains, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetDNSSupplementalMatchDomains, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSSupplementalMatchDomains \ SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchDomains \ ,"SupplementalMatchDomains" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetDNSSupplementalMatchOrders, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetDNSSupplementalMatchOrders, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetDNSSupplementalMatchOrders \ SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchOrders \ ,"SupplementalMatchOrders" \ ,CFArray[CFNumber] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetEthernetMediaSubType, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetEthernetMediaSubType, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetEthernetMediaSubType \ SC_SCHEMA_KV(kSCPropNetEthernetMediaSubType \ ,"MediaSubType" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetEthernetMediaOptions, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetEthernetMediaOptions, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetEthernetMediaOptions \ SC_SCHEMA_KV(kSCPropNetEthernetMediaOptions \ ,"MediaOptions" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetEthernetMTU, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetEthernetMTU, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetEthernetMTU \ SC_SCHEMA_KV(kSCPropNetEthernetMTU \ ,"MTU" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetInterfaceDeviceName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetInterfaceDeviceName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetInterfaceDeviceName \ SC_SCHEMA_KV(kSCPropNetInterfaceDeviceName \ ,"DeviceName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetInterfaceHardware, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetInterfaceHardware, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetInterfaceHardware \ SC_SCHEMA_KV(kSCPropNetInterfaceHardware \ ,"Hardware" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetInterfaceType, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetInterfaceType, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetInterfaceType \ SC_SCHEMA_KV(kSCPropNetInterfaceType \ ,"Type" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetInterfaceSubType, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetInterfaceSubType, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetInterfaceSubType \ SC_SCHEMA_KV(kSCPropNetInterfaceSubType \ ,"SubType" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetInterfaceSupportsModemOnHold, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetInterfaceSupportsModemOnHold, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetInterfaceSupportsModemOnHold \ SC_SCHEMA_KV(kSCPropNetInterfaceSupportsModemOnHold \ ,"SupportsModemOnHold" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeEthernet, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeEthernet, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetInterfaceTypeEthernet \ SC_SCHEMA_KV(kSCValNetInterfaceTypeEthernet \ ,"Ethernet" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeFireWire, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeFireWire, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetInterfaceTypeFireWire \ SC_SCHEMA_KV(kSCValNetInterfaceTypeFireWire \ ,"FireWire" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypePPP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypePPP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetInterfaceTypePPP \ SC_SCHEMA_KV(kSCValNetInterfaceTypePPP \ ,"PPP" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetInterfaceType6to4, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetInterfaceType6to4, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetInterfaceType6to4 \ SC_SCHEMA_KV(kSCValNetInterfaceType6to4 \ ,"6to4" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPPoE, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) + SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeIPSec, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCValNetInterfaceTypeIPSec \ + SC_SCHEMA_KV(kSCValNetInterfaceTypeIPSec \ + ,"IPSec" \ + , ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + + SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPPoE, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetInterfaceSubTypePPPoE \ SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPoE \ ,"PPPoE" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPPSerial, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPPSerial, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetInterfaceSubTypePPPSerial \ SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPSerial \ ,"PPPSerial" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPTP, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPTP, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetInterfaceSubTypePPTP \ SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPTP \ ,"PPTP" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypeL2TP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypeL2TP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetInterfaceSubTypeL2TP \ SC_SCHEMA_KV(kSCValNetInterfaceSubTypeL2TP \ ,"L2TP" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifier, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) + SC_SCHEMA_DECLARATION(kSCPropNetIPSecAuthenticationMethod, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecAuthenticationMethod \ + SC_SCHEMA_KV(kSCPropNetIPSecAuthenticationMethod \ + ,"AuthenticationMethod" \ + ,CFString ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalCertificate, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecLocalCertificate \ + SC_SCHEMA_KV(kSCPropNetIPSecLocalCertificate \ + ,"LocalCertificate" \ + ,CFData ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifier, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPSecLocalIdentifier \ SC_SCHEMA_KV(kSCPropNetIPSecLocalIdentifier \ ,"LocalIdentifier" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifierType, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifierType, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPSecLocalIdentifierType \ SC_SCHEMA_KV(kSCPropNetIPSecLocalIdentifierType \ ,"LocalIdentifierType" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetIPSecAuthenticationMethod, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) - #define kSCPropNetIPSecAuthenticationMethod \ - SC_SCHEMA_KV(kSCPropNetIPSecAuthenticationMethod \ - ,"AuthenticationMethod" \ - ,CFString ) -#endif - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecret, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecret, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPSecSharedSecret \ SC_SCHEMA_KV(kSCPropNetIPSecSharedSecret \ ,"SharedSecret" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecretEncryption, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecretEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPSecSharedSecretEncryption \ SC_SCHEMA_KV(kSCPropNetIPSecSharedSecretEncryption \ ,"SharedSecretEncryption" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalCertificate, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) + SC_SCHEMA_DECLARATION(kSCPropNetIPSecConnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecConnectTime \ + SC_SCHEMA_KV(kSCPropNetIPSecConnectTime \ + ,"ConnectTime" \ + ,CFNumber ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) - #define kSCPropNetIPSecLocalCertificate \ - SC_SCHEMA_KV(kSCPropNetIPSecLocalCertificate \ - ,"LocalCertificate" \ - ,CFData ) + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecRemoteAddress, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecRemoteAddress \ + SC_SCHEMA_KV(kSCPropNetIPSecRemoteAddress \ + ,"RemoteAddress" \ + ,CFString ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecStatus, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecStatus \ + SC_SCHEMA_KV(kSCPropNetIPSecStatus \ + ,"Status" \ + ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodSharedSecret, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) + SC_SCHEMA_DECLARATION(kSCPropNetIPSecXAuthEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecXAuthEnabled \ + SC_SCHEMA_KV(kSCPropNetIPSecXAuthEnabled \ + ,"XAuthEnabled" \ + ,CFNumber (0 or 1) ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecXAuthName, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecXAuthName \ + SC_SCHEMA_KV(kSCPropNetIPSecXAuthName \ + ,"XAuthName" \ + ,CFString ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecXAuthPassword, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecXAuthPassword \ + SC_SCHEMA_KV(kSCPropNetIPSecXAuthPassword \ + ,"XAuthPassword" \ + ,CFString ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecXAuthPasswordEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetIPSecXAuthPasswordEncryption \ + SC_SCHEMA_KV(kSCPropNetIPSecXAuthPasswordEncryption \ + ,"XAuthPasswordEncryption" \ + ,CFString ) +#endif + + SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodSharedSecret, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPSecAuthenticationMethodSharedSecret \ SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodSharedSecret \ ,"SharedSecret" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodCertificate, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodCertificate, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPSecAuthenticationMethodCertificate \ SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodCertificate \ ,"Certificate" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetIPSecSharedSecretEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) + SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodHybrid, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCValNetIPSecAuthenticationMethodHybrid \ + SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodHybrid \ + ,"Hybrid" \ + , ) +#endif + + SC_SCHEMA_DECLARATION(kSCValNetIPSecLocalIdentifierTypeKeyID, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCValNetIPSecLocalIdentifierTypeKeyID \ + SC_SCHEMA_KV(kSCValNetIPSecLocalIdentifierTypeKeyID \ + ,"KeyID" \ + , ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + + SC_SCHEMA_DECLARATION(kSCValNetIPSecSharedSecretEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPSecSharedSecretEncryptionKeychain \ SC_SCHEMA_KV(kSCValNetIPSecSharedSecretEncryptionKeychain \ ,"Keychain" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetIPSecLocalIdentifierTypeKeyID, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) - #define kSCValNetIPSecLocalIdentifierTypeKeyID \ - SC_SCHEMA_KV(kSCValNetIPSecLocalIdentifierTypeKeyID \ - ,"KeyID" \ + SC_SCHEMA_DECLARATION(kSCValNetIPSecXAuthPasswordEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCValNetIPSecXAuthPasswordEncryptionKeychain \ + SC_SCHEMA_KV(kSCValNetIPSecXAuthPasswordEncryptionKeychain \ + ,"Keychain" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv4Addresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) + SC_SCHEMA_DECLARATION(kSCValNetIPSecXAuthPasswordEncryptionPrompt, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/ + #define kSCValNetIPSecXAuthPasswordEncryptionPrompt \ + SC_SCHEMA_KV(kSCValNetIPSecXAuthPasswordEncryptionPrompt \ + ,"Prompt" \ + , ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + + SC_SCHEMA_DECLARATION(kSCPropNetIPv4Addresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv4Addresses \ SC_SCHEMA_KV(kSCPropNetIPv4Addresses \ ,"Addresses" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv4ConfigMethod, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetIPv4ConfigMethod, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv4ConfigMethod \ SC_SCHEMA_KV(kSCPropNetIPv4ConfigMethod \ ,"ConfigMethod" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv4DHCPClientID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetIPv4DHCPClientID, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv4DHCPClientID \ SC_SCHEMA_KV(kSCPropNetIPv4DHCPClientID \ ,"DHCPClientID" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv4Router, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetIPv4Router, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv4Router \ SC_SCHEMA_KV(kSCPropNetIPv4Router \ ,"Router" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv4SubnetMasks, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetIPv4SubnetMasks, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv4SubnetMasks \ SC_SCHEMA_KV(kSCPropNetIPv4SubnetMasks \ ,"SubnetMasks" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv4DestAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetIPv4DestAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv4DestAddresses \ SC_SCHEMA_KV(kSCPropNetIPv4DestAddresses \ ,"DestAddresses" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv4BroadcastAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetIPv4BroadcastAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv4BroadcastAddresses \ SC_SCHEMA_KV(kSCPropNetIPv4BroadcastAddresses \ ,"BroadcastAddresses" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodBOOTP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) + SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodAutomatic, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCValNetIPv4ConfigMethodAutomatic \ + SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodAutomatic \ + ,"Automatic" \ + , ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + + SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodBOOTP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv4ConfigMethodBOOTP \ SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodBOOTP \ ,"BOOTP" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodDHCP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodDHCP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv4ConfigMethodDHCP \ SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodDHCP \ ,"DHCP" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodINFORM, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodINFORM, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv4ConfigMethodINFORM \ SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodINFORM \ ,"INFORM" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodLinkLocal, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodLinkLocal, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv4ConfigMethodLinkLocal \ SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodLinkLocal \ ,"LinkLocal" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodManual, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodManual, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv4ConfigMethodManual \ SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodManual \ ,"Manual" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodPPP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodPPP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv4ConfigMethodPPP \ SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodPPP \ ,"PPP" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv6Addresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetIPv6Addresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv6Addresses \ SC_SCHEMA_KV(kSCPropNetIPv6Addresses \ ,"Addresses" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv6ConfigMethod, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetIPv6ConfigMethod, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv6ConfigMethod \ SC_SCHEMA_KV(kSCPropNetIPv6ConfigMethod \ ,"ConfigMethod" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv6DestAddresses, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetIPv6DestAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv6DestAddresses \ SC_SCHEMA_KV(kSCPropNetIPv6DestAddresses \ ,"DestAddresses" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv6Flags, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetIPv6Flags, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv6Flags \ SC_SCHEMA_KV(kSCPropNetIPv6Flags \ ,"Flags" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv6PrefixLength, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetIPv6PrefixLength, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv6PrefixLength \ SC_SCHEMA_KV(kSCPropNetIPv6PrefixLength \ ,"PrefixLength" \ ,CFArray[CFNumber] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetIPv6Router, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetIPv6Router, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIPv6Router \ SC_SCHEMA_KV(kSCPropNetIPv6Router \ ,"Router" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodAutomatic, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodAutomatic, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv6ConfigMethodAutomatic \ SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodAutomatic \ ,"Automatic" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodManual, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodManual, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv6ConfigMethodManual \ SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodManual \ ,"Manual" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodRouterAdvertisement, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodRouterAdvertisement, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv6ConfigMethodRouterAdvertisement \ SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodRouterAdvertisement \ ,"RouterAdvertisement" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethod6to4, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethod6to4, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv6ConfigMethod6to4 \ SC_SCHEMA_KV(kSCValNetIPv6ConfigMethod6to4 \ ,"6to4" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNet6to4Relay, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNet6to4Relay, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNet6to4Relay \ SC_SCHEMA_KV(kSCPropNet6to4Relay \ ,"Relay" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetLinkActive, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetLinkActive, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetLinkActive \ SC_SCHEMA_KV(kSCPropNetLinkActive \ ,"Active" \ ,CFBoolean ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetLinkDetaching, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetLinkDetaching, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetLinkDetaching \ SC_SCHEMA_KV(kSCPropNetLinkDetaching \ ,"Detaching" \ ,CFBoolean ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetModemAccessPointName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetModemAccessPointName, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemAccessPointName \ SC_SCHEMA_KV(kSCPropNetModemAccessPointName \ ,"AccessPointName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionPersonality, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionPersonality, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemConnectionPersonality \ SC_SCHEMA_KV(kSCPropNetModemConnectionPersonality \ ,"ConnectionPersonality" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionScript, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionScript, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemConnectionScript \ SC_SCHEMA_KV(kSCPropNetModemConnectionScript \ ,"ConnectionScript" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemConnectSpeed, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetModemConnectSpeed, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemConnectSpeed \ SC_SCHEMA_KV(kSCPropNetModemConnectSpeed \ ,"ConnectSpeed" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemDataCompression, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetModemDataCompression, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemDataCompression \ SC_SCHEMA_KV(kSCPropNetModemDataCompression \ ,"DataCompression" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceContextID, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceContextID, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemDeviceContextID \ SC_SCHEMA_KV(kSCPropNetModemDeviceContextID \ ,"DeviceContextID" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceModel, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceModel, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemDeviceModel \ SC_SCHEMA_KV(kSCPropNetModemDeviceModel \ ,"DeviceModel" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceVendor, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceVendor, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemDeviceVendor \ SC_SCHEMA_KV(kSCPropNetModemDeviceVendor \ ,"DeviceVendor" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemDialMode, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetModemDialMode, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemDialMode \ SC_SCHEMA_KV(kSCPropNetModemDialMode \ ,"DialMode" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemErrorCorrection, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetModemErrorCorrection, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemErrorCorrection \ SC_SCHEMA_KV(kSCPropNetModemErrorCorrection \ ,"ErrorCorrection" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemHoldCallWaitingAudibleAlert, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetModemHoldCallWaitingAudibleAlert, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemHoldCallWaitingAudibleAlert \ SC_SCHEMA_KV(kSCPropNetModemHoldCallWaitingAudibleAlert \ ,"HoldCallWaitingAudibleAlert" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemHoldDisconnectOnAnswer, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetModemHoldDisconnectOnAnswer, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemHoldDisconnectOnAnswer \ SC_SCHEMA_KV(kSCPropNetModemHoldDisconnectOnAnswer \ ,"HoldDisconnectOnAnswer" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemHoldEnabled, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetModemHoldEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemHoldEnabled \ SC_SCHEMA_KV(kSCPropNetModemHoldEnabled \ ,"HoldEnabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemHoldReminder, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetModemHoldReminder, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemHoldReminder \ SC_SCHEMA_KV(kSCPropNetModemHoldReminder \ ,"HoldReminder" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemHoldReminderTime, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetModemHoldReminderTime, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemHoldReminderTime \ SC_SCHEMA_KV(kSCPropNetModemHoldReminderTime \ ,"HoldReminderTime" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemNote, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetModemNote, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemNote \ SC_SCHEMA_KV(kSCPropNetModemNote \ ,"Note" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemPulseDial, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetModemPulseDial, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemPulseDial \ SC_SCHEMA_KV(kSCPropNetModemPulseDial \ ,"PulseDial" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemSpeaker, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetModemSpeaker, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemSpeaker \ SC_SCHEMA_KV(kSCPropNetModemSpeaker \ ,"Speaker" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetModemSpeed, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetModemSpeed, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetModemSpeed \ SC_SCHEMA_KV(kSCPropNetModemSpeed \ ,"Speed" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetModemDialModeIgnoreDialTone, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetModemDialModeIgnoreDialTone, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetModemDialModeIgnoreDialTone \ SC_SCHEMA_KV(kSCValNetModemDialModeIgnoreDialTone \ ,"IgnoreDialTone" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetModemDialModeManual, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetModemDialModeManual, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetModemDialModeManual \ SC_SCHEMA_KV(kSCValNetModemDialModeManual \ ,"Manual" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetModemDialModeWaitForDialTone, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetModemDialModeWaitForDialTone, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetModemDialModeWaitForDialTone \ SC_SCHEMA_KV(kSCValNetModemDialModeWaitForDialTone \ ,"WaitForDialTone" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBindingMethods, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBindingMethods, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetNetInfoBindingMethods \ SC_SCHEMA_KV(kSCPropNetNetInfoBindingMethods \ ,"BindingMethods" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerAddresses, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetNetInfoServerAddresses \ SC_SCHEMA_KV(kSCPropNetNetInfoServerAddresses \ ,"ServerAddresses" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerTags, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerTags, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetNetInfoServerTags \ SC_SCHEMA_KV(kSCPropNetNetInfoServerTags \ ,"ServerTags" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBroadcastServerTag, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBroadcastServerTag, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropNetNetInfoBroadcastServerTag \ SC_SCHEMA_KV(kSCPropNetNetInfoBroadcastServerTag \ ,"BroadcastServerTag" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsBroadcast, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsBroadcast, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCValNetNetInfoBindingMethodsBroadcast \ SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsBroadcast \ ,"Broadcast" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsDHCP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsDHCP, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCValNetNetInfoBindingMethodsDHCP \ SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsDHCP \ ,"DHCP" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsManual, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsManual, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCValNetNetInfoBindingMethodsManual \ SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsManual \ ,"Manual" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCValNetNetInfoDefaultServerTag, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetNetInfoDefaultServerTag, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCValNetNetInfoDefaultServerTag \ SC_SCHEMA_KV(kSCValNetNetInfoDefaultServerTag \ ,"network" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPACSPEnabled, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) +#endif // !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCPropNetPPPACSPEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPACSPEnabled \ SC_SCHEMA_KV(kSCPropNetPPPACSPEnabled \ ,"ACSPEnabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPConnectTime, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPConnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPConnectTime \ SC_SCHEMA_KV(kSCPropNetPPPConnectTime \ ,"ConnectTime" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPDeviceLastCause, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPDeviceLastCause, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPDeviceLastCause \ SC_SCHEMA_KV(kSCPropNetPPPDeviceLastCause \ ,"DeviceLastCause" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPDialOnDemand, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPDialOnDemand, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPDialOnDemand \ SC_SCHEMA_KV(kSCPropNetPPPDialOnDemand \ ,"DialOnDemand" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnFastUserSwitch, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnFastUserSwitch, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPDisconnectOnFastUserSwitch \ SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnFastUserSwitch \ ,"DisconnectOnFastUserSwitch" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnIdle, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnIdle, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPDisconnectOnIdle \ SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdle \ ,"DisconnectOnIdle" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnIdleTimer, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnIdleTimer, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPDisconnectOnIdleTimer \ SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdleTimer \ ,"DisconnectOnIdleTimer" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnLogout, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnLogout, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPDisconnectOnLogout \ SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnLogout \ ,"DisconnectOnLogout" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnSleep, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnSleep, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPDisconnectOnSleep \ SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnSleep \ ,"DisconnectOnSleep" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectTime, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPDisconnectTime \ SC_SCHEMA_KV(kSCPropNetPPPDisconnectTime \ ,"DisconnectTime" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPIdleReminderTimer, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPIdleReminderTimer, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPIdleReminderTimer \ SC_SCHEMA_KV(kSCPropNetPPPIdleReminderTimer \ ,"IdleReminderTimer" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPIdleReminder, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPIdleReminder, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPIdleReminder \ SC_SCHEMA_KV(kSCPropNetPPPIdleReminder \ ,"IdleReminder" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLastCause, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLastCause, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLastCause \ SC_SCHEMA_KV(kSCPropNetPPPLastCause \ ,"LastCause" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLogfile, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLogfile, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLogfile \ SC_SCHEMA_KV(kSCPropNetPPPLogfile \ ,"Logfile" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPPlugins, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPPlugins, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPPlugins \ SC_SCHEMA_KV(kSCPropNetPPPPlugins \ ,"Plugins" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPRetryConnectTime, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetPPPRetryConnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPRetryConnectTime \ SC_SCHEMA_KV(kSCPropNetPPPRetryConnectTime \ ,"RetryConnectTime" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPSessionTimer, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPSessionTimer, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPSessionTimer \ SC_SCHEMA_KV(kSCPropNetPPPSessionTimer \ ,"SessionTimer" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPStatus, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPStatus, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPStatus \ SC_SCHEMA_KV(kSCPropNetPPPStatus \ ,"Status" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPUseSessionTimer, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPUseSessionTimer, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPUseSessionTimer \ SC_SCHEMA_KV(kSCPropNetPPPUseSessionTimer \ ,"UseSessionTimer" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPVerboseLogging, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPVerboseLogging, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPVerboseLogging \ SC_SCHEMA_KV(kSCPropNetPPPVerboseLogging \ ,"VerboseLogging" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthEAPPlugins, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthEAPPlugins, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPAuthEAPPlugins \ SC_SCHEMA_KV(kSCPropNetPPPAuthEAPPlugins \ ,"AuthEAPPlugins" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPAuthName \ SC_SCHEMA_KV(kSCPropNetPPPAuthName \ ,"AuthName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPassword, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPassword, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPAuthPassword \ SC_SCHEMA_KV(kSCPropNetPPPAuthPassword \ ,"AuthPassword" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPasswordEncryption, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPasswordEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPAuthPasswordEncryption \ SC_SCHEMA_KV(kSCPropNetPPPAuthPasswordEncryption \ ,"AuthPasswordEncryption" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPrompt, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPrompt, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPAuthPrompt \ SC_SCHEMA_KV(kSCPropNetPPPAuthPrompt \ ,"AuthPrompt" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthProtocol, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthProtocol, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPAuthProtocol \ SC_SCHEMA_KV(kSCPropNetPPPAuthProtocol \ ,"AuthProtocol" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthPasswordEncryptionKeychain \ SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionKeychain \ ,"Keychain" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionToken, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionToken, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthPasswordEncryptionToken \ SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionToken \ ,"Token" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPromptBefore, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPromptBefore, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthPromptBefore \ SC_SCHEMA_KV(kSCValNetPPPAuthPromptBefore \ ,"Before" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPromptAfter, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPromptAfter, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthPromptAfter \ SC_SCHEMA_KV(kSCValNetPPPAuthPromptAfter \ ,"After" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolCHAP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolCHAP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthProtocolCHAP \ SC_SCHEMA_KV(kSCValNetPPPAuthProtocolCHAP \ ,"CHAP" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolEAP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolEAP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthProtocolEAP \ SC_SCHEMA_KV(kSCValNetPPPAuthProtocolEAP \ ,"EAP" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolMSCHAP1, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolMSCHAP1, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthProtocolMSCHAP1 \ SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP1 \ ,"MSCHAP1" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolMSCHAP2, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolMSCHAP2, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthProtocolMSCHAP2 \ SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP2 \ ,"MSCHAP2" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolPAP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolPAP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPAuthProtocolPAP \ SC_SCHEMA_KV(kSCValNetPPPAuthProtocolPAP \ ,"PAP" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommAlternateRemoteAddress, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommAlternateRemoteAddress, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommAlternateRemoteAddress \ SC_SCHEMA_KV(kSCPropNetPPPCommAlternateRemoteAddress \ ,"CommAlternateRemoteAddress" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommConnectDelay, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommConnectDelay, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommConnectDelay \ SC_SCHEMA_KV(kSCPropNetPPPCommConnectDelay \ ,"CommConnectDelay" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommDisplayTerminalWindow, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommDisplayTerminalWindow, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommDisplayTerminalWindow \ SC_SCHEMA_KV(kSCPropNetPPPCommDisplayTerminalWindow \ ,"CommDisplayTerminalWindow" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialCount, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialCount, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommRedialCount \ SC_SCHEMA_KV(kSCPropNetPPPCommRedialCount \ ,"CommRedialCount" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialEnabled, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommRedialEnabled \ SC_SCHEMA_KV(kSCPropNetPPPCommRedialEnabled \ ,"CommRedialEnabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialInterval, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialInterval, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommRedialInterval \ SC_SCHEMA_KV(kSCPropNetPPPCommRedialInterval \ ,"CommRedialInterval" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRemoteAddress, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRemoteAddress, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommRemoteAddress \ SC_SCHEMA_KV(kSCPropNetPPPCommRemoteAddress \ ,"CommRemoteAddress" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommTerminalScript, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommTerminalScript, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommTerminalScript \ SC_SCHEMA_KV(kSCPropNetPPPCommTerminalScript \ ,"CommTerminalScript" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCommUseTerminalScript, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCommUseTerminalScript, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCommUseTerminalScript \ SC_SCHEMA_KV(kSCPropNetPPPCommUseTerminalScript \ ,"CommUseTerminalScript" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPEnabled, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCCPEnabled \ SC_SCHEMA_KV(kSCPropNetPPPCCPEnabled \ ,"CCPEnabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPMPPE40Enabled, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPMPPE40Enabled, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCCPMPPE40Enabled \ SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE40Enabled \ ,"CCPMPPE40Enabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPMPPE128Enabled, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPMPPE128Enabled, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPCCPMPPE128Enabled \ SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE128Enabled \ ,"CCPMPPE128Enabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPIPCPCompressionVJ, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPIPCPCompressionVJ, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPIPCPCompressionVJ \ SC_SCHEMA_KV(kSCPropNetPPPIPCPCompressionVJ \ ,"IPCPCompressionVJ" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetPPPIPCPUsePeerDNS, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetPPPIPCPUsePeerDNS, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPIPCPUsePeerDNS \ SC_SCHEMA_KV(kSCPropNetPPPIPCPUsePeerDNS \ ,"IPCPUsePeerDNS" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoEnabled, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPEchoEnabled \ SC_SCHEMA_KV(kSCPropNetPPPLCPEchoEnabled \ ,"LCPEchoEnabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoFailure, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoFailure, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPEchoFailure \ SC_SCHEMA_KV(kSCPropNetPPPLCPEchoFailure \ ,"LCPEchoFailure" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoInterval, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoInterval, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPEchoInterval \ SC_SCHEMA_KV(kSCPropNetPPPLCPEchoInterval \ ,"LCPEchoInterval" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPCompressionACField, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPCompressionACField, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPCompressionACField \ SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionACField \ ,"LCPCompressionACField" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPCompressionPField, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPCompressionPField, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPCompressionPField \ SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionPField \ ,"LCPCompressionPField" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPMRU, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPMRU, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPMRU \ SC_SCHEMA_KV(kSCPropNetPPPLCPMRU \ ,"LCPMRU" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPMTU, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPMTU, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPMTU \ SC_SCHEMA_KV(kSCPropNetPPPLCPMTU \ ,"LCPMTU" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPReceiveACCM, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPReceiveACCM, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPReceiveACCM \ SC_SCHEMA_KV(kSCPropNetPPPLCPReceiveACCM \ ,"LCPReceiveACCM" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPTransmitACCM, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPTransmitACCM, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPLCPTransmitACCM \ SC_SCHEMA_KV(kSCPropNetPPPLCPTransmitACCM \ ,"LCPTransmitACCM" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetL2TPIPSecSharedSecret, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetL2TPIPSecSharedSecret, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetL2TPIPSecSharedSecret \ SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecret \ ,"IPSecSharedSecret" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetL2TPIPSecSharedSecretEncryption, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetL2TPIPSecSharedSecretEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetL2TPIPSecSharedSecretEncryption \ SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecretEncryption \ ,"IPSecSharedSecretEncryption" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetL2TPTransport, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCPropNetL2TPTransport, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetL2TPTransport \ SC_SCHEMA_KV(kSCPropNetL2TPTransport \ ,"Transport" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetL2TPIPSecSharedSecretEncryptionKeychain \ SC_SCHEMA_KV(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain \ ,"Keychain" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetL2TPTransportIP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetL2TPTransportIP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetL2TPTransportIP \ SC_SCHEMA_KV(kSCValNetL2TPTransportIP \ ,"IP" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCValNetL2TPTransportIPSec, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030) + SC_SCHEMA_DECLARATION(kSCValNetL2TPTransportIPSec, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetL2TPTransportIPSec \ SC_SCHEMA_KV(kSCValNetL2TPTransportIPSec \ ,"IPSec" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesExceptionsList, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesExceptionsList, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesExceptionsList \ SC_SCHEMA_KV(kSCPropNetProxiesExceptionsList \ ,"ExceptionsList" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesExcludeSimpleHostnames, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesExcludeSimpleHostnames, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesExcludeSimpleHostnames \ SC_SCHEMA_KV(kSCPropNetProxiesExcludeSimpleHostnames \ ,"ExcludeSimpleHostnames" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesFTPEnable \ SC_SCHEMA_KV(kSCPropNetProxiesFTPEnable \ ,"FTPEnable" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPPassive, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPPassive, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesFTPPassive \ SC_SCHEMA_KV(kSCPropNetProxiesFTPPassive \ ,"FTPPassive" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesFTPPort \ SC_SCHEMA_KV(kSCPropNetProxiesFTPPort \ ,"FTPPort" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesFTPProxy \ SC_SCHEMA_KV(kSCPropNetProxiesFTPProxy \ ,"FTPProxy" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesGopherEnable \ SC_SCHEMA_KV(kSCPropNetProxiesGopherEnable \ ,"GopherEnable" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesGopherPort \ SC_SCHEMA_KV(kSCPropNetProxiesGopherPort \ ,"GopherPort" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesGopherProxy \ SC_SCHEMA_KV(kSCPropNetProxiesGopherProxy \ ,"GopherProxy" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesHTTPEnable \ SC_SCHEMA_KV(kSCPropNetProxiesHTTPEnable \ ,"HTTPEnable" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesHTTPPort \ SC_SCHEMA_KV(kSCPropNetProxiesHTTPPort \ ,"HTTPPort" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesHTTPProxy \ SC_SCHEMA_KV(kSCPropNetProxiesHTTPProxy \ ,"HTTPProxy" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesHTTPSEnable \ SC_SCHEMA_KV(kSCPropNetProxiesHTTPSEnable \ ,"HTTPSEnable" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesHTTPSPort \ SC_SCHEMA_KV(kSCPropNetProxiesHTTPSPort \ ,"HTTPSPort" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesHTTPSProxy \ SC_SCHEMA_KV(kSCPropNetProxiesHTTPSProxy \ ,"HTTPSProxy" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesRTSPEnable \ SC_SCHEMA_KV(kSCPropNetProxiesRTSPEnable \ ,"RTSPEnable" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesRTSPPort \ SC_SCHEMA_KV(kSCPropNetProxiesRTSPPort \ ,"RTSPPort" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesRTSPProxy \ SC_SCHEMA_KV(kSCPropNetProxiesRTSPProxy \ ,"RTSPProxy" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesSOCKSEnable \ SC_SCHEMA_KV(kSCPropNetProxiesSOCKSEnable \ ,"SOCKSEnable" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesSOCKSPort \ SC_SCHEMA_KV(kSCPropNetProxiesSOCKSPort \ ,"SOCKSPort" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesSOCKSProxy \ SC_SCHEMA_KV(kSCPropNetProxiesSOCKSProxy \ ,"SOCKSProxy" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigEnable, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigEnable, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesProxyAutoConfigEnable \ SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigEnable \ ,"ProxyAutoConfigEnable" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigURLString, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigURLString, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesProxyAutoConfigURLString \ SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigURLString \ ,"ProxyAutoConfigURLString" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoDiscoveryEnable, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) + SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoDiscoveryEnable, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetProxiesProxyAutoDiscoveryEnable \ SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoDiscoveryEnable \ ,"ProxyAutoDiscoveryEnable" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSName, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetSMBNetBIOSName \ SC_SCHEMA_KV(kSCPropNetSMBNetBIOSName \ ,"NetBIOSName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSNodeType, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSNodeType, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetSMBNetBIOSNodeType \ SC_SCHEMA_KV(kSCPropNetSMBNetBIOSNodeType \ ,"NetBIOSNodeType" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSScope, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSScope, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetSMBNetBIOSScope \ SC_SCHEMA_KV(kSCPropNetSMBNetBIOSScope \ ,"NetBIOSScope" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetSMBWINSAddresses, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetSMBWINSAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetSMBWINSAddresses \ SC_SCHEMA_KV(kSCPropNetSMBWINSAddresses \ ,"WINSAddresses" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetSMBWorkgroup, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetSMBWorkgroup, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetSMBWorkgroup \ SC_SCHEMA_KV(kSCPropNetSMBWorkgroup \ ,"Workgroup" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeBroadcast, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeBroadcast, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetSMBNetBIOSNodeTypeBroadcast \ SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeBroadcast \ ,"Broadcast" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypePeer, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypePeer, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetSMBNetBIOSNodeTypePeer \ SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypePeer \ ,"Peer" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeMixed, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeMixed, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetSMBNetBIOSNodeTypeMixed \ SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeMixed \ ,"Mixed" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeHybrid, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeHybrid, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetSMBNetBIOSNodeTypeHybrid \ SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeHybrid \ ,"Hybrid" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCEntUsersConsoleUser, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#endif // !TARGET_OS_IPHONE + +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCEntUsersConsoleUser, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntUsersConsoleUser \ SC_SCHEMA_KV(kSCEntUsersConsoleUser \ ,"ConsoleUser" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropSystemComputerName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#endif // !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCPropSystemComputerName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropSystemComputerName \ SC_SCHEMA_KV(kSCPropSystemComputerName \ ,"ComputerName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameEncoding, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameEncoding, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropSystemComputerNameEncoding \ SC_SCHEMA_KV(kSCPropSystemComputerNameEncoding \ ,"ComputerNameEncoding" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainFile, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainFile, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStoreDomainFile \ SC_SCHEMA_KV(kSCDynamicStoreDomainFile \ ,"File:" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainPlugin, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainPlugin, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStoreDomainPlugin \ SC_SCHEMA_KV(kSCDynamicStoreDomainPlugin \ ,"Plugin:" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainSetup, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainSetup, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStoreDomainSetup \ SC_SCHEMA_KV(kSCDynamicStoreDomainSetup \ ,"Setup:" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainState, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainState, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStoreDomainState \ SC_SCHEMA_KV(kSCDynamicStoreDomainState \ ,"State:" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainPrefs, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainPrefs, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStoreDomainPrefs \ SC_SCHEMA_KV(kSCDynamicStoreDomainPrefs \ ,"Prefs:" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStorePropSetupCurrentSet, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStorePropSetupCurrentSet, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStorePropSetupCurrentSet \ SC_SCHEMA_KV(kSCDynamicStorePropSetupCurrentSet \ ,"CurrentSet" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStorePropSetupLastUpdated, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStorePropSetupLastUpdated, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStorePropSetupLastUpdated \ SC_SCHEMA_KV(kSCDynamicStorePropSetupLastUpdated \ ,"LastUpdated" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStorePropNetInterfaces \ SC_SCHEMA_KV(kSCDynamicStorePropNetInterfaces \ ,"Interfaces" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetPrimaryInterface, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetPrimaryInterface, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStorePropNetPrimaryInterface \ SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryInterface \ ,"PrimaryInterface" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetPrimaryService, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetPrimaryService, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStorePropNetPrimaryService \ SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryService \ ,"PrimaryService" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetServiceIDs, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetServiceIDs, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCDynamicStorePropNetServiceIDs \ SC_SCHEMA_KV(kSCDynamicStorePropNetServiceIDs \ ,"ServiceIDs" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserName, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropUsersConsoleUserName \ SC_SCHEMA_KV(kSCPropUsersConsoleUserName \ ,"Name" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserUID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserUID, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropUsersConsoleUserUID \ SC_SCHEMA_KV(kSCPropUsersConsoleUserUID \ ,"UID" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserGID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010) + SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserGID, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_NA,__IPHONE_NA)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) #define kSCPropUsersConsoleUserGID \ SC_SCHEMA_KV(kSCPropUsersConsoleUserGID \ ,"GID" \ ,CFNumber ) #endif -#endif /* _SCSCHEMADEFINITIONS_H */ +#endif // !TARGET_OS_IPHONE + +#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */ +#endif /* _SCSCHEMADEFINITIONS_H */ diff --git a/SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h b/SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h index 0f60ba3..6da9747 100644 --- a/SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h +++ b/SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -33,12 +33,30 @@ * * Network Entity Keys * + * kSCEntNetCommCenter "com.apple.CommCenter" CFDictionary * kSCEntNetEAPOL "EAPOL" CFDictionary + * kSCEntNetOnDemand "OnDemand" CFDictionary + * kSCEntNetService "__SERVICE__" CFDictionary * * kSCCompNetwork Properties * * kSCPropNetIgnoreLinkStatus "IgnoreLinkStatus" CFBoolean * + * kSCEntNetCommCenter Entity Keys + * + * kSCPropNetCommCenterAllowNetworkAccess "AllowNetworkAccess" CFNumber (0 or 1) + * kSCPropNetCommCenterAvailable "Available" CFNumber (0 or 1) + * + * kSCEntNetIPSec Entity Keys + * + * kSCPropNetIPSecLastCause "LastCause" CFNumber + * + * --- OnDemand: --- + * kSCPropNetIPSecOnDemandEnabled "OnDemandEnabled" CFNumber (0 or 1) + * kSCPropNetIPSecOnDemandMatchDomainsAlways "OnDemandMatchDomainsAlways" CFArray[CFString] + * kSCPropNetIPSecOnDemandMatchDomainsOnRetry "OnDemandMatchDomainsOnRetry" CFArray[CFString] + * kSCPropNetIPSecOnDemandMatchDomainsNever "OnDemandMatchDomainsNever" CFArray[CFString] + * * kSCEntNetIPv4 Entity Keys * * --- kSCPropNetIPv4ConfigMethod values --- @@ -63,6 +81,16 @@ * kSCValNetPPPOnDemandPriorityHigh "High" * kSCValNetPPPOnDemandPriorityLow "Low" * + * kSCEntNetService Entity Keys + * + * kSCPropNetServicePrimaryRank "PrimaryRank" CFString + * kSCPropNetServiceUserDefinedName "UserDefinedName" CFString + * + * --- kSCPropNetServicePrimaryRank values --- + * kSCValNetServicePrimaryRankFirst "First" + * kSCValNetServicePrimaryRankLast "Last" + * kSCValNetServicePrimaryRankNever "Never" + * * kSCCompSystem Properties * * kSCPropSystemComputerNameRegion "ComputerNameRegion" CFNumber @@ -109,12 +137,30 @@ extern const CFStringRef kSCPrefVirtualNetworkInterfaces; @group Network Entity Keys */ +/*! + @const kSCEntNetCommCenter + @availability Introduced in iPhone OS 2.0. + */ +extern const CFStringRef kSCEntNetCommCenter; + /*! @const kSCEntNetEAPOL @availability Introduced in Mac OS X 10.5. */ extern const CFStringRef kSCEntNetEAPOL; +/*! + @const kSCEntNetOnDemand + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCEntNetOnDemand; + +/*! + @const kSCEntNetService + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCEntNetService; + /*! @group kSCCompNetwork Properties */ @@ -125,6 +171,56 @@ extern const CFStringRef kSCEntNetEAPOL; */ extern const CFStringRef kSCPropNetIgnoreLinkStatus; +/*! + @group kSCEntNetCommCenter Entity Keys + */ + +/*! + @const kSCPropNetCommCenterAllowNetworkAccess + @availability Introduced in iPhone OS 2.0. + */ +extern const CFStringRef kSCPropNetCommCenterAllowNetworkAccess; + +/*! + @const kSCPropNetCommCenterAvailable + @availability Introduced in iPhone OS 2.0. + */ +extern const CFStringRef kSCPropNetCommCenterAvailable; + +/*! + @group kSCEntNetIPSec Entity Keys + */ + +/*! + @const kSCPropNetIPSecLastCause + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecLastCause; + +/*! + @const kSCPropNetIPSecOnDemandEnabled + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecOnDemandEnabled; + +/*! + @const kSCPropNetIPSecOnDemandMatchDomainsAlways + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsAlways; + +/*! + @const kSCPropNetIPSecOnDemandMatchDomainsOnRetry + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsOnRetry; + +/*! + @const kSCPropNetIPSecOnDemandMatchDomainsNever + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsNever; + /*! @group kSCEntNetIPv4 Entity Keys */ @@ -205,6 +301,40 @@ extern const CFStringRef kSCValNetPPPOnDemandPriorityHigh; */ extern const CFStringRef kSCValNetPPPOnDemandPriorityLow; +/*! + @group kSCEntNetService Entity Keys + */ + +/*! + @const kSCPropNetServicePrimaryRank + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetServicePrimaryRank; + +/*! + @const kSCPropNetServiceUserDefinedName + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCPropNetServiceUserDefinedName; + +/*! + @const kSCValNetServicePrimaryRankFirst + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCValNetServicePrimaryRankFirst; + +/*! + @const kSCValNetServicePrimaryRankLast + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCValNetServicePrimaryRankLast; + +/*! + @const kSCValNetServicePrimaryRankNever + @availability Introduced in Mac OS X 10.6. + */ +extern const CFStringRef kSCValNetServicePrimaryRankNever; + /*! @group kSCCompSystem Properties */ @@ -267,234 +397,290 @@ extern const CFStringRef kSCPropVirtualNetworkInterfacesVLANOptions; /* -------------------- Schema declarations -------------------- */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPrefVirtualNetworkInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPrefVirtualNetworkInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPrefVirtualNetworkInterfaces \ SC_SCHEMA_KV(kSCPrefVirtualNetworkInterfaces \ ,"VirtualNetworkInterfaces" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCEntNetEAPOL, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + + SC_SCHEMA_DECLARATION(kSCEntNetEAPOL, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCEntNetEAPOL \ SC_SCHEMA_KV(kSCEntNetEAPOL \ ,"EAPOL" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetIgnoreLinkStatus, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) + SC_SCHEMA_DECLARATION(kSCEntNetOnDemand, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/ + #define kSCEntNetOnDemand \ + SC_SCHEMA_KV(kSCEntNetOnDemand \ + ,"OnDemand" \ + ,CFDictionary ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + + SC_SCHEMA_DECLARATION(kSCEntNetService, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCEntNetService \ + SC_SCHEMA_KV(kSCEntNetService \ + ,"__SERVICE__" \ + ,CFDictionary ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetIgnoreLinkStatus, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetIgnoreLinkStatus \ SC_SCHEMA_KV(kSCPropNetIgnoreLinkStatus \ ,"IgnoreLinkStatus" \ ,CFBoolean ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodFailover, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecLastCause, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/ + #define kSCPropNetIPSecLastCause \ + SC_SCHEMA_KV(kSCPropNetIPSecLastCause \ + ,"LastCause" \ + ,CFNumber ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecOnDemandEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/ + #define kSCPropNetIPSecOnDemandEnabled \ + SC_SCHEMA_KV(kSCPropNetIPSecOnDemandEnabled \ + ,"OnDemandEnabled" \ + ,CFNumber (0 or 1) ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecOnDemandMatchDomainsAlways, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/ + #define kSCPropNetIPSecOnDemandMatchDomainsAlways \ + SC_SCHEMA_KV(kSCPropNetIPSecOnDemandMatchDomainsAlways \ + ,"OnDemandMatchDomainsAlways" \ + ,CFArray[CFString] ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecOnDemandMatchDomainsOnRetry, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/ + #define kSCPropNetIPSecOnDemandMatchDomainsOnRetry \ + SC_SCHEMA_KV(kSCPropNetIPSecOnDemandMatchDomainsOnRetry \ + ,"OnDemandMatchDomainsOnRetry" \ + ,CFArray[CFString] ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + + SC_SCHEMA_DECLARATION(kSCPropNetIPSecOnDemandMatchDomainsNever, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/ + #define kSCPropNetIPSecOnDemandMatchDomainsNever \ + SC_SCHEMA_KV(kSCPropNetIPSecOnDemandMatchDomainsNever \ + ,"OnDemandMatchDomainsNever" \ + ,CFArray[CFString] ) +#endif + + SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodFailover, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetIPv4ConfigMethodFailover \ SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodFailover \ ,"Failover" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandDomains, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandDomains, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPOnDemandDomains \ SC_SCHEMA_KV(kSCPropNetPPPOnDemandDomains \ ,"OnDemandDomains" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandEnabled, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPOnDemandEnabled \ SC_SCHEMA_KV(kSCPropNetPPPOnDemandEnabled \ ,"OnDemandEnabled" \ ,CFNumber (0 or 1) ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandHostName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandHostName, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPOnDemandHostName \ SC_SCHEMA_KV(kSCPropNetPPPOnDemandHostName \ ,"OnDemandHostName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandMode, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandMode, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPOnDemandMode \ SC_SCHEMA_KV(kSCPropNetPPPOnDemandMode \ ,"OnDemandMode" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandPriority, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandPriority, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropNetPPPOnDemandPriority \ SC_SCHEMA_KV(kSCPropNetPPPOnDemandPriority \ ,"OnDemandPriority" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeAggressive, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeAggressive, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPOnDemandModeAggressive \ SC_SCHEMA_KV(kSCValNetPPPOnDemandModeAggressive \ ,"Aggressive" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeConservative, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeConservative, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPOnDemandModeConservative \ SC_SCHEMA_KV(kSCValNetPPPOnDemandModeConservative \ ,"Conservative" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeCompatible, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeCompatible, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPOnDemandModeCompatible \ SC_SCHEMA_KV(kSCValNetPPPOnDemandModeCompatible \ ,"Compatible" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityDefault, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityDefault, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPOnDemandPriorityDefault \ SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityDefault \ ,"Default" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityHigh, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityHigh, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPOnDemandPriorityHigh \ SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityHigh \ ,"High" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityLow, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityLow, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCValNetPPPOnDemandPriorityLow \ SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityLow \ ,"Low" \ , ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameRegion, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) + SC_SCHEMA_DECLARATION(kSCPropNetServicePrimaryRank, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetServicePrimaryRank \ + SC_SCHEMA_KV(kSCPropNetServicePrimaryRank \ + ,"PrimaryRank" \ + ,CFString ) +#endif + + SC_SCHEMA_DECLARATION(kSCPropNetServiceUserDefinedName, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCPropNetServiceUserDefinedName \ + SC_SCHEMA_KV(kSCPropNetServiceUserDefinedName \ + ,"UserDefinedName" \ + ,CFString ) +#endif + + SC_SCHEMA_DECLARATION(kSCValNetServicePrimaryRankFirst, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCValNetServicePrimaryRankFirst \ + SC_SCHEMA_KV(kSCValNetServicePrimaryRankFirst \ + ,"First" \ + , ) +#endif + + SC_SCHEMA_DECLARATION(kSCValNetServicePrimaryRankLast, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCValNetServicePrimaryRankLast \ + SC_SCHEMA_KV(kSCValNetServicePrimaryRankLast \ + ,"Last" \ + , ) +#endif + + SC_SCHEMA_DECLARATION(kSCValNetServicePrimaryRankNever, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ + #define kSCValNetServicePrimaryRankNever \ + SC_SCHEMA_KV(kSCValNetServicePrimaryRankNever \ + ,"Never" \ + , ) #endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + + SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameRegion, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropSystemComputerNameRegion \ SC_SCHEMA_KV(kSCPropSystemComputerNameRegion \ ,"ComputerNameRegion" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropSystemHostName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropSystemHostName, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropSystemHostName \ SC_SCHEMA_KV(kSCPropSystemHostName \ ,"HostName" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) +#if !TARGET_OS_IPHONE + + SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropVirtualNetworkInterfacesBondInterfaces \ SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondInterfaces \ ,"Interfaces" \ ,CFArray[CFString] ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondMode, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondMode, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropVirtualNetworkInterfacesBondMode \ SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondMode \ ,"Mode" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondOptions, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondOptions, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropVirtualNetworkInterfacesBondOptions \ SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondOptions \ ,"Options" \ ,CFDictionary ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANInterface, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANInterface, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropVirtualNetworkInterfacesVLANInterface \ SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANInterface \ ,"Interface" \ ,CFString ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANTag, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANTag, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropVirtualNetworkInterfacesVLANTag \ SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANTag \ ,"Tag" \ ,CFNumber ) #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANOptions, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER) -#endif -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) + SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANOptions, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/)) +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/ #define kSCPropVirtualNetworkInterfacesVLANOptions \ SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANOptions \ ,"Options" \ ,CFDictionary ) #endif +#endif // !TARGET_OS_IPHONE + #endif /* _SCSCHEMADEFINITIONSPRIVATE_H */ diff --git a/SystemConfiguration.fproj/SystemConfiguration.h b/SystemConfiguration.fproj/SystemConfiguration.h index 74cbf3b..044107f 100644 --- a/SystemConfiguration.fproj/SystemConfiguration.h +++ b/SystemConfiguration.fproj/SystemConfiguration.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,6 +24,7 @@ #ifndef _SYSTEMCONFIGURATION_H #define _SYSTEMCONFIGURATION_H +#include #include #include @@ -66,6 +67,7 @@ @constant kSCStatusReachabilityUnknown A determination could not be made regarding the reachability of the specified nodename or address. + @constant kSCStatusConnectionNoService Network service for connection not available */ enum { /* @@ -100,7 +102,13 @@ enum { /* * SCNetwork error codes */ - kSCStatusReachabilityUnknown = 4001 /* Network reachability cannot be determined */ + kSCStatusReachabilityUnknown = 4001, /* Network reachability cannot be determined */ + /* + * SCNetworkConnection error codes + */ +#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000) + kSCStatusConnectionNoService = 5001 /* Network service for connection not available */ +#endif }; @@ -130,7 +138,7 @@ enum { @discussion CFError domain associated with errors reported by the SystemConfiguration.framework. */ -extern const CFStringRef kCFErrorDomainSystemConfiguration AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; +extern const CFStringRef kCFErrorDomainSystemConfiguration __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); __BEGIN_DECLS @@ -140,7 +148,7 @@ __BEGIN_DECLS as the result of calling a System Configuration framework API. @result Returns the last error encountered. */ -CFErrorRef SCCopyLastError (void); +CFErrorRef SCCopyLastError (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); /*! @function SCError @@ -148,7 +156,7 @@ CFErrorRef SCCopyLastError (void); as the result of calling a System Configuration framework API. @result Returns the last error encountered. */ -int SCError (void); +int SCError (void) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0); /*! @function SCErrorString @@ -157,7 +165,7 @@ int SCError (void); @param status The SCDynamicStoreStatus to be returned. @result Returns a pointer to the error message string. */ -const char * SCErrorString (int status); +const char * SCErrorString (int status) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0); __END_DECLS diff --git a/SystemConfiguration.fproj/VLANConfiguration.c b/SystemConfiguration.fproj/VLANConfiguration.c index 5644589..ed8bd36 100644 --- a/SystemConfiguration.fproj/VLANConfiguration.c +++ b/SystemConfiguration.fproj/VLANConfiguration.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2007 Apple Inc. All rights reserved. + * Copyright (c) 2003-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -54,8 +54,6 @@ #include #include -#include - /* ---------- VLAN support ---------- */ static int @@ -747,15 +745,22 @@ SCVLANInterfaceSetPhysicalInterfaceAndTag(SCVLANInterfaceRef vlan, SCNetworkInte } if (ok) { + SCNetworkInterfacePrivateRef newInterface; + CFTypeRef save; + // set physical interface - if (interfacePrivate->vlan.interface != NULL) - CFRelease(interfacePrivate->vlan.interface); - interfacePrivate->vlan.interface = CFRetain(physical); + newInterface = __SCNetworkInterfaceCreateCopy(NULL, + physical, + interfacePrivate->prefs, + interfacePrivate->serviceID); + save = interfacePrivate->vlan.interface; + interfacePrivate->vlan.interface = (SCNetworkInterfaceRef)newInterface; + if (save != NULL) CFRelease(save); // set tag - if (interfacePrivate->vlan.tag != NULL) - CFRelease(interfacePrivate->vlan.tag); + save = interfacePrivate->vlan.tag; interfacePrivate->vlan.tag = CFRetain(tag); + if (save != NULL) CFRelease(save); } return ok; @@ -1136,1153 +1141,3 @@ _SCVLANInterfaceUpdateConfiguration(SCPreferencesRef prefs) return ok; } - - -#pragma mark - -#pragma mark Deprecated SPIs (remove when no longer referenced) - - -/* ---------- VLAN "device" ---------- */ - -Boolean -IsVLANSupported(CFStringRef device) -{ - return __SCNetworkInterfaceSupportsVLAN(device); -} - -/* ---------- VLANInterface ---------- */ - -typedef struct { - - /* base CFType information */ - CFRuntimeBase cfBase; - - /* vlan interface configuration */ - CFStringRef ifname; // e.g. vlan0, vlan1, ... - CFStringRef device; // e.g. en0, en1, ... - CFNumberRef tag; // e.g. 1 <= tag <= 4094 - CFDictionaryRef options; // e.g. UserDefinedName - -} VLANInterfacePrivate, * VLANInterfacePrivateRef; - - -static CFStringRef __VLANInterfaceCopyDescription (CFTypeRef cf); -static void __VLANInterfaceDeallocate (CFTypeRef cf); -static Boolean __VLANInterfaceEqual (CFTypeRef cf1, CFTypeRef cf2); - - -static const CFRuntimeClass __VLANInterfaceClass = { - 0, // version - "VLANInterface", // className - NULL, // init - NULL, // copy - __VLANInterfaceDeallocate, // dealloc - __VLANInterfaceEqual, // equal - NULL, // hash - NULL, // copyFormattingDesc - __VLANInterfaceCopyDescription // copyDebugDesc -}; - - -static CFTypeID __kVLANInterfaceTypeID = _kCFRuntimeNotATypeID; - - -static pthread_once_t vlanInterface_init = PTHREAD_ONCE_INIT; - - -static CFStringRef -__VLANInterfaceCopyDescription(CFTypeRef cf) -{ - CFAllocatorRef allocator = CFGetAllocator(cf); - CFMutableStringRef result; - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)cf; - - result = CFStringCreateMutable(allocator, 0); - CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); - CFStringAppendFormat(result, NULL, CFSTR("if = %@"), vlanPrivate->ifname); - CFStringAppendFormat(result, NULL, CFSTR(", device = %@"), vlanPrivate->device); - CFStringAppendFormat(result, NULL, CFSTR(", tag = %@"), vlanPrivate->tag); - if (vlanPrivate->options != NULL) { - CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), vlanPrivate->options); - } - CFStringAppendFormat(result, NULL, CFSTR("}")); - - return result; -} - - -static void -__VLANInterfaceDeallocate(CFTypeRef cf) -{ - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)cf; - - /* release resources */ - - CFRelease(vlanPrivate->ifname); - CFRelease(vlanPrivate->device); - CFRelease(vlanPrivate->tag); - if (vlanPrivate->options) CFRelease(vlanPrivate->options); - - return; -} - - -static Boolean -__VLANInterfaceEquiv(CFTypeRef cf1, CFTypeRef cf2) -{ - VLANInterfacePrivateRef vlan1 = (VLANInterfacePrivateRef)cf1; - VLANInterfacePrivateRef vlan2 = (VLANInterfacePrivateRef)cf2; - - if (vlan1 == vlan2) - return TRUE; - - if (!CFEqual(vlan1->ifname, vlan2->ifname)) - return FALSE; // if not the same interface - - if (!CFEqual(vlan1->device, vlan2->device)) - return FALSE; // if not the same device - - if (!CFEqual(vlan1->tag, vlan2->tag)) - return FALSE; // if not the same tag - - return TRUE; -} - - -static Boolean -__VLANInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2) -{ - VLANInterfacePrivateRef vlan1 = (VLANInterfacePrivateRef)cf1; - VLANInterfacePrivateRef vlan2 = (VLANInterfacePrivateRef)cf2; - - if (!__VLANInterfaceEquiv(vlan1, vlan2)) - return FALSE; // if not the same VLAN interface/device/tag - - if (vlan1->options != vlan2->options) { - // if the options may differ - if ((vlan1->options != NULL) && (vlan2->options != NULL)) { - // if both VLANs have options - if (!CFEqual(vlan1->options, vlan2->options)) { - // if the options are not equal - return FALSE; - } - } else { - // if only one VLAN has options - return FALSE; - } - } - - return TRUE; -} - - -static void -__VLANInterfaceInitialize(void) -{ - __kVLANInterfaceTypeID = _CFRuntimeRegisterClass(&__VLANInterfaceClass); - return; -} - - -static __inline__ CFTypeRef -isA_VLANInterface(CFTypeRef obj) -{ - return (isA_CFType(obj, VLANInterfaceGetTypeID())); -} - - -CFTypeID -VLANInterfaceGetTypeID(void) -{ - pthread_once(&vlanInterface_init, __VLANInterfaceInitialize); /* initialize runtime */ - return __kVLANInterfaceTypeID; -} - - -static VLANInterfaceRef -__VLANInterfaceCreatePrivate(CFAllocatorRef allocator, - CFStringRef ifname, - CFStringRef device, - CFNumberRef tag, - CFDictionaryRef options) -{ - VLANInterfacePrivateRef vlanPrivate; - uint32_t size; - - /* initialize runtime */ - pthread_once(&vlanInterface_init, __VLANInterfaceInitialize); - - /* allocate vlan */ - size = sizeof(VLANInterfacePrivate) - sizeof(CFRuntimeBase); - vlanPrivate = (VLANInterfacePrivateRef)_CFRuntimeCreateInstance(allocator, - __kVLANInterfaceTypeID, - size, - NULL); - if (!vlanPrivate) { - return NULL; - } - - /* establish the vlan */ - - vlanPrivate->ifname = CFStringCreateCopy(allocator, ifname); - vlanPrivate->device = CFStringCreateCopy(allocator, device); - vlanPrivate->tag = CFRetain(tag); - if (options != NULL) { - vlanPrivate->options = CFDictionaryCreateCopy(allocator, options); - } else { - vlanPrivate->options = NULL; - } - - return (VLANInterfaceRef)vlanPrivate; -} - - -CFStringRef -VLANInterfaceGetInterface(VLANInterfaceRef vlan) -{ - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; - CFStringRef vlan_if = NULL; - - if (isA_VLANInterface(vlan)) { - vlan_if = vlanPrivate->ifname; - } - - return vlan_if; -} - - -CFStringRef -VLANInterfaceGetDevice(VLANInterfaceRef vlan) -{ - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; - CFStringRef vlan_device = NULL; - - if (isA_VLANInterface(vlan)) { - vlan_device = vlanPrivate->device; - } - - return vlan_device; -} - - -static void -VLANInterfaceSetDevice(VLANInterfaceRef vlan, CFStringRef newDevice) -{ - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; - - if (isA_VLANInterface(vlan)) { - CFAllocatorRef allocator = CFGetAllocator(vlan); - - CFRelease(vlanPrivate->device); - vlanPrivate->device = CFStringCreateCopy(allocator, newDevice); - } - - return; -} - - -CFNumberRef -VLANInterfaceGetTag(VLANInterfaceRef vlan) -{ - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; - CFNumberRef vlan_tag = NULL; - - if (isA_VLANInterface(vlan)) { - vlan_tag = vlanPrivate->tag; - } - - return vlan_tag; -} - - -static void -VLANInterfaceSetTag(VLANInterfaceRef vlan, CFNumberRef newTag) -{ - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; - - if (isA_VLANInterface(vlan)) { - CFRelease(vlanPrivate->tag); - vlanPrivate->tag = CFRetain(newTag); - } - - return; -} - - -CFDictionaryRef -VLANInterfaceGetOptions(VLANInterfaceRef vlan) -{ - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; - CFDictionaryRef vlan_options = NULL; - - if (isA_VLANInterface(vlan)) { - vlan_options = vlanPrivate->options; - } - - return vlan_options; -} - - -static void -VLANInterfaceSetOptions(VLANInterfaceRef vlan, CFDictionaryRef newOptions) -{ - VLANInterfacePrivateRef vlanPrivate = (VLANInterfacePrivateRef)vlan; - - if (isA_VLANInterface(vlan)) { - CFAllocatorRef allocator = CFGetAllocator(vlan); - - if (vlanPrivate->options) CFRelease(vlanPrivate->options); - if (newOptions != NULL) { - vlanPrivate->options = CFDictionaryCreateCopy(allocator, newOptions); - } else { - vlanPrivate->options = NULL; - } - } - - return; -} - - -/* ---------- VLANPreferences ---------- */ - -typedef struct { - - /* base CFType information */ - CFRuntimeBase cfBase; - - /* lock */ - pthread_mutex_t lock; - - /* underlying preferences */ - SCPreferencesRef prefs; - - /* base VLANs (before any commits) */ - CFArrayRef vlBase; - -} VLANPreferencesPrivate, * VLANPreferencesPrivateRef; - - -static CFStringRef __VLANPreferencesCopyDescription (CFTypeRef cf); -static void __VLANPreferencesDeallocate (CFTypeRef cf); - - -static const CFRuntimeClass __VLANPreferencesClass = { - 0, // version - "VLANPreferences", // className - NULL, // init - NULL, // copy - __VLANPreferencesDeallocate, // dealloc - NULL, // equal - NULL, // hash - NULL, // copyFormattingDesc - __VLANPreferencesCopyDescription // copyDebugDesc -}; - - -static CFTypeID __kVLANPreferencesTypeID = _kCFRuntimeNotATypeID; - - -static pthread_once_t vlanPreferences_init = PTHREAD_ONCE_INIT; - - -static CFStringRef -__VLANPreferencesCopyDescription(CFTypeRef cf) -{ - CFAllocatorRef allocator = CFGetAllocator(cf); - CFIndex i; - CFArrayRef keys; - CFIndex n; - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)cf; - CFMutableStringRef result; - - result = CFStringCreateMutable(allocator, 0); - CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); - - keys = SCPreferencesCopyKeyList(prefsPrivate->prefs); - n = CFArrayGetCount(keys); - for (i = 0; i < n; i++) { - CFStringRef key; - CFPropertyListRef val; - - key = CFArrayGetValueAtIndex(keys, i); - val = SCPreferencesGetValue(prefsPrivate->prefs, key); - - CFStringAppendFormat(result, NULL, CFSTR("%@ : %@"), key, val); - } - CFRelease(keys); - - CFStringAppendFormat(result, NULL, CFSTR(" }")); - - return result; -} - - -#define N_QUICK 8 - - -static void -__VLANPreferencesDeallocate(CFTypeRef cf) -{ - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)cf; - - /* release resources */ - - pthread_mutex_destroy(&prefsPrivate->lock); - - if (prefsPrivate->prefs) CFRelease(prefsPrivate->prefs); - if (prefsPrivate->vlBase) CFRelease(prefsPrivate->vlBase); - - return; -} - - -static void -__VLANPreferencesInitialize(void) -{ - __kVLANPreferencesTypeID = _CFRuntimeRegisterClass(&__VLANPreferencesClass); - return; -} - - -static __inline__ CFTypeRef -isA_VLANPreferences(CFTypeRef obj) -{ - return (isA_CFType(obj, VLANPreferencesGetTypeID())); -} - - -CFArrayRef -_VLANPreferencesCopyActiveInterfaces() -{ - CFArrayCallBacks callbacks; - struct ifaddrs *ifap; - struct ifaddrs *ifp; - int s; - CFMutableArrayRef vlans = NULL; - - if (getifaddrs(&ifap) == -1) { - SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno)); - _SCErrorSet(kSCStatusFailed); - return NULL; - } - - s = inet_dgram_socket(); - if (s == -1) { - _SCErrorSet(errno); - goto done; - } - - callbacks = kCFTypeArrayCallBacks; - callbacks.equal = __VLANInterfaceEquiv; - vlans = CFArrayCreateMutable(NULL, 0, &callbacks); - - for (ifp = ifap; ifp != NULL; ifp = ifp->ifa_next) { - switch (ifp->ifa_addr->sa_family) { - case AF_LINK : { - CFStringRef device; - struct if_data *if_data; - struct ifreq ifr; - CFNumberRef tag; - VLANInterfaceRef vlan; - CFStringRef vlan_if; - char vlr_parent[IFNAMSIZ + 1]; - int vlr_tag; - struct vlanreq vreq; - - if_data = (struct if_data *)ifp->ifa_data; - if (if_data == NULL) { - break; // if no interface data - } - - if (if_data->ifi_type != IFT_L2VLAN) { - break; // if not VLAN - } - - bzero(&ifr, sizeof(ifr)); - bzero(&vreq, sizeof(vreq)); - strncpy(ifr.ifr_name, ifp->ifa_name, sizeof(ifr.ifr_name)); - ifr.ifr_data = (caddr_t)&vreq; - - if (ioctl(s, SIOCGIFVLAN, (caddr_t)&ifr) == -1) { - SCLog(TRUE, LOG_ERR, CFSTR("ioctl() failed: %s"), strerror(errno)); - CFRelease(vlans); - vlans = NULL; - _SCErrorSet(kSCStatusFailed); - goto done; - } - vlr_tag = vreq.vlr_tag; - bzero(&vlr_parent, sizeof(vlr_parent)); - bcopy(vreq.vlr_parent, vlr_parent, IFNAMSIZ); - - vlan_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII); - device = CFStringCreateWithCString(NULL, vlr_parent, kCFStringEncodingASCII); - tag = CFNumberCreate(NULL, kCFNumberIntType, &vlr_tag); - vlan = __VLANInterfaceCreatePrivate(NULL, vlan_if, device, tag, NULL); - CFArrayAppendValue(vlans, vlan); - CFRelease(vlan_if); - CFRelease(device); - CFRelease(tag); - CFRelease(vlan); - break; - } - - default : - break; - } - } - - done : - - (void) close(s); - freeifaddrs(ifap); - return vlans; -} - - -static CFIndex -findVLAN(CFArrayRef vlans, CFStringRef device, CFNumberRef tag) -{ - CFIndex found = kCFNotFound; - CFIndex i; - CFIndex n; - - n = isA_CFArray(vlans) ? CFArrayGetCount(vlans) : 0; - for (i = 0; i < n; i++) { - CFDictionaryRef vlan_dict; - CFStringRef vlan_device; - CFStringRef vlan_if; - CFNumberRef vlan_tag; - - vlan_dict = CFArrayGetValueAtIndex(vlans, i); - if (!isA_CFDictionary(vlan_dict)) { - continue; // if the prefs are confused - } - - vlan_if = CFDictionaryGetValue(vlan_dict, __kVLANInterface_interface); - if (!isA_CFString(vlan_if)) { - continue; // if the prefs are confused - } - - vlan_device = CFDictionaryGetValue(vlan_dict, __kVLANInterface_device); - if (isA_CFString(vlan_device)) { - if (!CFEqual(device, vlan_device)) { - continue; // if not a match - } - } - - vlan_tag = CFDictionaryGetValue(vlan_dict, __kVLANInterface_tag); - if (isA_CFNumber(vlan_tag)) { - if (!CFEqual(tag, vlan_tag)) { - continue; // if not a match - } - } - - // if we have found a match - found = i; - break; - } - - return found; -} - - -static void -setConfigurationChanged(VLANPreferencesRef prefs) -{ - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; - - /* - * to facilitate device configuration we will take - * a snapshot of the VLAN preferences before any - * changes are made. Then, when the changes are - * applied we can compare what we had to what we - * want and configured the system accordingly. - */ - if (prefsPrivate->vlBase == NULL) { - prefsPrivate->vlBase = VLANPreferencesCopyInterfaces(prefs); - } - - return; -} - - -CFTypeID -VLANPreferencesGetTypeID(void) -{ - pthread_once(&vlanPreferences_init, __VLANPreferencesInitialize); /* initialize runtime */ - return __kVLANPreferencesTypeID; -} - - -VLANPreferencesRef -VLANPreferencesCreate(CFAllocatorRef allocator) -{ - CFBundleRef bundle; - CFStringRef bundleID = NULL; - CFStringRef name = CFSTR("VLANConfiguration"); - VLANPreferencesPrivateRef prefsPrivate; - uint32_t size; - - /* initialize runtime */ - pthread_once(&vlanPreferences_init, __VLANPreferencesInitialize); - - /* allocate preferences */ - size = sizeof(VLANPreferencesPrivate) - sizeof(CFRuntimeBase); - prefsPrivate = (VLANPreferencesPrivateRef)_CFRuntimeCreateInstance(allocator, - __kVLANPreferencesTypeID, - size, - NULL); - if (prefsPrivate == NULL) { - return NULL; - } - - /* establish the prefs */ - - pthread_mutex_init(&prefsPrivate->lock, NULL); - - bundle = CFBundleGetMainBundle(); - if (bundle) { - bundleID = CFBundleGetIdentifier(bundle); - if (bundleID) { - CFRetain(bundleID); - } else { - CFURLRef url; - - url = CFBundleCopyExecutableURL(bundle); - if (url) { - bundleID = CFURLCopyPath(url); - CFRelease(url); - } - } - } - - if (bundleID) { - CFStringRef fullName; - - if (CFEqual(bundleID, CFSTR("/"))) { - CFRelease(bundleID); - bundleID = CFStringCreateWithFormat(allocator, NULL, CFSTR("(%d)"), getpid()); - } - - fullName = CFStringCreateWithFormat(allocator, NULL, CFSTR("%@:%@"), bundleID, name); - name = fullName; - CFRelease(bundleID); - } else { - CFRetain(name); - } - - prefsPrivate->prefs = SCPreferencesCreate(allocator, name, VLAN_PREFERENCES_ID); - CFRelease(name); - - prefsPrivate->vlBase = NULL; - - return (VLANPreferencesRef)prefsPrivate; -} - - -CFArrayRef -VLANPreferencesCopyInterfaces(VLANPreferencesRef prefs) -{ - CFAllocatorRef allocator; - CFArrayCallBacks callbacks; - CFIndex i; - CFIndex n; - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; - CFMutableArrayRef result; - CFArrayRef vlans; - - if (!isA_VLANPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return NULL; - } - - allocator = CFGetAllocator(prefs); - callbacks = kCFTypeArrayCallBacks; - callbacks.equal = __VLANInterfaceEquiv; - result = CFArrayCreateMutable(allocator, 0, &callbacks); - - vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS); - n = isA_CFArray(vlans) ? CFArrayGetCount(vlans) : 0; - for (i = 0; i < n; i++) { - CFDictionaryRef vlan_dict; - CFStringRef device; - CFDictionaryRef options; - CFNumberRef tag; - VLANInterfaceRef vlan; - CFStringRef vlan_if; - - vlan_dict = CFArrayGetValueAtIndex(vlans, i); - if (!isA_CFDictionary(vlan_dict)) { - continue; // if the prefs are confused - } - - vlan_if = CFDictionaryGetValue(vlan_dict, __kVLANInterface_interface); - if (!isA_CFString(vlan_if)) { - continue; // if the prefs are confused - } - - - device = CFDictionaryGetValue(vlan_dict, __kVLANInterface_device); - if (!isA_CFString(device)) { - continue; // if the prefs are confused - } - - tag = CFDictionaryGetValue(vlan_dict, __kVLANInterface_tag); - if (!isA_CFNumber(tag)) { - continue; // if the prefs are confused - } - - options = CFDictionaryGetValue(vlan_dict, __kVLANInterface_options); - if ((options != NULL) && !isA_CFDictionary(options)) { - continue; // if the prefs are confused - } - - vlan = __VLANInterfaceCreatePrivate(allocator, vlan_if, device, tag, options); - CFArrayAppendValue(result, vlan); - CFRelease(vlan); - } - - return result; -} - - -VLANInterfaceRef -VLANPreferencesAddInterface(VLANPreferencesRef prefs, - CFStringRef device, - CFNumberRef tag, - CFDictionaryRef options) -{ - CFArrayRef active_vlans; - CFAllocatorRef allocator; - CFArrayRef config_vlans; - CFIndex dup_if; - CFIndex i; - CFIndex nActive; - CFIndex nConfig; - VLANInterfaceRef newVlan = NULL; - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; - - if (!isA_VLANPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return NULL; - } - - if (!isA_CFString(device)) { - _SCErrorSet(kSCStatusInvalidArgument); - return NULL; - } - - if (isA_CFNumber(tag)) { - int tag_val; - - CFNumberGetValue(tag, kCFNumberIntType, &tag_val); - if ((tag_val < 1) || (tag_val > 4094)) { - _SCErrorSet(kSCStatusInvalidArgument); - return NULL; - } - } else { - _SCErrorSet(kSCStatusInvalidArgument); - return NULL; - } - - if ((options != NULL) && !isA_CFDictionary(options)) { - _SCErrorSet(kSCStatusInvalidArgument); - return NULL; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - /* get "configured" VLANs (and check to ensure we are not creating a duplicate) */ - config_vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS); - nConfig = isA_CFArray(config_vlans) ? CFArrayGetCount(config_vlans) : 0; - - dup_if = findVLAN(config_vlans, device, tag); - if (dup_if != kCFNotFound) { - // sorry, you can't add a vlan using the same device/tag */ - _SCErrorSet(kSCStatusKeyExists); - goto done; - } - - /* get "active" VLANs */ - active_vlans = _VLANPreferencesCopyActiveInterfaces(); - nActive = isA_CFArray(active_vlans) ? CFArrayGetCount(active_vlans) : 0; - - /* create a new vlan using an unused interface name */ - allocator = CFGetAllocator(prefs); - - for (i = 0; newVlan == NULL; i++) { - CFIndex j; - CFMutableDictionaryRef newDict; - CFMutableArrayRef newVlans; - CFStringRef vlan_if; - - vlan_if = CFStringCreateWithFormat(allocator, NULL, CFSTR("vlan%d"), i); - - for (j = 0; j < nActive; j++) { - CFStringRef active_if; - VLANInterfaceRef active_vlan; - - active_vlan = CFArrayGetValueAtIndex(active_vlans, j); - active_if = VLANInterfaceGetInterface(active_vlan); - - if (CFEqual(vlan_if, active_if)) { - goto next_if; // if VLAN interface name not available - } - } - - for (j = 0; j < nConfig; j++) { - CFDictionaryRef config; - CFStringRef config_if; - - config = CFArrayGetValueAtIndex(config_vlans, j); - if (!isA_CFDictionary(config)) { - continue; // if the prefs are confused - } - - config_if = CFDictionaryGetValue(config, __kVLANInterface_interface); - if (!isA_CFString(config_if)) { - continue; // if the prefs are confused - } - - if (CFEqual(vlan_if, config_if)) { - goto next_if; // if VLAN interface name not available - } - } - - /* create the vlan */ - - newDict = CFDictionaryCreateMutable(allocator, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - CFDictionaryAddValue(newDict, __kVLANInterface_interface, vlan_if); - CFDictionaryAddValue(newDict, __kVLANInterface_device, device); - CFDictionaryAddValue(newDict, __kVLANInterface_tag, tag); - if (options != NULL) { - CFDictionaryAddValue(newDict, __kVLANInterface_options, options); - } - - /* create the accessor handle to be returned */ - - newVlan = __VLANInterfaceCreatePrivate(allocator, vlan_if, device, tag, options); - - /* yes, we're going to be changing the configuration */ - setConfigurationChanged(prefs); - - /* save in the prefs */ - - if (nConfig == 0) { - newVlans = CFArrayCreateMutable(allocator, 0, &kCFTypeArrayCallBacks); - } else { - newVlans = CFArrayCreateMutableCopy(allocator, 0, config_vlans); - } - CFArrayAppendValue(newVlans, newDict); - CFRelease(newDict); - - (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans); - CFRelease(newVlans); - - next_if : - CFRelease(vlan_if); - } - - CFRelease(active_vlans); - - done : - - pthread_mutex_unlock(&prefsPrivate->lock); - - return (VLANInterfaceRef) newVlan; -} - - -Boolean -VLANPreferencesUpdateInterface(VLANPreferencesRef prefs, - VLANInterfaceRef vlan, - CFStringRef newDevice, - CFNumberRef newTag, - CFDictionaryRef newOptions) -{ - CFAllocatorRef allocator; - CFIndex cur_if; - CFIndex dup_if; - CFMutableDictionaryRef newDict; - CFMutableArrayRef newVlans; - Boolean ok = FALSE; - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; - CFArrayRef vlans; - CFStringRef vlan_if; - - if (!isA_VLANPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!isA_VLANInterface(vlan)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if ((newDevice != NULL) && !isA_CFString(newDevice)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (newTag != NULL) { - if (isA_CFNumber(newTag)) { - int tag_val; - - CFNumberGetValue(newTag, kCFNumberIntType, &tag_val); - if ((tag_val < 1) || (tag_val > 4094)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - } else { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - } - - if ((newOptions != NULL) - && !isA_CFDictionary(newOptions) && (newOptions != (CFDictionaryRef)kCFNull)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - vlan_if = VLANInterfaceGetInterface(vlan); - - vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS); - if (!isA_CFArray(vlans)) { - goto done; // if the prefs are confused - } - - cur_if = findVLAN(vlans, - VLANInterfaceGetDevice(vlan), - VLANInterfaceGetTag (vlan)); - if (cur_if == kCFNotFound) { - _SCErrorSet(kSCStatusNoKey); - goto done; - } - - dup_if = findVLAN(vlans, - newDevice != NULL ? newDevice : VLANInterfaceGetDevice(vlan), - newTag != NULL ? newTag : VLANInterfaceGetTag (vlan)); - if (dup_if != kCFNotFound) { - // if the same device/tag has already been defined - if (cur_if != dup_if) { - /* - * sorry, you can't update another vlan that is using - * the same device/tag - */ - _SCErrorSet(kSCStatusKeyExists); - goto done; - } - } - - /* update the vlan */ - - if (newDevice != NULL) { - VLANInterfaceSetDevice(vlan, newDevice); - } else { - newDevice = VLANInterfaceGetDevice(vlan); - } - - if (newTag != NULL) { - VLANInterfaceSetTag(vlan, newTag); - } else { - newTag = VLANInterfaceGetTag(vlan); - } - - if (newOptions != NULL) { - if (newOptions != (CFDictionaryRef)kCFNull) { - VLANInterfaceSetOptions(vlan, newOptions); - } else { - VLANInterfaceSetOptions(vlan, NULL); - newOptions = NULL; - } - } else { - newOptions = VLANInterfaceGetOptions(vlan); - } - - /* update the prefs */ - - allocator = CFGetAllocator(prefs); - newDict = CFDictionaryCreateMutable(allocator, - 0, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - CFDictionaryAddValue(newDict, __kVLANInterface_interface, vlan_if); - CFDictionaryAddValue(newDict, __kVLANInterface_device, newDevice); - CFDictionaryAddValue(newDict, __kVLANInterface_tag, newTag); - if (newOptions != NULL) { - CFDictionaryAddValue(newDict, __kVLANInterface_options, newOptions); - } - - /* yes, we're going to be changing the configuration */ - setConfigurationChanged(prefs); - - /* update the prefs */ - - newVlans = CFArrayCreateMutableCopy(allocator, 0, vlans); - CFArraySetValueAtIndex(newVlans, cur_if, newDict); - CFRelease(newDict); - - (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans); - CFRelease(newVlans); - - ok = TRUE; - - done : - - pthread_mutex_unlock(&prefsPrivate->lock); - - return ok; -} - - -Boolean -VLANPreferencesRemoveInterface(VLANPreferencesRef prefs, - VLANInterfaceRef vlan) -{ - CFAllocatorRef allocator; - CFIndex cur_if; - CFMutableArrayRef newVlans; - Boolean ok = FALSE; - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; - CFArrayRef vlans; - - if (!isA_VLANPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - if (!isA_VLANInterface(vlan)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS); - if (!isA_CFArray(vlans)) { - _SCErrorSet(kSCStatusNoKey); - goto done; // if the prefs are confused - } - - cur_if = findVLAN(vlans, - VLANInterfaceGetDevice(vlan), - VLANInterfaceGetTag (vlan)); - if (cur_if == kCFNotFound) { - _SCErrorSet(kSCStatusNoKey); - goto done; - } - - /* yes, we're going to be changing the configuration */ - setConfigurationChanged(prefs); - - /* remove the vlan */ - - allocator = CFGetAllocator(prefs); - newVlans = CFArrayCreateMutableCopy(allocator, 0, vlans); - CFArrayRemoveValueAtIndex(newVlans, cur_if); - - (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans); - CFRelease(newVlans); - - ok = TRUE; - - done : - - pthread_mutex_unlock(&prefsPrivate->lock); - - return ok; -} - - -Boolean -VLANPreferencesCommitChanges(VLANPreferencesRef prefs) -{ - Boolean ok = FALSE; - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; - - if (!isA_VLANPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - ok = SCPreferencesCommitChanges(prefsPrivate->prefs); - if (!ok) { - return ok; - } - - if (prefsPrivate->vlBase != NULL) { - CFRelease(prefsPrivate->vlBase); - prefsPrivate->vlBase = NULL; - } - - return TRUE; -} - - -Boolean -_VLANPreferencesUpdateConfiguration(VLANPreferencesRef prefs) -{ - return TRUE; -} - - -Boolean -VLANPreferencesApplyChanges(VLANPreferencesRef prefs) -{ - SCPreferencesRef defaultPrefs; - Boolean ok = FALSE; - VLANPreferencesPrivateRef prefsPrivate = (VLANPreferencesPrivateRef)prefs; - - if (!isA_VLANPreferences(prefs)) { - _SCErrorSet(kSCStatusInvalidArgument); - return FALSE; - } - - pthread_mutex_lock(&prefsPrivate->lock); - - /* apply the preferences */ - ok = SCPreferencesApplyChanges(prefsPrivate->prefs); - if (!ok) { - goto done; - } - - /* apply the VLAN configuration */ - defaultPrefs = SCPreferencesCreate(NULL, CFSTR("VLANPreferencesApplyChanges"), NULL); - { - /* - * Note: In an ideal world, we'd simply call SCPreferencesApplyChanges() - * Unfortunately, it's possible that the caller (e.g NetworkCfgTool) - * is holding the lock on the default prefs and since "Apply" attempts - * to grab the lock we could end up in a deadlock situation. - */ -#include "SCPreferencesInternal.h" - SCPreferencesPrivateRef defaultPrefsPrivate; - - defaultPrefsPrivate = (SCPreferencesPrivateRef)defaultPrefs; - - pthread_mutex_lock(&defaultPrefsPrivate->lock); - if (defaultPrefsPrivate->session == NULL) { - __SCPreferencesAddSession(defaultPrefs); - } - pthread_mutex_unlock(&defaultPrefsPrivate->lock); - - ok = SCDynamicStoreNotifyValue(defaultPrefsPrivate->session, defaultPrefsPrivate->sessionKeyApply); - } - CFRelease(defaultPrefs); - if (!ok) { - goto done; - } - - done : - - pthread_mutex_unlock(&prefsPrivate->lock); - - return ok; -} diff --git a/SystemConfiguration.fproj/VLANConfiguration.h b/SystemConfiguration.fproj/VLANConfiguration.h deleted file mode 100644 index 00890a1..0000000 --- a/SystemConfiguration.fproj/VLANConfiguration.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _VLANCONFIGURATION_H -#define _VLANCONFIGURATION_H - -#include -#include -#include - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - -/*! - @header VLANConfiguration -*/ - -typedef const struct __VLANInterface * VLANInterfaceRef; - -typedef const struct __VLANPreferences * VLANPreferencesRef; - - -__BEGIN_DECLS - -// ---------- - -Boolean -IsVLANSupported (CFStringRef device) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // e.g. "en0", "en1", ... - -// ---------- - -CFTypeID -VLANInterfaceGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -CFStringRef -VLANInterfaceGetInterface (VLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // returns "vlan0", "vlan1", ... - -CFStringRef -VLANInterfaceGetDevice (VLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // returns "en0", "en1, ... - -CFNumberRef -VLANInterfaceGetTag (VLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // returns 1 <= tag <= 4094 - -CFDictionaryRef -VLANInterfaceGetOptions (VLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // e.g. UserDefinedName, ... - -// ---------- - -CFTypeID -VLANPreferencesGetTypeID (void) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -VLANPreferencesRef -VLANPreferencesCreate (CFAllocatorRef allocator) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -CFArrayRef /* of VLANInterfaceRef's */ -VLANPreferencesCopyInterfaces (VLANPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -VLANInterfaceRef -VLANPreferencesAddInterface (VLANPreferencesRef prefs, - CFStringRef device, // e.g. "en0", "en1", ... - CFNumberRef tag, // e.g. 1 <= tag <= 4094 - CFDictionaryRef options) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; // e.g. UserDefinedName, ... - -Boolean -VLANPreferencesUpdateInterface (VLANPreferencesRef prefs, - VLANInterfaceRef vlan, - CFStringRef newDevice, - CFNumberRef newTag, - CFDictionaryRef newOptions) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -Boolean -VLANPreferencesRemoveInterface (VLANPreferencesRef prefs, - VLANInterfaceRef vlan) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -Boolean -VLANPreferencesCommitChanges (VLANPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -Boolean -VLANPreferencesApplyChanges (VLANPreferencesRef prefs) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5; - -// ---------- - -__END_DECLS - -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ - -#endif /* _VLANCONFIGURATION_H */ diff --git a/SystemConfiguration.fproj/config_types.h b/SystemConfiguration.fproj/config_types.h index a9f67a2..a3a63ca 100644 --- a/SystemConfiguration.fproj/config_types.h +++ b/SystemConfiguration.fproj/config_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003, 2005, 2007 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -33,6 +33,9 @@ #define mig_external __private_extern__ /* Turn MIG type checking on by default */ +#ifdef __MigTypeCheck +#undef __MigTypeCheck +#endif #define __MigTypeCheck 1 /* diff --git a/SystemConfiguration.fproj/dy_framework.c b/SystemConfiguration.fproj/dy_framework.c index 421361d..9763e5b 100644 --- a/SystemConfiguration.fproj/dy_framework.c +++ b/SystemConfiguration.fproj/dy_framework.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2002-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -252,6 +252,8 @@ _IOServiceMatching(const char *name) return dyfunc ? dyfunc(name) : NULL; } +#if !TARGET_OS_IPHONE + static void * __loadSecurity(void) { static void *image = NULL; @@ -477,3 +479,4 @@ _SecTrustedApplicationCreateFromPath(const char *path, SecTrustedApplicationRef return dyfunc ? dyfunc(path, app) : -1; } +#endif // !TARGET_OS_IPHONE diff --git a/SystemConfiguration.fproj/dy_framework.h b/SystemConfiguration.fproj/dy_framework.h index e96845d..cb5f201 100644 --- a/SystemConfiguration.fproj/dy_framework.h +++ b/SystemConfiguration.fproj/dy_framework.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2002-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -25,11 +25,16 @@ #ifndef _DY_FRAMEWORK_H #define _DY_FRAMEWORK_H +#include +#include #include #include #include #include + +#if !TARGET_OS_IPHONE #include +#endif // !TARGET_OS_IPHONE __BEGIN_DECLS @@ -154,6 +159,8 @@ _IOServiceMatching ( #pragma mark - #pragma mark Security.framework APIs +#if !TARGET_OS_IPHONE + OSStatus _AuthorizationMakeExternalForm ( AuthorizationRef authorization, @@ -286,7 +293,9 @@ _SecTrustedApplicationCreateFromPath ( ); #define SecTrustedApplicationCreateFromPath _SecTrustedApplicationCreateFromPath +#endif // !TARGET_OS_IPHONE + __END_DECLS -#endif /* _DY_FRAMEWORK_H */ +#endif // _DY_FRAMEWORK_H diff --git a/SystemConfiguration.fproj/genSCPreferences.c b/SystemConfiguration.fproj/genSCPreferences.c index 102d693..dd435d5 100644 --- a/SystemConfiguration.fproj/genSCPreferences.c +++ b/SystemConfiguration.fproj/genSCPreferences.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -59,7 +59,7 @@ char copyright_string[] = "/*\n" -" * Copyright (c) 2000-2007 Apple Inc. All rights reserved.\n" +" * Copyright (c) 2000-2009 Apple Inc. All rights reserved.\n" " *\n" " * @APPLE_LICENSE_HEADER_START@\n" " * \n" @@ -83,18 +83,27 @@ char copyright_string[] = typedef enum { + DEFINE, + DEFINE_PRIVATE, COMMENT, GROUP, SC_10_1, - SC_10_1_10_4, // deprecated in 10.4 - SC_10_1_10_5, // deprecated in 10.5 SC_10_2, SC_10_3, + SC_10_1_10_4, // deprecated in 10.4 SC_10_4, + SC_10_1_10_5, // deprecated in 10.5 SC_10_5, + SC_10_1_10_6, // deprecated in 10.6 + SC_10_2_10_6, // deprecated in 10.6 + SC_10_6_IPHONE_2_0, + SC_10_6_IPHONE_3_0, COMMENT_PRIVATE, GROUP_PRIVATE, SC_10_5_PRIVATE, + SC_10_6_IPHONE_2_0_PRIVATE, + SC_10_6_IPHONE_3_0_PRIVATE, + SC_IPHONE_2_0_PRIVATE, COMMENT_DEPRECATED, GROUP_DEPRECATED, END @@ -142,6 +151,7 @@ typedef enum { #define ALERT "Alert" #define ALLOWNETCREATION "AllowNetCreation" #define ALTERNATEREMOTEADDRESS "AlternateRemoteAddress" +#define ALWAYS "Always" #define ANYREGEX "AnyRegex" #define APPLETALK "AppleTalk" #define AUTH "Auth" @@ -259,7 +269,6 @@ typedef enum { #define MEDIA "Media" #define MIXED "Mixed" #define MODEL "Model" -#define OPTIONS "Options" #define MODE "Mode" #define MODEM "Modem" #define MPPE40 "MPPE40" @@ -275,10 +284,13 @@ typedef enum { #define NETWORKID "NetworkID" #define NETWORKRANGE "NetworkRange" #define NETWORKSERVICES "NetworkServices" +#define NEVER "Never" #define NODE "Node" #define NODEID "NodeID" #define NOTE "Note" #define ONDEMAND "OnDemand" +#define ONRETRY "OnRetry" +#define OPTIONS "Options" #define ORDER "Order" #define ORDERS "Orders" #define OVERRIDEPRIMARY "OverridePrimary" @@ -299,6 +311,7 @@ typedef enum { #define PREFIXLENGTH "PrefixLength" #define PREFS "Prefs" #define PRIMARYINTERFACE "PrimaryInterface" +#define PRIMARYRANK "PrimaryRank" #define PRIMARYSERVICE "PrimaryService" #define PRIORITY "Priority" #define PROMPT "Prompt" @@ -371,6 +384,8 @@ typedef enum { #define WAITFORDIALTONE "WaitForDialTone" #define WINS "WINS" #define WORKGROUP "Workgroup" +#define XAUTH "XAuth" + typedef struct { int control; @@ -427,7 +442,9 @@ static schemaDefinition names[] = { { GROUP, NETENT, "Network Entity Keys", NULL, NULL }, { SC_10_1, NETENT, AIRPORT, NULL, CFDICTIONARY }, - { SC_10_1, NETENT, APPLETALK, NULL, CFDICTIONARY }, + { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, + { SC_10_1_10_6, NETENT, APPLETALK, NULL, CFDICTIONARY }, + { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, { SC_10_1, NETENT, DHCP, NULL, CFDICTIONARY }, { SC_10_1, NETENT, DNS, NULL, CFDICTIONARY }, { SC_10_1, NETENT, ETHERNET, NULL, CFDICTIONARY }, @@ -439,19 +456,25 @@ static schemaDefinition names[] = { { SC_10_3, NETENT, L2TP, NULL, CFDICTIONARY }, { SC_10_1, NETENT, LINK, NULL, CFDICTIONARY }, { SC_10_1, NETENT, MODEM, NULL, CFDICTIONARY }, + { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, { SC_10_1_10_5, NETENT, NETINFO, NULL, CFDICTIONARY }, + { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, { SC_10_1, NETENT, PPP, NULL, CFDICTIONARY }, { SC_10_1, NETENT, PPPOE, NULL, CFDICTIONARY }, { SC_10_3, NETENT, PPPSERIAL, NULL, CFDICTIONARY }, { SC_10_3, NETENT, PPTP, NULL, CFDICTIONARY }, { SC_10_1, NETENT, PROXIES, NULL, CFDICTIONARY }, + { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, { SC_10_5, NETENT, SMB, NULL, CFDICTIONARY }, + { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, { SC_10_3, NETENT, STF, NULL, CFDICTIONARY }, { COMMENT, "", NULL, NULL, NULL }, { GROUP_PRIVATE, NETENT, "Network Entity Keys", NULL, NULL }, { SC_10_5_PRIVATE, NETENT, EAPOL, NULL, CFDICTIONARY }, + { SC_10_6_IPHONE_3_0_PRIVATE, NETENT, ONDEMAND, NULL, CFDICTIONARY }, + { SC_10_6_IPHONE_2_0_PRIVATE, NETENT, SERVICE, "__SERVICE__", CFDICTIONARY }, { COMMENT_PRIVATE, "", NULL, NULL, NULL }, { GROUP, NETPROP, KEY_PREFIX COMP NETWORK " Properties", NULL, NULL }, @@ -497,23 +520,26 @@ static schemaDefinition names[] = { { SC_10_3, NETVAL AIRPORT AUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL }, { COMMENT, "", NULL, NULL, NULL }, - { GROUP, NETPROP APPLETALK, KEY_PREFIX NETENT APPLETALK " Entity Keys", NULL, NULL }, - - { SC_10_1, NETPROP APPLETALK, COMPUTERNAME, NULL, CFSTRING }, - { SC_10_1, NETPROP APPLETALK, COMPUTERNAME ENCODING, NULL, CFNUMBER }, - { SC_10_1, NETPROP APPLETALK, CONFIGMETHOD, NULL, CFSTRING }, - { SC_10_1, NETPROP APPLETALK, DEFAULTZONE, NULL, CFSTRING }, - { SC_10_1, NETPROP APPLETALK, NETWORKID, NULL, CFNUMBER }, - { SC_10_2, NETPROP APPLETALK, NETWORKRANGE, NULL, CFARRAY_CFNUMBER }, - { SC_10_1, NETPROP APPLETALK, NODEID, NULL, CFNUMBER }, - { SC_10_1, NETPROP APPLETALK, SEEDNETWORKRANGE, NULL, CFARRAY_CFNUMBER }, - { SC_10_1, NETPROP APPLETALK, SEEDZONES, NULL, CFARRAY_CFSTRING }, - { COMMENT, "", NULL, NULL, NULL }, - { COMMENT, "--- " KEY_PREFIX NETPROP APPLETALK CONFIGMETHOD " values ---", NULL, NULL, NULL }, - { SC_10_1, NETVAL APPLETALK CONFIGMETHOD, NODE, NULL, NULL }, - { SC_10_1, NETVAL APPLETALK CONFIGMETHOD, ROUTER, NULL, NULL }, - { SC_10_1, NETVAL APPLETALK CONFIGMETHOD, SEEDROUTER, NULL, NULL }, - { COMMENT, "", NULL, NULL, NULL }, + { GROUP_DEPRECATED, NETPROP APPLETALK, KEY_PREFIX NETENT APPLETALK " Entity Keys", NULL, NULL }, + + { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, + { SC_10_1_10_6, NETPROP APPLETALK, COMPUTERNAME, NULL, CFSTRING }, + { SC_10_1_10_6, NETPROP APPLETALK, COMPUTERNAME ENCODING, NULL, CFNUMBER }, + { SC_10_1_10_6, NETPROP APPLETALK, CONFIGMETHOD, NULL, CFSTRING }, + { SC_10_1_10_6, NETPROP APPLETALK, DEFAULTZONE, NULL, CFSTRING }, + { SC_10_1_10_6, NETPROP APPLETALK, NETWORKID, NULL, CFNUMBER }, + { SC_10_2_10_6, NETPROP APPLETALK, NETWORKRANGE, NULL, CFARRAY_CFNUMBER }, + { SC_10_1_10_6, NETPROP APPLETALK, NODEID, NULL, CFNUMBER }, + { SC_10_1_10_6, NETPROP APPLETALK, SEEDNETWORKRANGE, NULL, CFARRAY_CFNUMBER }, + { SC_10_1_10_6, NETPROP APPLETALK, SEEDZONES, NULL, CFARRAY_CFSTRING }, + { COMMENT_DEPRECATED, "", NULL, NULL, NULL }, + { COMMENT_DEPRECATED, "--- " KEY_PREFIX NETPROP APPLETALK CONFIGMETHOD " values ---", NULL, NULL, NULL }, + { SC_10_1_10_6, NETVAL APPLETALK CONFIGMETHOD, NODE, NULL, NULL }, + { SC_10_1_10_6, NETVAL APPLETALK CONFIGMETHOD, ROUTER, NULL, NULL }, + { SC_10_1_10_6, NETVAL APPLETALK CONFIGMETHOD, SEEDROUTER, NULL, NULL }, + { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, + { COMMENT_DEPRECATED, "", NULL, NULL, NULL }, + { GROUP, NETPROP DNS, KEY_PREFIX NETENT DNS " Entity Keys", NULL, NULL }, @@ -554,6 +580,7 @@ static schemaDefinition names[] = { { SC_10_3, NETVAL INTERFACE TYPE, FIREWIRE, NULL, NULL }, { SC_10_1, NETVAL INTERFACE TYPE, PPP, NULL, NULL }, { SC_10_3, NETVAL INTERFACE TYPE, STF, NULL, NULL }, + { SC_10_6_IPHONE_2_0, NETVAL INTERFACE TYPE, IPSEC, NULL, NULL }, { COMMENT, "", NULL, NULL, NULL }, { COMMENT, "--- " KEY_PREFIX NETPROP SERVICE SUBTYPE " values (for " PPP ") ---", NULL, NULL, NULL }, { SC_10_1, NETVAL INTERFACE SUBTYPE, PPPOE, NULL, NULL }, @@ -564,24 +591,47 @@ static schemaDefinition names[] = { { GROUP, NETPROP IPSEC, KEY_PREFIX NETENT IPSEC " Entity Keys", NULL, NULL }, + { SC_10_5, NETPROP IPSEC, AUTHENTICATIONMETHOD, NULL, CFSTRING }, + { SC_10_5, NETPROP IPSEC, LOCALCERTIFICATE, NULL, CFDATA }, { SC_10_5, NETPROP IPSEC, LOCALIDENTIFIER, NULL, CFSTRING }, { SC_10_5, NETPROP IPSEC, LOCALIDENTIFIER TYPE, NULL, CFSTRING }, - { SC_10_5, NETPROP IPSEC, AUTHENTICATIONMETHOD, NULL, CFSTRING }, { SC_10_5, NETPROP IPSEC, SHAREDSECRET, NULL, CFSTRING }, { SC_10_5, NETPROP IPSEC, SHAREDSECRET ENCRYPTION, NULL, CFSTRING }, - { SC_10_5, NETPROP IPSEC, LOCALCERTIFICATE, NULL, CFDATA }, + { SC_10_6_IPHONE_2_0, NETPROP IPSEC, CONNECTTIME, NULL, CFNUMBER }, + { SC_10_6_IPHONE_2_0, NETPROP IPSEC, REMOTEADDRESS, NULL, CFSTRING }, + { SC_10_6_IPHONE_2_0, NETPROP IPSEC, STATUS, STATUS, CFNUMBER }, + { SC_10_6_IPHONE_2_0, NETPROP IPSEC, XAUTH ENABLED, NULL, CFNUMBER_BOOL }, + { SC_10_6_IPHONE_2_0, NETPROP IPSEC, XAUTH NAME, NULL, CFSTRING }, + { SC_10_6_IPHONE_2_0, NETPROP IPSEC, XAUTH PASSWORD, NULL, CFSTRING }, + { SC_10_6_IPHONE_2_0, NETPROP IPSEC, XAUTH PASSWORD ENCRYPTION, NULL, CFSTRING }, { COMMENT, "", NULL, NULL, NULL }, { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC AUTHENTICATIONMETHOD " values ---", NULL, NULL, NULL }, { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, SHAREDSECRET, NULL, NULL }, { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, CERTIFICATE, NULL, NULL }, + { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, HYBRID, NULL, NULL }, + { COMMENT, "", NULL, NULL, NULL }, + { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC LOCALIDENTIFIER TYPE " values ---", NULL, NULL, NULL }, + { SC_10_5, NETVAL IPSEC LOCALIDENTIFIER TYPE, KEYID, NULL, NULL }, { COMMENT, "", NULL, NULL, NULL }, { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC SHAREDSECRET ENCRYPTION " values ---", NULL, NULL, NULL }, { SC_10_5, NETVAL IPSEC SHAREDSECRET ENCRYPTION, KEYCHAIN, NULL, NULL }, { COMMENT, "", NULL, NULL, NULL }, - { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC LOCALIDENTIFIER TYPE " values ---", NULL, NULL, NULL }, - { SC_10_5, NETVAL IPSEC LOCALIDENTIFIER TYPE, KEYID, NULL, NULL }, + { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC XAUTH PASSWORD ENCRYPTION " values ---", NULL, NULL, NULL }, + { SC_10_6_IPHONE_2_0, NETVAL IPSEC XAUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL }, + { SC_10_6_IPHONE_3_0, NETVAL IPSEC XAUTH PASSWORD ENCRYPTION, PROMPT, NULL, NULL }, { COMMENT, "", NULL, NULL, NULL }, + { GROUP_PRIVATE, NETPROP IPSEC, KEY_PREFIX NETENT IPSEC " Entity Keys", NULL, NULL }, + + { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, LAST CAUSE, NULL, CFNUMBER }, + { COMMENT_PRIVATE, "", NULL, NULL, NULL }, + { COMMENT_PRIVATE, "--- " ONDEMAND ": ---", NULL, NULL, NULL }, + { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, ONDEMAND ENABLED, NULL, CFNUMBER_BOOL }, + { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, ONDEMAND MATCH DOMAINS ALWAYS, NULL, CFARRAY_CFSTRING }, + { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, ONDEMAND MATCH DOMAINS ONRETRY, NULL, CFARRAY_CFSTRING }, + { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, ONDEMAND MATCH DOMAINS NEVER, NULL, CFARRAY_CFSTRING }, + { COMMENT_PRIVATE, "", NULL, NULL, NULL }, + { GROUP, NETPROP IPV4, KEY_PREFIX NETENT IPV4 " Entity Keys", NULL, NULL }, { SC_10_1, NETPROP IPV4, ADDRESSES, NULL, CFARRAY_CFSTRING }, @@ -593,6 +643,7 @@ static schemaDefinition names[] = { { SC_10_1, NETPROP IPV4, BROADCAST ADDRESSES, NULL, CFARRAY_CFSTRING }, { COMMENT, "", NULL, NULL, NULL }, { COMMENT, "--- " KEY_PREFIX NETPROP IPV4 CONFIGMETHOD " values ---", NULL, NULL, NULL }, + { SC_10_6_IPHONE_2_0, NETVAL IPV4 CONFIGMETHOD, AUTOMATIC, NULL, NULL }, { SC_10_1, NETVAL IPV4 CONFIGMETHOD, BOOTP, NULL, NULL }, { SC_10_1, NETVAL IPV4 CONFIGMETHOD, DHCP, NULL, NULL }, { SC_10_1, NETVAL IPV4 CONFIGMETHOD, INFORM, NULL, NULL }, @@ -663,6 +714,7 @@ static schemaDefinition names[] = { { GROUP_DEPRECATED, NETPROP NETINFO, KEY_PREFIX NETENT NETINFO " Entity Keys", NULL, NULL }, + { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, { SC_10_1_10_5, NETPROP NETINFO, BINDINGMETHODS, NULL, CFSTRING }, { SC_10_1_10_5, NETPROP NETINFO, SERVER ADDRESSES, NULL, CFARRAY_CFSTRING }, { SC_10_1_10_5, NETPROP NETINFO, SERVER TAGS, NULL, CFARRAY_CFSTRING }, @@ -675,6 +727,7 @@ static schemaDefinition names[] = { { COMMENT_DEPRECATED, "", NULL, NULL, NULL }, { COMMENT_DEPRECATED, "--- " KEY_PREFIX NETPROP NETINFO BROADCAST SERVER TAG " default value ---", NULL, NULL, NULL }, { SC_10_1_10_5, NETVAL NETINFO, DEFAULT SERVER TAG, "network", NULL }, + { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, { COMMENT_DEPRECATED, "", NULL, NULL, NULL }, { GROUP, NETPROP PPP, KEY_PREFIX NETENT PPP " Entity Keys", NULL, NULL }, @@ -765,7 +818,12 @@ static schemaDefinition names[] = { { COMMENT_PRIVATE, "--- " ONDEMAND ": ---", NULL, NULL, NULL }, { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND DOMAINS, NULL, CFARRAY_CFSTRING }, { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND ENABLED, NULL, CFNUMBER_BOOL }, - { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND HOSTNAME, NULL, CFSTRING }, + { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND HOSTNAME, NULL, CFSTRING }, // DEPRECATED, use kSCNetworkConnectionSelectionOptionOnDemandHostName +#ifdef NOTYET + { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS ALWAYS, NULL, CFARRAY_CFSTRING }, + { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS ONRETRY, NULL, CFARRAY_CFSTRING }, + { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS NEVER, NULL, CFARRAY_CFSTRING }, +#endif // NOTYET { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND MODE, NULL, CFSTRING }, { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND PRIORITY, NULL, CFSTRING }, { COMMENT_PRIVATE, "", NULL, NULL, NULL }, @@ -837,8 +895,20 @@ static schemaDefinition names[] = { { SC_10_4, NETPROP PROXIES, PROXY AUTODISCOVERY ENABLE, NULL, CFNUMBER_BOOL }, { COMMENT, "", NULL, NULL, NULL }, + { GROUP_PRIVATE, NETPROP SERVICE, KEY_PREFIX NETENT SERVICE " Entity Keys", NULL, NULL }, + + { SC_10_6_IPHONE_2_0_PRIVATE, NETPROP SERVICE, PRIMARYRANK, NULL, CFSTRING }, + { SC_10_6_IPHONE_2_0_PRIVATE, NETPROP SERVICE, USERDEFINEDNAME, NULL, CFSTRING }, + { COMMENT_PRIVATE, "", NULL, NULL, NULL }, + { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP SERVICE PRIMARYRANK " values ---", NULL, NULL, NULL }, + { SC_10_6_IPHONE_2_0_PRIVATE, NETVAL SERVICE PRIMARYRANK, FIRST, NULL }, + { SC_10_6_IPHONE_2_0_PRIVATE, NETVAL SERVICE PRIMARYRANK, LAST, NULL }, + { SC_10_6_IPHONE_2_0_PRIVATE, NETVAL SERVICE PRIMARYRANK, NEVER, NULL }, + { COMMENT_PRIVATE, "", NULL, NULL, NULL }, + { GROUP, NETPROP SMB, KEY_PREFIX NETENT SMB " Entity Keys", NULL, NULL }, + { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, { SC_10_5, NETPROP SMB, NETBIOS NAME, NULL, CFSTRING }, { SC_10_5, NETPROP SMB, NETBIOS NODE TYPE, NULL, CFSTRING }, { SC_10_5, NETPROP SMB, NETBIOS SCOPE, NULL, CFSTRING }, @@ -850,11 +920,14 @@ static schemaDefinition names[] = { { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, PEER, NULL }, { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, MIXED, NULL }, { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, HYBRID, NULL }, + { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, { COMMENT, "", NULL, NULL, NULL }, { GROUP, USERSENT CONSOLEUSER, KEY_PREFIX COMP USERS " Entity Keys", NULL, NULL }, + { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, { SC_10_1, USERSENT, CONSOLEUSER, NULL, NULL }, + { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, { COMMENT, "", NULL, NULL, NULL }, { GROUP, SYSTEMPROP COMPUTERNAME, KEY_PREFIX COMP SYSTEM " Properties", NULL, NULL }, @@ -894,6 +967,7 @@ static schemaDefinition names[] = { { GROUP_PRIVATE, VIRTUALNETWORKINTERFACES, "Virtual Network Interface Keys", NULL, NULL }, + { DEFINE_PRIVATE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, { SC_10_5_PRIVATE, VIRTUALPROP BOND, INTERFACES, NULL, CFARRAY_CFSTRING }, { SC_10_5_PRIVATE, VIRTUALPROP BOND, MODE, NULL, CFNUMBER }, { SC_10_5_PRIVATE, VIRTUALPROP BOND, OPTIONS, NULL, CFDICTIONARY }, @@ -901,13 +975,16 @@ static schemaDefinition names[] = { { SC_10_5_PRIVATE, VIRTUALPROP VLAN, INTERFACE, NULL, CFSTRING }, { SC_10_5_PRIVATE, VIRTUALPROP VLAN, TAG, NULL, CFNUMBER }, { SC_10_5_PRIVATE, VIRTUALPROP VLAN, OPTIONS, NULL, CFDICTIONARY }, + { DEFINE_PRIVATE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, // { COMMENT_PRIVATE, "", NULL, NULL, NULL }, //{ GROUP, "DEPRECATED", "Deprecated schema definition keys", NULL, NULL }, + { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL }, { SC_10_1_10_4, USERSPROP CONSOLEUSER, NAME, NULL, CFSTRING }, { SC_10_1_10_4, USERSPROP CONSOLEUSER, UID, NULL, CFNUMBER }, { SC_10_1_10_4, USERSPROP CONSOLEUSER, GID, NULL, CFNUMBER }, + { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL }, // { COMMENT, "", NULL, NULL, NULL }, { END, NULL, NULL, NULL, NULL }, @@ -964,6 +1041,13 @@ print_comment(schemaDefinition *def) return; } +void +print_define(schemaDefinition *def) +{ + printf("%s %s\n", def->prefix, def->key); + return; +} + void print_headerdoc(schemaDefinition *def) { @@ -989,22 +1073,39 @@ print_headerdoc(schemaDefinition *def) case SC_10_2: printf(" @availability Introduced in Mac OS X 10.2.\n"); break; - case SC_10_1_10_4: - printf(" @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.4.\n"); - break; - case SC_10_1_10_5: - printf(" @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.\n"); - break; case SC_10_3: printf(" @availability Introduced in Mac OS X 10.3.\n"); break; + case SC_10_1_10_4: + printf(" @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.4.\n"); + break; case SC_10_4: printf(" @availability Introduced in Mac OS X 10.4.\n"); break; + case SC_10_1_10_5: + printf(" @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.\n"); + break; case SC_10_5: case SC_10_5_PRIVATE: printf(" @availability Introduced in Mac OS X 10.5.\n"); break; + case SC_10_1_10_6: + printf(" @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.\n"); + break; + case SC_10_2_10_6: + printf(" @availability Introduced in Mac OS X 10.2, but later deprecated in Mac OS X 10.6.\n"); + break; + case SC_10_6_IPHONE_2_0: + case SC_10_6_IPHONE_2_0_PRIVATE: + printf(" @availability Introduced in Mac OS X 10.6.\n"); + break; + case SC_10_6_IPHONE_3_0: + case SC_10_6_IPHONE_3_0_PRIVATE: + printf(" @availability Introduced in Mac OS X 10.6.\n"); + break; + case SC_IPHONE_2_0_PRIVATE: + printf(" @availability Introduced in iPhone OS 2.0.\n"); + break; } printf(" */\n"); printf("extern const CFStringRef %s;\n", kbuf); @@ -1030,66 +1131,88 @@ print_hfile(schemaDefinition *def) switch (def->control) { case SC_10_1: - printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n"); - printf(" " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)\n", kbuf); - printf("#endif\n"); + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))\n", kbuf); break; case SC_10_2: - printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n"); - printf(" " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)\n", kbuf); - printf("#endif\n"); + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))\n", kbuf); break; case SC_10_3: - printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n"); - printf(" " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)\n", kbuf); - printf("#endif\n"); + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))\n", kbuf); break; case SC_10_1_10_4: - printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n"); - printf(" " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4)\n", kbuf); - printf("#endif\n"); - break; - case SC_10_1_10_5: - printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040\n"); - printf(" " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)\n", kbuf); - printf("#endif\n"); + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_NA,__IPHONE_NA))\n", kbuf); break; case SC_10_4: - printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040\n"); - printf(" " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)\n", kbuf); - printf("#endif\n"); + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))\n", kbuf); + break; + case SC_10_1_10_5: + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))\n", kbuf); break; case SC_10_5: case SC_10_5_PRIVATE: - printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050\n"); - printf(" " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)\n", kbuf); - printf("#endif\n"); + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))\n", kbuf); + break; + case SC_10_1_10_6: + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))\n", kbuf); + break; + case SC_10_2_10_6: + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))\n", kbuf); + break; + case SC_10_6_IPHONE_2_0: + case SC_10_6_IPHONE_2_0_PRIVATE: + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))\n", kbuf); + break; + case SC_10_6_IPHONE_3_0: + case SC_10_6_IPHONE_3_0_PRIVATE: + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))\n", kbuf); + break; + case SC_IPHONE_2_0_PRIVATE: + printf(" " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_2_0/*SPI*/))\n", kbuf); break; default: - printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n"); printf(" " SC_SCHEMA_DECLARATION "(%s,)\n", kbuf); - printf("#endif\n"); break; } switch (def->control) { case SC_10_1: - case SC_10_1_10_4: - case SC_10_1_10_5: - printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)\n"); + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n"); break; case SC_10_2: - printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)\n"); + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n"); break; case SC_10_3: - printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)\n"); + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n"); + break; + case SC_10_1_10_4: + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)\n"); break; case SC_10_4: - printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)\n"); + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n"); + break; + case SC_10_1_10_5: + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)\n"); break; case SC_10_5: case SC_10_5_PRIVATE: - printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)\n"); + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n"); + break; + case SC_10_1_10_6: + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)\n"); + break; + case SC_10_2_10_6: + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020)\n"); + break; + case SC_10_6_IPHONE_2_0: + case SC_10_6_IPHONE_2_0_PRIVATE: + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n"); + break; + case SC_10_6_IPHONE_3_0: + case SC_10_6_IPHONE_3_0_PRIVATE: + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/\n"); + break; + case SC_IPHONE_2_0_PRIVATE: + printf("#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n"); break; } @@ -1104,13 +1227,20 @@ print_hfile(schemaDefinition *def) switch (def->control) { case SC_10_1: - case SC_10_1_10_4: - case SC_10_1_10_5: case SC_10_2: case SC_10_3: + case SC_10_1_10_4: case SC_10_4: + case SC_10_1_10_5: case SC_10_5: case SC_10_5_PRIVATE: + case SC_10_1_10_6: + case SC_10_2_10_6: + case SC_10_6_IPHONE_2_0: + case SC_10_6_IPHONE_3_0: + case SC_10_6_IPHONE_2_0_PRIVATE: + case SC_10_6_IPHONE_3_0_PRIVATE: + case SC_IPHONE_2_0_PRIVATE: printf("#endif\n"); break; } @@ -1163,6 +1293,48 @@ dump_names(int type) break; } + case DEFINE: { + switch (type) { + case gen_hfile_e: + printf("\n"); + print_define(&names[i]); + break; + case gen_cfile_e: + if ((strcmp(names[i].prefix, "#if") == 0) || + (strcmp(names[i].prefix, "#ifdef") == 0) || + (strcmp(names[i].prefix, "#ifndef") == 0)) + printf("\n"); + print_define(&names[i]); + if (strcmp(names[i].prefix, "#endif") == 0) + printf("\n"); + break; + default: + break; + } + break; + } + + case DEFINE_PRIVATE: { + switch (type) { + case gen_hfile_private_e: + printf("\n"); + print_define(&names[i]); + break; + case gen_cfile_e: + if ((strcmp(names[i].prefix, "#if") == 0) || + (strcmp(names[i].prefix, "#ifdef") == 0) || + (strcmp(names[i].prefix, "#ifndef") == 0)) + printf("\n"); + print_define(&names[i]); + if (strcmp(names[i].prefix, "#endif") == 0) + printf("\n"); + break; + default: + break; + } + break; + } + case GROUP: case GROUP_DEPRECATED: { switch (type) { @@ -1222,9 +1394,14 @@ dump_names(int type) switch (names[i].control) { case SC_10_1_10_4: case SC_10_1_10_5: + case SC_10_1_10_6: + case SC_10_2_10_6: // don't report deprecated keys break; case SC_10_5_PRIVATE: + case SC_10_6_IPHONE_2_0_PRIVATE: + case SC_10_6_IPHONE_3_0_PRIVATE: + case SC_IPHONE_2_0_PRIVATE: // don't report private definitions break; default: @@ -1236,9 +1413,14 @@ dump_names(int type) switch (names[i].control) { case SC_10_1_10_4: case SC_10_1_10_5: + case SC_10_1_10_6: + case SC_10_2_10_6: // don't report deprecated keys break; case SC_10_5_PRIVATE: + case SC_10_6_IPHONE_2_0_PRIVATE: + case SC_10_6_IPHONE_3_0_PRIVATE: + case SC_IPHONE_2_0_PRIVATE: print_comment(&names[i]); break; default: @@ -1250,8 +1432,11 @@ dump_names(int type) case gen_headerdoc_e: switch (names[i].control) { case SC_10_5_PRIVATE: - break; + case SC_10_6_IPHONE_2_0_PRIVATE: + case SC_10_6_IPHONE_3_0_PRIVATE: + case SC_IPHONE_2_0_PRIVATE: // don't report private definitions + break; default: print_headerdoc(&names[i]); break; @@ -1260,6 +1445,9 @@ dump_names(int type) case gen_headerdoc_private_e: switch (names[i].control) { case SC_10_5_PRIVATE: + case SC_10_6_IPHONE_2_0_PRIVATE: + case SC_10_6_IPHONE_3_0_PRIVATE: + case SC_IPHONE_2_0_PRIVATE: print_headerdoc(&names[i]); break; default: @@ -1271,6 +1459,9 @@ dump_names(int type) case gen_hfile_e: switch (names[i].control) { case SC_10_5_PRIVATE: + case SC_10_6_IPHONE_2_0_PRIVATE: + case SC_10_6_IPHONE_3_0_PRIVATE: + case SC_IPHONE_2_0_PRIVATE: break; // don't report private definitions default: @@ -1281,6 +1472,9 @@ dump_names(int type) case gen_hfile_private_e: switch (names[i].control) { case SC_10_5_PRIVATE: + case SC_10_6_IPHONE_2_0_PRIVATE: + case SC_10_6_IPHONE_3_0_PRIVATE: + case SC_IPHONE_2_0_PRIVATE: print_hfile(&names[i]); break; default: @@ -1325,39 +1519,7 @@ main(int argc, char * argv[]) if (argc >= 2) type = argv[1]; - if (strcmp(type, "header-x") == 0) { - printf("%s\n", copyright_string); - printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n"); - - printf("/*\n"); - printf(" * Note: For Cocoa/Obj-C/Foundation programs accessing these preference\n"); - printf(" * keys you may want to consider the following:\n"); - printf(" *\n"); - printf(" * #define SCSTR(s) (NSString *)CFSTR(s)\n"); - printf(" * #import \n"); - printf(" */\n\n"); - - printf("#ifndef _SCSCHEMADEFINITIONS_10_1_H\n#define _SCSCHEMADEFINITIONS_10_1_H\n\n"); - - printf("#warning USE OF THIS HEADER HAS BEEN DEPRECATED\n"); - - printf("#ifndef _SCSCHEMADEFINITIONS_H\n"); - printf("#warning Please #include instead\n"); - printf("#warning of including this file directly.\n"); - printf("#include \n"); - printf("#endif\n\n"); - -// printf("#ifndef SCSTR\n"); -// printf("#include \n"); -// printf("#define SCSTR(s) CFSTR(s)\n"); -// printf("#endif\n\n"); -// -// dump_names(gen_header_e); -// printf("\n"); - - printf("#endif /* _SCSCHEMADEFINITIONS_10_1_H */\n"); - } - else if (strcmp(type, "header") == 0) { + if (strcmp(type, "header") == 0) { printf("%s\n", copyright_string); printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n"); @@ -1402,18 +1564,25 @@ main(int argc, char * argv[]) printf(" * \"" SC_SCHEMA_DECLARATION "\" and \"" SC_SCHEMA_KV "\" macros\n"); printf(" */\n\n\n"); - printf("#ifndef _SCSCHEMADEFINITIONS_H\n#define _SCSCHEMADEFINITIONS_H\n\n"); + printf("#ifndef\t_SCSCHEMADEFINITIONS_H\n"); + printf("#ifdef\tUSE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\n"); + printf("#include \n"); + printf("#else\t/* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */\n"); + printf("#define\t_SCSCHEMADEFINITIONS_H\n"); + printf("\n"); printf("/* -------------------- Macro declarations -------------------- */\n\n"); - printf("#include \n\n"); + printf("#include \n"); + printf("#include \n"); + printf("\n"); printf("/*\n"); printf(" * let's \"do the right thing\" for those wishing to build for\n"); printf(" * Mac OS X 10.1.0 ... 10.2.x\n"); printf(" */\n"); - printf("#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1020\n"); + printf("#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (__MAC_OS_X_VERSION_MIN_REQUIRED <= 1020) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)\n"); printf(" #ifndef SCSTR\n"); printf(" #include \n"); printf(" #define SCSTR(s) CFSTR(s)\n"); @@ -1447,7 +1616,7 @@ main(int argc, char * argv[]) printf("#endif\n"); // The SCSTR() macro should only be availble for Mac OS X 10.1.0 ... 10.4.x - printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)\n"); + printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)\n"); printf(" #ifndef SCSTR\n"); printf(" #include \n"); printf(" #define SCSTR(s) CFSTR(s)\n"); @@ -1467,7 +1636,8 @@ main(int argc, char * argv[]) dump_names(gen_hfile_e); printf("\n"); - printf("#endif /* _SCSCHEMADEFINITIONS_H */\n"); + printf("#endif\t/* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */\n"); + printf("#endif\t/* _SCSCHEMADEFINITIONS_H */\n"); } else if (strcmp(type, "private") == 0) { printf("%s\n", copyright_string); @@ -1477,7 +1647,9 @@ main(int argc, char * argv[]) dump_names(gen_comments_private_e); printf(" */\n\n\n"); - printf("#ifndef _SCSCHEMADEFINITIONSPRIVATE_H\n#define _SCSCHEMADEFINITIONSPRIVATE_H\n\n"); + printf("#ifndef _SCSCHEMADEFINITIONSPRIVATE_H\n"); + printf("#define _SCSCHEMADEFINITIONSPRIVATE_H\n"); + printf("\n"); printf("/* -------------------- Macro declarations -------------------- */\n\n"); @@ -1504,6 +1676,8 @@ main(int argc, char * argv[]) printf(" * DO NOT EDIT!\n"); printf(" */\n"); printf("\n"); + printf("#include \n"); + printf("#include \n"); printf("#include \n"); printf("\n"); dump_names(gen_cfile_e); diff --git a/SystemConfiguration.fproj/helper/SCHelper_client.c b/SystemConfiguration.fproj/helper/SCHelper_client.c index 3fe56db..638008f 100644 --- a/SystemConfiguration.fproj/helper/SCHelper_client.c +++ b/SystemConfiguration.fproj/helper/SCHelper_client.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -51,203 +52,46 @@ __private_extern__ int _SCHelperOpen(CFDataRef authorizationData) { - sigset_t block; - sigset_t block_old; - CFBundleRef bundle; - int comm[2] = { -1, -1 }; - int exit_status = 0; - struct sigaction ignore; - struct sigaction int_old; - Boolean ok = FALSE; - char path[MAXPATHLEN]= { 0 }; - pid_t pid1; - struct sigaction quit_old; - uint32_t status = 0; - CFURLRef url = NULL; - static int yes = 1; - - // get CFBundleRef for SystemConfiguration.framework - bundle = _SC_CFBundleGet(); - if (bundle != NULL) { - url = CFBundleCopyResourceURL(bundle, CFSTR(HELPER), NULL, NULL); - } - - if (url != NULL) { - if (!CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)path, sizeof(path))) { - path[0] = 0; - } - CFRelease(url); - } - - // create tool<-->helper communications socket - if (socketpair(AF_UNIX, SOCK_STREAM, 0, comm) == -1) { - perror("_SCHelperOpen socketpair() failed"); + Boolean ok; + int sock; + struct sockaddr_un sun; + uint32_t status = 0; + static int yes = 1; + + if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { + perror("_SCHelperOpen socket() failed"); return -1; } - // ignore SIGINT, SIGQUIT - ignore.sa_handler = SIG_IGN; - ignore.sa_flags = 0; - (void)sigemptyset(&ignore.sa_mask); - (void)sigaction(SIGINT , &ignore, &int_old ); - (void)sigaction(SIGQUIT, &ignore, &quit_old); - - // block SIGCHLD - (void)sigemptyset(&block); - (void)sigaddset(&block, SIGCHLD); - (void)sigprocmask(SIG_BLOCK, &block, &block_old); - - // fork - pid1 = fork(); - if (pid1 == -1) { // if error - perror("_SCHelperOpen fork() failed"); - goto done; - } else if (pid1 == 0) { // if [first] child - int i; - pid_t pid2; - - // make sure that we don't step on syslog's FD (if open) - closelog(); - - // set stdin, stdout, stderr (and close other FD's) - if (comm[0] != STDIN_FILENO) { - (void)dup2(comm[0], STDIN_FILENO); - } - - if (comm[0] != STDOUT_FILENO) { - (void)dup2(comm[0], STDOUT_FILENO); - } - - (void)close(STDERR_FILENO); - (void)open(_PATH_CONSOLE, O_WRONLY, 0); - - for (i = getdtablesize() - 1; i > STDERR_FILENO; i--) { - (void)close(i); - } - - pid2 = vfork(); - if (pid2 == -1) { // if error - int err = errno; - - perror("_SCHelperOpen vfork() failed\n"); - (void)__SCHelper_txMessage(STDOUT_FILENO, err, NULL); - _exit(err); - } else if (pid2 == 0) { // if [second] child - char *env; - int err = ENOENT; - size_t len; - - // restore signal processing - (void)sigaction(SIGINT , &int_old , NULL); - (void)sigaction(SIGQUIT, &quit_old, NULL); - (void)sigprocmask(SIG_SETMASK, &block_old, NULL); - - if (path[0] != 0) { - (void)execl(path, path, NULL); - err = errno; - } - - // if appropriate (e.g. when debugging), try a bit harder - - env = getenv("DYLD_FRAMEWORK_PATH"); - len = (env != NULL) ? strlen(env) : 0; - - // trim any trailing slashes - while ((len > 1) && (env[len - 1] == '/')) { - len--; - } - - // if DYLD_FRAMEWORK_PATH is ".../xxx~sym" than try ".../xxx~sym/SCHelper" - if ((len > SUFFIX_SYM_LEN) && - (strncmp(&env[len - SUFFIX_SYM_LEN], SUFFIX_SYM, SUFFIX_SYM_LEN) == 0) && - ((len + 1 + HELPER_LEN) < MAXPATHLEN)) { - char path[MAXPATHLEN]; - - strlcpy(path, env, sizeof(path)); - strlcpy(&path[len], "/", sizeof(path) - (len - 1)); - strlcat(&path[len], HELPER, sizeof(path) - len); - - (void)execl(path, path, NULL); - err = errno; - } - - // if SCHelper could not be started - (void)__SCHelper_txMessage(STDOUT_FILENO, err, NULL); - _exit(err != 0 ? err : ENOENT); - } - - // [first] child - _exit(0); - } - - if (wait4(pid1, &exit_status, 0, NULL) == -1) { - perror("_SCHelperOpen wait4() failed"); - goto done; - } - - if (WIFEXITED(exit_status)) { - if (WEXITSTATUS(exit_status) != 0) { - SCLog(TRUE, LOG_INFO, - CFSTR("could not start \"" HELPER "[1]\", exited w/status = %d"), - WEXITSTATUS(exit_status)); - goto done; - } - } else if (WIFSIGNALED(exit_status)) { - SCLog(TRUE, LOG_INFO, - CFSTR("could not start \"" HELPER "[1]\", terminated w/signal = %d"), - WTERMSIG(exit_status)); - goto done; - } else { - SCLog(TRUE, LOG_INFO, - CFSTR("could not start \"" HELPER "[1]\", exit_status = %x"), - exit_status); - goto done; + sun.sun_family = AF_UNIX; + strlcpy(sun.sun_path, "/var/run/SCHelper", sizeof(sun.sun_path)); + if (connect(sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) { + perror("_SCHelperOpen connect() failed"); + close(sock); + return -1; } - (void)close(comm[0]); - comm[0] = -1; - - if (setsockopt(comm[1], SOL_SOCKET, SO_NOSIGPIPE, (const void *)&yes, sizeof(yes)) == -1) { + if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (const void *)&yes, sizeof(yes)) == -1) { perror("_SCHelperOpen setsockopt() failed"); - goto done; + close(sock); + return -1; } - ok = __SCHelper_rxMessage(comm[1], &status, NULL); + ok = _SCHelperExec(sock, SCHELPER_MSG_AUTH, authorizationData, &status, NULL); if (!ok) { - SCLog(TRUE, LOG_INFO, CFSTR("could not start \"" HELPER "\", no status available")); - goto done; + SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen: could not send authorization")); + close(sock); + return -1; } ok = (status == 0); if (!ok) { SCLog(TRUE, LOG_INFO, CFSTR("could not start \"" HELPER "\", status = %u"), status); - goto done; - } - - ok = _SCHelperExec(comm[1], SCHELPER_MSG_AUTH, authorizationData, &status, NULL); - if (!ok) { - SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen: could not send authorization")); - goto done; - } - - done : - - // restore signal processing - (void)sigaction(SIGINT , &int_old , NULL); - (void)sigaction(SIGQUIT, &quit_old, NULL); - (void)sigprocmask(SIG_SETMASK, &block_old, NULL); - - if (comm[0] > 0) { - (void)close(comm[0]); -// comm[0] = -1; - } - - if (!ok) { - (void)close(comm[1]); - comm[1] = -1; + close(sock); + return -1; } - return comm[1]; + return sock; } diff --git a/SystemConfiguration.fproj/helper/SCHelper_client.h b/SystemConfiguration.fproj/helper/SCHelper_client.h index 3fb24bb..74d78eb 100644 --- a/SystemConfiguration.fproj/helper/SCHelper_client.h +++ b/SystemConfiguration.fproj/helper/SCHelper_client.h @@ -25,7 +25,9 @@ #define _SCHELPER_CLIENT_H #include -#include +#include +#include +#include #define kSCKeychainOptionsAccount CFSTR("Account") // CFString #define kSCKeychainOptionsDescription CFSTR("Description") // CFString @@ -51,11 +53,13 @@ enum { // SCNetworkConfiguration SCHELPER_MSG_INTERFACE_REFRESH = 200, +#if !TARGET_OS_IPHONE // "System" Keychain SCHELPER_MSG_KEYCHAIN_COPY = 300, SCHELPER_MSG_KEYCHAIN_EXISTS, SCHELPER_MSG_KEYCHAIN_REMOVE, SCHELPER_MSG_KEYCHAIN_SET, +#endif // !TARGET_OS_IPHONE // miscellaneous SCHELPER_MSG_EXIT = 9999 diff --git a/SystemConfiguration.fproj/helper/SCHelper_server.c b/SystemConfiguration.fproj/helper/SCHelper_server.c index 7a8ca55..cdf3fd3 100644 --- a/SystemConfiguration.fproj/helper/SCHelper_server.c +++ b/SystemConfiguration.fproj/helper/SCHelper_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2007 Apple Inc. All rights reserved. + * Copyright (c) 2005-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,21 +22,274 @@ */ #include +#include #include #include #include +#include #include #include -#include +#include +#include +#include #include "SCPreferencesInternal.h" #include "SCHelper_client.h" #include "helper_comm.h" -static AuthorizationRef authorization = NULL; -static SCPreferencesRef prefs = NULL; +#if TARGET_OS_IPHONE +#include + +__private_extern__ int +getgrnam_r(const char *name, __unused struct group *grp, __unused char *buf, __unused size_t bufsize, struct group **grpP) +{ + *grpP = getgrnam(name); + return (*grpP == NULL) ? -1 : 0; +} +#endif // TARGET_OS_IPHONE + + +#pragma mark - +#pragma mark Session managment + + +typedef const struct __SCHelperSession * SCHelperSessionRef; + +typedef struct { + + // base CFType information + CFRuntimeBase cfBase; + + // authorization + AuthorizationRef authorization; +#if TARGET_OS_IPHONE + uid_t peer_euid; + gid_t peer_egid; +#endif // TARGET_OS_IPHONE + + // preferences + SCPreferencesRef prefs; + +} SCHelperSessionPrivate, *SCHelperSessionPrivateRef; + + +static AuthorizationRef +__SCHelperSessionGetAuthorization(SCHelperSessionRef session) +{ + SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)session; + + return sessionPrivate->authorization; +} + + +static Boolean +__SCHelperSessionSetAuthorization(SCHelperSessionRef session, CFTypeRef authorizationData) +{ + Boolean ok = TRUE; + SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)session; + +#if !TARGET_OS_IPHONE + if (sessionPrivate->authorization != NULL) { + AuthorizationFree(sessionPrivate->authorization, kAuthorizationFlagDefaults); +// AuthorizationFree(sessionPrivate->authorization, kAuthorizationFlagDestroyRights); + sessionPrivate->authorization = NULL; + } + + if (isA_CFData(authorizationData)) { + AuthorizationExternalForm extForm; + + if (CFDataGetLength(authorizationData) == sizeof(extForm.bytes)) { + OSStatus err; + + bcopy(CFDataGetBytePtr(authorizationData), extForm.bytes, sizeof(extForm.bytes)); + err = AuthorizationCreateFromExternalForm(&extForm, + &sessionPrivate->authorization); + if (err != errAuthorizationSuccess) { + SCLog(TRUE, LOG_ERR, + CFSTR("AuthorizationCreateFromExternalForm() failed: status = %d"), + (int)err); + sessionPrivate->authorization = NULL; + ok = FALSE; + } + } + } +#else // !TARGET_OS_IPHONE + if (sessionPrivate->authorization != NULL) { + CFRelease(sessionPrivate->authorization); + sessionPrivate->authorization = NULL; + } + + if (isA_CFString(authorizationData)) { + sessionPrivate->authorization = (void *)CFRetain(authorizationData); + } +#endif // !TARGET_OS_IPHONE + + return ok; +} + + +#if TARGET_OS_IPHONE +static void +__SCHelperSessionGetCredentials(SCHelperSessionRef session, uid_t *euid, gid_t *egid) +{ + SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)session; + + if (euid != NULL) *euid = sessionPrivate->peer_euid; + if (egid != NULL) *egid = sessionPrivate->peer_egid; + return; +} + + +static Boolean +__SCHelperSessionSetCredentials(SCHelperSessionRef session, uid_t euid, gid_t egid) +{ + SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)session; + + sessionPrivate->peer_euid = euid; + sessionPrivate->peer_egid = egid; + return TRUE; +} +#endif // TARGET_OS_IPHONE + +static SCPreferencesRef +__SCHelperSessionGetPreferences(SCHelperSessionRef session) +{ + SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)session; + + return sessionPrivate->prefs; +} + + +static Boolean +__SCHelperSessionSetPreferences(SCHelperSessionRef session, SCPreferencesRef prefs) +{ + SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)session; + + if (prefs != NULL) { + CFRetain(prefs); + } + if (sessionPrivate->prefs != NULL) { + CFRelease(sessionPrivate->prefs); + } + sessionPrivate->prefs = prefs; + + return TRUE; +} + + +static CFStringRef __SCHelperSessionCopyDescription (CFTypeRef cf); +static void __SCHelperSessionDeallocate (CFTypeRef cf); + + +static CFTypeID __kSCHelperSessionTypeID = _kCFRuntimeNotATypeID; +static Boolean debug = FALSE; +static pthread_once_t initialized = PTHREAD_ONCE_INIT; +static CFRunLoopRef main_runLoop = NULL; +static CFMutableSetRef sessions = NULL; +static int sessions_closed = 0; // count of sessions recently closed +static pthread_mutex_t sessions_lock = PTHREAD_MUTEX_INITIALIZER; + + +static const CFRuntimeClass __SCHelperSessionClass = { + 0, // version + "SCHelperSession", // className + NULL, // init + NULL, // copy + __SCHelperSessionDeallocate, // dealloc + NULL, // equal + NULL, // hash + NULL, // copyFormattingDesc + __SCHelperSessionCopyDescription // copyDebugDesc +}; + + +static CFStringRef +__SCHelperSessionCopyDescription(CFTypeRef cf) +{ + CFAllocatorRef allocator = CFGetAllocator(cf); + CFMutableStringRef result; + SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)cf; + + result = CFStringCreateMutable(allocator, 0); + CFStringAppendFormat(result, NULL, CFSTR(" {"), cf, allocator); + CFStringAppendFormat(result, NULL, CFSTR("authorization = %p"), sessionPrivate->authorization); + CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), sessionPrivate->prefs); + CFStringAppendFormat(result, NULL, CFSTR("}")); + + return result; +} + + +static void +__SCHelperSessionDeallocate(CFTypeRef cf) +{ + SCHelperSessionPrivateRef sessionPrivate = (SCHelperSessionPrivateRef)cf; + + // release resources + __SCHelperSessionSetAuthorization((SCHelperSessionRef)sessionPrivate, NULL); + __SCHelperSessionSetPreferences ((SCHelperSessionRef)sessionPrivate, NULL); + + // we no longer need/want to track this session + pthread_mutex_lock(&sessions_lock); + CFSetRemoveValue(sessions, sessionPrivate); + sessions_closed++; + pthread_mutex_unlock(&sessions_lock); + CFRunLoopWakeUp(main_runLoop); + + return; +} + + +static void +__SCHelperSessionInitialize(void) +{ + __kSCHelperSessionTypeID = _CFRuntimeRegisterClass(&__SCHelperSessionClass); + return; +} + + +static SCHelperSessionRef +__SCHelperSessionCreate(CFAllocatorRef allocator) +{ + SCHelperSessionPrivateRef sessionPrivate; + uint32_t size; + + /* initialize runtime */ + pthread_once(&initialized, __SCHelperSessionInitialize); + + /* allocate session */ + size = sizeof(SCHelperSessionPrivate) - sizeof(CFRuntimeBase); + sessionPrivate = (SCHelperSessionPrivateRef)_CFRuntimeCreateInstance(allocator, + __kSCHelperSessionTypeID, + size, + NULL); + if (sessionPrivate == NULL) { + return NULL; + } + + sessionPrivate->authorization = NULL; +#if TARGET_OS_IPHONE + sessionPrivate->peer_euid = 0; + sessionPrivate->peer_egid = 0; +#endif // TARGET_OS_IPHONE + sessionPrivate->prefs = NULL; + + // keep track this session + pthread_mutex_lock(&sessions_lock); + if (sessions == NULL) { + sessions = CFSetCreateMutable(NULL, 0, NULL); // create a non-retaining set + } + CFSetAddValue(sessions, sessionPrivate); + pthread_mutex_unlock(&sessions_lock); + + return (SCHelperSessionRef)sessionPrivate; +} + + +#pragma mark - +#pragma mark Helpers /* @@ -46,8 +299,9 @@ static SCPreferencesRef prefs = NULL; * (out) reply = N/A */ static Boolean -do_Exit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_Exit(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { + *status = -1; return FALSE; } @@ -59,38 +313,40 @@ do_Exit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = N/A */ static Boolean -do_Auth(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_Auth(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - if (authorization != NULL) { - AuthorizationFree(authorization, kAuthorizationFlagDefaults); -// AuthorizationFree(authorization, kAuthorizationFlagDestroyRights); - authorization = NULL; - } + Boolean ok; - if (data != NULL) { - AuthorizationExternalForm extForm; +#if !TARGET_OS_IPHONE - if (CFDataGetLength(data) == sizeof(extForm.bytes)) { - OSStatus err; + ok = __SCHelperSessionSetAuthorization(session, data); - bcopy(CFDataGetBytePtr(data), extForm.bytes, sizeof(extForm.bytes)); - err = AuthorizationCreateFromExternalForm(&extForm, &authorization); - if (err != errAuthorizationSuccess) { - SCLog(TRUE, LOG_ERR, - CFSTR("AuthorizationCreateFromExternalForm() failed: status = %d"), - (int)err); - } - } +#else //!TARGET_OS_IPHONE - CFRelease(data); + CFStringRef authorizationInfo = NULL; + + if ((data != NULL) && !_SCUnserializeString(&authorizationInfo, data, NULL, 0)) { + return FALSE; } - *status = (authorization != NULL) ? 0 : 1; + if (!isA_CFString(authorizationInfo)) { + if (authorizationInfo != NULL) CFRelease(authorizationInfo); + return FALSE; + } + + ok = __SCHelperSessionSetAuthorization(session, authorizationInfo); + if (authorizationInfo != NULL) CFRelease(authorizationInfo); + +#endif // !TARGET_OS_IPHONE + *status = ok ? 0 : 1; return TRUE; } +#if !TARGET_OS_IPHONE + + /* * SCHELPER_MSG_KEYCHAIN_COPY * (in) data = unique_id @@ -98,9 +354,10 @@ do_Auth(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = password */ static Boolean -do_keychain_copy(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_keychain_copy(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - CFStringRef unique_id = NULL; + SCPreferencesRef prefs; + CFStringRef unique_id = NULL; if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) { return FALSE; @@ -110,6 +367,7 @@ do_keychain_copy(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) return FALSE; } + prefs = __SCHelperSessionGetPreferences(session); *reply = _SCPreferencesSystemKeychainPasswordItemCopy(prefs, unique_id); CFRelease(unique_id); if (*reply == NULL) { @@ -127,22 +385,24 @@ do_keychain_copy(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = N/A */ static Boolean -do_keychain_exists(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_keychain_exists(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - Boolean ok; - CFStringRef unique_id = NULL; + Boolean ok; + SCPreferencesRef prefs; + CFStringRef unique_id = NULL; if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) { return FALSE; } if (!isA_CFString(unique_id)) { + if (unique_id != NULL) CFRelease(unique_id); return FALSE; } + prefs = __SCHelperSessionGetPreferences(session); ok = _SCPreferencesSystemKeychainPasswordItemExists(prefs, unique_id); CFRelease(unique_id); - if (!ok) { *status = SCError(); } @@ -158,22 +418,24 @@ do_keychain_exists(void *info, CFDataRef data, uint32_t *status, CFDataRef *repl * (out) reply = N/A */ static Boolean -do_keychain_remove(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_keychain_remove(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - Boolean ok; - CFStringRef unique_id = NULL; + Boolean ok; + SCPreferencesRef prefs; + CFStringRef unique_id = NULL; if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) { return FALSE; } if (!isA_CFString(unique_id)) { + if (unique_id != NULL) CFRelease(unique_id); return FALSE; } + prefs = __SCHelperSessionGetPreferences(session); ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id); CFRelease(unique_id); - if (!ok) { *status = SCError(); } @@ -189,22 +451,24 @@ do_keychain_remove(void *info, CFDataRef data, uint32_t *status, CFDataRef *repl * (out) reply = N/A */ static Boolean -do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_keychain_set(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - CFStringRef account; - CFStringRef description; - CFArrayRef executablePaths = NULL; - CFStringRef label; - Boolean ok; - CFDictionaryRef options = NULL; - CFDataRef password; - CFStringRef unique_id; + CFStringRef account; + CFStringRef description; + CFArrayRef executablePaths = NULL; + CFStringRef label; + Boolean ok; + CFDictionaryRef options = NULL; + CFDataRef password; + SCPreferencesRef prefs; + CFStringRef unique_id; if ((data != NULL) && !_SCUnserialize((CFPropertyListRef *)&options, data, NULL, 0)) { return FALSE; } if (!isA_CFDictionary(options)) { + if (options != NULL) CFRelease(options); return FALSE; } @@ -247,6 +511,7 @@ do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) account = CFDictionaryGetValue(options, kSCKeychainOptionsAccount); password = CFDictionaryGetValue(options, kSCKeychainOptionsPassword); + prefs = __SCHelperSessionGetPreferences(session); ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs, unique_id, label, @@ -255,7 +520,6 @@ do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) password, options); CFRelease(options); - if (!ok) { *status = SCError(); } @@ -264,6 +528,9 @@ do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) } +#endif // !TARGET_OS_IPHONE + + /* * SCHELPER_MSG_INTERFACE_REFRESH * (in) data = ifName @@ -271,7 +538,7 @@ do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = N/A */ static Boolean -do_interface_refresh(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_interface_refresh(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { CFStringRef ifName = NULL; Boolean ok; @@ -283,12 +550,12 @@ do_interface_refresh(void *info, CFDataRef data, uint32_t *status, CFDataRef *re if (!isA_CFString(ifName)) { SCLog(TRUE, LOG_ERR, CFSTR("interface name not valid")); + if (ifName != NULL) CFRelease(ifName); return FALSE; } ok = _SCNetworkInterfaceForceConfigurationRefresh(ifName); CFRelease(ifName); - if (!ok) { *status = SCError(); } @@ -304,23 +571,73 @@ do_interface_refresh(void *info, CFDataRef data, uint32_t *status, CFDataRef *re * (out) reply = N/A */ static Boolean -do_prefs_Open(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_prefs_Open(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - CFStringRef prefsID = NULL; + CFStringRef name; + CFNumberRef pid; + SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session); + CFDictionaryRef prefsInfo = NULL; + CFStringRef prefsID; + CFStringRef prefsName; if (prefs != NULL) { return FALSE; } - if ((data != NULL) && !_SCUnserializeString(&prefsID, data, NULL, 0)) { - SCLog(TRUE, LOG_ERR, CFSTR("prefsID not valid")); + if ((data != NULL) && !_SCUnserialize((CFPropertyListRef *)&prefsInfo, data, NULL, 0)) { + SCLog(TRUE, LOG_ERR, CFSTR("data not valid, %@"), data); return FALSE; } - prefs = SCPreferencesCreate(NULL, CFSTR("SCHelper"), prefsID); - if (prefsID != NULL) CFRelease(prefsID); + if ((prefsInfo == NULL) || !isA_CFDictionary(prefsInfo)) { + SCLog(TRUE, LOG_ERR, CFSTR("info not valid")); + if (prefsInfo != NULL) CFRelease(prefsInfo); + return FALSE; + } - if (prefs == NULL) { + // get [optional] prefsID + prefsID = CFDictionaryGetValue(prefsInfo, CFSTR("prefsID")); + prefsID = isA_CFString(prefsID); + if (prefsID != NULL) { + if (CFStringHasPrefix(prefsID, CFSTR("/")) || + CFStringHasPrefix(prefsID, CFSTR("../")) || + CFStringHasSuffix(prefsID, CFSTR("/..")) || + (CFStringFind(prefsID, CFSTR("/../"), 0).location != kCFNotFound)) { + // if we're trying to escape from the preferences directory + SCLog(TRUE, LOG_ERR, CFSTR("prefsID (%@) not valid"), prefsID); + CFRelease(prefsInfo); + *status = kSCStatusInvalidArgument; + return TRUE; + } + } + + // get preferences session "name" + name = CFDictionaryGetValue(prefsInfo, CFSTR("name")); + if (!isA_CFString(name)) { + SCLog(TRUE, LOG_ERR, CFSTR("session \"name\" not valid")); + CFRelease(prefsInfo); + return FALSE; + } + + // get PID of caller + pid = CFDictionaryGetValue(prefsInfo, CFSTR("PID")); + if (!isA_CFNumber(pid)) { + SCLog(TRUE, LOG_ERR, CFSTR("PID not valid")); + CFRelease(prefsInfo); + return FALSE; + } + + // build [helper] preferences "name" (used for debugging) and estabish + // a preferences session. + prefsName = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@:%@"), pid, name); + prefs = SCPreferencesCreate(NULL, prefsName, prefsID); + CFRelease(prefsName); + CFRelease(prefsInfo); + + __SCHelperSessionSetPreferences(session, prefs); + if (prefs != NULL) { + CFRelease(prefs); + } else { *status = SCError(); } @@ -335,10 +652,10 @@ do_prefs_Open(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = current signature + current preferences */ static Boolean -do_prefs_Access(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_prefs_Access(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { Boolean ok; - SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; + SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session); CFDataRef signature; if (prefs == NULL) { @@ -347,9 +664,10 @@ do_prefs_Access(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) signature = SCPreferencesGetSignature(prefs); if (signature != NULL) { - const void * dictKeys[2]; - const void * dictVals[2]; - CFDictionaryRef replyDict; + const void * dictKeys[2]; + const void * dictVals[2]; + SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; + CFDictionaryRef replyDict; dictKeys[0] = CFSTR("signature"); dictVals[0] = signature; @@ -384,11 +702,12 @@ do_prefs_Access(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = N/A */ static Boolean -do_prefs_Lock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_prefs_Lock(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - CFDataRef clientSignature = (CFDataRef)data; - Boolean ok; - Boolean wait = (info == (void *)FALSE) ? FALSE : TRUE; + CFDataRef clientSignature = (CFDataRef)data; + Boolean ok; + SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session); + Boolean wait = (info == (void *)FALSE) ? FALSE : TRUE; if (prefs == NULL) { return FALSE; @@ -421,16 +740,18 @@ do_prefs_Lock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = new signature */ static Boolean -do_prefs_Commit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_prefs_Commit(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { Boolean ok; - SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; + SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session); if (prefs == NULL) { return FALSE; } if (data != NULL) { + SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs; + if (prefsPrivate->prefs != NULL) { CFRelease(prefsPrivate->prefs); } @@ -463,9 +784,10 @@ do_prefs_Commit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = N/A */ static Boolean -do_prefs_Apply(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_prefs_Apply(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - Boolean ok; + Boolean ok; + SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session); if (prefs == NULL) { return FALSE; @@ -487,9 +809,10 @@ do_prefs_Apply(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = N/A */ static Boolean -do_prefs_Unlock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_prefs_Unlock(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { - Boolean ok; + Boolean ok; + SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session); if (prefs == NULL) { return FALSE; @@ -511,15 +834,16 @@ do_prefs_Unlock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = N/A */ static Boolean -do_prefs_Close(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_prefs_Close(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { + SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session); + if (prefs == NULL) { return FALSE; } - CFRelease(prefs); - prefs = NULL; - + __SCHelperSessionSetPreferences(session, NULL); + *status = -1; return TRUE; } @@ -531,21 +855,30 @@ do_prefs_Close(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) * (out) reply = N/A */ static Boolean -do_prefs_Synchronize(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) +do_prefs_Synchronize(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply) { + SCPreferencesRef prefs = __SCHelperSessionGetPreferences(session); + if (prefs == NULL) { return FALSE; } - + SCPreferencesSynchronize(prefs); *status = kSCStatusOK; return TRUE; } +#pragma mark - +#pragma mark Process commands + + static Boolean -hasAuthorization() +hasAuthorization(SCHelperSessionRef session) { + AuthorizationRef authorization = __SCHelperSessionGetAuthorization(session); + +#if !TARGET_OS_IPHONE AuthorizationFlags flags; AuthorizationItem items[1]; AuthorizationRights rights; @@ -577,16 +910,49 @@ hasAuthorization() if (status != errAuthorizationSuccess) { return FALSE; } +#else // !TARGET_OS_IPHONE + uid_t peer_euid; + gid_t peer_egid; -if (items[0].flags != 0) SCLog(TRUE, LOG_DEBUG, CFSTR("***** success w/flags (%u) != 0"), items[0].flags); + if (authorization == NULL) { + return FALSE; + } + + __SCHelperSessionGetCredentials(session, &peer_euid, &peer_egid); + if ((peer_euid != 0) && (peer_egid != 0)) { + static gid_t mobile_gid = -1; + + /* + * if peer is not user "root" nor group "wheel" then + * we check to see if we are one of the authorized + * callers. + */ + if (mobile_gid == -1) { + char buffer[1024]; + struct group grp; + struct group *grpP; + + if (getgrnam_r("mobile", &grp, buffer, sizeof(buffer), &grpP) == 0) { + mobile_gid = grpP->gr_gid; + } + } + + if (peer_egid != mobile_gid) { + return FALSE; + } + } +#endif // !TARGET_OS_IPHONE + +// if (items[0].flags != 0) SCLog(TRUE, LOG_DEBUG, CFSTR("***** success w/flags (%u) != 0"), items[0].flags); return TRUE; } -typedef Boolean (*helperFunction) (void *info, - CFDataRef data, - uint32_t *status, - CFDataRef *reply); +typedef Boolean (*helperFunction) (SCHelperSessionRef session, + void *info, + CFDataRef data, + uint32_t *status, + CFDataRef *reply); static const struct helper { @@ -610,10 +976,12 @@ static const struct helper { { SCHELPER_MSG_INTERFACE_REFRESH, "INTERFACE refresh", TRUE, do_interface_refresh , NULL }, +#if !TARGET_OS_IPHONE { SCHELPER_MSG_KEYCHAIN_COPY, "KEYCHAIN copy", TRUE, do_keychain_copy , NULL }, { SCHELPER_MSG_KEYCHAIN_EXISTS, "KEYCHAIN exists", TRUE, do_keychain_exists , NULL }, { SCHELPER_MSG_KEYCHAIN_REMOVE, "KEYCHAIN remove", TRUE, do_keychain_remove , NULL }, { SCHELPER_MSG_KEYCHAIN_SET, "KEYCHAIN set", TRUE, do_keychain_set , NULL }, +#endif // !TARGET_OS_IPHONE { SCHELPER_MSG_EXIT, "EXIT", FALSE, do_Exit , NULL } }; @@ -621,7 +989,7 @@ static const struct helper { static int -findHelper(command) +findHelper(uint32_t command) { int i; @@ -635,88 +1003,324 @@ findHelper(command) } -int -main(int argc, char **argv) +static Boolean +process_command(SCHelperSessionRef session, int fd, int *err) { - int err = 0; - Boolean ok = TRUE; + uint32_t command = 0; + CFDataRef data = NULL; + int i; + Boolean ok = FALSE; + CFDataRef reply = NULL; + uint32_t status = kSCStatusOK; + + if (!__SCHelper_rxMessage(fd, &command, &data)) { + SCLog(TRUE, LOG_ERR, CFSTR("no command")); + *err = EIO; + goto done; + } - openlog("SCHelper", LOG_CONS|LOG_PID, LOG_DAEMON); + i = findHelper(command); + if (i == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("received unknown command : %u"), command); + *err = EINVAL; + goto done; + } - if (geteuid() != 0) { - (void)__SCHelper_txMessage(STDOUT_FILENO, EACCES, NULL); - exit(EACCES); + SCLog(debug, LOG_DEBUG, + CFSTR("processing command \"%s\"%s"), + helpers[i].commandName, + (data != NULL) ? " w/data" : ""); + + if (helpers[i].needsAuthorization && !hasAuthorization(session)) { + SCLog(debug, LOG_DEBUG, + CFSTR("command \"%s\" : not authorized"), + helpers[i].commandName); + status = kSCStatusAccessError; } - // send "we are here" message - if (!__SCHelper_txMessage(STDOUT_FILENO, 0, NULL)) { - exit(EIO); + if (status == kSCStatusOK) { + ok = (*helpers[i].func)(session, helpers[i].info, data, &status, &reply); } - while (ok) { - uint32_t command; - CFDataRef data; - int i; - CFDataRef reply; - uint32_t status; + if ((status != -1) || (reply != NULL)) { + SCLog(debug, LOG_DEBUG, + CFSTR("sending status %u%s"), + status, + (reply != NULL) ? " w/reply" : ""); - command = 0; - data = NULL; - if (!__SCHelper_rxMessage(STDIN_FILENO, &command, &data)) { - SCLog(TRUE, LOG_ERR, CFSTR("no command")); - err = EIO; - break; + if (!__SCHelper_txMessage(fd, status, reply)) { + *err = EIO; + ok = FALSE; + goto done; } + } - i = findHelper(command); - if (i == -1) { - SCLog(TRUE, LOG_ERR, CFSTR("received unknown command : %u"), command); - err = EINVAL; - break; - } + done : - SCLog(TRUE, LOG_DEBUG, - CFSTR("processing command \"%s\"%s"), - helpers[i].commandName, - (data != NULL) ? " w/data" : ""); + if (data != NULL) { + CFRelease(data); + } - status = kSCStatusOK; - reply = NULL; + if (reply != NULL) { + CFRelease(reply); + } - if (helpers[i].needsAuthorization && !hasAuthorization()) { - SCLog(TRUE, LOG_DEBUG, - CFSTR("command \"%s\" : not authorized"), - helpers[i].commandName); - status = kSCStatusAccessError; - } + return ok; +} - if (status == kSCStatusOK) { - ok = (*helpers[i].func)(helpers[i].info, data, &status, &reply); - } - SCLog(TRUE, LOG_DEBUG, - CFSTR("sending status %u%s"), - status, - (reply != NULL) ? " w/reply" : ""); +#pragma mark - +#pragma mark Main loop + + +static void +readCallback(CFSocketRef s, + CFSocketCallBackType callbackType, + CFDataRef address, + const void *data, + void *info) +{ + CFSocketNativeHandle fd; + int err = 0; + Boolean ok; + SCHelperSessionRef session = (SCHelperSessionRef)info; + + if (callbackType != kCFSocketReadCallBack) { + SCLog(TRUE, LOG_ERR, CFSTR("readCallback w/callbackType = %d"), callbackType); + return; + } + + fd = CFSocketGetNative(s); + ok = process_command(session, fd, &err); + if (!ok) { + SCLog(debug, LOG_DEBUG, CFSTR("per-session socket : invalidate fd %d"), fd); + CFSocketInvalidate(s); + } + + return; +} + + +static void * +newHelper(void *arg) +{ + CFSocketContext context = { 0, NULL, CFRetain, CFRelease, CFCopyDescription }; + CFSocketNativeHandle fd = (CFSocketNativeHandle)(intptr_t)arg; + CFRunLoopSourceRef rls; + SCHelperSessionRef session; + CFSocketRef sock; + +#if TARGET_OS_IPHONE + uid_t peer_euid; + gid_t peer_egid; +#endif // TARGET_OS_IPHONE + + session = __SCHelperSessionCreate(NULL); +#if TARGET_OS_IPHONE + if (getpeereid(fd, &peer_euid, &peer_egid) == 0) { + __SCHelperSessionSetCredentials(session, peer_euid, peer_egid); + } else { + SCLog(TRUE, LOG_ERR, CFSTR("getpeereid() failed: %s"), strerror(errno)); + } +#endif // TARGET_OS_IPHONE + + context.info = (void *)session; + sock = CFSocketCreateWithNative(NULL, + fd, + kCFSocketReadCallBack, + readCallback, + &context); + CFRelease(session); + + rls = CFSocketCreateRunLoopSource(NULL, sock, 0); + CFRelease(sock); + + CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode); + CFRelease(rls); + + CFRunLoopRun(); + return NULL; +} + + +static void +acceptCallback(CFSocketRef s, + CFSocketCallBackType callbackType, + CFDataRef address, + const void *data, + void *info) +{ + CFSocketNativeHandle fd; + pthread_attr_t tattr; + pthread_t tid; + static int yes = 1; + + if (callbackType != kCFSocketAcceptCallBack) { + SCLog(TRUE, LOG_ERR, CFSTR("acceptCallback w/callbackType = %d"), callbackType); + return; + } + + if ((data == NULL) || + ((fd = *((CFSocketNativeHandle *)data)) == -1)) { + SCLog(TRUE, LOG_ERR, CFSTR("accept w/no FD")); + return; + } + + if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (const void *)&yes, sizeof(yes)) == -1) { + SCLog(TRUE, LOG_ERR, CFSTR("setsockopt(SO_NOSIGPIPE) failed: %s"), strerror(errno)); + return; + } + + // start per-session thread + pthread_attr_init(&tattr); + pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&tattr, 96 * 1024); // each thread gets a 96K stack + pthread_create(&tid, &tattr, newHelper, (void *)(intptr_t)fd); + pthread_attr_destroy(&tattr); - if (!__SCHelper_txMessage(STDOUT_FILENO, status, reply)) { - err = EIO; - break; + return; +} + + +#include + + +static const struct option longopts[] = { + { "debug", no_argument, 0, 'd' }, + { 0, 0, 0, 0 } +}; + + +int +main(int argc, char **argv) +{ + Boolean done = FALSE; + int err = 0; + int i; + launch_data_t l_listeners; + launch_data_t l_msg; + launch_data_t l_reply; + launch_data_t l_sockets; + launch_data_type_t l_type; + int n = 0; + extern int optind; + int opt; + int opti; + + openlog("SCHelper", LOG_CONS|LOG_PID, LOG_DAEMON); + + // process any arguments + while ((opt = getopt_long(argc, argv, "d", longopts, &opti)) != -1) { + switch(opt) { + case 'd': + debug = TRUE; + break; + case 0 : +// if (strcmp(longopts[opti].name, "debug") == 1) { +// } + break; + case '?': + default : + SCLog(TRUE, LOG_ERR, + CFSTR("ignoring unknown or ambiguous command line option")); + break; } + } +// argc -= optind; +// argv += optind; - if (reply != NULL) { - CFRelease(reply); + if (geteuid() != 0) { + SCLog(TRUE, LOG_ERR, CFSTR("%s"), strerror(EACCES)); + exit(EACCES); + } + + main_runLoop = CFRunLoopGetCurrent(); + + l_msg = launch_data_new_string(LAUNCH_KEY_CHECKIN); + l_reply = launch_msg(l_msg); + launch_data_free(l_msg); + l_type = (l_reply != NULL) ? launch_data_get_type(l_reply) : 0; + if (l_type != LAUNCH_DATA_DICTIONARY) { + SCLog(TRUE, LOG_ERR, + CFSTR("SCHelper: error w/launchd " LAUNCH_KEY_CHECKIN " dictionary (%p, %d)"), + l_reply, + l_type); + err = 1; + goto done; + } + + l_sockets = launch_data_dict_lookup(l_reply, LAUNCH_JOBKEY_SOCKETS); + l_type = (l_sockets != NULL) ? launch_data_get_type(l_sockets) : 0; + if (l_type != LAUNCH_DATA_DICTIONARY) { + SCLog(TRUE, LOG_ERR, + CFSTR("SCHelper: error w/" LAUNCH_JOBKEY_SOCKETS " (%p, %d)"), + l_sockets, + l_type); + err = 1; + goto done; + } + + l_listeners = launch_data_dict_lookup(l_sockets, "Listeners"); + l_type = (l_listeners != NULL) ? launch_data_get_type(l_listeners) : 0; + if (l_type != LAUNCH_DATA_ARRAY) { + SCLog(TRUE, LOG_ERR, CFSTR("SCHelper: error w/Listeners (%p, %d)"), + l_listeners, + l_type); + goto done; + } + + n = launch_data_array_get_count(l_listeners); + for (i = 0; i < n; i++) { + CFSocketNativeHandle fd; + launch_data_t l_fd; + CFRunLoopSourceRef rls; + CFSocketRef sock; + + l_fd = launch_data_array_get_index(l_listeners, i); + l_type = (l_fd != NULL) ? launch_data_get_type(l_fd) : 0; + if (l_type != LAUNCH_DATA_FD) { + SCLog(TRUE, LOG_ERR, CFSTR("SCHelper: error w/Listeners[%d] (%p, %d)"), + i, + l_fd, + l_type); + err = 1; + goto done; } + + fd = launch_data_get_fd(l_fd); + sock = CFSocketCreateWithNative(NULL, + fd, + kCFSocketAcceptCallBack, + acceptCallback, + NULL); + rls = CFSocketCreateRunLoopSource(NULL, sock, 0); + CFRunLoopAddSource(main_runLoop, rls, kCFRunLoopDefaultMode); + CFRelease(rls); + CFRelease(sock); } - if (prefs != NULL) { - CFRelease(prefs); + done : + + if (l_reply != NULL) launch_data_free(l_reply); + + if ((err != 0) || (n == 0)) { + exit(err); } - if (authorization != NULL) { - AuthorizationFree(authorization, kAuthorizationFlagDefaults); -// AuthorizationFree(authorization, kAuthorizationFlagDestroyRights); + while (!done) { + SInt32 rlStatus; + + rlStatus = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 15.0, TRUE); + if (rlStatus == kCFRunLoopRunTimedOut) { + pthread_mutex_lock(&sessions_lock); + done = ((sessions != NULL) && + (CFSetGetCount(sessions) == 0) && + (sessions_closed == 0)); + sessions_closed = 0; + pthread_mutex_unlock(&sessions_lock); + } } - exit(err); + exit(EX_OK); } diff --git a/SystemConfiguration.fproj/helper/com.apple.SCHelper-embedded.plist b/SystemConfiguration.fproj/helper/com.apple.SCHelper-embedded.plist new file mode 100644 index 0000000..023d9b4 --- /dev/null +++ b/SystemConfiguration.fproj/helper/com.apple.SCHelper-embedded.plist @@ -0,0 +1,22 @@ + + + + + Label + com.apple.SCHelper + Program + /System/Library/Frameworks/SystemConfiguration.framework/SCHelper + Sockets + + Listeners + + SockFamily + Unix + SockPathMode + 438 + SockPathName + /var/run/SCHelper + + + + diff --git a/SystemConfiguration.fproj/helper/com.apple.SCHelper.plist b/SystemConfiguration.fproj/helper/com.apple.SCHelper.plist new file mode 100644 index 0000000..10dd6df --- /dev/null +++ b/SystemConfiguration.fproj/helper/com.apple.SCHelper.plist @@ -0,0 +1,22 @@ + + + + + Label + com.apple.SCHelper + Program + /System/Library/Frameworks/SystemConfiguration.framework/Resources/SCHelper + Sockets + + Listeners + + SockFamily + Unix + SockPathMode + 438 + SockPathName + /var/run/SCHelper + + + + diff --git a/SystemConfiguration.fproj/update-headers b/SystemConfiguration.fproj/update-headers new file mode 100755 index 0000000..62838ac --- /dev/null +++ b/SystemConfiguration.fproj/update-headers @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +if (!$ENV{"INSTALL_DIR"} or !$ENV{"PUBLIC_HEADERS_FOLDER_PATH"} or !$ENV{"PRIVATE_HEADERS_FOLDER_PATH"}) { + die "Cannot update headers, missing ENV vars\n"; +} + +$DO_SPLIT = ($#ARGV >= 0 and $ARGV[0] eq "split"); + +$API_BASE = $ENV{"INSTALL_DIR"} . "/" . $ENV{"PUBLIC_HEADERS_FOLDER_PATH"}; +$SPI_BASE = $ENV{"INSTALL_DIR"} . "/" . $ENV{"PRIVATE_HEADERS_FOLDER_PATH"}; + +sub clean_INC { + my ($inc) = @_; + + $inc =~ s/#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+.*?\n#else.*?\n//; + $inc =~ s/#endif\s+.*?USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS.*?\n//; + + return $inc; +} + +sub clean_API { + my ($api) = @_; + my ($api_new); + + $api_new = $DO_SPLIT ? $api : clean_INC($api); + $api_new =~ s/(__MAC)_\w+\/\*SPI\*\//\1_NA/g; + $api_new =~ s/(\(__MAC_OS_X_VERSION_MIN_REQUIRED >= \d+\)\/\*SPI\*\/ \|\| )//g; + $api_new =~ s/(__IPHONE)_\w+\/\*SPI\*\//\1_NA/g; + $api_new =~ s/( \|\| \(__IPHONE_OS_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\///g; + + return $api_new; +} + +sub clean_SPI { + my ($spi) = @_; + my ($spi_new); + + $spi_new = clean_INC($spi); + $spi_new =~ s/(__MAC_\w+)\/\*SPI\*\//\1/g; + $api_new =~ s/(\(__MAC_OS_X_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\/( \|\| )/\1\2/g; + $spi_new =~ s/(__IPHONE_\w+)\/\*SPI\*\//\1/g; + $spi_new =~ s/( \|\| )(\(__IPHONE_OS_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\//\1\2/g; + + return $spi_new; +} + +# +# Update .../PrivateHeaders +# + +opendir(HEADERS, $SPI_BASE); +@headers = readdir(HEADERS); +closedir(HEADERS); + +undef $/; +for (@headers) { + next if ($_ eq '.'); + next if ($_ eq '..'); + + $spi_header = $_; + $spi_path = $SPI_BASE . "/" . $spi_header; + next if (! -f $spi_path); + + open(SPI, "<", $spi_path); + $spi = ; + close(SPI); + + $spi_new = clean_SPI($spi); + if ($spi ne $spi_new) { +# printf "cleaning .../PrivateHeaders/%s\n", $spi_header; + open(SPI, ">", $spi_path); + print SPI $spi_new; + close(SPI); + } +} +$/ = "\n"; + +# +# Update .../Headers +# + +opendir(HEADERS, $API_BASE); +@headers = readdir(HEADERS); +closedir(HEADERS); + +undef $/; +for (@headers) { + next if ($_ eq '.'); + next if ($_ eq '..'); + + $api_header = $_; + $api_path = $API_BASE . "/" . $api_header; + next if (! -f $api_path); + + open(API, "<", $api_path); + $api = ; + close(API); + + $api_new = clean_API($api); + if ($api ne $api_new) { +# printf "cleaning .../Headers/%s\n", $api_header; + open(API, ">", $api_path); + print API $api_new; + close(API); + + if ($DO_SPLIT) { + $spi_new = clean_SPI($api); + if ($api_new ne $spi_new) { + if ((($spi_header) = ($api =~ /#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+\s*.*?\n/))) { + if ($api_header eq $spi_header) { + die "API & SPI header not unique: $api_header\n"; + } + } else { + die "Header missing #ifdef/#else/#endif: $api_header\n"; +# $spi_header = $api_header; +# $spi_header =~ s/\.h$/PRIVATE.h/; + } + +# printf " adding .../PrivateHeaders/%s\n", $spi_header; + $spi_path = $SPI_BASE . "/" . $spi_header; + open(SPI, ">", $spi_path); + print SPI $spi_new; + close(SPI); + } + } + } +} +$/ = "\n"; + +exit 0; diff --git a/configd.tproj/_SCD.c b/configd.tproj/_SCD.c index 87b8ade..7a8b084 100644 --- a/configd.tproj/_SCD.c +++ b/configd.tproj/_SCD.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -271,7 +271,7 @@ _removeWatcher(CFNumberRef sessionNum, CFStringRef watchedKey) __private_extern__ void -pushNotifications() +pushNotifications(FILE *_configd_trace) { const void **sessionsToNotify; CFIndex notifyCnt; @@ -300,13 +300,15 @@ pushNotifications() /* * Post notification as mach message */ -#ifdef DEBUG - if (_configd_verbose) { - SCLog(TRUE, LOG_DEBUG, CFSTR("sending mach message notification.")); - SCLog(TRUE, LOG_DEBUG, CFSTR(" port = %d"), storePrivate->notifyPort); - SCLog(TRUE, LOG_DEBUG, CFSTR(" msgid = %d"), storePrivate->notifyPortIdentifier); + if (_configd_trace != NULL) { + SCTrace(TRUE, _configd_trace, + CFSTR("%s : %5d : port = %d, msgid = %d\n"), + "-->port", + storePrivate->server, + storePrivate->notifyPort, + storePrivate->notifyPortIdentifier); } -#endif /* DEBUG */ + _SC_sendMachMessage(storePrivate->notifyPort, storePrivate->notifyPortIdentifier); } @@ -314,13 +316,14 @@ pushNotifications() (storePrivate->notifyFile >= 0)) { ssize_t written; -#ifdef DEBUG - if (_configd_verbose) { - SCLog(TRUE, LOG_DEBUG, CFSTR("sending (UNIX domain) socket notification")); - SCLog(TRUE, LOG_DEBUG, CFSTR(" fd = %d"), storePrivate->notifyFile); - SCLog(TRUE, LOG_DEBUG, CFSTR(" msgid = %d"), storePrivate->notifyFileIdentifier); + if (_configd_trace != NULL) { + SCTrace(TRUE, _configd_trace, + CFSTR("%s : %5d : fd = %d, msgid = %d\n"), + "-->fd ", + storePrivate->server, + storePrivate->notifyFile, + storePrivate->notifyFileIdentifier); } -#endif /* DEBUG */ written = write(storePrivate->notifyFile, &storePrivate->notifyFileIdentifier, @@ -357,33 +360,39 @@ pushNotifications() */ status = pid_for_task(storePrivate->notifySignalTask, &pid); if (status == KERN_SUCCESS) { -#ifdef DEBUG - if (_configd_verbose) { - SCLog(TRUE, LOG_DEBUG, CFSTR("sending signal notification")); - SCLog(TRUE, LOG_DEBUG, CFSTR(" pid = %d"), pid); - SCLog(TRUE, LOG_DEBUG, CFSTR(" signal = %d"), storePrivate->notifySignal); + if (_configd_trace != NULL) { + SCTrace(TRUE, _configd_trace, + CFSTR("%s : %5d : pid = %d, signal = sig%s (%d)\n"), + "-->sig ", + storePrivate->server, + pid, + sys_signame[storePrivate->notifySignal], + storePrivate->notifySignal); } -#endif /* DEBUG */ + if (kill(pid, storePrivate->notifySignal) != 0) { -#ifdef DEBUG - SCLog(_configd_verbose, LOG_DEBUG, CFSTR("could not send signal: %s"), strerror(errno)); -#endif /* DEBUG */ - status = KERN_FAILURE; + if (errno != ESRCH) { + SCLog(TRUE, LOG_ERR, + CFSTR("could not send sig%s to PID %d: %s"), + sys_signame[storePrivate->notifySignal], + pid, + strerror(errno)); + } } } else { mach_port_type_t pt; - if ((mach_port_type(mach_task_self(), storePrivate->notifySignalTask, &pt) == KERN_SUCCESS) && - (pt & MACH_PORT_TYPE_DEAD_NAME)) { - SCLog(_configd_verbose, LOG_DEBUG, CFSTR("could not send signal, process died")); + __MACH_PORT_DEBUG(TRUE, "*** pushNotifications pid_for_task failed: releasing task", storePrivate->notifySignalTask); + if (mach_port_type(mach_task_self(), storePrivate->notifySignalTask, &pt) == KERN_SUCCESS) { + if ((pt & MACH_PORT_TYPE_DEAD_NAME) != 0) { + SCLog(TRUE, LOG_ERR, CFSTR("pushNotifications pid_for_task() failed: %s"), mach_error_string(status)); + } } else { - SCLog(_configd_verbose, LOG_DEBUG, CFSTR("could not send signal: %s"), mach_error_string(status)); + SCLog(TRUE, LOG_ERR, CFSTR("pushNotifications mach_port_type() failed: %s"), mach_error_string(status)); } - } - if (status != KERN_SUCCESS) { /* don't bother with any more attempts */ - (void) mach_port_destroy(mach_task_self(), storePrivate->notifySignalTask); + (void) mach_port_deallocate(mach_task_self(), storePrivate->notifySignalTask); storePrivate->notifySignal = 0; storePrivate->notifySignalTask = TASK_NULL; } diff --git a/configd.tproj/_SCD.h b/configd.tproj/_SCD.h index 56abe72..4b0ea50 100644 --- a/configd.tproj/_SCD.h +++ b/configd.tproj/_SCD.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -187,7 +187,7 @@ __SCDynamicStoreCopyNotifiedKeys (SCDynamicStoreRef store, int __SCDynamicStoreNotifyMachPort (SCDynamicStoreRef store, mach_msg_id_t msgid, - mach_port_t *port); + mach_port_t port); int __SCDynamicStoreNotifyFileDescriptor (SCDynamicStoreRef store, @@ -214,7 +214,7 @@ _removeWatcher (CFNumberRef sessionNum, CFStringRef watchedKey); void -pushNotifications (void); +pushNotifications (FILE *_configd_trace); __END_DECLS diff --git a/configd.tproj/_configadd.c b/configd.tproj/_configadd.c index 87bfe7b..e1a0168 100644 --- a/configd.tproj/_configadd.c +++ b/configd.tproj/_configadd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -115,7 +115,7 @@ _configadd(mach_port_t server, { CFStringRef key = NULL; /* key (un-serialized) */ CFDataRef data = NULL; /* data (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; *sc_status = kSCStatusOK; @@ -139,6 +139,7 @@ _configadd(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; @@ -171,7 +172,7 @@ _configadd_s(mach_port_t server, { CFDataRef data = NULL; /* data (un-serialized) */ CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; SCDynamicStorePrivateRef storePrivate; Boolean useSessionKeys; @@ -196,6 +197,7 @@ _configadd_s(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; diff --git a/configd.tproj/_configclose.c b/configd.tproj/_configclose.c index 1e0942b..5b817f2 100644 --- a/configd.tproj/_configclose.c +++ b/configd.tproj/_configclose.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003, 2004, 2006-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -125,6 +125,7 @@ __SCDynamicStoreClose(SCDynamicStoreRef *store, Boolean internal) removeAllKeys(*store, TRUE); // patterns /* Remove/cancel any outstanding notification requests. */ + __MACH_PORT_DEBUG(storePrivate->notifyPort != MACH_PORT_NULL, "*** __SCDynamicStoreClose", storePrivate->notifyPort); (void) __SCDynamicStoreNotifyCancel(*store); /* Remove any session keys */ @@ -182,9 +183,13 @@ __SCDynamicStoreClose(SCDynamicStoreRef *store, Boolean internal) if (mySession->serverRunLoopSource) { CFRunLoopSourceInvalidate(mySession->serverRunLoopSource); CFRelease(mySession->serverRunLoopSource); + mySession->serverRunLoopSource = NULL; + } + if (mySession->serverPort != NULL) { + CFMachPortInvalidate(mySession->serverPort); + CFRelease(mySession->serverPort); + mySession->serverPort = NULL; } - CFMachPortInvalidate(mySession->serverPort); - CFRelease(mySession->serverPort); storePrivate->server = MACH_PORT_NULL; CFRelease(*store); @@ -208,16 +213,24 @@ _configclose(mach_port_t server, int *sc_status) /* * Close the session. */ + __MACH_PORT_DEBUG(TRUE, "*** _configclose", server); *sc_status = __SCDynamicStoreClose(&mySession->store, FALSE); if (*sc_status != kSCStatusOK) { + SCLog(TRUE, LOG_ERR, + CFSTR("_configclose __SCDynamicStoreClose() failed, status = %s"), + SCErrorString(*sc_status)); return KERN_SUCCESS; } + __MACH_PORT_DEBUG(TRUE, "*** _configclose (after __SCDynamicStoreClose)", server); /* - * Remove send and receive right + * Remove our receive right. + * + * Note: there is no need to cancel the notification request because the + * kernel will have no way to deliver the notification once the + * receive right has been removed. */ - mach_port_mod_refs(mach_task_self(), mySession->key, MACH_PORT_RIGHT_SEND , -1); - mach_port_mod_refs(mach_task_self(), mySession->key, MACH_PORT_RIGHT_RECEIVE, -1); + (void) mach_port_mod_refs(mach_task_self(), server, MACH_PORT_RIGHT_RECEIVE, -1); /* * Remove the session entry. diff --git a/configd.tproj/_configget.c b/configd.tproj/_configget.c index 52525e3..13bc53f 100644 --- a/configd.tproj/_configget.c +++ b/configd.tproj/_configget.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -77,7 +77,7 @@ _configget(mach_port_t server, ) { CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; Boolean ok; CFDataRef value; @@ -95,6 +95,7 @@ _configget(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; @@ -235,7 +236,7 @@ _configget_m(mach_port_t server, { CFDictionaryRef dict = NULL; /* keys/values (un-serialized) */ CFArrayRef keys = NULL; /* keys (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; Boolean ok; CFArrayRef patterns = NULL; /* patterns (un-serialized) */ @@ -272,6 +273,7 @@ _configget_m(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; diff --git a/configd.tproj/_configlist.c b/configd.tproj/_configlist.c index 9201f65..cbc7e36 100644 --- a/configd.tproj/_configlist.c +++ b/configd.tproj/_configlist.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -108,7 +108,7 @@ _configlist(mach_port_t server, ) { CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; Boolean ok; CFArrayRef subKeys; /* array of CFStringRef's */ @@ -126,6 +126,7 @@ _configlist(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; diff --git a/configd.tproj/_configlock.c b/configd.tproj/_configlock.c index 9ed185b..29b9726 100644 --- a/configd.tproj/_configlock.c +++ b/configd.tproj/_configlock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -58,7 +58,7 @@ __SCDynamicStoreLock(SCDynamicStoreRef store, Boolean recursive) /* check credentials */ mySession = getSession(storePrivate->server); - if (mySession->callerEUID != 0) { + if (!hasWriteAccess(mySession)) { return kSCStatusAccessError; } diff --git a/configd.tproj/_confignotify.c b/configd.tproj/_confignotify.c index 26fb1f4..ab26edf 100644 --- a/configd.tproj/_confignotify.c +++ b/configd.tproj/_confignotify.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -98,7 +98,7 @@ _confignotify(mach_port_t server, ) { CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; /* un-serialize the key */ if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) { @@ -111,6 +111,7 @@ _confignotify(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; diff --git a/configd.tproj/_configopen.c b/configd.tproj/_configopen.c index 1d40698..5f70aeb 100644 --- a/configd.tproj/_configopen.c +++ b/configd.tproj/_configopen.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -163,19 +163,10 @@ _configopen(mach_port_t server, */ mySession = addSession(MACH_PORT_NULL, openMPCopyDescription); *newServer = mySession->key; + __MACH_PORT_DEBUG(TRUE, "*** _configopen (after addSession)", *newServer); - /* - * get the credentials associated with the caller. - */ - audit_token_to_au32(audit_token, - NULL, // auidp - &mySession->callerEUID, // euid - NULL, // egid - NULL, // ruid - NULL, // rgid - NULL, // pid - NULL, // asid - NULL); // tid + /* save the audit_token in case we need to check the callers credentials */ + mySession->auditToken = audit_token; /* Create and add a run loop source for the port */ mySession->serverRunLoopSource = CFMachPortCreateRunLoopSource(NULL, mySession->serverPort, 0); @@ -195,6 +186,7 @@ _configopen(mach_port_t server, /* * Make the server port accessible to the framework routines. + * ... and be sure to clear before calling CFRelease(store) */ storePrivate->server = *newServer; @@ -214,18 +206,17 @@ _configopen(mach_port_t server, MACH_MSG_TYPE_MAKE_SEND_ONCE, &oldNotify); if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("_configopen() mach_port_request_notification() failed: %s"), mach_error_string(status)); + SCLog(TRUE, LOG_ERR, CFSTR("_configopen() mach_port_request_notification() failed: %s"), mach_error_string(status)); cleanupSession(*newServer); *newServer = MACH_PORT_NULL; *sc_status = kSCStatusFailed; goto done; } + __MACH_PORT_DEBUG(TRUE, "*** _configopen (after mach_port_request_notification)", *newServer); -#ifdef DEBUG if (oldNotify != MACH_PORT_NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("_configopen(): why is oldNotify != MACH_PORT_NULL?")); + SCLog(TRUE, LOG_ERR, CFSTR("_configopen(): oldNotify != MACH_PORT_NULL")); } -#endif /* DEBUG */ /* * Save the name of the calling application / plug-in with the session data. @@ -245,6 +236,12 @@ _configopen(mach_port_t server, CFRelease(newInfo); CFRelease(sessionKey); + /* + * Note: at this time we should be holding ONE send right and + * ONE receive right to the server. The send right is + * moved to the caller. + */ + done : if (name != NULL) CFRelease(name); diff --git a/configd.tproj/_configremove.c b/configd.tproj/_configremove.c index 33e8b57..9bb06b8 100644 --- a/configd.tproj/_configremove.c +++ b/configd.tproj/_configremove.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -137,7 +137,7 @@ _configremove(mach_port_t server, ) { CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; /* un-serialize the key */ if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) { @@ -150,6 +150,7 @@ _configremove(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; diff --git a/configd.tproj/_configset.c b/configd.tproj/_configset.c index 3fda0fe..a15b3ec 100644 --- a/configd.tproj/_configset.c +++ b/configd.tproj/_configset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -234,7 +234,7 @@ _configset(mach_port_t server, { CFDataRef data = NULL; /* data (un-serialized) */ CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; *sc_status = kSCStatusOK; @@ -257,6 +257,7 @@ _configset(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; @@ -397,7 +398,7 @@ _configset_m(mach_port_t server, int *sc_status) { CFDictionaryRef dict = NULL; /* key/value dictionary (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; CFArrayRef notify = NULL; /* keys to notify (un-serialized) */ CFArrayRef remove = NULL; /* keys to remove (un-serialized) */ @@ -443,6 +444,7 @@ _configset_m(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { /* you must have an open session to play */ *sc_status = kSCStatusNoStoreSession; diff --git a/configd.tproj/_configtouch.c b/configd.tproj/_configtouch.c index 242f8ef..fb30131 100644 --- a/configd.tproj/_configtouch.c +++ b/configd.tproj/_configtouch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -39,7 +39,7 @@ int __SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key) { SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store; - int sc_status; + int sc_status = kSCStatusOK; CFDataRef value; if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) { @@ -105,7 +105,7 @@ __SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key) */ __SCDynamicStoreUnlock(store, TRUE); - return kSCStatusOK; + return sc_status; } @@ -118,7 +118,7 @@ _configtouch(mach_port_t server, ) { CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; /* un-serialize the key */ if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) { @@ -131,6 +131,7 @@ _configtouch(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; diff --git a/configd.tproj/_notifyadd.c b/configd.tproj/_notifyadd.c index 90616fd..8eebbbb 100644 --- a/configd.tproj/_notifyadd.c +++ b/configd.tproj/_notifyadd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -126,7 +126,7 @@ _notifyadd(mach_port_t server, ) { CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; /* un-serialize the key */ if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) { @@ -139,6 +139,7 @@ _notifyadd(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; @@ -276,7 +277,7 @@ _notifyset(mach_port_t server, ) { CFArrayRef keys = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; CFArrayRef patterns = NULL; /* patterns (un-serialized) */ *sc_status = kSCStatusOK; @@ -309,6 +310,7 @@ _notifyset(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { /* you must have an open session to play */ *sc_status = kSCStatusNoStoreSession; diff --git a/configd.tproj/_notifycancel.c b/configd.tproj/_notifycancel.c index ba77aa0..36311c7 100644 --- a/configd.tproj/_notifycancel.c +++ b/configd.tproj/_notifycancel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -47,7 +47,8 @@ __SCDynamicStoreNotifyCancel(SCDynamicStoreRef store) * cleanup any mach port based notifications. */ if (storePrivate->notifyPort != MACH_PORT_NULL) { - (void) mach_port_destroy(mach_task_self(), storePrivate->notifyPort); + __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreNotifyCancel (notify port)", storePrivate->notifyPort); + (void) mach_port_deallocate(mach_task_self(), storePrivate->notifyPort); storePrivate->notifyPort = MACH_PORT_NULL; } @@ -64,7 +65,8 @@ __SCDynamicStoreNotifyCancel(SCDynamicStoreRef store) * cleanup any signal notifications. */ if (storePrivate->notifySignal > 0) { - (void) mach_port_destroy(mach_task_self(), storePrivate->notifySignalTask); + __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreNotifyCancel (signal)", storePrivate->notifySignalTask); + (void) mach_port_deallocate(mach_task_self(), storePrivate->notifySignalTask); storePrivate->notifySignal = 0; storePrivate->notifySignalTask = TASK_NULL; } @@ -102,6 +104,9 @@ _notifycancel(mach_port_t server, return KERN_SUCCESS; } + __MACH_PORT_DEBUG(((SCDynamicStorePrivateRef)mySession->store)->notifyPort != MACH_PORT_NULL, + "*** _notifycancel", + ((SCDynamicStorePrivateRef)mySession->store)->notifyPort); *sc_status = __SCDynamicStoreNotifyCancel(mySession->store); return KERN_SUCCESS; } diff --git a/configd.tproj/_notifyremove.c b/configd.tproj/_notifyremove.c index 346beb0..e77c777 100644 --- a/configd.tproj/_notifyremove.c +++ b/configd.tproj/_notifyremove.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -102,7 +102,7 @@ _notifyremove(mach_port_t server, ) { CFStringRef key = NULL; /* key (un-serialized) */ - serverSessionRef mySession = getSession(server); + serverSessionRef mySession; /* un-serialize the key */ if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) { @@ -115,6 +115,7 @@ _notifyremove(mach_port_t server, goto done; } + mySession = getSession(server); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ goto done; diff --git a/configd.tproj/_notifyviafd.c b/configd.tproj/_notifyviafd.c index 7c1201f..870813c 100644 --- a/configd.tproj/_notifyviafd.c +++ b/configd.tproj/_notifyviafd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -102,8 +103,7 @@ _notifyviafd(mach_port_t server, serverSessionRef mySession = getSession(server); int nbioYes; int sock; - kern_return_t status; - SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)mySession->store; + SCDynamicStorePrivateRef storePrivate; struct sockaddr_un un; /* @@ -112,13 +112,7 @@ _notifyviafd(mach_port_t server, /* validate the UNIX domain socket path */ if (pathLen > (sizeof(un.sun_path) - 1)) { SCLog(TRUE, LOG_NOTICE, CFSTR("_notifyviafd(): domain socket path length too long!")); - status = vm_deallocate(mach_task_self(), (vm_address_t)pathRef, pathLen); -#ifdef DEBUG - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd vm_deallocate() failed: %s"), mach_error_string(status)); - /* non-fatal???, proceed */ - } -#endif /* DEBUG */ + (void) vm_deallocate(mach_task_self(), (vm_address_t)pathRef, pathLen); *sc_status = kSCStatusFailed; return KERN_SUCCESS; } @@ -127,18 +121,30 @@ _notifyviafd(mach_port_t server, un.sun_family = AF_UNIX; bcopy(pathRef, un.sun_path, pathLen); un.sun_path[pathLen] = '\0'; - status = vm_deallocate(mach_task_self(), (vm_address_t)pathRef, pathLen); -#ifdef DEBUG - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd vm_deallocate() failed: %s"), mach_error_string(status)); - /* non-fatal???, proceed */ - } -#endif /* DEBUG */ + (void) vm_deallocate(mach_task_self(), (vm_address_t)pathRef, pathLen); if (mySession == NULL) { *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ return KERN_SUCCESS; } + storePrivate = (SCDynamicStorePrivateRef)mySession->store; + + /* check permissions */ + if (!hasRootAccess(mySession)) { + struct stat statbuf; + + bzero(&statbuf, sizeof(statbuf)); + if (stat(un.sun_path, &statbuf) == -1) { + *sc_status = errno; + SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd stat() failed: %s"), strerror(errno)); + return KERN_SUCCESS; + } + if (mySession->callerEUID != statbuf.st_uid) { + *sc_status = kSCStatusAccessError; + SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd permissions error")); + return KERN_SUCCESS; + } + } /* do common sanity checks, get socket */ *sc_status = __SCDynamicStoreNotifyFileDescriptor(mySession->store, identifier, &sock); @@ -150,29 +156,25 @@ _notifyviafd(mach_port_t server, /* establish the connection, get ready for a read() */ if (connect(sock, (struct sockaddr *)&un, sizeof(un)) == -1) { + *sc_status = errno; SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd connect() failed: %s"), strerror(errno)); (void) close(sock); - storePrivate->notifyStatus = NotifierNotRegistered; - storePrivate->notifyFile = -1; - *sc_status = kSCStatusFailed; return KERN_SUCCESS; } - (void) unlink(un.sun_path); - bufSiz = sizeof(storePrivate->notifyFileIdentifier); if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &bufSiz, sizeof(bufSiz)) == -1) { + *sc_status = errno; SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd setsockopt() failed: %s"), strerror(errno)); (void) close(sock); - *sc_status = kSCStatusFailed; return KERN_SUCCESS; } nbioYes = 1; if (ioctl(sock, FIONBIO, &nbioYes) == -1) { + *sc_status = errno; SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd ioctl(,FIONBIO,) failed: %s"), strerror(errno)); (void) close(sock); - *sc_status = kSCStatusFailed; return KERN_SUCCESS; } diff --git a/configd.tproj/_notifyviaport.c b/configd.tproj/_notifyviaport.c index 906fe14..8456108 100644 --- a/configd.tproj/_notifyviaport.c +++ b/configd.tproj/_notifyviaport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -38,7 +38,7 @@ __private_extern__ int __SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier, - mach_port_t *port) + mach_port_t port) { SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store; CFStringRef sessionKey; @@ -53,7 +53,7 @@ __SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, return kSCStatusNotifierActive; } - if (*port == MACH_PORT_NULL) { + if (port == MACH_PORT_NULL) { /* sorry, you must specify a valid mach port */ return kSCStatusInvalidArgument; } @@ -87,27 +87,34 @@ _notifyviaport(mach_port_t server, int *sc_status ) { - serverSessionRef mySession = getSession(server); - SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)mySession->store; + serverSessionRef mySession = getSession(server); + SCDynamicStorePrivateRef storePrivate; if (mySession == NULL) { - *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ + /* sorry, you must have an open session to play */ + *sc_status = kSCStatusNoStoreSession; + if (port != MACH_PORT_NULL) { + (void) mach_port_deallocate(mach_task_self(), port); + } return KERN_SUCCESS; } - - if (storePrivate->notifyPort != MACH_PORT_NULL) { - // destroying [old] callback mach port - (void) mach_port_destroy(mach_task_self(), storePrivate->notifyPort); + storePrivate = (SCDynamicStorePrivateRef)mySession->store; + + *sc_status = __SCDynamicStoreNotifyMachPort(mySession->store, identifier, port); + if (*sc_status != kSCStatusOK) { + // if we can't enable the notification, release the provided callback port + if (port != MACH_PORT_NULL) { + __MACH_PORT_DEBUG(TRUE, "*** _notifyviaport __SCDynamicStoreNotifyMachPort failed: releasing port", port); + (void) mach_port_deallocate(mach_task_self(), port); + } + return KERN_SUCCESS; } - *sc_status = __SCDynamicStoreNotifyMachPort(mySession->store, identifier, &port); - - if (*sc_status == kSCStatusOK) { - /* save notification port, requested identifier, and set notifier active */ - storePrivate->notifyStatus = Using_NotifierInformViaMachPort; - storePrivate->notifyPort = port; - storePrivate->notifyPortIdentifier = identifier; - } + /* save notification port, requested identifier, and set notifier active */ + __MACH_PORT_DEBUG(TRUE, "*** _notifyviaport", port); + storePrivate->notifyStatus = Using_NotifierInformViaMachPort; + storePrivate->notifyPort = port; + storePrivate->notifyPortIdentifier = identifier; return KERN_SUCCESS; } diff --git a/configd.tproj/_notifyviasignal.c b/configd.tproj/_notifyviasignal.c index a31dcb5..4021c40 100644 --- a/configd.tproj/_notifyviasignal.c +++ b/configd.tproj/_notifyviasignal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -96,84 +96,40 @@ _notifyviasignal(mach_port_t server, serverSessionRef mySession = getSession(server); pid_t pid; kern_return_t status; - SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)mySession->store; -#ifdef NOTYET - mach_port_t oldNotify; -#endif /* NOTYET */ - - status = pid_for_task(task, &pid); - if (status != KERN_SUCCESS) { - *sc_status = kSCStatusFailed; /* could not determine pid for task */ - return KERN_SUCCESS; - } + SCDynamicStorePrivateRef storePrivate; if (mySession == NULL) { - *sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */ - return KERN_SUCCESS; - } - - *sc_status = __SCDynamicStoreNotifySignal(mySession->store, pid, sig); - if (*sc_status != kSCStatusOK) { + /* sorry, you must have an open session to play */ + *sc_status = kSCStatusNoStoreSession; if (task != TASK_NULL) { - (void) mach_port_destroy(mach_task_self(), task); + (void) mach_port_deallocate(mach_task_self(), task); } return KERN_SUCCESS; } - -#ifdef DEBUG - { mach_port_type_t pt; - - status = mach_port_type(mach_task_self(), task, &pt); - if (status == MACH_MSG_SUCCESS) { - char rights[8], *rp = &rights[0]; - - if (pt & MACH_PORT_TYPE_SEND) - *rp++ = 'S'; - if (pt & MACH_PORT_TYPE_RECEIVE) - *rp++ = 'R'; - if (pt & MACH_PORT_TYPE_SEND_ONCE) - *rp++ = 'O'; - if (pt & MACH_PORT_TYPE_PORT_SET) - *rp++ = 'P'; - if (pt & MACH_PORT_TYPE_DEAD_NAME) - *rp++ = 'D'; - *rp = '\0'; - - SCLog(_configd_verbose, LOG_DEBUG, CFSTR("Task %d, port rights = %s"), task, rights); + storePrivate = (SCDynamicStorePrivateRef)mySession->store; + + if (task != TASK_NULL) { + status = pid_for_task(task, &pid); + if (status != KERN_SUCCESS) { + /* could not determine pid for task */ + *sc_status = kSCStatusFailed; + (void) mach_port_deallocate(mach_task_self(), task); + return KERN_SUCCESS; } - } -#endif /* DEBUG */ - -#ifdef NOTYET - /* Request a notification when/if the client dies */ - status = mach_port_request_notification(mach_task_self(), - task, - MACH_NOTIFY_DEAD_NAME, - 1, - task, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - &oldNotify); - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviasignal mach_port_request_notification() failed: %s"), mach_error_string(status)); - *sc_status = kSCStatusFailed; + } else { + /* sorry, you must specify a valid task */ + *sc_status = kSCStatusInvalidArgument; return KERN_SUCCESS; } -#ifdef NOTYET_DEBUG - if (oldNotify != MACH_PORT_NULL) { - SCLog(TRUE, LOG_ERR, CFSTR("_notifyviasignal(): why is oldNotify != MACH_PORT_NULL?")); - } -#endif /* NOTYET_DEBUG */ - - // add task notification port to the server's port set - status = mach_port_move_member(mach_task_self(), task, server_ports); - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviasignal mach_port_move_member() failed: %s"), mach_error_string(status)); - *sc_status = kSCStatusFailed; + *sc_status = __SCDynamicStoreNotifySignal(mySession->store, pid, sig); + if (*sc_status != kSCStatusOK) { + __MACH_PORT_DEBUG(TRUE, "*** _notifyviasignal __SCDynamicStoreNotifySignal failed: releasing task)", task); + (void) mach_port_deallocate(mach_task_self(), task); return KERN_SUCCESS; } -#endif /* NOTYET */ + __MACH_PORT_DEBUG(TRUE, "*** _notifyviasignal", task); storePrivate->notifyStatus = Using_NotifierInformViaSignal; storePrivate->notifySignal = sig; storePrivate->notifySignalTask = task; diff --git a/configd.tproj/_snapshot.c b/configd.tproj/_snapshot.c index 8452da2..4459095 100644 --- a/configd.tproj/_snapshot.c +++ b/configd.tproj/_snapshot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -136,7 +136,7 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store) /* check credentials */ mySession = getSession(storePrivate->server); - if (mySession->callerEUID != 0) { + if (!hasRootAccess(mySession)) { return kSCStatusAccessError; } @@ -157,6 +157,7 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store) SCPrint(TRUE, f, CFSTR("Plug-in thread :\n\n")); SCPrint(TRUE, f, CFSTR("%@\n"), plugin_runLoop); } + listSessions(f); (void) fclose(f); /* Save a snapshot of the "store" data */ diff --git a/configd.tproj/com.apple.configd.plist b/configd.tproj/com.apple.configd.plist index 4a228fe..50243de 100644 --- a/configd.tproj/com.apple.configd.plist +++ b/configd.tproj/com.apple.configd.plist @@ -1,11 +1,15 @@ - + + EnableTransactions + KeepAlive Label com.apple.configd + MachExceptionHandler + com.apple.ReportCrash.DirectoryService MachServices com.apple.SystemConfiguration.configd @@ -13,7 +17,9 @@ ProgramArguments - /usr/sbin/configd + /usr/libexec/configd + Umask + 18 diff --git a/configd.tproj/configd.8 b/configd.tproj/configd.8 index 12df9c6..1cb36da 100644 --- a/configd.tproj/configd.8 +++ b/configd.tproj/configd.8 @@ -66,8 +66,6 @@ At the present time, the majority of the configuration agents (or bundles) hoste are used to establish and maintain the network configuration. These agents include: .Pp -.Ss ATconfig -This bundle is responsible for establishing and maintaining the AppleTalk network configuration on the system. .Ss KernelEventMonitor This bundle is responsible for monitoring kernel events and conveying changes to the network state (e.g. link status) to other configuration agents and interested applications. .Ss InterfaceNamer @@ -83,7 +81,7 @@ This agent is responsible for establishing and maintaining the primary network s .Ss LinkConfiguration This agent is responsible for establishing and maintaining the media type, media options, and MTU for ethernet interfaces. .Ss PreferencesMonitor -This agent is responsible for conveying the network configuration preferences specified by the administrator to the various configuration agents (AppleTalk, IPv4, IPv6, ...). +This agent is responsible for conveying the network configuration preferences specified by the administrator to the various configuration agents (IPv4, IPv6, ...). .Ss PPPController This agent is responsible for establishing and maintaining PPP connections on the system. .Sh FILES diff --git a/configd.tproj/configd.h b/configd.tproj/configd.h index ffb79c2..ce441fa 100644 --- a/configd.tproj/configd.h +++ b/configd.tproj/configd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003, 2006, 2007 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -54,6 +54,7 @@ extern Boolean _configd_verbose; /* TRUE if verbose logging enabled */ extern FILE *_configd_trace; /* non-NULL if tracing enabled */ extern CFMutableSetRef _plugins_exclude; /* bundle identifiers to exclude from loading */ +extern Boolean _plugins_fork; /* TRUE if plugins should be exec'd in their own process */ extern CFMutableSetRef _plugins_verbose; /* bundle identifiers to enable verbose logging */ __BEGIN_DECLS diff --git a/configd.tproj/configd.m b/configd.tproj/configd.m index b115bcb..9a6958e 100644 --- a/configd.tproj/configd.m +++ b/configd.tproj/configd.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include "configd.h" #include "configd_server.h" @@ -60,6 +62,9 @@ FILE *_configd_trace = NULL; /* non-NULL if tracing enabled */ __private_extern__ CFMutableSetRef _plugins_exclude = NULL; /* bundle identifiers to exclude from loading */ +__private_extern__ +Boolean _plugins_fork = FALSE; /* TRUE if plugins should be exec'd in their own process */ + __private_extern__ CFMutableSetRef _plugins_verbose = NULL; /* bundle identifiers to enable verbose logging */ @@ -94,59 +99,6 @@ usage(const char *prog) } -static void -allow_crash_reports(void) -{ - mach_msg_type_number_t i; - exception_mask_t masks[EXC_TYPES_COUNT]; - mach_msg_type_number_t n_masks = 0; - mach_port_t new_exception_port = MACH_PORT_NULL; - exception_port_t old_handlers[EXC_TYPES_COUNT]; - exception_behavior_t old_behaviors[EXC_TYPES_COUNT]; - thread_state_flavor_t old_flavors[EXC_TYPES_COUNT]; - kern_return_t status; - - status = bootstrap_look_up(bootstrap_port, "com.apple.ReportCrash.DirectoryService", &new_exception_port); - if (status != BOOTSTRAP_SUCCESS) { - SCLog(TRUE, LOG_ERR, - CFSTR("allow_crash_reports bootstrap_look_up() failed: %s"), - bootstrap_strerror(status)); - return; - } - - // get information about the original crash exception port for the task - status = task_get_exception_ports(mach_task_self(), - EXC_MASK_CRASH, - masks, - &n_masks, - old_handlers, - old_behaviors, - old_flavors); - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_ERR, - CFSTR("allow_crash_reports task_get_exception_ports() failed: %s"), - mach_error_string(status)); - return; - } - - // replace the original crash exception port with our new port - for (i = 0; i < n_masks; i++) { - status = task_set_exception_ports(mach_task_self(), - masks[i], - new_exception_port, - old_behaviors[i], - old_flavors[i]); - if (status != KERN_SUCCESS) { - SCLog(TRUE, LOG_ERR, - CFSTR("allow_crash_reports task_set_exception_ports() failed: %s"), - mach_error_string(status)); - } - } - - return; -} - - static void catcher(int signum) { @@ -162,7 +114,7 @@ catcher(int signum) * such, let's also push any remaining log * messages to stdout/stderr. */ - _sc_log++; + _sc_log = 2; } /* @@ -330,8 +282,9 @@ main(int argc, char * const argv[]) , NULL , termMPCopyDescription }; - Boolean enableRestart = (argc <= 1); /* only if there are no arguments */ Boolean forceForeground = FALSE; + Boolean forcePlugin = FALSE; + int64_t is_launchd_job = 0; mach_port_limits_t limits; Boolean loadBundles = TRUE; struct sigaction nact; @@ -339,7 +292,6 @@ main(int argc, char * const argv[]) extern int optind; const char *prog = argv[0]; CFRunLoopSourceRef rls; - mach_port_t service_port = MACH_PORT_NULL; kern_return_t status; CFStringRef str; const char *testBundle = NULL; @@ -349,7 +301,7 @@ main(int argc, char * const argv[]) /* process any arguments */ - while ((opt = getopt_long(argc, argv, "bB:dt:vV:", longopts, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "bB:dt:vV:f", longopts, NULL)) != -1) { switch(opt) { case 'b': loadBundles = FALSE; @@ -377,23 +329,16 @@ main(int argc, char * const argv[]) CFRelease(str); } break; + case 'f': + _plugins_fork = TRUE; + break; case '?': default : usage(prog); } } - argc -= optind; - argv += optind; - - /* - * display an error if configd is already running and we are - * not solely executing/testing a bundle. - */ - if (testBundle == NULL) { - if (server_active(&service_port)) { - exit (EX_UNAVAILABLE); - } - } +// argc -= optind; +// argv += optind; /* check credentials */ if (getuid() != 0) { @@ -401,7 +346,16 @@ main(int argc, char * const argv[]) exit (EX_NOPERM); } - if (!forceForeground && (service_port == MACH_PORT_NULL)) { + /* check if we have been started by launchd */ + vproc_swap_integer(NULL, VPROC_GSK_IS_MANAGED, NULL, &is_launchd_job); + + /* ensure that forked plugins behave */ + if ((testBundle != NULL) && (getenv("__FORKED_PLUGIN__") != NULL)) { + forcePlugin = TRUE; + } + + /* if needed, daemonize */ + if (!forceForeground && !is_launchd_job) { /* * if we haven't been asked to run in the foreground * and have not been started by launchd (i.e. we're @@ -423,12 +377,12 @@ main(int argc, char * const argv[]) * close file descriptors, establish stdin/stdout/stderr, * setup logging. */ - if (!forceForeground) { + if (!forceForeground || forcePlugin) { int facility = LOG_DAEMON; int logopt = LOG_CONS|LOG_NDELAY|LOG_PID; struct stat statbuf; - if (service_port == MACH_PORT_NULL) { + if (!is_launchd_job && !forcePlugin) { init_fds(); } @@ -445,9 +399,6 @@ main(int argc, char * const argv[]) _sc_log = FALSE; /* redirect SCLog() to stdout/stderr */ } - /* enable crash reporting */ - allow_crash_reports(); - /* check/enable trace logging */ set_trace(); @@ -508,9 +459,9 @@ main(int argc, char * const argv[]) if (testBundle == NULL) { /* initialize primary (store management) thread */ - server_init(service_port, enableRestart); + server_init(); - if (!forceForeground && (service_port == MACH_PORT_NULL)) { + if (!forceForeground && !is_launchd_job) { /* synchronize with parent process */ kill(getppid(), SIGTERM); } diff --git a/configd.tproj/configd_server.c b/configd.tproj/configd_server.c index ef9fb13..6b2af16 100644 --- a/configd.tproj/configd_server.c +++ b/configd.tproj/configd_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -58,9 +58,6 @@ extern boolean_t shared_dns_info_server(mach_msg_header_t *, mach_msg_header_t /* configd server port (for new session requests) */ static CFMachPortRef configd_port = NULL; -/* priviledged bootstrap port (for registering/unregistering w/launchd) */ -static mach_port_t priv_bootstrap_port = MACH_PORT_NULL; - __private_extern__ boolean_t config_demux(mach_msg_header_t *request, mach_msg_header_t *reply) @@ -204,46 +201,6 @@ configdCallback(CFMachPortRef port, void *msg, CFIndex size, void *info) } -__private_extern__ -boolean_t -server_active(mach_port_t *restart_service_port) -{ - char *service_name; - kern_return_t status; - - service_name = getenv("SCD_SERVER"); - if (!service_name) { - service_name = SCD_SERVER; - } - - /* Check "configd" server status */ - status = bootstrap_check_in(bootstrap_port, service_name, restart_service_port); - switch (status) { - case BOOTSTRAP_SUCCESS : - /* if we are being restarted by launchd */ - priv_bootstrap_port = bootstrap_port; - break; - case BOOTSTRAP_SERVICE_ACTIVE : - case BOOTSTRAP_NOT_PRIVILEGED : - /* if another instance of the server is active (or starting) */ - fprintf(stderr, "'%s' server already active\n", - service_name); - return TRUE; - case BOOTSTRAP_UNKNOWN_SERVICE : - /* if the server is not currently registered/active */ - *restart_service_port = MACH_PORT_NULL; - break; - default : - fprintf(stderr, - "bootstrap_check_in() failed: %s\n", - bootstrap_strerror(status)); - exit (EX_UNAVAILABLE); - } - - return FALSE; -} - - static CFStringRef serverMPCopyDescription(const void *info) { @@ -253,102 +210,40 @@ serverMPCopyDescription(const void *info) __private_extern__ void -server_init(mach_port_t restart_service_port, - Boolean enableRestart) +server_init() { serverSessionRef mySession; CFRunLoopSourceRef rls; char *service_name; - mach_port_t service_port = restart_service_port; + mach_port_t service_port = MACH_PORT_NULL; kern_return_t status; - mach_port_t unpriv_bootstrap_port; service_name = getenv("SCD_SERVER"); if (!service_name) { service_name = SCD_SERVER; } - if (service_port == MACH_PORT_NULL) { - mach_port_t service_send_port; - - /* Check "configd" server status */ - status = bootstrap_check_in(bootstrap_port, service_name, &service_port); - switch (status) { - case BOOTSTRAP_SUCCESS : - /* if we are being restarted by launchd */ - priv_bootstrap_port = bootstrap_port; - break; - case BOOTSTRAP_NOT_PRIVILEGED : - /* if another instance of the server is starting */ - SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already starting"), service_name); - exit (EX_UNAVAILABLE); - case BOOTSTRAP_UNKNOWN_SERVICE : - /* service not currently registered, "a good thing" (tm) */ - if (enableRestart) { - status = bootstrap_create_server(bootstrap_port, - "/usr/sbin/configd", - geteuid(), - FALSE, /* not onDemand == restart now */ - &priv_bootstrap_port); - if (status != BOOTSTRAP_SUCCESS) { - SCLog(TRUE, LOG_ERR, - CFSTR("server_init bootstrap_create_server() failed: %s"), - bootstrap_strerror(status)); - exit (EX_UNAVAILABLE); - } - } else { - priv_bootstrap_port = bootstrap_port; - } - - status = bootstrap_create_service(priv_bootstrap_port, service_name, &service_send_port); - if (status != BOOTSTRAP_SUCCESS) { - SCLog(TRUE, LOG_ERR, - CFSTR("server_init bootstrap_create_service() failed: %s"), - bootstrap_strerror(status)); - exit (EX_UNAVAILABLE); - } - - status = bootstrap_check_in(priv_bootstrap_port, service_name, &service_port); - if (status != BOOTSTRAP_SUCCESS) { - SCLog(TRUE, LOG_ERR, - CFSTR("server_init bootstrap_check_in() failed: %s"), - bootstrap_strerror(status)); - exit (EX_UNAVAILABLE); - } - break; - case BOOTSTRAP_SERVICE_ACTIVE : - /* if another instance of the server is active */ - SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already active"), service_name); - exit (EX_UNAVAILABLE); - default : + /* Check "configd" server status */ + status = bootstrap_check_in(bootstrap_port, service_name, &service_port); + switch (status) { + case BOOTSTRAP_SUCCESS : + /* if we are being [re-]started by launchd */ + break; + case BOOTSTRAP_NOT_PRIVILEGED : + /* if another instance of the server is starting */ + SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already starting"), service_name); + exit (EX_UNAVAILABLE); + case BOOTSTRAP_SERVICE_ACTIVE : + /* if another instance of the server is active */ + SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already active"), service_name); + exit (EX_UNAVAILABLE); + default : SCLog(TRUE, LOG_ERR, CFSTR("server_init bootstrap_check_in() failed: %s"), bootstrap_strerror(status)); exit (EX_UNAVAILABLE); - } - - } - - /* we don't want to pass our priviledged bootstrap port along to any spawned helpers so... */ - status = bootstrap_unprivileged(priv_bootstrap_port, &unpriv_bootstrap_port); - if (status != BOOTSTRAP_SUCCESS) { - SCLog(TRUE, LOG_ERR, - CFSTR("server_init bootstrap_unprivileged() failed: %s"), - bootstrap_strerror(status)); - exit (EX_UNAVAILABLE); } - status = task_set_bootstrap_port(mach_task_self(), unpriv_bootstrap_port); - if (status != BOOTSTRAP_SUCCESS) { - SCLog(TRUE, LOG_ERR, - CFSTR("server_init task_set_bootstrap_port(): %s"), - mach_error_string(status)); - exit (EX_UNAVAILABLE); - } - - /* ... and make sure that the global "bootstrap_port" is also unpriviledged */ - bootstrap_port = unpriv_bootstrap_port; - /* Create the primary / new connection port and backing session */ mySession = addSession(service_port, serverMPCopyDescription); configd_port = mySession->serverPort; @@ -373,41 +268,20 @@ __private_extern__ int server_shutdown() { - char *service_name; - mach_port_t service_port; - kern_return_t status; - - /* - * Note: we can't use SCLog() since the signal may be received while the - * logging thread lock is held. - */ - if ((priv_bootstrap_port == MACH_PORT_NULL) || (configd_port == NULL)) { - return EX_OK; - } - - service_name = getenv("SCD_SERVER"); - if (!service_name) { - service_name = SCD_SERVER; - } + if (configd_port != NULL) { + mach_port_t service_port; + + service_port = CFMachPortGetPort(configd_port); + if (service_port != MACH_PORT_NULL) { + (void) mach_port_mod_refs(mach_task_self(), + service_port, + MACH_PORT_RIGHT_RECEIVE, + -1); + } - service_port = CFMachPortGetPort(configd_port); - if (service_port != MACH_PORT_NULL) { - (void) mach_port_destroy(mach_task_self(), service_port); - } - - status = bootstrap_register(priv_bootstrap_port, service_name, MACH_PORT_NULL); - switch (status) { - case BOOTSTRAP_SUCCESS : - break; - case MACH_SEND_INVALID_DEST : - case MIG_SERVER_DIED : - /* something happened to launchd */ - break; - default : - SCLog(TRUE, LOG_ERR, - CFSTR("server_shutdown bootstrap_register(): %s"), - bootstrap_strerror(status)); - return EX_UNAVAILABLE; + CFMachPortInvalidate(configd_port); + CFRelease(configd_port); + configd_port = NULL; } return EX_OK; @@ -419,25 +293,18 @@ void server_loop() { CFStringRef rlMode; - int rlStatus; while (TRUE) { - /* - * if linked with a DEBUG version of the framework, display some - * debugging information - */ - __showMachPortStatus(); - /* * process one run loop event */ rlMode = (storeLocked > 0) ? CFSTR("locked") : kCFRunLoopDefaultMode; - rlStatus = CFRunLoopRunInMode(rlMode, 1.0e10, TRUE); + CFRunLoopRunInMode(rlMode, 1.0e10, TRUE); /* * check for, and if necessary, push out change notifications * to other processes. */ - pushNotifications(); + pushNotifications(_configd_trace); } } diff --git a/configd.tproj/configd_server.h b/configd.tproj/configd_server.h index 07becd3..934c91b 100644 --- a/configd.tproj/configd_server.h +++ b/configd.tproj/configd_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2006, 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -45,10 +45,7 @@ void configdCallback (CFMachPortRef port, CFIndex size, void *info); -boolean_t server_active (mach_port_t *service_port); - -void server_init (mach_port_t service_port, - Boolean enableRestart); +void server_init (void); int server_shutdown (void); diff --git a/configd.tproj/entitlements.plist b/configd.tproj/entitlements.plist new file mode 100644 index 0000000..ec0be16 --- /dev/null +++ b/configd.tproj/entitlements.plist @@ -0,0 +1,16 @@ + + + + + keychain-access-groups + + apple + + com.apple.springboard.launchapplications + + com.apple.wifi.manager-access + + com.apple.MobileInternetSharing.allow + + + diff --git a/configd.tproj/notify_server.c b/configd.tproj/notify_server.c index f4aea4b..7599238 100644 --- a/configd.tproj/notify_server.c +++ b/configd.tproj/notify_server.c @@ -53,8 +53,7 @@ notify_server(mach_msg_header_t *request, mach_msg_header_t *reply) switch (Request->not_header.msgh_id) { case MACH_NOTIFY_NO_SENDERS : - SCLog(_configd_verbose, LOG_DEBUG, CFSTR("No more senders for port %d, closing."), - Request->not_header.msgh_local_port); + __MACH_PORT_DEBUG(TRUE, "*** notify_server MACH_NOTIFY_NO_SENDERS", Request->not_header.msgh_local_port); cleanupSession(Request->not_header.msgh_local_port); Reply->Head.msgh_bits = 0; diff --git a/configd.tproj/pattern.c b/configd.tproj/pattern.c index e4bc1c4..207491b 100644 --- a/configd.tproj/pattern.c +++ b/configd.tproj/pattern.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2003, 2004, 2006-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -442,9 +442,11 @@ __private_extern__ void patternAddKey(CFStringRef key) { + void *context = (void *)key; + my_CFDictionaryApplyFunction(patternData, (CFDictionaryApplierFunction)addKeyForPattern, - (void *)key); + context); return; } @@ -497,9 +499,11 @@ __private_extern__ void patternRemoveKey(CFStringRef key) { + void *context = (void *)key; + my_CFDictionaryApplyFunction(patternData, (CFDictionaryApplierFunction)removeKeyFromPattern, - (void *)key); + context); return; } diff --git a/configd.tproj/plugin_support.c b/configd.tproj/plugin_support.c index 9ddeb4a..f0a5506 100644 --- a/configd.tproj/plugin_support.c +++ b/configd.tproj/plugin_support.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -84,23 +84,16 @@ __private_extern__ CFRunLoopRef plugin_runLoop = NULL; -extern SCDynamicStoreBundleLoadFunction load_ATconfig; -extern SCDynamicStoreBundleStopFunction stop_ATconfig; extern SCDynamicStoreBundleLoadFunction load_IPMonitor; extern SCDynamicStoreBundlePrimeFunction prime_IPMonitor; extern SCDynamicStoreBundleLoadFunction load_InterfaceNamer; extern SCDynamicStoreBundleLoadFunction load_KernelEventMonitor; extern SCDynamicStoreBundlePrimeFunction prime_KernelEventMonitor; -#ifdef INCLUDE_KICKER -extern SCDynamicStoreBundleLoadFunction load_Kicker; -#endif // INCLUDE_KICKER extern SCDynamicStoreBundleLoadFunction load_LinkConfiguration; extern SCDynamicStoreBundleLoadFunction load_PreferencesMonitor; extern SCDynamicStoreBundlePrimeFunction prime_PreferencesMonitor; -extern SCDynamicStoreBundleStopFunction stop_PreferencesMonitor; extern SCDynamicStoreBundleLoadFunction load_NetworkIdentification; extern SCDynamicStoreBundlePrimeFunction prime_NetworkIdentification; -extern SCDynamicStoreBundleStopFunction stop_NetworkIdentification; typedef struct { @@ -113,13 +106,6 @@ typedef struct { static const builtin builtin_plugins[] = { - { - CFSTR("com.apple.SystemConfiguration.ATconfig"), - &load_ATconfig, - NULL, - NULL, - &stop_ATconfig - }, { CFSTR("com.apple.SystemConfiguration.IPMonitor"), &load_IPMonitor, @@ -141,15 +127,6 @@ static const builtin builtin_plugins[] = { &prime_KernelEventMonitor, NULL }, -#ifdef INCLUDE_KICKER - { - CFSTR("com.apple.SystemConfiguration.Kicker"), - &load_Kicker, - NULL, - NULL, - NULL - }, -#endif // INCLUDE_KICKER { CFSTR("com.apple.SystemConfiguration.LinkConfiguration"), &load_LinkConfiguration, @@ -162,14 +139,14 @@ static const builtin builtin_plugins[] = { &load_NetworkIdentification, NULL, &prime_NetworkIdentification, - &stop_NetworkIdentification + NULL }, { CFSTR("com.apple.SystemConfiguration.PreferencesMonitor"), &load_PreferencesMonitor, NULL, &prime_PreferencesMonitor, - &stop_PreferencesMonitor + NULL } }; @@ -293,6 +270,97 @@ getBundleSymbol(CFBundleRef bundle, CFStringRef functionName, CFStringRef shortI } +static const char * +getBundleDirNameAndPath(CFBundleRef bundle, char *buf, size_t buf_len) +{ + char *cp; + int len; + Boolean ok; + CFURLRef url; + + url = CFBundleCopyBundleURL(bundle); + if (url == NULL) { + return NULL; + } + + ok = CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)buf, buf_len); + CFRelease(url); + if (!ok) { + return NULL; + } + + cp = strrchr(buf, '/'); + if (cp != NULL) { + cp++; + } else { + cp = buf; + } + + /* check if this directory entry is a valid bundle name */ + len = strlen(cp); + if (len <= (int)sizeof(BUNDLE_DIR_EXTENSION)) { + /* if entry name isn't long enough */ + return NULL; + } + + len -= sizeof(BUNDLE_DIR_EXTENSION) - 1; + if (strcmp(&cp[len], BUNDLE_DIR_EXTENSION) != 0) { + /* if entry name doesn't end with ".bundle" */ + return NULL; + } + + return cp; +} + + +#pragma mark - +#pragma mark load + + +static void +forkBundle_setup(pid_t pid, void *setupContext) +{ + if (pid == 0) { + // if child + unsetenv("__LAUNCHD_FD"); + setenv("__FORKED_PLUGIN__", "Yes", 1); + } + + return; +} + + +static void +forkBundle(CFBundleRef bundle, CFStringRef bundleID) +{ + char *argv[] = { "configd", "-d", "-t", NULL, NULL }; + const char *name; + char path[MAXPATHLEN]; + pid_t pid; + + // get the bundle's path + name = getBundleDirNameAndPath(bundle, path, sizeof(path)); + if (name == NULL) { + SCLog(TRUE, LOG_ERR, CFSTR("skipped %@ (could not determine path)"), bundle); + return; + } + + // fork and exec configd opting to load only this plugin + argv[3] = path; + pid = _SCDPluginExecCommand2(NULL, NULL, 0, 0, "/usr/libexec/configd", argv, forkBundle_setup, NULL); + if (pid == -1) { + SCLog(TRUE, LOG_ERR, + CFSTR("skipped %@ (could not exec child) : %s"), + bundle, + strerror(errno)); + return; + } + + SCLog(TRUE, LOG_NOTICE, CFSTR("forked %@, pid=%d"), bundleID, pid); + return; +} + + static void loadBundle(const void *value, void *context) { CFStringRef bundleID; @@ -304,7 +372,7 @@ loadBundle(const void *value, void *context) { bundleID = CFBundleGetIdentifier(bundleInfo->bundle); if (bundleID == NULL) { // sorry, no bundles without a bundle identifier - SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (no bundle ID)"), bundleInfo->bundle); + SCLog(TRUE, LOG_NOTICE, CFSTR("skipped %@ (no bundle ID)"), bundleInfo->bundle); return; } @@ -319,13 +387,18 @@ loadBundle(const void *value, void *context) { if (bundleExclude) { // sorry, this bundle has been excluded - SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (excluded)"), bundleID); + SCLog(TRUE, LOG_NOTICE, CFSTR("skipped %@ (excluded)"), bundleID); goto done; } if (!bundleInfo->enabled) { - // sorry, this bundle has not been enaabled - SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (disabled)"), bundleID); + // sorry, this bundle has not been enabled + SCLog(TRUE, LOG_INFO, CFSTR("skipped %@ (disabled)"), bundleID); + goto done; + } + + if (_plugins_fork) { + forkBundle(bundleInfo->bundle, bundleID); goto done; } @@ -339,7 +412,7 @@ loadBundle(const void *value, void *context) { } if (bundleInfo->builtin) { - int i; + int i; SCLog(TRUE, LOG_DEBUG, CFSTR("adding %@"), bundleID); @@ -361,14 +434,22 @@ loadBundle(const void *value, void *context) { goto done; } } else { + CFErrorRef error = NULL; + SCLog(TRUE, LOG_DEBUG, CFSTR("loading %@"), bundleID); #ifdef DEBUG traceBundle("loading", bundleInfo->bundle); #endif /* DEBUG */ - if (!CFBundleLoadExecutable(bundleInfo->bundle)) { + if (!CFBundleLoadExecutableAndReturnError(bundleInfo->bundle, &error)) { + CFStringRef description; + + description = CFErrorCopyDescription(error); SCLog(TRUE, LOG_NOTICE, CFSTR("%@ load failed"), bundleID); + SCLog(TRUE, LOG_NOTICE, CFSTR(" %@"), description); + CFRelease(description); + CFRelease(error); goto done; } @@ -415,15 +496,17 @@ callLoadFunction(const void *value, void *context) { } +#pragma mark - +#pragma mark start + + void callStartFunction(const void *value, void *context) { + const char *bundleDirName; bundleInfoRef bundleInfo = (bundleInfoRef)value; - CFURLRef bundleURL; char bundleName[MAXNAMLEN + 1]; char bundlePath[MAXPATHLEN]; - char *cp; int len; - Boolean ok; if (!bundleInfo->loaded) { return; @@ -434,43 +517,20 @@ callStartFunction(const void *value, void *context) { return; } - bundleURL = CFBundleCopyBundleURL(bundleInfo->bundle); - if (bundleURL == NULL) { - return; - } - - ok = CFURLGetFileSystemRepresentation(bundleURL, - TRUE, - (UInt8 *)&bundlePath, - sizeof(bundlePath)); - CFRelease(bundleURL); - if (!ok) { - return; - } - - cp = strrchr(bundlePath, '/'); - if (cp) { - cp++; - } else { - cp = bundlePath; - } - - /* check if this directory entry is a valid bundle name */ - len = strlen(cp); - if (len <= (int)sizeof(BUNDLE_DIR_EXTENSION)) { - /* if entry name isn't long enough */ + /* copy the bundle's path */ + bundleDirName = getBundleDirNameAndPath(bundleInfo->bundle, bundlePath, sizeof(bundlePath)); + if (bundleDirName == NULL) { + // if we have a problem with the bundle's path return; } - len -= sizeof(BUNDLE_DIR_EXTENSION) - 1; - if (strcmp(&cp[len], BUNDLE_DIR_EXTENSION) != 0) { - /* if entry name doesn end with ".bundle" */ + /* copy (just) the bundle's name */ + if (strlcpy(bundleName, bundleDirName, sizeof(bundleName)) > sizeof(bundleName)) { + // if we have a problem with the bundle's name return; } - - /* get (just) the bundle's name */ - bundleName[0] = '\0'; - (void) strncat(bundleName, cp, len); + len = strlen(bundleName) - (sizeof(BUNDLE_DIR_EXTENSION) - 1); + bundleName[len] = '\0'; #ifdef DEBUG traceBundle("calling start() for", bundleInfo->bundle); @@ -482,6 +542,10 @@ callStartFunction(const void *value, void *context) { } +#pragma mark - +#pragma mark prime + + void callPrimeFunction(const void *value, void *context) { bundleInfoRef bundleInfo = (bundleInfoRef)value; @@ -505,6 +569,10 @@ callPrimeFunction(const void *value, void *context) { } +#pragma mark - +#pragma mark stop + + static void stopComplete(void *info) { @@ -515,6 +583,10 @@ stopComplete(void *info) SCLog(TRUE, LOG_DEBUG, CFSTR("** %@ complete (%f)"), bundleID, CFAbsoluteTimeGetCurrent()); stopRls = (CFRunLoopSourceRef)CFDictionaryGetValue(exiting, bundle); + if (stopRls == NULL) { + return; + } + CFRunLoopSourceInvalidate(stopRls); CFDictionaryRemoveValue(exiting, bundle); @@ -653,6 +725,10 @@ stopBundles() } +#pragma mark - +#pragma mark term + + static CFStringRef termRLSCopyDescription(const void *info) { @@ -705,6 +781,10 @@ plugin_term(int *status) } +#pragma mark - +#pragma mark initialization + + #ifdef DEBUG static void timerCallback(CFRunLoopTimerRef timer, void *info) @@ -898,6 +978,11 @@ plugin_exec(void *arg) callLoadFunction, NULL); + if (nLoaded == 0) { + // if no bundles loaded + goto done; + } + /* * If defined, call each bundles start() function. This function is * called after the bundle has been loaded and its load() function has @@ -960,6 +1045,8 @@ plugin_exec(void *arg) plugin_runLoop = CFRunLoopGetCurrent(); CFRunLoopRun(); + done : + SCLog(_configd_verbose, LOG_INFO, CFSTR("No more work for the \"configd\" plugins")); plugin_runLoop = NULL; return NULL; diff --git a/configd.tproj/session.c b/configd.tproj/session.c index 968f392..bc25fe2 100644 --- a/configd.tproj/session.c +++ b/configd.tproj/session.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -35,6 +35,9 @@ #include "configd_server.h" #include "session.h" +#include +#include + /* information maintained for each active session */ static serverSessionRef *sessions = NULL; static int nSessions = 0; @@ -47,7 +50,7 @@ getSession(mach_port_t server) int i; if (server == MACH_PORT_NULL) { - SCLog(TRUE, LOG_NOTICE, CFSTR("Excuse me, why is getSession() being called with an invalid port?")); + SCLog(TRUE, LOG_ERR, CFSTR("Excuse me, why is getSession() being called with an invalid port?")); return NULL; } @@ -60,7 +63,7 @@ getSession(mach_port_t server) } else if (thisSession->key == server) { return thisSession; /* we've seen this server before */ } else if (thisSession->store && - (((SCDynamicStorePrivateRef)thisSession->store)->notifySignalTask == server)) { + (((SCDynamicStorePrivateRef)thisSession->store)->notifySignalTask == server)) { return thisSession; } } @@ -75,6 +78,7 @@ serverSessionRef addSession(mach_port_t server, CFStringRef (*copyDescription)(const void *info)) { CFMachPortContext context = { 0, NULL, NULL, NULL, NULL }; + mach_port_t mp = server; int n = -1; if (nSessions <= 0) { @@ -109,24 +113,37 @@ addSession(mach_port_t server, CFStringRef (*copyDescription)(const void *info)) context.copyDescription = copyDescription; if (server == MACH_PORT_NULL) { - // SCDynamicStore client ports + // create mach port for SCDynamicStore client (void) mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, - &server); + &mp); + } + + // + // Note: we create the CFMachPort *before* we insert a send + // right present to ensure that CF does not establish + // its dead name notification. + // + sessions[n]->serverPort = CFMachPortCreateWithPort(NULL, + mp, + configdCallback, + &context, + NULL); + + if (server == MACH_PORT_NULL) { + // insert send right that will be moved to the client (void) mach_port_insert_right(mach_task_self(), - server, - server, + mp, + mp, MACH_MSG_TYPE_MAKE_SEND); } - sessions[n]->key = server; - sessions[n]->serverPort = CFMachPortCreateWithPort(NULL, - server, - configdCallback, - &context, - NULL); + + sessions[n]->key = mp; // sessions[n]->serverRunLoopSource = NULL; // sessions[n]->store = NULL; - sessions[n]->callerEUID = 1; /* not "root" */ + sessions[n]->callerEUID = 1; /* not "root" */ + sessions[n]->callerRootAccess = UNKNOWN; + sessions[n]->callerWriteAccess = UNKNOWN; return sessions[n]; } @@ -205,17 +222,15 @@ cleanupSession(mach_port_t server) * Close any open connections including cancelling any outstanding * notification requests and releasing any locks. */ + __MACH_PORT_DEBUG(TRUE, "*** cleanupSession", server); (void) __SCDynamicStoreClose(&thisSession->store, TRUE); + __MACH_PORT_DEBUG(TRUE, "*** cleanupSession (after __SCDynamicStoreClose)", server); /* - * Our send right has already been removed. Remove our - * receive right. + * Our send right has already been removed. Remove our receive right. */ - mach_port_mod_refs(mach_task_self(), - thisSession->key, - MACH_PORT_RIGHT_RECEIVE, - -1); - + (void) mach_port_mod_refs(mach_task_self(), server, MACH_PORT_RIGHT_RECEIVE, -1); + /* * Lastly, remove the session entry. */ @@ -224,17 +239,20 @@ cleanupSession(mach_port_t server) return; } } + + SCLog(TRUE, LOG_ERR, CFSTR("MACH_NOTIFY_NO_SENDERS w/no session, port = %d"), server); + __MACH_PORT_DEBUG(TRUE, "*** cleanupSession w/no session", server); return; } __private_extern__ void -listSessions() +listSessions(FILE *f) { int i; - fprintf(stderr, "Current sessions:"); + SCPrint(TRUE, f, CFSTR("Current sessions :\n")); for (i = 0; i < nSessions; i++) { serverSessionRef thisSession = sessions[i]; @@ -242,16 +260,165 @@ listSessions() continue; } - fprintf(stderr, " %d", thisSession->key); + SCPrint(TRUE, f, CFSTR("\t%d : port = 0x%x"), i, thisSession->key); + + if (thisSession->store != NULL) { + SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)thisSession->store; + + if (storePrivate->notifySignalTask != TASK_NULL) { + SCPrint(TRUE, f, CFSTR(", task = %d"), storePrivate->notifySignalTask); + } + } + + if (sessionData != NULL) { + CFDictionaryRef info; + CFStringRef key; + + key = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), thisSession->key); + info = CFDictionaryGetValue(sessionData, key); + CFRelease(key); + if (info != NULL) { + CFStringRef name; + + name = CFDictionaryGetValue(info, kSCDName); + if (name != NULL) { + SCPrint(TRUE, f, CFSTR(", name = %@"), name); + } + } + } + + if (thisSession->serverPort != NULL) { + SCPrint(TRUE, f, CFSTR("\n\t\t%@"), thisSession->serverPort); + } + + if (thisSession->serverRunLoopSource != NULL) { + SCPrint(TRUE, f, CFSTR("\n\t\t%@"), thisSession->serverRunLoopSource); + } + + SCPrint(TRUE, f, CFSTR("\n")); + } + + SCPrint(TRUE, f, CFSTR("\n")); + return; +} + + +#if TARGET_OS_IPHONE + +#include +#include - if (thisSession->store) { - task_t task = ((SCDynamicStorePrivateRef)thisSession->store)->notifySignalTask; +static CFStringRef +sessionName(serverSessionRef session) +{ + CFDictionaryRef info; + CFStringRef name = NULL; + CFStringRef sessionKey; + + sessionKey = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), session->key); + info = CFDictionaryGetValue(sessionData, sessionKey); + CFRelease(sessionKey); + + if (info != NULL) { + name = CFDictionaryGetValue(info, kSCDName); + } - if (task != TASK_NULL) { - fprintf(stderr, "/%d", task); + return (name != NULL) ? name : CFSTR("???"); +} + + +static Boolean +hasEntitlement(serverSessionRef session, CFStringRef entitlement) +{ + Boolean hasEntitlement = FALSE; + SecTaskRef task; + + /* Create the security task from the audit token. */ + task = SecTaskCreateWithAuditToken(NULL, session->auditToken); + if (task != NULL) { + CFErrorRef error = NULL; + CFTypeRef value; + + /* Get the value for the entitlement. */ + value = SecTaskCopyValueForEntitlement(task, kSCWriteEntitlementName, &error); + if (value != NULL) { + if (isA_CFBoolean(value)) { + if (CFBooleanGetValue(value)) { + /* if client DOES have entitlement */ + hasEntitlement = YES; + } + } else { + SCLog(TRUE, LOG_ERR, + CFSTR("hasEntitlement: entitlement not valid: %@"), + sessionName(session)); } + + CFRelease(value); + } else if (error != NULL) { + SCLog(TRUE, LOG_ERR, + CFSTR("hasEntitlement SecTaskCopyValueForEntitlement() failed, error=%@: %@"), + error, + sessionName(session)); + CFRelease(error); } + + CFRelease(task); + } else { + SCLog(TRUE, LOG_ERR, + CFSTR("hasEntitlement SecTaskCreateWithAuditToken() failed: %@"), + sessionName(session)); } - fprintf(stderr, "\n"); + + return hasEntitlement; } +#endif // TARGET_OS_IPHONE + + +__private_extern__ +Boolean +hasRootAccess(serverSessionRef session) +{ + if (session->callerRootAccess == UNKNOWN) { + /* + * get the credentials associated with the caller. + */ + audit_token_to_au32(session->auditToken, + NULL, // auidp + &session->callerEUID, // euid + NULL, // egid + NULL, // ruid + NULL, // rgid + NULL, // pid + NULL, // asid + NULL); // tid + + session->callerRootAccess = (session->callerEUID == 0) ? YES : NO; + } + + return (session->callerRootAccess == YES) ? TRUE : FALSE; +} + + +__private_extern__ +Boolean +hasWriteAccess(serverSessionRef session) +{ + if (session->callerWriteAccess == UNKNOWN) { + /* assume that the client DOES NOT have the entitlement */ + session->callerWriteAccess = NO; + + if (hasRootAccess(session)) { + // grant write access to eUID==0 processes + session->callerWriteAccess = YES; + } +#if TARGET_OS_IPHONE + else if (hasEntitlement(session, kSCWriteEntitlementName)) { + // grant write access to "entitled" processes + session->callerWriteAccess = YES; + } +#endif // TARGET_OS_IPHONE + } + + return (session->callerWriteAccess == YES) ? TRUE : FALSE; +} diff --git a/configd.tproj/session.h b/configd.tproj/session.h index bf25de1..37817d1 100644 --- a/configd.tproj/session.h +++ b/configd.tproj/session.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2005-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2005-2007, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -35,6 +35,17 @@ #define _S_SESSION_H #include +#include +#include + + +#if TARGET_OS_IPHONE +#define kSCWriteEntitlementName CFSTR("com.apple.SystemConfiguration.SCDynamicStore-write-access") +#endif // TARGET_OS_IPHONE + + +typedef enum { UNKNOWN, NO, YES } lazyBoolean; + /* Per client server state */ typedef struct { @@ -52,6 +63,15 @@ typedef struct { /* credentials associated with this "open" session */ uid_t callerEUID; + /* Mach security audit trailer for evaluating credentials */ + audit_token_t auditToken; + + /* root access credential associated with this "open" session */ + lazyBoolean callerRootAccess; + + /* write access entitlement associated with this "open" session */ + lazyBoolean callerWriteAccess; + } serverSession, *serverSessionRef; __BEGIN_DECLS @@ -65,7 +85,11 @@ void removeSession (mach_port_t server); void cleanupSession (mach_port_t server); -void listSessions (void); +void listSessions (FILE *f); + +Boolean hasRootAccess (serverSessionRef session); + +Boolean hasWriteAccess (serverSessionRef session); __END_DECLS diff --git a/configd.xcodeproj/project.pbxproj b/configd.xcodeproj/project.pbxproj index c994655..a29f242 100644 --- a/configd.xcodeproj/project.pbxproj +++ b/configd.xcodeproj/project.pbxproj @@ -3,10 +3,35 @@ archiveVersion = 1; classes = { }; - objectVersion = 42; + objectVersion = 45; objects = { /* Begin PBXAggregateTarget section */ + 151C1CC60CFB487000C5AFD6 /* All-Embedded */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 151C1CD60CFB48E300C5AFD6 /* Build configuration list for PBXAggregateTarget "All-Embedded" */; + buildPhases = ( + ); + dependencies = ( + 15C64A2F0F684C8300D78394 /* PBXTargetDependency */, + 158317100CFB77D1006F62B9 /* PBXTargetDependency */, + 158317160CFB783B006F62B9 /* PBXTargetDependency */, + 158317180CFB784D006F62B9 /* PBXTargetDependency */, + ); + name = "All-Embedded"; + productName = Embedded; + }; + 151FE2DD0D5B7046000D6DB1 /* configd_base-EmbeddedSimulator */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 151FE2E40D5B7046000D6DB1 /* Build configuration list for PBXAggregateTarget "configd_base-EmbeddedSimulator" */; + buildPhases = ( + ); + dependencies = ( + 15A5A2710D5B942D0087BDA0 /* PBXTargetDependency */, + ); + name = "configd_base-EmbeddedSimulator"; + productName = Frameworks; + }; 155847FA07550D210046C2E9 /* configd_executables */ = { isa = PBXAggregateTarget; buildConfigurationList = 156EB62E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_executables" */; @@ -16,7 +41,7 @@ 1558480607550D470046C2E9 /* PBXTargetDependency */, 1558480807550D470046C2E9 /* PBXTargetDependency */, 1558480A07550D470046C2E9 /* PBXTargetDependency */, - 150ECB3C0D0079280065E94D /* PBXTargetDependency */, + 150ECB300D0042DA0065E94D /* PBXTargetDependency */, ); name = configd_executables; productName = configd_executables; @@ -27,21 +52,66 @@ buildPhases = ( ); dependencies = ( - 157BB8C2075924470025DA7A /* PBXTargetDependency */, 157BB8C0075924460025DA7A /* PBXTargetDependency */, 1520A386084681350010B584 /* PBXTargetDependency */, ); name = configd_base; productName = Frameworks; }; + 158316CF0CFB774B006F62B9 /* configd_base-Embedded */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 158316D80CFB774B006F62B9 /* Build configuration list for PBXAggregateTarget "configd_base-Embedded" */; + buildPhases = ( + ); + dependencies = ( + 158317120CFB77E1006F62B9 /* PBXTargetDependency */, + 158317140CFB77E8006F62B9 /* PBXTargetDependency */, + ); + name = "configd_base-Embedded"; + productName = Frameworks; + }; + 158316E30CFB7761006F62B9 /* configd_plugins-Embedded */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 158317000CFB7761006F62B9 /* Build configuration list for PBXAggregateTarget "configd_plugins-Embedded" */; + buildPhases = ( + ); + dependencies = ( + 157A85480D56CA0B00B6F1A0 /* PBXTargetDependency */, + 158317BB0CFB8660006F62B9 /* PBXTargetDependency */, + 157A854A0D56CA2300B6F1A0 /* PBXTargetDependency */, + 158317B90CFB8660006F62B9 /* PBXTargetDependency */, + 157A854C0D56CA5100B6F1A0 /* PBXTargetDependency */, + 158317B70CFB8660006F62B9 /* PBXTargetDependency */, + 157A854E0D56CA6F00B6F1A0 /* PBXTargetDependency */, + 158317B50CFB8660006F62B9 /* PBXTargetDependency */, + 156CA4A80EF8550800C59A18 /* PBXTargetDependency */, + 157A85500D56CA8800B6F1A0 /* PBXTargetDependency */, + 158317B30CFB8660006F62B9 /* PBXTargetDependency */, + 157A85520D56CA9E00B6F1A0 /* PBXTargetDependency */, + 157A85540D56CACA00B6F1A0 /* PBXTargetDependency */, + ); + name = "configd_plugins-Embedded"; + productName = Plugins; + }; + 158317040CFB7782006F62B9 /* configd_executables-Embedded */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 1583170B0CFB7782006F62B9 /* Build configuration list for PBXAggregateTarget "configd_executables-Embedded" */; + buildPhases = ( + ); + dependencies = ( + 158317660CFB80D5006F62B9 /* PBXTargetDependency */, + 157434210D4A8166002ACA73 /* PBXTargetDependency */, + 1574341F0D4A815E002ACA73 /* PBXTargetDependency */, + ); + name = "configd_executables-Embedded"; + productName = configd_executables; + }; 159D542007528E7C004F8947 /* configd_plugins */ = { isa = PBXAggregateTarget; buildConfigurationList = 156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */; buildPhases = ( ); dependencies = ( - 1533B94109731A9600F2B34A /* PBXTargetDependency */, - 15DAD5740759115F0084A6ED /* PBXTargetDependency */, 159D542807528E85004F8947 /* PBXTargetDependency */, 158AD9860754E72500124717 /* PBXTargetDependency */, 159D542607528E85004F8947 /* PBXTargetDependency */, @@ -50,6 +120,7 @@ 159D542207528E85004F8947 /* PBXTargetDependency */, 159D542A07528E85004F8947 /* PBXTargetDependency */, 158AD98C0754E72500124717 /* PBXTargetDependency */, + 1521405B0E9400BF00DACD2C /* PBXTargetDependency */, 159D542C07528E85004F8947 /* PBXTargetDependency */, 158AD98E0754E72500124717 /* PBXTargetDependency */, F95B8A790B03FB9100993BA3 /* PBXTargetDependency */, @@ -58,12 +129,37 @@ name = configd_plugins; productName = Plugins; }; + 15C64A1E0F684C3300D78394 /* configd_libSystem */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 15C64A270F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem" */; + buildPhases = ( + 15BED7930F6853F800016614 /* OLD libdnsinfo.a */, + ); + dependencies = ( + 15C64A220F684C4900D78394 /* PBXTargetDependency */, + ); + name = configd_libSystem; + productName = configd_libSystem; + }; + 15C64A280F684C6B00D78394 /* configd_libSystem-Embedded */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 15C64A2B0F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem-Embedded" */; + buildPhases = ( + 15BED7A20F68551200016614 /* OLD libdnsinfo.a */, + ); + dependencies = ( + 15C64A310F684C8F00D78394 /* PBXTargetDependency */, + ); + name = "configd_libSystem-Embedded"; + productName = configd_libSystem; + }; 15CB690005C0722A0099E85F /* All */ = { isa = PBXAggregateTarget; buildConfigurationList = 156EB6320905594A00EEF749 /* Build configuration list for PBXAggregateTarget "All" */; buildPhases = ( ); dependencies = ( + 15C64A240F684C5700D78394 /* PBXTargetDependency */, 157BB8C40759244B0025DA7A /* PBXTargetDependency */, 159D542E07529008004F8947 /* PBXTargetDependency */, 1558480F07550DD00046C2E9 /* PBXTargetDependency */, @@ -71,32 +167,39 @@ name = All; productName = "configd (Aggregate)"; }; + 15FD13BF0D59485000F9409C /* All-EmbeddedSimulator */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 15FD13C60D59485000F9409C /* Build configuration list for PBXAggregateTarget "All-EmbeddedSimulator" */; + buildPhases = ( + ); + dependencies = ( + 151FE37A0D5B713C000D6DB1 /* PBXTargetDependency */, + ); + name = "All-EmbeddedSimulator"; + productName = EmbeddedSimulator; + }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ 15060818075A00A300B147BA /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; }; 1506081A075A00A300B147BA /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1508E39F07552B6A0062B350 /* atconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C707528B36004F8947 /* atconfig.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; - 1508E3A007552B6B0062B350 /* cfManager.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C507528B36004F8947 /* cfManager.c */; }; - 1508E3A107552B720062B350 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; }; 150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; }; 1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; - 1520A3D0084682A30010B584 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; }; 1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; }; - 1523F6F1075A36F70066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; }; - 1523F6F2075A37050066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; }; - 1523F710075A371D0066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; }; - 1523F715075A376B0066F0B2 /* libdnsinfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */; }; - 1523F719075A37C70066F0B2 /* libdnsinfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */; }; + 152140020E93EC6500DACD2C /* logger.c in Sources */ = {isa = PBXBuildFile; fileRef = 1531D3DB0E93E6DA00248432 /* logger.c */; }; + 1521400C0E93FFF500DACD2C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; + 152140580E93FFFC00DACD2C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; + 1522FCFB0FA7FE4B00B24128 /* dnsinfo_flatfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 1522FCE50FA7FD7000B24128 /* dnsinfo_flatfile.c */; }; 152E68C10A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 152E68C30A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; }; - 1533B94D09731BE600F2B34A /* libATconfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15FD73400754DBDA001CC321 /* libATconfig.a */; }; 1533D77B0B10A14300CA4946 /* libNetworkIdentification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */; }; - 153BED940B75566200989D5C /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1587A31F0B6AACD70063104A /* libicucore.dylib */; }; 1540E3610987DA9500157C07 /* com.apple.configd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1540E3600987DA9500157C07 /* com.apple.configd.plist */; }; 154361E00752C81800A8EC6C /* set-hostname.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AB07528B36004F8947 /* set-hostname.c */; }; 1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; }; + 154707300D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; }; + 154707350D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; }; 154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 155281020E3E4A0F00C54315 /* ip_plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53A707528B36004F8947 /* ip_plugin.c */; }; 155847470754FDCD0046C2E9 /* scutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4305C0722B0099E85F /* scutil.h */; }; 155847480754FDCD0046C2E9 /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4505C0722B0099E85F /* commands.h */; }; 155847490754FDCD0046C2E9 /* dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4705C0722B0099E85F /* dictionary.h */; }; @@ -129,6 +232,11 @@ 1558481607550EC10046C2E9 /* scselect.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A2E05C0722B0099E85F /* scselect.c */; settings = {ATTRIBUTES = (); }; }; 1558481907550EC10046C2E9 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; 1558481C07550EC10046C2E9 /* scselect.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A3605C0722B0099E85F /* scselect.8 */; }; + 1559C4450D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; + 1559C4490D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; + 1559C44A0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; + 1559C44E0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; + 1559C44F0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; 155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 155B7BF70847776D00F0E262 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; }; 155B7BF80847776D00F0E262 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; }; @@ -136,15 +244,248 @@ 155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22390AF13A7300D52ED0 /* set-hostname.h */; }; 155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D223A0AF13A7300D52ED0 /* smb-configuration.h */; }; 156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 156CA47B0EF853BB00C59A18 /* logger.c in Sources */ = {isa = PBXBuildFile; fileRef = 1531D3DB0E93E6DA00248432 /* logger.c */; }; + 156CA47D0EF853BB00C59A18 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; + 156CA47E0EF853BB00C59A18 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; + 156CA47F0EF853BB00C59A18 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; }; + 1572C4A90CFB55B400E2776E /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1572C4AA0CFB55B400E2776E /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4AB0CFB55B400E2776E /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 1572C4AC0CFB55B400E2776E /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4AD0CFB55B400E2776E /* SCDynamicStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691B05C0722B0099E85F /* SCDynamicStoreInternal.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 1572C4AE0CFB55B400E2776E /* SCDynamicStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691D05C0722B0099E85F /* SCDynamicStore.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4AF0CFB55B400E2776E /* SCDynamicStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691F05C0722B0099E85F /* SCDynamicStorePrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 1572C4B00CFB55B400E2776E /* SCDynamicStoreKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692105C0722B0099E85F /* SCDynamicStoreKey.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4B10CFB55B400E2776E /* SCDynamicStoreCopySpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692305C0722B0099E85F /* SCDynamicStoreCopySpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4B20CFB55B400E2776E /* SCDynamicStoreCopySpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692505C0722B0099E85F /* SCDynamicStoreCopySpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 1572C4B30CFB55B400E2776E /* SCDynamicStoreSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692705C0722B0099E85F /* SCDynamicStoreSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 1572C4B40CFB55B400E2776E /* SCPreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692905C0722B0099E85F /* SCPreferencesInternal.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 1572C4B50CFB55B400E2776E /* SCPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692B05C0722B0099E85F /* SCPreferences.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4B60CFB55B400E2776E /* SCPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692D05C0722B0099E85F /* SCPreferencesPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 1572C4B70CFB55B400E2776E /* SCPreferencesPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692F05C0722B0099E85F /* SCPreferencesPath.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4B80CFB55B400E2776E /* SCPreferencesSetSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4B90CFB55B400E2776E /* SCNetworkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1572C4BA0CFB55B400E2776E /* SCNetworkConfigurationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */; settings = {ATTRIBUTES = (); }; }; + 1572C4BB0CFB55B400E2776E /* SCNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693305C0722B0099E85F /* SCNetwork.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4BC0CFB55B400E2776E /* SCNetworkConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693505C0722B0099E85F /* SCNetworkConnection.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4BD0CFB55B400E2776E /* SCNetworkReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693705C0722B0099E85F /* SCNetworkReachability.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 1572C4BE0CFB55B400E2776E /* SCValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693905C0722B0099E85F /* SCValidation.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 1572C4BF0CFB55B400E2776E /* DHCPClientPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1572C4C00CFB55B400E2776E /* SCDynamicStoreCopyDHCPInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693F05C0722B0099E85F /* SCDynamicStoreCopyDHCPInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1572C4C10CFB55B400E2776E /* moh_msg.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694105C0722B0099E85F /* moh_msg.h */; }; + 1572C4C20CFB55B400E2776E /* moh.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694305C0722B0099E85F /* moh.h */; }; + 1572C4C30CFB55B400E2776E /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4C50CFB55B400E2776E /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; }; + 1572C4C70CFB55B400E2776E /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4C80CFB55B400E2776E /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; }; + 1572C4C90CFB55B400E2776E /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; }; + 1572C4CA0CFB55B400E2776E /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; }; + 1572C4CB0CFB55B400E2776E /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; }; + 1572C4CE0CFB55B400E2776E /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4CF0CFB55B400E2776E /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4D00CFB55B400E2776E /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4D10CFB55B400E2776E /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; }; + 1572C4D20CFB55B400E2776E /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; }; + 1572C4D40CFB55B400E2776E /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4D50CFB55B400E2776E /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4D60CFB55B400E2776E /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4D70CFB55B400E2776E /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4D80CFB55B400E2776E /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1572C4DA0CFB55B400E2776E /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; }; + 1572C4DB0CFB55B400E2776E /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; }; + 1572C4DC0CFB55B400E2776E /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; }; + 1572C4DD0CFB55B400E2776E /* get-mobility-info in Resources */ = {isa = PBXBuildFile; fileRef = 15CFC229068B222F00123568 /* get-mobility-info */; }; + 1572C4DF0CFB55B400E2776E /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; }; + 1572C4E00CFB55B400E2776E /* SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695005C0722B0099E85F /* SCD.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E10CFB55B400E2776E /* SCDKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695205C0722B0099E85F /* SCDKeys.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E20CFB55B400E2776E /* SCDPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695405C0722B0099E85F /* SCDPrivate.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E30CFB55B400E2776E /* SCDPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695605C0722B0099E85F /* SCDPlugin.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E40CFB55B400E2776E /* SCDOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695805C0722B0099E85F /* SCDOpen.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E50CFB55B400E2776E /* SCDLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695A05C0722B0099E85F /* SCDLock.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E60CFB55B400E2776E /* SCDUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695C05C0722B0099E85F /* SCDUnlock.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E70CFB55B400E2776E /* SCDList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695E05C0722B0099E85F /* SCDList.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E80CFB55B400E2776E /* SCDAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696005C0722B0099E85F /* SCDAdd.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4E90CFB55B400E2776E /* SCDGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696405C0722B0099E85F /* SCDGet.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4EA0CFB55B400E2776E /* SCDSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696605C0722B0099E85F /* SCDSet.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4EB0CFB55B400E2776E /* SCDRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696805C0722B0099E85F /* SCDRemove.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4EC0CFB55B400E2776E /* SCDTouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696A05C0722B0099E85F /* SCDTouch.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4ED0CFB55B400E2776E /* SCDNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696C05C0722B0099E85F /* SCDNotify.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4EE0CFB55B400E2776E /* SCDNotifierSetKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696E05C0722B0099E85F /* SCDNotifierSetKeys.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4EF0CFB55B400E2776E /* SCDNotifierAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697005C0722B0099E85F /* SCDNotifierAdd.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F00CFB55B400E2776E /* SCDNotifierRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697205C0722B0099E85F /* SCDNotifierRemove.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F10CFB55B400E2776E /* SCDNotifierGetChanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697405C0722B0099E85F /* SCDNotifierGetChanges.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F20CFB55B400E2776E /* SCDNotifierWait.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697605C0722B0099E85F /* SCDNotifierWait.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F30CFB55B400E2776E /* SCDNotifierInformViaCallback.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697805C0722B0099E85F /* SCDNotifierInformViaCallback.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F40CFB55B400E2776E /* SCDNotifierInformViaMachPort.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697A05C0722B0099E85F /* SCDNotifierInformViaMachPort.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F50CFB55B400E2776E /* SCDNotifierInformViaFD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697C05C0722B0099E85F /* SCDNotifierInformViaFD.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F60CFB55B400E2776E /* SCDNotifierInformViaSignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697E05C0722B0099E85F /* SCDNotifierInformViaSignal.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F70CFB55B400E2776E /* SCDNotifierCancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698005C0722B0099E85F /* SCDNotifierCancel.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F80CFB55B400E2776E /* SCDSnapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698205C0722B0099E85F /* SCDSnapshot.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4F90CFB55B400E2776E /* SCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698405C0722B0099E85F /* SCP.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4FA0CFB55B400E2776E /* SCPOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698605C0722B0099E85F /* SCPOpen.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4FB0CFB55B400E2776E /* SCPLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698805C0722B0099E85F /* SCPLock.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4FC0CFB55B400E2776E /* SCPUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698A05C0722B0099E85F /* SCPUnlock.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4FD0CFB55B400E2776E /* SCPList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698C05C0722B0099E85F /* SCPList.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4FE0CFB55B400E2776E /* SCPGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698E05C0722B0099E85F /* SCPGet.c */; settings = {ATTRIBUTES = (); }; }; + 1572C4FF0CFB55B400E2776E /* SCPAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699005C0722B0099E85F /* SCPAdd.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5000CFB55B400E2776E /* SCPSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699205C0722B0099E85F /* SCPSet.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5010CFB55B400E2776E /* SCPRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699405C0722B0099E85F /* SCPRemove.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5020CFB55B400E2776E /* SCPCommit.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699605C0722B0099E85F /* SCPCommit.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5030CFB55B400E2776E /* SCPApply.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699805C0722B0099E85F /* SCPApply.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5040CFB55B400E2776E /* SCPPath.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699A05C0722B0099E85F /* SCPPath.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5060CFB55B400E2776E /* SCDHostName.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699E05C0722B0099E85F /* SCDHostName.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5070CFB55B400E2776E /* SCLocation.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A005C0722B0099E85F /* SCLocation.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5080CFB55B400E2776E /* SCNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A205C0722B0099E85F /* SCNetwork.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5090CFB55B400E2776E /* pppcontroller.defs in Sources */ = {isa = PBXBuildFile; fileRef = 23C1E2B8062DD45900835B54 /* pppcontroller.defs */; settings = {ATTRIBUTES = (Client, ); }; }; + 1572C50A0CFB55B400E2776E /* SCNetworkConnection.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A405C0722B0099E85F /* SCNetworkConnection.c */; settings = {ATTRIBUTES = (); }; }; + 1572C50B0CFB55B400E2776E /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; }; + 1572C50C0CFB55B400E2776E /* SCNetworkReachability.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A605C0722B0099E85F /* SCNetworkReachability.c */; settings = {ATTRIBUTES = (); }; }; + 1572C50D0CFB55B400E2776E /* SCProxies.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A805C0722B0099E85F /* SCProxies.c */; settings = {ATTRIBUTES = (); }; }; + 1572C50E0CFB55B400E2776E /* DHCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AC05C0722B0099E85F /* DHCP.c */; settings = {ATTRIBUTES = (); }; }; + 1572C50F0CFB55B400E2776E /* moh.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AE05C0722B0099E85F /* moh.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5100CFB55B400E2776E /* DeviceOnHold.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B005C0722B0099E85F /* DeviceOnHold.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5110CFB55B400E2776E /* LinkConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B205C0722B0099E85F /* LinkConfiguration.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5120CFB55B400E2776E /* dy_framework.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B405C0722B0099E85F /* dy_framework.c */; settings = {ATTRIBUTES = (); }; }; + 1572C5140CFB55B400E2776E /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Client, ); }; }; + 1572C5150CFB55B400E2776E /* SCPreferencesPathKey.c in Sources */ = {isa = PBXBuildFile; fileRef = 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */; }; + 1572C5160CFB55B400E2776E /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; }; + 1572C5170CFB55B400E2776E /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; }; + 1572C5180CFB55B400E2776E /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; }; + 1572C5190CFB55B400E2776E /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; }; + 1572C51A0CFB55B400E2776E /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; }; + 1572C51B0CFB55B400E2776E /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; }; + 1572C51C0CFB55B400E2776E /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; }; + 1572C51D0CFB55B400E2776E /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; }; + 1572C51F0CFB55B400E2776E /* helper_comm.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D608466D4900D1B2BD /* helper_comm.c */; }; + 1572C5200CFB55B400E2776E /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; }; + 1572C5210CFB55B400E2776E /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; }; + 1572C5220CFB55B400E2776E /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; }; + 1572C5240CFB55B400E2776E /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; 1572EB7B0A506D3B00D02459 /* smb-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 1572EB7A0A506D3B00D02459 /* smb-configuration.c */; }; + 157433E00D4A8122002ACA73 /* scselect.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A2E05C0722B0099E85F /* scselect.c */; settings = {ATTRIBUTES = (); }; }; + 157433E20D4A8122002ACA73 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; + 157433E30D4A8122002ACA73 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; }; + 157433F20D4A8137002ACA73 /* scutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4305C0722B0099E85F /* scutil.h */; }; + 157433F30D4A8137002ACA73 /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4505C0722B0099E85F /* commands.h */; }; + 157433F40D4A8137002ACA73 /* dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4705C0722B0099E85F /* dictionary.h */; }; + 157433F50D4A8137002ACA73 /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4905C0722B0099E85F /* session.h */; }; + 157433F60D4A8137002ACA73 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4B05C0722B0099E85F /* cache.h */; }; + 157433F70D4A8137002ACA73 /* notifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4D05C0722B0099E85F /* notifications.h */; }; + 157433F80D4A8137002ACA73 /* tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4F05C0722B0099E85F /* tests.h */; }; + 157433F90D4A8137002ACA73 /* prefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A5105C0722B0099E85F /* prefs.h */; }; + 157433FA0D4A8137002ACA73 /* net.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A509A406C2518F001F0AB7 /* net.h */; }; + 157433FB0D4A8137002ACA73 /* net_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC34680711D49400A3311C /* net_interface.h */; }; + 157433FC0D4A8137002ACA73 /* net_protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346A0711D49400A3311C /* net_protocol.h */; }; + 157433FD0D4A8137002ACA73 /* net_service.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346C0711D49400A3311C /* net_service.h */; }; + 157433FE0D4A8137002ACA73 /* net_set.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346E0711D49400A3311C /* net_set.h */; }; + 157434000D4A8137002ACA73 /* scutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5405C0722B0099E85F /* scutil.c */; settings = {ATTRIBUTES = (); }; }; + 157434010D4A8137002ACA73 /* commands.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5605C0722B0099E85F /* commands.c */; settings = {ATTRIBUTES = (); }; }; + 157434020D4A8137002ACA73 /* dictionary.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5805C0722B0099E85F /* dictionary.c */; settings = {ATTRIBUTES = (); }; }; + 157434030D4A8137002ACA73 /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5A05C0722B0099E85F /* session.c */; settings = {ATTRIBUTES = (); }; }; + 157434040D4A8137002ACA73 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5C05C0722B0099E85F /* cache.c */; settings = {ATTRIBUTES = (); }; }; + 157434050D4A8137002ACA73 /* notifications.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5E05C0722B0099E85F /* notifications.c */; settings = {ATTRIBUTES = (); }; }; + 157434060D4A8137002ACA73 /* tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A6005C0722B0099E85F /* tests.c */; settings = {ATTRIBUTES = (); }; }; + 157434070D4A8137002ACA73 /* prefs.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A6205C0722B0099E85F /* prefs.c */; settings = {ATTRIBUTES = (); }; }; + 157434080D4A8137002ACA73 /* net.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A509A306C2518F001F0AB7 /* net.c */; }; + 157434090D4A8137002ACA73 /* net_interface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC34670711D49400A3311C /* net_interface.c */; }; + 1574340A0D4A8137002ACA73 /* net_protocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC34690711D49400A3311C /* net_protocol.c */; }; + 1574340B0D4A8137002ACA73 /* net_service.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC346B0711D49400A3311C /* net_service.c */; }; + 1574340C0D4A8137002ACA73 /* net_set.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC346D0711D49400A3311C /* net_set.c */; }; + 1574340E0D4A8137002ACA73 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; + 1574340F0D4A8137002ACA73 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; }; + 157434110D4A8137002ACA73 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 152CEED0070CF6640050F23C /* libedit.dylib */; }; + 15792B9B0DA2C190008DDED9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; }; + 157A84DA0D56C63900B6F1A0 /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 157A84DB0D56C63900B6F1A0 /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; }; + 157A84DE0D56C63900B6F1A0 /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; }; + 157A84DF0D56C63900B6F1A0 /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; }; + 157A84E00D56C63900B6F1A0 /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; }; + 157A84F60D56C7E800B6F1A0 /* dns-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22380AF13A7300D52ED0 /* dns-configuration.h */; }; + 157A84F70D56C7E800B6F1A0 /* set-hostname.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22390AF13A7300D52ED0 /* set-hostname.h */; }; + 157A84FB0D56C7E800B6F1A0 /* dns-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AA07528B36004F8947 /* dns-configuration.c */; }; + 157A84FC0D56C7E800B6F1A0 /* set-hostname.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AB07528B36004F8947 /* set-hostname.c */; }; + 157A85080D56C8AA00B6F1A0 /* ifnamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AE07528B36004F8947 /* ifnamer.c */; }; + 157A85120D56C8E000B6F1A0 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53CB07528B36004F8947 /* cache.h */; }; + 157A85140D56C8E000B6F1A0 /* ev_dlil.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B207528B36004F8947 /* ev_dlil.h */; }; + 157A85150D56C8E000B6F1A0 /* ev_ipv4.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B807528B36004F8947 /* ev_ipv4.h */; }; + 157A85160D56C8E000B6F1A0 /* ev_ipv6.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53BA07528B36004F8947 /* ev_ipv6.h */; }; + 157A85170D56C8E000B6F1A0 /* eventmon.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B707528B36004F8947 /* eventmon.h */; }; + 157A85190D56C8E000B6F1A0 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; }; + 157A851B0D56C8E000B6F1A0 /* ev_dlil.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B107528B36004F8947 /* ev_dlil.c */; }; + 157A851C0D56C8E000B6F1A0 /* ev_ipv4.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B307528B36004F8947 /* ev_ipv4.c */; }; + 157A851D0D56C8E000B6F1A0 /* ev_ipv6.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B407528B36004F8947 /* ev_ipv6.c */; }; + 157A851E0D56C8E000B6F1A0 /* eventmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B007528B36004F8947 /* eventmon.c */; }; + 157A85290D56C91100B6F1A0 /* linkconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C107528B36004F8947 /* linkconfig.c */; }; + 157A85340D56C94F00B6F1A0 /* NetworkIdentification.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A680B03F97800993BA3 /* NetworkIdentification.c */; }; + 157A853F0D56C96F00B6F1A0 /* prefsmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C307528B36004F8947 /* prefsmon.c */; }; 157A88890A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 158ADD0E0754F1A000124717 /* Resolvers.plist in Resources */ = {isa = PBXBuildFile; fileRef = 159D53A807528B36004F8947 /* Resolvers.plist */; }; + 158317250CFB80A1006F62B9 /* configd.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69CF05C0722B0099E85F /* configd.h */; }; + 158317260CFB80A1006F62B9 /* _SCD.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D105C0722B0099E85F /* _SCD.h */; }; + 158317270CFB80A1006F62B9 /* configd_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D305C0722B0099E85F /* configd_server.h */; }; + 158317280CFB80A1006F62B9 /* notify_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D505C0722B0099E85F /* notify_server.h */; }; + 158317290CFB80A1006F62B9 /* plugin_support.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D705C0722B0099E85F /* plugin_support.h */; }; + 1583172A0CFB80A1006F62B9 /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D905C0722B0099E85F /* session.h */; }; + 1583172B0CFB80A1006F62B9 /* pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69DB05C0722B0099E85F /* pattern.h */; }; + 1583172D0CFB80A1006F62B9 /* configd.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E005C0722B0099E85F /* configd.m */; settings = {ATTRIBUTES = (); }; }; + 1583172E0CFB80A1006F62B9 /* _SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E205C0722B0099E85F /* _SCD.c */; settings = {ATTRIBUTES = (); }; }; + 1583172F0CFB80A1006F62B9 /* configd_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E405C0722B0099E85F /* configd_server.c */; settings = {ATTRIBUTES = (); }; }; + 158317300CFB80A1006F62B9 /* notify_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E605C0722B0099E85F /* notify_server.c */; settings = {ATTRIBUTES = (); }; }; + 158317310CFB80A1006F62B9 /* plugin_support.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E805C0722B0099E85F /* plugin_support.c */; settings = {ATTRIBUTES = (); }; }; + 158317320CFB80A1006F62B9 /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69EA05C0722B0099E85F /* session.c */; settings = {ATTRIBUTES = (); }; }; + 158317330CFB80A1006F62B9 /* pattern.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69EC05C0722B0099E85F /* pattern.c */; settings = {ATTRIBUTES = (); }; }; + 158317340CFB80A1006F62B9 /* _configopen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F005C0722B0099E85F /* _configopen.c */; settings = {ATTRIBUTES = (); }; }; + 158317350CFB80A1006F62B9 /* _configclose.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F205C0722B0099E85F /* _configclose.c */; settings = {ATTRIBUTES = (); }; }; + 158317360CFB80A1006F62B9 /* _configlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F405C0722B0099E85F /* _configlock.c */; settings = {ATTRIBUTES = (); }; }; + 158317370CFB80A1006F62B9 /* _configunlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F605C0722B0099E85F /* _configunlock.c */; settings = {ATTRIBUTES = (); }; }; + 158317380CFB80A1006F62B9 /* _configlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F805C0722B0099E85F /* _configlist.c */; settings = {ATTRIBUTES = (); }; }; + 158317390CFB80A1006F62B9 /* _configadd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69FA05C0722B0099E85F /* _configadd.c */; settings = {ATTRIBUTES = (); }; }; + 1583173A0CFB80A1006F62B9 /* _configget.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69FE05C0722B0099E85F /* _configget.c */; settings = {ATTRIBUTES = (); }; }; + 1583173B0CFB80A1006F62B9 /* _configset.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0005C0722B0099E85F /* _configset.c */; settings = {ATTRIBUTES = (); }; }; + 1583173C0CFB80A1006F62B9 /* _configremove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0205C0722B0099E85F /* _configremove.c */; settings = {ATTRIBUTES = (); }; }; + 1583173D0CFB80A1006F62B9 /* _configtouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0405C0722B0099E85F /* _configtouch.c */; settings = {ATTRIBUTES = (); }; }; + 1583173E0CFB80A1006F62B9 /* _confignotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0605C0722B0099E85F /* _confignotify.c */; settings = {ATTRIBUTES = (); }; }; + 1583173F0CFB80A1006F62B9 /* _notifyadd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0805C0722B0099E85F /* _notifyadd.c */; settings = {ATTRIBUTES = (); }; }; + 158317400CFB80A1006F62B9 /* _notifyremove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0A05C0722B0099E85F /* _notifyremove.c */; settings = {ATTRIBUTES = (); }; }; + 158317410CFB80A1006F62B9 /* _notifychanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0C05C0722B0099E85F /* _notifychanges.c */; settings = {ATTRIBUTES = (); }; }; + 158317420CFB80A1006F62B9 /* _notifyviaport.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0E05C0722B0099E85F /* _notifyviaport.c */; settings = {ATTRIBUTES = (); }; }; + 158317430CFB80A1006F62B9 /* _notifyviafd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1005C0722B0099E85F /* _notifyviafd.c */; settings = {ATTRIBUTES = (); }; }; + 158317440CFB80A1006F62B9 /* _notifyviasignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1205C0722B0099E85F /* _notifyviasignal.c */; settings = {ATTRIBUTES = (); }; }; + 158317450CFB80A1006F62B9 /* _notifycancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1405C0722B0099E85F /* _notifycancel.c */; settings = {ATTRIBUTES = (); }; }; + 158317460CFB80A1006F62B9 /* _snapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1605C0722B0099E85F /* _snapshot.c */; settings = {ATTRIBUTES = (); }; }; + 158317470CFB80A1006F62B9 /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Server, ); }; }; + 158317480CFB80A1006F62B9 /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; }; + 158317490CFB80A1006F62B9 /* dnsinfo_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0D05FD1B670096477F /* dnsinfo_server.c */; }; + 1583174A0CFB80A1006F62B9 /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Server, ); }; }; + 1583174C0CFB80A1006F62B9 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; + 1583174E0CFB80A1006F62B9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; }; + 158317500CFB80A1006F62B9 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; }; + 158317520CFB80A1006F62B9 /* libKernelEventMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */; }; + 158317530CFB80A1006F62B9 /* libInterfaceNamer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */; }; + 158317540CFB80A1006F62B9 /* libIPMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53EC07528C61004F8947 /* libIPMonitor.a */; }; + 158317550CFB80A1006F62B9 /* libLinkConfiguration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53F307528C79004F8947 /* libLinkConfiguration.a */; }; + 158317560CFB80A1006F62B9 /* libNetworkIdentification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */; }; + 158317570CFB80A1006F62B9 /* libPreferencesMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */; }; + 1583175C0CFB80A1006F62B9 /* com.apple.configd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1540E3600987DA9500157C07 /* com.apple.configd.plist */; }; + 1583379B0CFB6B9E0033AB93 /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; }; + 1583379C0CFB6B9E0033AB93 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; }; + 1583379E0CFB6B9E0033AB93 /* SCHelper_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */; }; + 158337A00CFB6B9E0033AB93 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; + 158337A20CFB6B9E0033AB93 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; }; + 158337AD0CFB6BDC0033AB93 /* com.apple.SCHelper-embedded.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 151356AD0CE0CF2F0017E523 /* com.apple.SCHelper-embedded.plist */; }; 158ADD190754F1F100124717 /* Kicker.xml in Resources */ = {isa = PBXBuildFile; fileRef = 159D53BC07528B36004F8947 /* Kicker.xml */; }; 158ADD1B0754F1F400124717 /* enable-network in Resources */ = {isa = PBXBuildFile; fileRef = 159D53BD07528B36004F8947 /* enable-network */; }; + 15943D440E94081800B87535 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; }; + 159C32B60F583724008A72EE /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; }; + 159C9B290DB68E0700BEEF10 /* atconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C707528B36004F8947 /* atconfig.c */; }; + 159C9B2A0DB68E0800BEEF10 /* cfManager.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C507528B36004F8947 /* cfManager.c */; }; + 159C9B2D0DB68E3D00BEEF10 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; }; + 159C9B300DB68E8400BEEF10 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; + 159C9B7A0DB68E8A00BEEF10 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; + 159C9B820DB68EE500BEEF10 /* kicker.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53BE07528B36004F8947 /* kicker.c */; }; + 159C9B860DB68F1600BEEF10 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; + 159C9B870DB68F1600BEEF10 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; }; 159D540907528D3A004F8947 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; }; 159D540A07528D3B004F8947 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53CB07528B36004F8947 /* cache.h */; }; - 159D540B07528DA9004F8947 /* ev_appletalk.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B907528B36004F8947 /* ev_appletalk.c */; }; - 159D540C07528DAA004F8947 /* ev_appletalk.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B607528B36004F8947 /* ev_appletalk.h */; }; 159D540D07528DAE004F8947 /* ev_dlil.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B107528B36004F8947 /* ev_dlil.c */; }; 159D540E07528DAE004F8947 /* ev_dlil.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B207528B36004F8947 /* ev_dlil.h */; }; 159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B307528B36004F8947 /* ev_ipv4.c */; }; @@ -153,7 +494,6 @@ 159D541207528DB3004F8947 /* ev_ipv6.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53BA07528B36004F8947 /* ev_ipv6.h */; }; 159D541307528DB5004F8947 /* eventmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B007528B36004F8947 /* eventmon.c */; }; 159D541407528DB5004F8947 /* eventmon.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B707528B36004F8947 /* eventmon.h */; }; - 159D541507528DDE004F8947 /* kicker.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53BE07528B36004F8947 /* kicker.c */; }; 159D541607528DF1004F8947 /* ifnamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AE07528B36004F8947 /* ifnamer.c */; }; 159D541707528E05004F8947 /* ip_plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53A707528B36004F8947 /* ip_plugin.c */; }; 159D541807528E09004F8947 /* dns-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AA07528B36004F8947 /* dns-configuration.c */; }; @@ -205,15 +545,131 @@ 159D54D607529FFF004F8947 /* configd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A2005C0722B0099E85F /* configd.8 */; }; 15A2972F0A13C08C009879B3 /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; }; 15A297300A13C08C009879B3 /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A1E70D5B94190087BDA0 /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 15A5A1E80D5B94190087BDA0 /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1E90D5B94190087BDA0 /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 15A5A1EA0D5B94190087BDA0 /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A1EB0D5B94190087BDA0 /* SCDynamicStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691B05C0722B0099E85F /* SCDynamicStoreInternal.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 15A5A1EC0D5B94190087BDA0 /* SCDynamicStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691D05C0722B0099E85F /* SCDynamicStore.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1ED0D5B94190087BDA0 /* SCDynamicStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691F05C0722B0099E85F /* SCDynamicStorePrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 15A5A1EE0D5B94190087BDA0 /* SCDynamicStoreKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692105C0722B0099E85F /* SCDynamicStoreKey.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1EF0D5B94190087BDA0 /* SCDynamicStoreCopySpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692305C0722B0099E85F /* SCDynamicStoreCopySpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1F00D5B94190087BDA0 /* SCDynamicStoreCopySpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692505C0722B0099E85F /* SCDynamicStoreCopySpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 15A5A1F10D5B94190087BDA0 /* SCDynamicStoreSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692705C0722B0099E85F /* SCDynamicStoreSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 15A5A1F20D5B94190087BDA0 /* SCPreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692905C0722B0099E85F /* SCPreferencesInternal.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 15A5A1F30D5B94190087BDA0 /* SCPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692B05C0722B0099E85F /* SCPreferences.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1F40D5B94190087BDA0 /* SCPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692D05C0722B0099E85F /* SCPreferencesPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 15A5A1F50D5B94190087BDA0 /* SCPreferencesPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692F05C0722B0099E85F /* SCPreferencesPath.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1F60D5B94190087BDA0 /* SCPreferencesSetSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1F70D5B94190087BDA0 /* SCNetworkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 15A5A1F80D5B94190087BDA0 /* SCNetworkConfigurationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */; settings = {ATTRIBUTES = (); }; }; + 15A5A1F90D5B94190087BDA0 /* SCNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693305C0722B0099E85F /* SCNetwork.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1FA0D5B94190087BDA0 /* SCNetworkConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693505C0722B0099E85F /* SCNetworkConnection.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1FB0D5B94190087BDA0 /* SCNetworkReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693705C0722B0099E85F /* SCNetworkReachability.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; + 15A5A1FC0D5B94190087BDA0 /* SCValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693905C0722B0099E85F /* SCValidation.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; + 15A5A1FD0D5B94190087BDA0 /* DHCPClientPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 15A5A1FE0D5B94190087BDA0 /* SCDynamicStoreCopyDHCPInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693F05C0722B0099E85F /* SCDynamicStoreCopyDHCPInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 15A5A1FF0D5B94190087BDA0 /* moh_msg.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694105C0722B0099E85F /* moh_msg.h */; }; + 15A5A2000D5B94190087BDA0 /* moh.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694305C0722B0099E85F /* moh.h */; }; + 15A5A2010D5B94190087BDA0 /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A2030D5B94190087BDA0 /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; }; + 15A5A2050D5B94190087BDA0 /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A2060D5B94190087BDA0 /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; }; + 15A5A2070D5B94190087BDA0 /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; }; + 15A5A2080D5B94190087BDA0 /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; }; + 15A5A2090D5B94190087BDA0 /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; }; + 15A5A20C0D5B94190087BDA0 /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A20D0D5B94190087BDA0 /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A20E0D5B94190087BDA0 /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A20F0D5B94190087BDA0 /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; }; + 15A5A2100D5B94190087BDA0 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; }; + 15A5A2110D5B94190087BDA0 /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A2120D5B94190087BDA0 /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A2130D5B94190087BDA0 /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A2140D5B94190087BDA0 /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A2150D5B94190087BDA0 /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 15A5A2190D5B94190087BDA0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; }; + 15A5A21A0D5B94190087BDA0 /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; }; + 15A5A21B0D5B94190087BDA0 /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; }; + 15A5A21E0D5B94190087BDA0 /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; }; + 15A5A21F0D5B94190087BDA0 /* SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695005C0722B0099E85F /* SCD.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2200D5B94190087BDA0 /* SCDKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695205C0722B0099E85F /* SCDKeys.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2210D5B94190087BDA0 /* SCDPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695405C0722B0099E85F /* SCDPrivate.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2220D5B94190087BDA0 /* SCDPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695605C0722B0099E85F /* SCDPlugin.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2230D5B94190087BDA0 /* SCDOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695805C0722B0099E85F /* SCDOpen.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2240D5B94190087BDA0 /* SCDLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695A05C0722B0099E85F /* SCDLock.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2250D5B94190087BDA0 /* SCDUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695C05C0722B0099E85F /* SCDUnlock.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2260D5B94190087BDA0 /* SCDList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695E05C0722B0099E85F /* SCDList.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2270D5B94190087BDA0 /* SCDAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696005C0722B0099E85F /* SCDAdd.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2280D5B94190087BDA0 /* SCDGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696405C0722B0099E85F /* SCDGet.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2290D5B94190087BDA0 /* SCDSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696605C0722B0099E85F /* SCDSet.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A22A0D5B94190087BDA0 /* SCDRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696805C0722B0099E85F /* SCDRemove.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A22B0D5B94190087BDA0 /* SCDTouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696A05C0722B0099E85F /* SCDTouch.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A22C0D5B94190087BDA0 /* SCDNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696C05C0722B0099E85F /* SCDNotify.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A22D0D5B94190087BDA0 /* SCDNotifierSetKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696E05C0722B0099E85F /* SCDNotifierSetKeys.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A22E0D5B94190087BDA0 /* SCDNotifierAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697005C0722B0099E85F /* SCDNotifierAdd.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A22F0D5B94190087BDA0 /* SCDNotifierRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697205C0722B0099E85F /* SCDNotifierRemove.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2300D5B94190087BDA0 /* SCDNotifierGetChanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697405C0722B0099E85F /* SCDNotifierGetChanges.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2310D5B94190087BDA0 /* SCDNotifierWait.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697605C0722B0099E85F /* SCDNotifierWait.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2320D5B94190087BDA0 /* SCDNotifierInformViaCallback.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697805C0722B0099E85F /* SCDNotifierInformViaCallback.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2330D5B94190087BDA0 /* SCDNotifierInformViaMachPort.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697A05C0722B0099E85F /* SCDNotifierInformViaMachPort.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2340D5B94190087BDA0 /* SCDNotifierInformViaFD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697C05C0722B0099E85F /* SCDNotifierInformViaFD.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2350D5B94190087BDA0 /* SCDNotifierInformViaSignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697E05C0722B0099E85F /* SCDNotifierInformViaSignal.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2360D5B94190087BDA0 /* SCDNotifierCancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698005C0722B0099E85F /* SCDNotifierCancel.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2370D5B94190087BDA0 /* SCDSnapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698205C0722B0099E85F /* SCDSnapshot.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2380D5B94190087BDA0 /* SCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698405C0722B0099E85F /* SCP.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2390D5B94190087BDA0 /* SCPOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698605C0722B0099E85F /* SCPOpen.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A23A0D5B94190087BDA0 /* SCPLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698805C0722B0099E85F /* SCPLock.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A23B0D5B94190087BDA0 /* SCPUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698A05C0722B0099E85F /* SCPUnlock.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A23C0D5B94190087BDA0 /* SCPList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698C05C0722B0099E85F /* SCPList.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A23D0D5B94190087BDA0 /* SCPGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698E05C0722B0099E85F /* SCPGet.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A23E0D5B94190087BDA0 /* SCPAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699005C0722B0099E85F /* SCPAdd.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A23F0D5B94190087BDA0 /* SCPSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699205C0722B0099E85F /* SCPSet.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2400D5B94190087BDA0 /* SCPRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699405C0722B0099E85F /* SCPRemove.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2410D5B94190087BDA0 /* SCPCommit.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699605C0722B0099E85F /* SCPCommit.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2420D5B94190087BDA0 /* SCPApply.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699805C0722B0099E85F /* SCPApply.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2430D5B94190087BDA0 /* SCPPath.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699A05C0722B0099E85F /* SCPPath.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2450D5B94190087BDA0 /* SCDHostName.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699E05C0722B0099E85F /* SCDHostName.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2460D5B94190087BDA0 /* SCLocation.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A005C0722B0099E85F /* SCLocation.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2470D5B94190087BDA0 /* SCNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A205C0722B0099E85F /* SCNetwork.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2480D5B94190087BDA0 /* pppcontroller.defs in Sources */ = {isa = PBXBuildFile; fileRef = 23C1E2B8062DD45900835B54 /* pppcontroller.defs */; settings = {ATTRIBUTES = (Client, ); }; }; + 15A5A2490D5B94190087BDA0 /* SCNetworkConnection.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A405C0722B0099E85F /* SCNetworkConnection.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A24A0D5B94190087BDA0 /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; }; + 15A5A24B0D5B94190087BDA0 /* SCNetworkReachability.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A605C0722B0099E85F /* SCNetworkReachability.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A24C0D5B94190087BDA0 /* SCProxies.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A805C0722B0099E85F /* SCProxies.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A24D0D5B94190087BDA0 /* DHCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AC05C0722B0099E85F /* DHCP.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A24E0D5B94190087BDA0 /* moh.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AE05C0722B0099E85F /* moh.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A24F0D5B94190087BDA0 /* DeviceOnHold.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B005C0722B0099E85F /* DeviceOnHold.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2500D5B94190087BDA0 /* LinkConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B205C0722B0099E85F /* LinkConfiguration.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2510D5B94190087BDA0 /* dy_framework.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B405C0722B0099E85F /* dy_framework.c */; settings = {ATTRIBUTES = (); }; }; + 15A5A2530D5B94190087BDA0 /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Client, ); }; }; + 15A5A2540D5B94190087BDA0 /* SCPreferencesPathKey.c in Sources */ = {isa = PBXBuildFile; fileRef = 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */; }; + 15A5A2550D5B94190087BDA0 /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; }; + 15A5A2560D5B94190087BDA0 /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; }; + 15A5A2570D5B94190087BDA0 /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; }; + 15A5A2580D5B94190087BDA0 /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; }; + 15A5A2590D5B94190087BDA0 /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; }; + 15A5A25A0D5B94190087BDA0 /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; }; + 15A5A25B0D5B94190087BDA0 /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; }; + 15A5A25C0D5B94190087BDA0 /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; }; + 15A5A25E0D5B94190087BDA0 /* helper_comm.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D608466D4900D1B2BD /* helper_comm.c */; }; + 15A5A25F0D5B94190087BDA0 /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; }; + 15A5A2600D5B94190087BDA0 /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; }; + 15A5A2610D5B94190087BDA0 /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; }; + 15A5A2630D5B94190087BDA0 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; 15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; }; 15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; }; + 15D48EBF0F67061600B4711E /* dnsinfo_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */; }; + 15D48EC00F67061700B4711E /* dnsinfo_create.h in Headers */ = {isa = PBXBuildFile; fileRef = 1532629006281C9D00B1C10C /* dnsinfo_create.h */; }; + 15D48EC10F67061F00B4711E /* dnsinfo_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */; }; + 15D48EC20F67061F00B4711E /* dnsinfo_create.h in Headers */ = {isa = PBXBuildFile; fileRef = 1532629006281C9D00B1C10C /* dnsinfo_create.h */; }; + 15D48ED30F67079B00B4711E /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; }; + 15D48ED40F6707A600B4711E /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; }; 15DAD5E1075913CE0084A6ED /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15DAD5E2075913CE0084A6ED /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; }; - 15DAD5E3075913CE0084A6ED /* dnsinfo_create.h in Headers */ = {isa = PBXBuildFile; fileRef = 1532629006281C9D00B1C10C /* dnsinfo_create.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; }; 15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; }; 15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; }; - 15DAD5E8075913CE0084A6ED /* dnsinfo_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */; }; 15DAD64307591A1A0084A6ED /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; }; 15DAD64407591A1A0084A6ED /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; }; 15DAD64507591A1A0084A6ED /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -242,14 +698,11 @@ 15DAD65C07591A1A0084A6ED /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; }; 15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694705C0722B0099E85F /* LinkConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; }; 15DAD65E07591A1A0084A6ED /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; }; - 15DAD65F07591A1A0084A6ED /* VLANConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694B05C0722B0099E85F /* VLANConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; }; 15DAD66107591A1A0084A6ED /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; }; 15DAD66207591A1A0084A6ED /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; }; 15DAD66307591A1A0084A6ED /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; }; 15DAD66407591A1A0084A6ED /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; }; 15DAD66507591A1A0084A6ED /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; }; - 15DAD66607591A1A0084A6ED /* BondConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EE943F406AF409B00772EB5 /* BondConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 15DAD66707591A1A0084A6ED /* BondConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; }; 15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */ = {isa = PBXBuildFile; fileRef = 15CFC229068B222F00123568 /* get-mobility-info */; }; 15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; }; @@ -310,8 +763,8 @@ 15DAD6A407591A1A0084A6ED /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; }; 15DAD6A507591A1A0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; }; 15DAD6A607591A1A0084A6ED /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; }; - 15DAD6A707591A1A0084A6ED /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; }; - 15DAD6A807591A1A0084A6ED /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; }; + 15DAD6A707591A1A0084A6ED /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; + 15DAD6A807591A1A0084A6ED /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; 15DAD6A907591A1A0084A6ED /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; }; 15DAD6AA07591A1A0084A6ED /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; }; 15DAD6AB07591A1A0084A6ED /* BondConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 9EE943F306AF409B00772EB5 /* BondConfiguration.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; @@ -321,11 +774,11 @@ 15DAF2DC08466D4900D1B2BD /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; }; 15DAF2DF08466D4900D1B2BD /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; }; 15DAF2E108466D4900D1B2BD /* SCHelper_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */; }; - 15E517680CCFBCD0008FFE82 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; }; 15FC130B0CCEA59E0013872C /* monitor.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FC130A0CCEA59E0013872C /* monitor.c */; }; 15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; }; 15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */; }; 15FEE81F0CD03E75001312F9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15FEE8180CD03CBB001312F9 /* Localizable.strings */; }; + 15FF5C370CDF776200EEC8AA /* com.apple.SCHelper.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15FF5C290CDF770500EEC8AA /* com.apple.SCHelper.plist */; }; F95B8A430B03E07A00993BA3 /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; }; F95B8A460B03E09300993BA3 /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; }; F95B8A470B03E09300993BA3 /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -333,13 +786,20 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 150ECB3B0D0079280065E94D /* PBXContainerItemProxy */ = { + 150ECB2F0D0042DA0065E94D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; proxyType = 1; remoteGlobalIDString = 151F5D990CCE98E50093AC3B; remoteInfo = SCMonitor; }; + 151FE3790D5B713C000D6DB1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 151FE2DD0D5B7046000D6DB1; + remoteInfo = "configd_base-EmbeddedSimulator"; + }; 1520A385084681350010B584 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; @@ -347,12 +807,12 @@ remoteGlobalIDString = 1547001808455B98006787CE; remoteInfo = SCHelper; }; - 1533B94009731A9600F2B34A /* PBXContainerItemProxy */ = { + 1521405A0E9400BF00DACD2C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; proxyType = 1; - remoteGlobalIDString = 15FD733A0754DBDA001CC321; - remoteInfo = ATconfig; + remoteGlobalIDString = 15213FF90E93E9F500DACD2C; + remoteInfo = Logger.bundle; }; 1558480507550D470046C2E9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -382,19 +842,82 @@ remoteGlobalIDString = 155847FA07550D210046C2E9; remoteInfo = configd_executables; }; - 157BB8BF075924460025DA7A /* PBXContainerItemProxy */ = { + 156CA4A70EF8550800C59A18 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; proxyType = 1; - remoteGlobalIDString = 15DAD63F07591A1A0084A6ED; - remoteInfo = SystemConfiguration.framework; + remoteGlobalIDString = 156CA4790EF853BB00C59A18; + remoteInfo = "Logger.bundle-Embedded"; }; - 157BB8C1075924470025DA7A /* PBXContainerItemProxy */ = { + 1574341E0D4A815E002ACA73 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; proxyType = 1; - remoteGlobalIDString = 15DAD5DF075913CE0084A6ED; - remoteInfo = DNSConfiguration; + remoteGlobalIDString = 157433F00D4A8137002ACA73; + remoteInfo = "scutil-Embedded"; + }; + 157434200D4A8166002ACA73 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 157433DD0D4A8122002ACA73; + remoteInfo = "scselect-Embedded"; + }; + 157A85470D56CA0B00B6F1A0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 157A84F40D56C7E800B6F1A0; + remoteInfo = "IPMonitor-Embedded"; + }; + 157A85490D56CA2300B6F1A0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 157A85050D56C8AA00B6F1A0; + remoteInfo = "InterfaceNamer-Embedded"; + }; + 157A854B0D56CA5100B6F1A0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 157A85100D56C8E000B6F1A0; + remoteInfo = "KernelEventMonitor-Embedded"; + }; + 157A854D0D56CA6F00B6F1A0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 157A85260D56C91100B6F1A0; + remoteInfo = "LinkConfiguration-Embedded"; + }; + 157A854F0D56CA8800B6F1A0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 157A85310D56C94F00B6F1A0; + remoteInfo = "NetworkIdentification-Embedded"; + }; + 157A85510D56CA9E00B6F1A0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 157A853C0D56C96F00B6F1A0; + remoteInfo = "PreferencesMonitor-Embedded"; + }; + 157A85530D56CACA00B6F1A0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158317A80CFB8639006F62B9; + remoteInfo = "PreferencesMonitor.bundle-Embedded"; + }; + 157BB8BF075924460025DA7A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 15DAD63F07591A1A0084A6ED; + remoteInfo = SystemConfiguration.framework; }; 157BB8C30759244B0025DA7A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -410,6 +933,83 @@ remoteGlobalIDString = 15828AE60753B5F900AD4710; remoteInfo = KernelEventMonitor.bundle; }; + 1583170F0CFB77D1006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158316CF0CFB774B006F62B9; + remoteInfo = "configd_base-Embedded"; + }; + 158317110CFB77E1006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1572C4A60CFB55B400E2776E; + remoteInfo = "SystemConfiguration.framework-Embedded"; + }; + 158317130CFB77E8006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158337990CFB6B9E0033AB93; + remoteInfo = "SCHelper-Embedded"; + }; + 158317150CFB783B006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158316E30CFB7761006F62B9; + remoteInfo = "configd_plugins-Embedded"; + }; + 158317170CFB784D006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158317040CFB7782006F62B9; + remoteInfo = "configd_executables-Embedded"; + }; + 158317650CFB80D5006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158317230CFB80A1006F62B9; + remoteInfo = "configd-Embedded"; + }; + 158317B20CFB8660006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158317A00CFB8626006F62B9; + remoteInfo = "NetworkIdentification.bundle-Embedded"; + }; + 158317B40CFB8660006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158317980CFB860C006F62B9; + remoteInfo = "LinkConfiguration.bundle-Embedded"; + }; + 158317B60CFB8660006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158317900CFB85F7006F62B9; + remoteInfo = "KernelEventMonitor.bundle-Embedded"; + }; + 158317B80CFB8660006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 158317870CFB85DD006F62B9; + remoteInfo = "InterfaceNamer.bundle-Embedded"; + }; + 158317BA0CFB8660006F62B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1583177D0CFB85C8006F62B9; + remoteInfo = "IPMonitor.bundle-Embedded"; + }; 158AD9850754E72500124717 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; @@ -480,12 +1080,40 @@ remoteGlobalIDString = 159D542007528E7C004F8947; remoteInfo = Plugins; }; - 15DAD5730759115F0084A6ED /* PBXContainerItemProxy */ = { + 15A5A2700D5B942D0087BDA0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 15A5A1E40D5B94190087BDA0; + remoteInfo = "SystemConfiguration.framework-EmbeddedSimulator"; + }; + 15C64A210F684C4900D78394 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 15DAD5DF075913CE0084A6ED; + remoteInfo = DNSConfiguration; + }; + 15C64A230F684C5700D78394 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 15C64A1E0F684C3300D78394; + remoteInfo = configd_libSystem; + }; + 15C64A2E0F684C8300D78394 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 15C64A280F684C6B00D78394; + remoteInfo = "configd_libSystem-Embedded"; + }; + 15C64A300F684C8F00D78394 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 15CB6A7705C0722B0099E85F /* Project object */; proxyType = 1; - remoteGlobalIDString = 15FD731E0754DB9F001CC321; - remoteInfo = ATconfig.bundle; + remoteGlobalIDString = 157A84D80D56C63900B6F1A0; + remoteInfo = "DNSConfiguration-Embedded"; }; F95B8A760B03FB9100993BA3 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -524,6 +1152,26 @@ ); runOnlyForDeploymentPostprocessing = 1; }; + 1583175B0CFB80A1006F62B9 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /System/Library/LaunchDaemons; + dstSubfolderSpec = 0; + files = ( + 1583175C0CFB80A1006F62B9 /* com.apple.configd.plist in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 158337A40CFB6B9E0033AB93 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /System/Library/LaunchDaemons; + dstSubfolderSpec = 0; + files = ( + 158337AD0CFB6BDC0033AB93 /* com.apple.SCHelper-embedded.plist in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; 159D54D507529FFF004F8947 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 8; @@ -544,49 +1192,85 @@ ); runOnlyForDeploymentPostprocessing = 1; }; + 15FF5C380CDF778F00EEC8AA /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /System/Library/LaunchDaemons; + dstSubfolderSpec = 0; + files = ( + 15FF5C370CDF776200EEC8AA /* com.apple.SCHelper.plist in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCSchemaDefinitions.c; sourceTree = ""; }; 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitions.h; sourceTree = ""; }; + 151356AD0CE0CF2F0017E523 /* com.apple.SCHelper-embedded.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "com.apple.SCHelper-embedded.plist"; path = "helper/com.apple.SCHelper-embedded.plist"; sourceTree = ""; }; 1514D76D05C08A5F00757DC9 /* config_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config_types.h; path = SystemConfiguration.fproj/config_types.h; sourceTree = SOURCE_ROOT; }; 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCPreferencesPathKey.h; path = SystemConfiguration.fproj/SCPreferencesPathKey.h; sourceTree = SOURCE_ROOT; }; 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCPreferencesPathKey.c; path = SystemConfiguration.fproj/SCPreferencesPathKey.c; sourceTree = SOURCE_ROOT; }; 151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SCMonitor.plugin; sourceTree = BUILT_PRODUCTS_DIR; }; 151F63EC09328A3C0096DCC9 /* genSCPreferences */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = genSCPreferences; sourceTree = BUILT_PRODUCTS_DIR; }; 1520A3DE0846B2DC0010B584 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = ""; }; + 15213FFA0E93E9F500DACD2C /* Logger.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Logger.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_create.c; path = dnsinfo/dnsinfo_create.c; sourceTree = SOURCE_ROOT; }; + 1522FCE50FA7FD7000B24128 /* dnsinfo_flatfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dnsinfo_flatfile.c; path = dnsinfo/dnsinfo_flatfile.c; sourceTree = ""; }; 152CEED0070CF6640050F23C /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.2.dylib; sourceTree = ""; }; 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesKeychainPrivate.h; sourceTree = ""; }; 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCPreferencesKeychainPrivate.c; sourceTree = ""; }; + 1531D3DA0E93E6DA00248432 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Plugins/Logger/Info.plist; sourceTree = ""; }; + 1531D3DB0E93E6DA00248432 /* logger.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = logger.c; path = Plugins/Logger/logger.c; sourceTree = ""; }; 1532629006281C9D00B1C10C /* dnsinfo_create.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_create.h; path = dnsinfo/dnsinfo_create.h; sourceTree = ""; }; - 1540E3600987DA9500157C07 /* com.apple.configd.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = com.apple.configd.plist; sourceTree = ""; }; + 153393E20D34994100FE74E7 /* update-headers */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = "update-headers"; sourceTree = ""; }; + 1540E3600987DA9500157C07 /* com.apple.configd.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.xml; fileEncoding = 30; path = com.apple.configd.plist; sourceTree = ""; }; 1543636A0752D03C00A8EC6C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; 1547001D08455B98006787CE /* SCHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCHelper; sourceTree = BUILT_PRODUCTS_DIR; }; + 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesGetSpecificPrivate.h; sourceTree = ""; }; 1558476A0754FDCD0046C2E9 /* scutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scutil; sourceTree = BUILT_PRODUCTS_DIR; }; 1558481D07550EC10046C2E9 /* scselect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scselect; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C4470D349A4E0098FD59 /* SCHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCHelper; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C44C0D349A4E0098FD59 /* configd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = configd; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C4500D349A4E0098FD59 /* IPMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IPMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C4510D349A4E0098FD59 /* InterfaceNamer.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InterfaceNamer.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C4520D349A4E0098FD59 /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C4530D349A4E0098FD59 /* LinkConfiguration.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LinkConfiguration.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C4540D349A4E0098FD59 /* PreferencesMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PreferencesMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 1559C4550D349A4E0098FD59 /* NetworkIdentification.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkIdentification.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfigurationPrivate.h; sourceTree = ""; }; 155B7BF60847776D00F0E262 /* SCHelper_client.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCHelper_client.h; path = helper/SCHelper_client.h; sourceTree = ""; }; 155D22380AF13A7300D52ED0 /* dns-configuration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "dns-configuration.h"; sourceTree = ""; }; 155D22390AF13A7300D52ED0 /* set-hostname.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "set-hostname.h"; sourceTree = ""; }; 155D223A0AF13A7300D52ED0 /* smb-configuration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "smb-configuration.h"; sourceTree = ""; }; + 1567333E0DD1FD6500145179 /* entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = entitlements.plist; sourceTree = ""; }; 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesSetSpecificPrivate.h; sourceTree = ""; }; + 156CA4850EF853BB00C59A18 /* Logger.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Logger.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 156CA48D0EF853BB00C59A18 /* Info-Embedded.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-Embedded.plist"; path = "Plugins/Logger/Info-Embedded.plist"; sourceTree = ""; }; 1572EB7A0A506D3B00D02459 /* smb-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "smb-configuration.c"; sourceTree = ""; }; + 157433EC0D4A8122002ACA73 /* scselect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scselect; sourceTree = BUILT_PRODUCTS_DIR; }; + 1574341A0D4A8137002ACA73 /* scutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scutil; sourceTree = BUILT_PRODUCTS_DIR; }; 1577252F06EFB96700D7B52B /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/NetworkInterface.strings; sourceTree = ""; }; + 157A84E80D56C63900B6F1A0 /* libdnsinfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdnsinfo.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 157A85020D56C7E800B6F1A0 /* libIPMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIPMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 157A850D0D56C8AA00B6F1A0 /* libInterfaceNamer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInterfaceNamer.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 157A85230D56C8E000B6F1A0 /* libKernelEventMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKernelEventMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 157A852E0D56C91100B6F1A0 /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 157A85390D56C94F00B6F1A0 /* libNetworkIdentification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetworkIdentification.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 157A85440D56C96F00B6F1A0 /* libPreferencesMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPreferencesMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; }; 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitionsPrivate.h; sourceTree = ""; }; 15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 1587A31F0B6AACD70063104A /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = ""; }; - 158AD85B0754E38F00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - 158AD8700754E3D400124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - 158AD8C00754E3EF00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - 158AD9100754E40E00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; + 158AD85B0754E38F00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 158AD8700754E3D400124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 158AD8C00754E3EF00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 158AD9100754E40E00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 158AD9F80754EA2F00124717 /* AppleTalk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppleTalk.framework; path = /System/Library/Frameworks/AppleTalk.framework; sourceTree = ""; }; - 159D53A707528B36004F8947 /* ip_plugin.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ip_plugin.c; sourceTree = ""; tabWidth = 8; usesTabs = 1; }; - 159D53A807528B36004F8947 /* Resolvers.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Resolvers.plist; sourceTree = ""; }; + 159D53A707528B36004F8947 /* ip_plugin.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ip_plugin.c; sourceTree = ""; }; 159D53AA07528B36004F8947 /* dns-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "dns-configuration.c"; sourceTree = ""; }; 159D53AB07528B36004F8947 /* set-hostname.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "set-hostname.c"; sourceTree = ""; }; - 159D53AE07528B36004F8947 /* ifnamer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ifnamer.c; sourceTree = ""; }; + 159D53AE07528B36004F8947 /* ifnamer.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ifnamer.c; sourceTree = ""; }; 159D53B007528B36004F8947 /* eventmon.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = eventmon.c; sourceTree = ""; }; 159D53B107528B36004F8947 /* ev_dlil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_dlil.c; sourceTree = ""; }; 159D53B207528B36004F8947 /* ev_dlil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_dlil.h; sourceTree = ""; }; @@ -608,7 +1292,6 @@ 159D53CA07528B36004F8947 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = ""; }; 159D53CB07528B36004F8947 /* cache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cache.h; sourceTree = ""; }; 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKernelEventMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 159D53DE07528C2E004F8947 /* libKicker.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKicker.a; sourceTree = BUILT_PRODUCTS_DIR; }; 159D53E507528C4A004F8947 /* libInterfaceNamer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInterfaceNamer.a; sourceTree = BUILT_PRODUCTS_DIR; }; 159D53EC07528C61004F8947 /* libIPMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIPMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; }; 159D53F307528C79004F8947 /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -618,6 +1301,7 @@ 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConnectionPrivate.h; sourceTree = ""; }; 15A509A306C2518F001F0AB7 /* net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net.c; sourceTree = ""; }; 15A509A406C2518F001F0AB7 /* net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net.h; sourceTree = ""; }; + 15A5A26A0D5B94190087BDA0 /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 15A6F7C30A4B266D00B907EA /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; 15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfiguration.h; sourceTree = ""; }; 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkConfigurationInternal.c; sourceTree = ""; }; @@ -626,7 +1310,8 @@ 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkProtocol.c; sourceTree = ""; }; 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkService.c; sourceTree = ""; }; 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSet.c; sourceTree = ""; }; - 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */ = {isa = PBXFileReference; explicitFileType = text.xml; fileEncoding = 4; path = NetworkConfiguration.plist; sourceTree = ""; }; + 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = AspenSDK.xcconfig; path = AppleInternal/XcodeConfig/AspenSDK.xcconfig; sourceTree = DEVELOPER_DIR; }; + 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.xml; fileEncoding = 4; path = NetworkConfiguration.plist; sourceTree = ""; }; 15B73F0805FD1B670096477F /* dnsinfo_copy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_copy.c; path = dnsinfo/dnsinfo_copy.c; sourceTree = ""; }; 15B73F0905FD1B670096477F /* dnsinfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo.h; path = dnsinfo/dnsinfo.h; sourceTree = ""; }; 15B73F0B05FD1B670096477F /* dnsinfo_private.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_private.c; path = dnsinfo/dnsinfo_private.c; sourceTree = ""; }; @@ -634,7 +1319,6 @@ 15B73F0D05FD1B670096477F /* dnsinfo_server.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_server.c; path = dnsinfo/dnsinfo_server.c; sourceTree = ""; }; 15B73F0E05FD1B670096477F /* dnsinfo_server.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_server.h; path = dnsinfo/dnsinfo_server.h; sourceTree = ""; }; 15BAA32207F0699A00D9EC95 /* libbsm.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbsm.dylib; path = /usr/lib/libbsm.dylib; sourceTree = ""; }; - 15CB690505C0722A0099E85F /* preferences.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = preferences.xml; sourceTree = ""; }; 15CB691305C0722B0099E85F /* SystemConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemConfiguration.h; sourceTree = ""; }; 15CB691505C0722B0099E85F /* SCPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPrivate.h; sourceTree = ""; }; 15CB691705C0722B0099E85F /* SCDPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDPlugin.h; sourceTree = ""; }; @@ -661,7 +1345,6 @@ 15CB694505C0722B0099E85F /* DeviceOnHold.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceOnHold.h; sourceTree = ""; }; 15CB694705C0722B0099E85F /* LinkConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LinkConfiguration.h; sourceTree = ""; }; 15CB694905C0722B0099E85F /* dy_framework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dy_framework.h; sourceTree = ""; }; - 15CB694B05C0722B0099E85F /* VLANConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLANConfiguration.h; sourceTree = ""; }; 15CB695005C0722B0099E85F /* SCD.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCD.c; sourceTree = ""; }; 15CB695205C0722B0099E85F /* SCDKeys.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDKeys.c; sourceTree = ""; }; 15CB695405C0722B0099E85F /* SCDPrivate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDPrivate.c; sourceTree = ""; }; @@ -688,7 +1371,7 @@ 15CB698005C0722B0099E85F /* SCDNotifierCancel.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierCancel.c; sourceTree = ""; }; 15CB698205C0722B0099E85F /* SCDSnapshot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDSnapshot.c; sourceTree = ""; }; 15CB698405C0722B0099E85F /* SCP.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCP.c; sourceTree = ""; }; - 15CB698605C0722B0099E85F /* SCPOpen.c */ = {isa = PBXFileReference; indentWidth = 8; lastKnownFileType = sourcecode.c.c; path = SCPOpen.c; sourceTree = ""; tabWidth = 8; }; + 15CB698605C0722B0099E85F /* SCPOpen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPOpen.c; sourceTree = ""; }; 15CB698805C0722B0099E85F /* SCPLock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPLock.c; sourceTree = ""; }; 15CB698A05C0722B0099E85F /* SCPUnlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPUnlock.c; sourceTree = ""; }; 15CB698C05C0722B0099E85F /* SCPList.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPList.c; sourceTree = ""; }; @@ -713,7 +1396,7 @@ 15CB69B405C0722B0099E85F /* dy_framework.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dy_framework.c; sourceTree = ""; }; 15CB69B605C0722B0099E85F /* VLANConfiguration.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = VLANConfiguration.c; sourceTree = ""; }; 15CB69BE05C0722B0099E85F /* config.defs */ = {isa = PBXFileReference; explicitFileType = sourcecode.mig; name = config.defs; path = SystemConfiguration.fproj/config.defs; sourceTree = ""; }; - 15CB69BF05C0722B0099E85F /* genSCPreferences.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = genSCPreferences.c; path = SystemConfiguration.fproj/genSCPreferences.c; sourceTree = ""; }; + 15CB69BF05C0722B0099E85F /* genSCPreferences.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; name = genSCPreferences.c; path = SystemConfiguration.fproj/genSCPreferences.c; sourceTree = ""; }; 15CB69CF05C0722B0099E85F /* configd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configd.h; sourceTree = ""; }; 15CB69D105C0722B0099E85F /* _SCD.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _SCD.h; sourceTree = ""; }; 15CB69D305C0722B0099E85F /* configd_server.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configd_server.h; sourceTree = ""; }; @@ -770,7 +1453,6 @@ 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 15CFC229068B222F00123568 /* get-mobility-info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = "get-mobility-info"; sourceTree = SOURCE_ROOT; }; 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdnsinfo.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 15DAF2D608466D4900D1B2BD /* helper_comm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = helper_comm.c; path = helper/helper_comm.c; sourceTree = ""; }; 15DAF2D708466D4900D1B2BD /* helper_comm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = helper_comm.h; path = helper/helper_comm.h; sourceTree = ""; }; 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCHelper_client.c; path = helper/SCHelper_client.c; sourceTree = ""; }; @@ -787,30 +1469,29 @@ 15FC130A0CCEA59E0013872C /* monitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = monitor.c; path = SCMonitor/monitor.c; sourceTree = ""; }; 15FCAACF05FD0EBF00CB79E6 /* shared_dns_info_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = shared_dns_info_types.h; path = dnsinfo/shared_dns_info_types.h; sourceTree = SOURCE_ROOT; }; 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = shared_dns_info.defs; path = dnsinfo/shared_dns_info.defs; sourceTree = ""; }; + 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = IndigoSDK.xcconfig; path = /AppleInternal/Indigo/IndigoSDK.xcconfig; sourceTree = ""; }; 15FD71090754D628001CC321 /* Kicker.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Kicker.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InterfaceNamer.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 15FD72A50754DA4C001CC321 /* IPMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IPMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LinkConfiguration.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PreferencesMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 15FD73220754DB9F001CC321 /* ATconfig.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ATconfig.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 15FD73400754DBDA001CC321 /* libATconfig.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libATconfig.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 15FD73970754DE49001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - 15FD73EE0754DE62001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - 15FD743E0754DE7A001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; + 15FD73970754DE49001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 15FD73EE0754DE62001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 15FD743E0754DE7A001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; 15FEE8160CD03CA3001312F9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = SCMonitor/English.lproj/Localizable.strings; sourceTree = ""; }; + 15FF5C290CDF770500EEC8AA /* com.apple.SCHelper.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = com.apple.SCHelper.plist; path = helper/com.apple.SCHelper.plist; sourceTree = ""; }; 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pppcontroller_types.h; path = /usr/local/include/ppp/pppcontroller_types.h; sourceTree = ""; }; 23C1E2B8062DD45900835B54 /* pppcontroller.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = pppcontroller.defs; path = SystemConfiguration.fproj/pppcontroller.defs; sourceTree = ""; }; 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pppcontroller.h; path = configd.build/SystemConfiguration.framework.build/DerivedSources/pppcontroller.h; sourceTree = BUILT_PRODUCTS_DIR; }; 9EE943F306AF409B00772EB5 /* BondConfiguration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = BondConfiguration.c; sourceTree = ""; }; - 9EE943F406AF409B00772EB5 /* BondConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BondConfiguration.h; sourceTree = ""; }; - 9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BondConfigurationPrivate.h; sourceTree = ""; }; F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSignature.c; sourceTree = ""; }; F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignature.h; sourceTree = ""; }; F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignaturePrivate.h; sourceTree = ""; }; F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetworkIdentification.a; sourceTree = BUILT_PRODUCTS_DIR; }; - F95B8A670B03F97800993BA3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - F95B8A680B03F97800993BA3 /* NetworkIdentification.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = NetworkIdentification.c; sourceTree = ""; }; + F95B8A670B03F97800993BA3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F95B8A680B03F97800993BA3 /* NetworkIdentification.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = NetworkIdentification.c; sourceTree = ""; }; F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkIdentification.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -820,18 +1501,29 @@ buildActionMask = 2147483647; files = ( 15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */, - 15E517680CCFBCD0008FFE82 /* SystemConfiguration.framework in Frameworks */, + 1559C4490D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */, + 15792B9B0DA2C190008DDED9 /* IOKit.framework in Frameworks */, 15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */, 150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; + 1521400B0E93FF8600DACD2C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1521400C0E93FFF500DACD2C /* CoreFoundation.framework in Frameworks */, + 152140580E93FFFC00DACD2C /* SystemConfiguration.framework in Frameworks */, + 15943D440E94081800B87535 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 1547001B08455B98006787CE /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */, - 1520A3D0084682A30010B584 /* SystemConfiguration.framework in Frameworks */, + 1559C4450D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */, 1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -841,8 +1533,7 @@ buildActionMask = 2147483647; files = ( 155847640754FDCD0046C2E9 /* CoreFoundation.framework in Frameworks */, - 1523F710075A371D0066F0B2 /* SystemConfiguration.framework in Frameworks */, - 1523F719075A37C70066F0B2 /* libdnsinfo.a in Frameworks */, + 1559C44F0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */, 155847660754FDCD0046C2E9 /* libedit.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -852,49 +1543,97 @@ buildActionMask = 2147483647; files = ( 1558481907550EC10046C2E9 /* CoreFoundation.framework in Frameworks */, - 1523F6F2075A37050066F0B2 /* SystemConfiguration.framework in Frameworks */, + 1559C44E0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 156CA47C0EF853BB00C59A18 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 156CA47D0EF853BB00C59A18 /* CoreFoundation.framework in Frameworks */, + 156CA47E0EF853BB00C59A18 /* SystemConfiguration.framework in Frameworks */, + 156CA47F0EF853BB00C59A18 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1572C5230CFB55B400E2776E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1572C5240CFB55B400E2776E /* CoreFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157433E10D4A8122002ACA73 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 157433E20D4A8122002ACA73 /* CoreFoundation.framework in Frameworks */, + 157433E30D4A8122002ACA73 /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53D207528BDA004F8947 /* Frameworks */ = { + 1574340D0D4A8137002ACA73 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1574340E0D4A8137002ACA73 /* CoreFoundation.framework in Frameworks */, + 1574340F0D4A8137002ACA73 /* SystemConfiguration.framework in Frameworks */, + 157434110D4A8137002ACA73 /* libedit.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53DC07528C2E004F8947 /* Frameworks */ = { + 157A84E20D56C63900B6F1A0 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53E307528C4A004F8947 /* Frameworks */ = { + 1583174B0CFB80A1006F62B9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1583174C0CFB80A1006F62B9 /* CoreFoundation.framework in Frameworks */, + 154707350D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */, + 1583174E0CFB80A1006F62B9 /* IOKit.framework in Frameworks */, + 159C32B60F583724008A72EE /* Security.framework in Frameworks */, + 158317500CFB80A1006F62B9 /* libbsm.dylib in Frameworks */, + 158317520CFB80A1006F62B9 /* libKernelEventMonitor.a in Frameworks */, + 158317530CFB80A1006F62B9 /* libInterfaceNamer.a in Frameworks */, + 158317540CFB80A1006F62B9 /* libIPMonitor.a in Frameworks */, + 158317550CFB80A1006F62B9 /* libLinkConfiguration.a in Frameworks */, + 158317560CFB80A1006F62B9 /* libNetworkIdentification.a in Frameworks */, + 158317570CFB80A1006F62B9 /* libPreferencesMonitor.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53EA07528C61004F8947 /* Frameworks */ = { + 1583379F0CFB6B9E0033AB93 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 158337A00CFB6B9E0033AB93 /* CoreFoundation.framework in Frameworks */, + 154707300D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */, + 158337A20CFB6B9E0033AB93 /* Security.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53F107528C79004F8947 /* Frameworks */ = { + 159C9B2F0DB68E8300BEEF10 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 159C9B300DB68E8400BEEF10 /* CoreFoundation.framework in Frameworks */, + 159C9B7A0DB68E8A00BEEF10 /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53F807528C95004F8947 /* Frameworks */ = { + 159C9B850DB68F0300BEEF10 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 159C9B860DB68F1600BEEF10 /* CoreFoundation.framework in Frameworks */, + 159C9B870DB68F1600BEEF10 /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -903,11 +1642,9 @@ buildActionMask = 2147483647; files = ( 159D54CC07529FFF004F8947 /* CoreFoundation.framework in Frameworks */, - 1523F6F1075A36F70066F0B2 /* SystemConfiguration.framework in Frameworks */, + 1559C44A0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */, 1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */, - 1523F715075A376B0066F0B2 /* libdnsinfo.a in Frameworks */, 15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */, - 1533B94D09731BE600F2B34A /* libATconfig.a in Frameworks */, 159D54CE07529FFF004F8947 /* libKernelEventMonitor.a in Frameworks */, 159D54D007529FFF004F8947 /* libInterfaceNamer.a in Frameworks */, 159D54D107529FFF004F8947 /* libIPMonitor.a in Frameworks */, @@ -917,47 +1654,32 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 15DAD5E9075913CE0084A6ED /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 15DAD6AD07591A1A0084A6ED /* Frameworks */ = { + 15A5A2620D5B94190087BDA0 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 15DAD6AE07591A1A0084A6ED /* CoreFoundation.framework in Frameworks */, - 153BED940B75566200989D5C /* libicucore.dylib in Frameworks */, + 15A5A2630D5B94190087BDA0 /* CoreFoundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD733F0754DBDA001CC321 /* Frameworks */ = { + 15DAD5E9075913CE0084A6ED /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - F95B8A5D0B03F81400993BA3 /* Frameworks */ = { + 15DAD6AD07591A1A0084A6ED /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15DAD6AE07591A1A0084A6ED /* CoreFoundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 1514D77D05C08AB700757DC9 /* Initial Preferences */ = { - isa = PBXGroup; - children = ( - 15CB690505C0722A0099E85F /* preferences.xml */, - ); - name = "Initial Preferences"; - sourceTree = ""; - }; 151F5DA80CCE995D0093AC3B /* SCMonitor */ = { isa = PBXGroup; children = ( @@ -968,53 +1690,127 @@ name = SCMonitor; sourceTree = ""; }; - 1547002E084561B4006787CE /* SCHelper */ = { + 1531D3D90E93E6AA00248432 /* Logger */ = { isa = PBXGroup; children = ( - 1547002F084561ED006787CE /* Headers */, - 15470030084561FF006787CE /* Sources */, + 1531D3DB0E93E6DA00248432 /* logger.c */, + 1531D3DA0E93E6DA00248432 /* Info.plist */, + 156CA48D0EF853BB00C59A18 /* Info-Embedded.plist */, ); - name = SCHelper; - path = SystemConfiguration.fproj; + name = Logger; sourceTree = ""; }; - 1547002F084561ED006787CE /* Headers */ = { + 154083530D5B824400E07907 /* MacOSX */ = { isa = PBXGroup; children = ( - 15DAF2D708466D4900D1B2BD /* helper_comm.h */, - 155B7BF60847776D00F0E262 /* SCHelper_client.h */, + 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */, + 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */, + 1547001D08455B98006787CE /* SCHelper */, + 151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */, + 158ADBFD0754ECB100124717 /* Plugins */, + 158ADCA60754ECC800124717 /* configd, scutil, scselect */, ); - name = Headers; + name = MacOSX; sourceTree = ""; }; - 15470030084561FF006787CE /* Sources */ = { + 1540835A0D5B825200E07907 /* Embedded */ = { isa = PBXGroup; children = ( - 15DAF2D608466D4900D1B2BD /* helper_comm.c */, - 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */, - 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */, + 157A84E80D56C63900B6F1A0 /* libdnsinfo.a */, + 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */, + 154083C50D5B832F00E07907 /* Plugins */, + 1559C4470D349A4E0098FD59 /* SCHelper */, + 154083C90D5B835200E07907 /* configd, scutil, scselect */, ); - name = Sources; + name = Embedded; sourceTree = ""; }; - 1582B36B05FD1A4D009C2750 /* DNSConfiguration */ = { + 154083890D5B82A900E07907 /* EmbeddedSimulator */ = { isa = PBXGroup; children = ( - 1582B37205FD1A5B009C2750 /* Headers */, - 1582B37905FD1A66009C2750 /* Sources */, + 15A5A26A0D5B94190087BDA0 /* SystemConfiguration.framework */, ); - name = DNSConfiguration; + name = EmbeddedSimulator; sourceTree = ""; }; - 1582B37205FD1A5B009C2750 /* Headers */ = { + 154083C50D5B832F00E07907 /* Plugins */ = { isa = PBXGroup; children = ( - 15B73F0905FD1B670096477F /* dnsinfo.h */, - 1532629006281C9D00B1C10C /* dnsinfo_create.h */, - 15B73F0C05FD1B670096477F /* dnsinfo_private.h */, - 15B73F0E05FD1B670096477F /* dnsinfo_server.h */, + 157A85020D56C7E800B6F1A0 /* libIPMonitor.a */, + 1559C4500D349A4E0098FD59 /* IPMonitor.bundle */, + 157A850D0D56C8AA00B6F1A0 /* libInterfaceNamer.a */, + 1559C4510D349A4E0098FD59 /* InterfaceNamer.bundle */, + 157A85230D56C8E000B6F1A0 /* libKernelEventMonitor.a */, + 1559C4520D349A4E0098FD59 /* KernelEventMonitor.bundle */, + 157A852E0D56C91100B6F1A0 /* libLinkConfiguration.a */, + 1559C4530D349A4E0098FD59 /* LinkConfiguration.bundle */, + 156CA4850EF853BB00C59A18 /* Logger.bundle */, + 157A85440D56C96F00B6F1A0 /* libPreferencesMonitor.a */, + 1559C4540D349A4E0098FD59 /* PreferencesMonitor.bundle */, + 157A85390D56C94F00B6F1A0 /* libNetworkIdentification.a */, + 1559C4550D349A4E0098FD59 /* NetworkIdentification.bundle */, ); - name = Headers; + name = Plugins; + sourceTree = ""; + }; + 154083C90D5B835200E07907 /* configd, scutil, scselect */ = { + isa = PBXGroup; + children = ( + 1559C44C0D349A4E0098FD59 /* configd */, + 157433EC0D4A8122002ACA73 /* scselect */, + 1574341A0D4A8137002ACA73 /* scutil */, + ); + name = "configd, scutil, scselect"; + sourceTree = ""; + }; + 1547002E084561B4006787CE /* SCHelper */ = { + isa = PBXGroup; + children = ( + 1547002F084561ED006787CE /* Headers */, + 15470030084561FF006787CE /* Sources */, + 15FF5C390CDF9C4000EEC8AA /* Supporting Files */, + ); + name = SCHelper; + path = SystemConfiguration.fproj; + sourceTree = ""; + }; + 1547002F084561ED006787CE /* Headers */ = { + isa = PBXGroup; + children = ( + 15DAF2D708466D4900D1B2BD /* helper_comm.h */, + 155B7BF60847776D00F0E262 /* SCHelper_client.h */, + ); + name = Headers; + sourceTree = ""; + }; + 15470030084561FF006787CE /* Sources */ = { + isa = PBXGroup; + children = ( + 15DAF2D608466D4900D1B2BD /* helper_comm.c */, + 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */, + 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */, + ); + name = Sources; + sourceTree = ""; + }; + 1582B36B05FD1A4D009C2750 /* DNSConfiguration */ = { + isa = PBXGroup; + children = ( + 1582B37205FD1A5B009C2750 /* Headers */, + 1582B37905FD1A66009C2750 /* Sources */, + ); + name = DNSConfiguration; + sourceTree = ""; + }; + 1582B37205FD1A5B009C2750 /* Headers */ = { + isa = PBXGroup; + children = ( + 15B73F0905FD1B670096477F /* dnsinfo.h */, + 1532629006281C9D00B1C10C /* dnsinfo_create.h */, + 15B73F0C05FD1B670096477F /* dnsinfo_private.h */, + 15B73F0E05FD1B670096477F /* dnsinfo_server.h */, + ); + name = Headers; sourceTree = ""; }; 1582B37905FD1A66009C2750 /* Sources */ = { @@ -1023,6 +1819,7 @@ 15B73F0B05FD1B670096477F /* dnsinfo_private.c */, 15B73F0805FD1B670096477F /* dnsinfo_copy.c */, 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */, + 1522FCE50FA7FD7000B24128 /* dnsinfo_flatfile.c */, 15B73F0D05FD1B670096477F /* dnsinfo_server.c */, ); name = Sources; @@ -1031,7 +1828,6 @@ 158ADBFD0754ECB100124717 /* Plugins */ = { isa = PBXGroup; children = ( - 15FD73400754DBDA001CC321 /* libATconfig.a */, 15FD73220754DB9F001CC321 /* ATconfig.bundle */, 159D53EC07528C61004F8947 /* libIPMonitor.a */, 15FD72A50754DA4C001CC321 /* IPMonitor.bundle */, @@ -1039,14 +1835,14 @@ 15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */, 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */, 15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */, - 159D53DE07528C2E004F8947 /* libKicker.a */, 15FD71090754D628001CC321 /* Kicker.bundle */, 159D53F307528C79004F8947 /* libLinkConfiguration.a */, 15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */, - F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */, F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */, - 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */, + 15213FFA0E93E9F500DACD2C /* Logger.bundle */, + F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */, 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */, + 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */, ); name = Plugins; sourceTree = ""; @@ -1071,6 +1867,7 @@ 159D53AF07528B36004F8947 /* KernelEventMonitor */, 159D53BB07528B36004F8947 /* Kicker */, 159D53C007528B36004F8947 /* LinkConfiguration */, + 1531D3D90E93E6AA00248432 /* Logger */, F95B8A660B03F97800993BA3 /* NetworkIdentification */, 159D53C207528B36004F8947 /* PreferencesMonitor */, ); @@ -1087,7 +1884,6 @@ 159D53AB07528B36004F8947 /* set-hostname.c */, 155D223A0AF13A7300D52ED0 /* smb-configuration.h */, 1572EB7A0A506D3B00D02459 /* smb-configuration.c */, - 159D53A807528B36004F8947 /* Resolvers.plist */, 15FD743E0754DE7A001CC321 /* Info.plist */, ); name = IPMonitor; @@ -1184,6 +1980,7 @@ 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */, 1577253606EFBF3100D7B52B /* NetworkInterface.strings */, 15CFC229068B222F00123568 /* get-mobility-info */, + 153393E20D34994100FE74E7 /* update-headers */, ); name = "Supporting Files"; sourceTree = ""; @@ -1201,12 +1998,16 @@ 15CB6A2205C0722B0099E85F /* scselect */, 15CB6A3705C0722B0099E85F /* scutil */, 159D53A207528B06004F8947 /* Plugins */, - 1514D77D05C08AB700757DC9 /* Initial Preferences */, 15CB6A6E05C0722B0099E85F /* External Frameworks and Libraries */, 15CB690F05C0722B0099E85F /* Products */, + 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */, + 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */, ); + indentWidth = 8; name = configd; sourceTree = ""; + tabWidth = 8; + usesTabs = 1; }; 15CB690705C0722A0099E85F /* SystemConfiguration */ = { isa = PBXGroup; @@ -1222,13 +2023,10 @@ 15CB690F05C0722B0099E85F /* Products */ = { isa = PBXGroup; children = ( - 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */, - 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */, - 1547001D08455B98006787CE /* SCHelper */, - 151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */, - 158ADCA60754ECC800124717 /* configd, scutil, scselect */, - 158ADBFD0754ECB100124717 /* Plugins */, 151F63EC09328A3C0096DCC9 /* genSCPreferences */, + 154083530D5B824400E07907 /* MacOSX */, + 1540835A0D5B825200E07907 /* Embedded */, + 154083890D5B82A900E07907 /* EmbeddedSimulator */, ); name = Products; sourceTree = ""; @@ -1236,9 +2034,6 @@ 15CB691205C0722B0099E85F /* Headers */ = { isa = PBXGroup; children = ( - F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */, - F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */, - 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */, 15CB691305C0722B0099E85F /* SystemConfiguration.h */, 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */, 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */, @@ -1259,6 +2054,7 @@ 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */, 15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */, 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */, + 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */, 15CB691505C0722B0099E85F /* SCPrivate.h */, 15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */, 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */, @@ -1267,13 +2063,12 @@ 15CB693505C0722B0099E85F /* SCNetworkConnection.h */, 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */, 15CB693705C0722B0099E85F /* SCNetworkReachability.h */, + F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */, + F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */, 15CB693905C0722B0099E85F /* SCValidation.h */, - 9EE943F406AF409B00772EB5 /* BondConfiguration.h */, - 9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */, 15CB694505C0722B0099E85F /* DeviceOnHold.h */, 15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */, 15CB694705C0722B0099E85F /* LinkConfiguration.h */, - 15CB694B05C0722B0099E85F /* VLANConfiguration.h */, 15CB694905C0722B0099E85F /* dy_framework.h */, 15CB694305C0722B0099E85F /* moh.h */, 15CB694105C0722B0099E85F /* moh_msg.h */, @@ -1285,13 +2080,10 @@ 15CB694F05C0722B0099E85F /* Sources */ = { isa = PBXGroup; children = ( - F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */, - 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */, 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */, 15CB695005C0722B0099E85F /* SCD.c */, - 15CB695205C0722B0099E85F /* SCDKeys.c */, 15CB695405C0722B0099E85F /* SCDPrivate.c */, - 15CB695605C0722B0099E85F /* SCDPlugin.c */, + 15CB695205C0722B0099E85F /* SCDKeys.c */, 15CB695805C0722B0099E85F /* SCDOpen.c */, 15CB695A05C0722B0099E85F /* SCDLock.c */, 15CB695C05C0722B0099E85F /* SCDUnlock.c */, @@ -1326,11 +2118,16 @@ 15CB699805C0722B0099E85F /* SCPApply.c */, 15CB699A05C0722B0099E85F /* SCPPath.c */, 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */, + 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */, 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */, 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */, 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */, 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */, 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */, + 15CB69B205C0722B0099E85F /* LinkConfiguration.c */, + 9EE943F306AF409B00772EB5 /* BondConfiguration.c */, + 15CB69B605C0722B0099E85F /* VLANConfiguration.c */, + 15CB695605C0722B0099E85F /* SCDPlugin.c */, 15CB699C05C0722B0099E85F /* SCDConsoleUser.c */, 15CB699E05C0722B0099E85F /* SCDHostName.c */, 15CB69A005C0722B0099E85F /* SCLocation.c */, @@ -1338,14 +2135,12 @@ 15CB69A405C0722B0099E85F /* SCNetworkConnection.c */, 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */, 15CB69A605C0722B0099E85F /* SCNetworkReachability.c */, + F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */, 15CB69A805C0722B0099E85F /* SCProxies.c */, 15CB69AC05C0722B0099E85F /* DHCP.c */, 15CB69AE05C0722B0099E85F /* moh.c */, 15CB69B005C0722B0099E85F /* DeviceOnHold.c */, - 15CB69B205C0722B0099E85F /* LinkConfiguration.c */, 15CB69B405C0722B0099E85F /* dy_framework.c */, - 9EE943F306AF409B00772EB5 /* BondConfiguration.c */, - 15CB69B605C0722B0099E85F /* VLANConfiguration.c */, ); name = Sources; sourceTree = ""; @@ -1413,6 +2208,7 @@ children = ( 1540E3600987DA9500157C07 /* com.apple.configd.plist */, 15CB6A2005C0722B0099E85F /* configd.8 */, + 1567333E0DD1FD6500145179 /* entitlements.plist */, ); name = "Supporting Files"; sourceTree = ""; @@ -1512,7 +2308,6 @@ 1520A3DE0846B2DC0010B584 /* Security.framework */, 15BAA32207F0699A00D9EC95 /* libbsm.dylib */, 152CEED0070CF6640050F23C /* libedit.dylib */, - 1587A31F0B6AACD70063104A /* libicucore.dylib */, ); name = "External Frameworks and Libraries"; sourceTree = ""; @@ -1538,6 +2333,15 @@ name = MiG; sourceTree = ""; }; + 15FF5C390CDF9C4000EEC8AA /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 15FF5C290CDF770500EEC8AA /* com.apple.SCHelper.plist */, + 151356AD0CE0CF2F0017E523 /* com.apple.SCHelper-embedded.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; F95B8A660B03F97800993BA3 /* NetworkIdentification */ = { isa = PBXGroup; children = ( @@ -1587,26 +2391,191 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53D007528BDA004F8947 /* Headers */ = { + 1572C4A80CFB55B400E2776E /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1572C4A90CFB55B400E2776E /* SCSchemaDefinitions.h in Headers */, + 1572C4AA0CFB55B400E2776E /* SystemConfiguration.h in Headers */, + 1572C4AB0CFB55B400E2776E /* SCPrivate.h in Headers */, + 1572C4AC0CFB55B400E2776E /* SCDPlugin.h in Headers */, + 1572C4AD0CFB55B400E2776E /* SCDynamicStoreInternal.h in Headers */, + 1572C4AE0CFB55B400E2776E /* SCDynamicStore.h in Headers */, + 1572C4AF0CFB55B400E2776E /* SCDynamicStorePrivate.h in Headers */, + 1572C4B00CFB55B400E2776E /* SCDynamicStoreKey.h in Headers */, + 1572C4B10CFB55B400E2776E /* SCDynamicStoreCopySpecific.h in Headers */, + 1572C4B20CFB55B400E2776E /* SCDynamicStoreCopySpecificPrivate.h in Headers */, + 1572C4B30CFB55B400E2776E /* SCDynamicStoreSetSpecificPrivate.h in Headers */, + 1572C4B40CFB55B400E2776E /* SCPreferencesInternal.h in Headers */, + 1572C4B50CFB55B400E2776E /* SCPreferences.h in Headers */, + 1572C4B60CFB55B400E2776E /* SCPreferencesPrivate.h in Headers */, + 1572C4B70CFB55B400E2776E /* SCPreferencesPath.h in Headers */, + 1572C4B80CFB55B400E2776E /* SCPreferencesSetSpecific.h in Headers */, + 1572C4B90CFB55B400E2776E /* SCNetworkConfiguration.h in Headers */, + 1572C4BA0CFB55B400E2776E /* SCNetworkConfigurationInternal.h in Headers */, + 1572C4BB0CFB55B400E2776E /* SCNetwork.h in Headers */, + 1572C4BC0CFB55B400E2776E /* SCNetworkConnection.h in Headers */, + 1572C4BD0CFB55B400E2776E /* SCNetworkReachability.h in Headers */, + 1572C4BE0CFB55B400E2776E /* SCValidation.h in Headers */, + 1572C4BF0CFB55B400E2776E /* DHCPClientPreferences.h in Headers */, + 1572C4C00CFB55B400E2776E /* SCDynamicStoreCopyDHCPInfo.h in Headers */, + 1572C4C10CFB55B400E2776E /* moh_msg.h in Headers */, + 1572C4C20CFB55B400E2776E /* moh.h in Headers */, + 1572C4C30CFB55B400E2776E /* DeviceOnHold.h in Headers */, + 1572C4C50CFB55B400E2776E /* dy_framework.h in Headers */, + 1572C4C70CFB55B400E2776E /* SCPreferencesPathKey.h in Headers */, + 1572C4C80CFB55B400E2776E /* dnsinfo.h in Headers */, + 1572C4C90CFB55B400E2776E /* dnsinfo_private.h in Headers */, + 1572C4CA0CFB55B400E2776E /* pppcontroller_types.h in Headers */, + 1572C4CB0CFB55B400E2776E /* pppcontroller.h in Headers */, + 1572C4CE0CFB55B400E2776E /* SCPreferencesSetSpecificPrivate.h in Headers */, + 1572C4CF0CFB55B400E2776E /* SCPreferencesGetSpecificPrivate.h in Headers */, + 1572C4D00CFB55B400E2776E /* SCNetworkConfigurationPrivate.h in Headers */, + 1572C4D10CFB55B400E2776E /* helper_comm.h in Headers */, + 1572C4D20CFB55B400E2776E /* SCHelper_client.h in Headers */, + 1572C4D40CFB55B400E2776E /* SCNetworkConnectionPrivate.h in Headers */, + 1572C4D50CFB55B400E2776E /* SCPreferencesKeychainPrivate.h in Headers */, + 1572C4D60CFB55B400E2776E /* SCSchemaDefinitionsPrivate.h in Headers */, + 1572C4D70CFB55B400E2776E /* SCNetworkSignature.h in Headers */, + 1572C4D80CFB55B400E2776E /* SCNetworkSignaturePrivate.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157433DE0D4A8122002ACA73 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157433F10D4A8137002ACA73 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 157433F20D4A8137002ACA73 /* scutil.h in Headers */, + 157433F30D4A8137002ACA73 /* commands.h in Headers */, + 157433F40D4A8137002ACA73 /* dictionary.h in Headers */, + 157433F50D4A8137002ACA73 /* session.h in Headers */, + 157433F60D4A8137002ACA73 /* cache.h in Headers */, + 157433F70D4A8137002ACA73 /* notifications.h in Headers */, + 157433F80D4A8137002ACA73 /* tests.h in Headers */, + 157433F90D4A8137002ACA73 /* prefs.h in Headers */, + 157433FA0D4A8137002ACA73 /* net.h in Headers */, + 157433FB0D4A8137002ACA73 /* net_interface.h in Headers */, + 157433FC0D4A8137002ACA73 /* net_protocol.h in Headers */, + 157433FD0D4A8137002ACA73 /* net_service.h in Headers */, + 157433FE0D4A8137002ACA73 /* net_set.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A84D90D56C63900B6F1A0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A84DA0D56C63900B6F1A0 /* dnsinfo.h in Headers */, + 157A84DB0D56C63900B6F1A0 /* dnsinfo_private.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A84F50D56C7E800B6F1A0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A84F60D56C7E800B6F1A0 /* dns-configuration.h in Headers */, + 157A84F70D56C7E800B6F1A0 /* set-hostname.h in Headers */, + 15D48EC20F67061F00B4711E /* dnsinfo_create.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A85060D56C8AA00B6F1A0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A85110D56C8E000B6F1A0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A85120D56C8E000B6F1A0 /* cache.h in Headers */, + 157A85140D56C8E000B6F1A0 /* ev_dlil.h in Headers */, + 157A85150D56C8E000B6F1A0 /* ev_ipv4.h in Headers */, + 157A85160D56C8E000B6F1A0 /* ev_ipv6.h in Headers */, + 157A85170D56C8E000B6F1A0 /* eventmon.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A85270D56C91100B6F1A0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A85320D56C94F00B6F1A0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A853D0D56C96F00B6F1A0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 158317240CFB80A1006F62B9 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 158317250CFB80A1006F62B9 /* configd.h in Headers */, + 158317260CFB80A1006F62B9 /* _SCD.h in Headers */, + 158317270CFB80A1006F62B9 /* configd_server.h in Headers */, + 158317280CFB80A1006F62B9 /* notify_server.h in Headers */, + 158317290CFB80A1006F62B9 /* plugin_support.h in Headers */, + 1583172A0CFB80A1006F62B9 /* session.h in Headers */, + 1583172B0CFB80A1006F62B9 /* pattern.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1583379A0CFB6B9E0033AB93 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1583379B0CFB6B9E0033AB93 /* helper_comm.h in Headers */, + 1583379C0CFB6B9E0033AB93 /* SCHelper_client.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 159C9B2B0DB68E2600BEEF10 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 159D540A07528D3B004F8947 /* cache.h in Headers */, - 159D540C07528DAA004F8947 /* ev_appletalk.h in Headers */, - 159D540E07528DAE004F8947 /* ev_dlil.h in Headers */, - 159D541007528DB1004F8947 /* ev_ipv4.h in Headers */, - 159D541207528DB3004F8947 /* ev_ipv6.h in Headers */, - 159D541407528DB5004F8947 /* eventmon.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53DA07528C2E004F8947 /* Headers */ = { + 159C9B830DB68F0300BEEF10 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; + 159D53D007528BDA004F8947 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 159D540A07528D3B004F8947 /* cache.h in Headers */, + 159D540E07528DAE004F8947 /* ev_dlil.h in Headers */, + 159D541007528DB1004F8947 /* ev_ipv4.h in Headers */, + 159D541207528DB3004F8947 /* ev_ipv6.h in Headers */, + 159D541407528DB5004F8947 /* eventmon.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 159D53E107528C4A004F8947 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1621,6 +2590,7 @@ 155D223B0AF13A7300D52ED0 /* dns-configuration.h in Headers */, 155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */, 155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */, + 15D48EC00F67061700B4711E /* dnsinfo_create.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1652,13 +2622,62 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15A5A1E60D5B94190087BDA0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 15A5A1E70D5B94190087BDA0 /* SCSchemaDefinitions.h in Headers */, + 15A5A1E80D5B94190087BDA0 /* SystemConfiguration.h in Headers */, + 15A5A1E90D5B94190087BDA0 /* SCPrivate.h in Headers */, + 15A5A1EA0D5B94190087BDA0 /* SCDPlugin.h in Headers */, + 15A5A1EB0D5B94190087BDA0 /* SCDynamicStoreInternal.h in Headers */, + 15A5A1EC0D5B94190087BDA0 /* SCDynamicStore.h in Headers */, + 15A5A1ED0D5B94190087BDA0 /* SCDynamicStorePrivate.h in Headers */, + 15A5A1EE0D5B94190087BDA0 /* SCDynamicStoreKey.h in Headers */, + 15A5A1EF0D5B94190087BDA0 /* SCDynamicStoreCopySpecific.h in Headers */, + 15A5A1F00D5B94190087BDA0 /* SCDynamicStoreCopySpecificPrivate.h in Headers */, + 15A5A1F10D5B94190087BDA0 /* SCDynamicStoreSetSpecificPrivate.h in Headers */, + 15A5A1F20D5B94190087BDA0 /* SCPreferencesInternal.h in Headers */, + 15A5A1F30D5B94190087BDA0 /* SCPreferences.h in Headers */, + 15A5A1F40D5B94190087BDA0 /* SCPreferencesPrivate.h in Headers */, + 15A5A1F50D5B94190087BDA0 /* SCPreferencesPath.h in Headers */, + 15A5A1F60D5B94190087BDA0 /* SCPreferencesSetSpecific.h in Headers */, + 15A5A1F70D5B94190087BDA0 /* SCNetworkConfiguration.h in Headers */, + 15A5A1F80D5B94190087BDA0 /* SCNetworkConfigurationInternal.h in Headers */, + 15A5A1F90D5B94190087BDA0 /* SCNetwork.h in Headers */, + 15A5A1FA0D5B94190087BDA0 /* SCNetworkConnection.h in Headers */, + 15A5A1FB0D5B94190087BDA0 /* SCNetworkReachability.h in Headers */, + 15A5A1FC0D5B94190087BDA0 /* SCValidation.h in Headers */, + 15A5A1FD0D5B94190087BDA0 /* DHCPClientPreferences.h in Headers */, + 15A5A1FE0D5B94190087BDA0 /* SCDynamicStoreCopyDHCPInfo.h in Headers */, + 15A5A1FF0D5B94190087BDA0 /* moh_msg.h in Headers */, + 15A5A2000D5B94190087BDA0 /* moh.h in Headers */, + 15A5A2010D5B94190087BDA0 /* DeviceOnHold.h in Headers */, + 15A5A2030D5B94190087BDA0 /* dy_framework.h in Headers */, + 15A5A2050D5B94190087BDA0 /* SCPreferencesPathKey.h in Headers */, + 15A5A2060D5B94190087BDA0 /* dnsinfo.h in Headers */, + 15A5A2070D5B94190087BDA0 /* dnsinfo_private.h in Headers */, + 15A5A2080D5B94190087BDA0 /* pppcontroller_types.h in Headers */, + 15A5A2090D5B94190087BDA0 /* pppcontroller.h in Headers */, + 15A5A20C0D5B94190087BDA0 /* SCPreferencesSetSpecificPrivate.h in Headers */, + 15A5A20D0D5B94190087BDA0 /* SCPreferencesGetSpecificPrivate.h in Headers */, + 15A5A20E0D5B94190087BDA0 /* SCNetworkConfigurationPrivate.h in Headers */, + 15A5A20F0D5B94190087BDA0 /* helper_comm.h in Headers */, + 15A5A2100D5B94190087BDA0 /* SCHelper_client.h in Headers */, + 15A5A2110D5B94190087BDA0 /* SCNetworkConnectionPrivate.h in Headers */, + 15A5A2120D5B94190087BDA0 /* SCPreferencesKeychainPrivate.h in Headers */, + 15A5A2130D5B94190087BDA0 /* SCSchemaDefinitionsPrivate.h in Headers */, + 15A5A2140D5B94190087BDA0 /* SCNetworkSignature.h in Headers */, + 15A5A2150D5B94190087BDA0 /* SCNetworkSignaturePrivate.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15DAD5E0075913CE0084A6ED /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 15DAD5E1075913CE0084A6ED /* dnsinfo.h in Headers */, 15DAD5E2075913CE0084A6ED /* dnsinfo_private.h in Headers */, - 15DAD5E3075913CE0084A6ED /* dnsinfo_create.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1695,14 +2714,11 @@ 15DAD65C07591A1A0084A6ED /* DeviceOnHold.h in Headers */, 15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */, 15DAD65E07591A1A0084A6ED /* dy_framework.h in Headers */, - 15DAD65F07591A1A0084A6ED /* VLANConfiguration.h in Headers */, 15DAD66107591A1A0084A6ED /* SCPreferencesPathKey.h in Headers */, 15DAD66207591A1A0084A6ED /* dnsinfo.h in Headers */, 15DAD66307591A1A0084A6ED /* dnsinfo_private.h in Headers */, 15DAD66407591A1A0084A6ED /* pppcontroller_types.h in Headers */, 15DAD66507591A1A0084A6ED /* pppcontroller.h in Headers */, - 15DAD66607591A1A0084A6ED /* BondConfiguration.h in Headers */, - 15DAD66707591A1A0084A6ED /* BondConfigurationPrivate.h in Headers */, 156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */, 154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */, 155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */, @@ -1716,13 +2732,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD733C0754DBDA001CC321 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; F95B8A5B0B03F81400993BA3 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1766,6 +2775,23 @@ productReference = 151F63EC09328A3C0096DCC9 /* genSCPreferences */; productType = "com.apple.product-type.tool"; }; + 15213FF90E93E9F500DACD2C /* Logger.bundle */ = { + isa = PBXNativeTarget; + buildConfigurationList = 15213FFF0E93E9F600DACD2C /* Build configuration list for PBXNativeTarget "Logger.bundle" */; + buildPhases = ( + 15213FF70E93E9F500DACD2C /* Sources */, + 1521400B0E93FF8600DACD2C /* Frameworks */, + 15213FF60E93E9F500DACD2C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Logger.bundle; + productName = Logger.bundle; + productReference = 15213FFA0E93E9F500DACD2C /* Logger.bundle */; + productType = "com.apple.product-type.bundle"; + }; 1547001808455B98006787CE /* SCHelper */ = { isa = PBXNativeTarget; buildConfigurationList = 156EB5E20905594A00EEF749 /* Build configuration list for PBXNativeTarget "SCHelper" */; @@ -1773,7 +2799,7 @@ 1547001908455B98006787CE /* Headers */, 1547001A08455B98006787CE /* Sources */, 1547001B08455B98006787CE /* Frameworks */, - 1547001C08455B98006787CE /* Rez */, + 15FF5C380CDF778F00EEC8AA /* CopyFiles */, ); buildRules = ( ); @@ -1792,7 +2818,6 @@ 155847460754FDCD0046C2E9 /* Headers */, 155847540754FDCD0046C2E9 /* Sources */, 155847620754FDCD0046C2E9 /* Frameworks */, - 155847670754FDCD0046C2E9 /* Rez */, 155847680754FDCD0046C2E9 /* CopyFiles */, ); buildRules = ( @@ -1812,7 +2837,6 @@ 1558481407550EC10046C2E9 /* Headers */, 1558481507550EC10046C2E9 /* Sources */, 1558481707550EC10046C2E9 /* Frameworks */, - 1558481A07550EC10046C2E9 /* Rez */, 1558481B07550EC10046C2E9 /* CopyFiles */, ); buildRules = ( @@ -1825,120 +2849,419 @@ productReference = 1558481D07550EC10046C2E9 /* scselect */; productType = "com.apple.product-type.tool"; }; - 15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */ = { + 156CA4790EF853BB00C59A18 /* Logger.bundle-Embedded */ = { isa = PBXNativeTarget; - buildConfigurationList = 156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */; + buildConfigurationList = 156CA4820EF853BB00C59A18 /* Build configuration list for PBXNativeTarget "Logger.bundle-Embedded" */; buildPhases = ( - 15828AE30753B5F900AD4710 /* Resources */, + 156CA47A0EF853BB00C59A18 /* Sources */, + 156CA47C0EF853BB00C59A18 /* Frameworks */, + 156CA4810EF853BB00C59A18 /* Resources */, ); buildRules = ( ); dependencies = ( ); - name = KernelEventMonitor.bundle; - productName = KernelEventMonitor.bundle; - productReference = 15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */; + name = "Logger.bundle-Embedded"; + productName = Logger.bundle; + productReference = 156CA4850EF853BB00C59A18 /* Logger.bundle */; productType = "com.apple.product-type.bundle"; }; - 159D53D307528BDA004F8947 /* KernelEventMonitor */ = { + 1572C4A60CFB55B400E2776E /* SystemConfiguration.framework-Embedded */ = { isa = PBXNativeTarget; - buildConfigurationList = 156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */; + buildConfigurationList = 1572C5290CFB55B400E2776E /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-Embedded" */; buildPhases = ( - 159D53D007528BDA004F8947 /* Headers */, - 159D53D107528BDA004F8947 /* Sources */, - 159D53D207528BDA004F8947 /* Frameworks */, + 1572C4A80CFB55B400E2776E /* Headers */, + 153393E40D34999D00FE74E7 /* Update Headers */, + 1572C4D90CFB55B400E2776E /* Resources */, + 1572C4DE0CFB55B400E2776E /* Sources */, + 1572C5230CFB55B400E2776E /* Frameworks */, + 1572C5270CFB55B400E2776E /* get-mobility-info */, ); buildRules = ( ); dependencies = ( ); - name = KernelEventMonitor; - productName = KernelEventMonitor; - productReference = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */; - productType = "com.apple.product-type.library.static"; + name = "SystemConfiguration.framework-Embedded"; + productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; + productName = "SystemConfiguration (Framework)"; + productReference = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; + productType = "com.apple.product-type.framework"; }; - 159D53DD07528C2E004F8947 /* Kicker */ = { + 157433DD0D4A8122002ACA73 /* scselect-Embedded */ = { isa = PBXNativeTarget; - buildConfigurationList = 156EB6060905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker" */; + buildConfigurationList = 157433E80D4A8122002ACA73 /* Build configuration list for PBXNativeTarget "scselect-Embedded" */; buildPhases = ( - 159D53DA07528C2E004F8947 /* Headers */, - 159D53DB07528C2E004F8947 /* Sources */, - 159D53DC07528C2E004F8947 /* Frameworks */, + 157433DE0D4A8122002ACA73 /* Headers */, + 157433DF0D4A8122002ACA73 /* Sources */, + 157433E10D4A8122002ACA73 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); - name = Kicker; - productName = Kicker; - productReference = 159D53DE07528C2E004F8947 /* libKicker.a */; - productType = "com.apple.product-type.library.static"; + name = "scselect-Embedded"; + productInstallPath = /usr/sbin; + productName = "scselect (Tool)"; + productReference = 157433EC0D4A8122002ACA73 /* scselect */; + productType = "com.apple.product-type.tool"; }; - 159D53E407528C4A004F8947 /* InterfaceNamer */ = { + 157433F00D4A8137002ACA73 /* scutil-Embedded */ = { isa = PBXNativeTarget; - buildConfigurationList = 156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */; + buildConfigurationList = 157434160D4A8137002ACA73 /* Build configuration list for PBXNativeTarget "scutil-Embedded" */; buildPhases = ( - 159D53E107528C4A004F8947 /* Headers */, - 159D53E207528C4A004F8947 /* Sources */, - 159D53E307528C4A004F8947 /* Frameworks */, + 157433F10D4A8137002ACA73 /* Headers */, + 157433FF0D4A8137002ACA73 /* Sources */, + 1574340D0D4A8137002ACA73 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); - name = InterfaceNamer; - productName = InterfaceNamer; - productReference = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */; - productType = "com.apple.product-type.library.static"; + name = "scutil-Embedded"; + productInstallPath = /usr/sbin; + productName = "scutil (Tool)"; + productReference = 1574341A0D4A8137002ACA73 /* scutil */; + productType = "com.apple.product-type.tool"; }; - 159D53EB07528C61004F8947 /* IPMonitor */ = { + 157A84D80D56C63900B6F1A0 /* DNSConfiguration-Embedded */ = { isa = PBXNativeTarget; - buildConfigurationList = 156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */; + buildConfigurationList = 157A84E40D56C63900B6F1A0 /* Build configuration list for PBXNativeTarget "DNSConfiguration-Embedded" */; buildPhases = ( - 159D53E807528C61004F8947 /* Headers */, - 159D53E907528C61004F8947 /* Sources */, - 159D53EA07528C61004F8947 /* Frameworks */, + 157A84D90D56C63900B6F1A0 /* Headers */, + 157A84DD0D56C63900B6F1A0 /* Sources */, + 157A84E20D56C63900B6F1A0 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); - name = IPMonitor; - productName = IPMonitor; - productReference = 159D53EC07528C61004F8947 /* libIPMonitor.a */; + name = "DNSConfiguration-Embedded"; + productInstallPath = /usr/local/lib/system; + productName = DNSConfiguration; + productReference = 157A84E80D56C63900B6F1A0 /* libdnsinfo.a */; productType = "com.apple.product-type.library.static"; }; - 159D53F207528C79004F8947 /* LinkConfiguration */ = { + 157A84F40D56C7E800B6F1A0 /* IPMonitor-Embedded */ = { isa = PBXNativeTarget; - buildConfigurationList = 156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */; + buildConfigurationList = 157A84FE0D56C7E800B6F1A0 /* Build configuration list for PBXNativeTarget "IPMonitor-Embedded" */; buildPhases = ( - 159D53EF07528C79004F8947 /* Headers */, - 159D53F007528C79004F8947 /* Sources */, - 159D53F107528C79004F8947 /* Frameworks */, + 157A84F50D56C7E800B6F1A0 /* Headers */, + 157A84F90D56C7E800B6F1A0 /* Sources */, ); buildRules = ( ); dependencies = ( ); - name = LinkConfiguration; - productName = LinkConfiguration; - productReference = 159D53F307528C79004F8947 /* libLinkConfiguration.a */; + name = "IPMonitor-Embedded"; + productName = IPMonitor; + productReference = 157A85020D56C7E800B6F1A0 /* libIPMonitor.a */; productType = "com.apple.product-type.library.static"; }; - 159D53F907528C95004F8947 /* PreferencesMonitor */ = { + 157A85050D56C8AA00B6F1A0 /* InterfaceNamer-Embedded */ = { isa = PBXNativeTarget; - buildConfigurationList = 156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */; + buildConfigurationList = 157A85090D56C8AA00B6F1A0 /* Build configuration list for PBXNativeTarget "InterfaceNamer-Embedded" */; buildPhases = ( - 159D53F607528C95004F8947 /* Headers */, - 159D53F707528C95004F8947 /* Sources */, - 159D53F807528C95004F8947 /* Frameworks */, + 157A85060D56C8AA00B6F1A0 /* Headers */, + 157A85070D56C8AA00B6F1A0 /* Sources */, ); buildRules = ( ); dependencies = ( ); - name = PreferencesMonitor; - productName = PreferencesMonitor; + name = "InterfaceNamer-Embedded"; + productName = InterfaceNamer; + productReference = 157A850D0D56C8AA00B6F1A0 /* libInterfaceNamer.a */; + productType = "com.apple.product-type.library.static"; + }; + 157A85100D56C8E000B6F1A0 /* KernelEventMonitor-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 157A851F0D56C8E000B6F1A0 /* Build configuration list for PBXNativeTarget "KernelEventMonitor-Embedded" */; + buildPhases = ( + 157A85110D56C8E000B6F1A0 /* Headers */, + 157A85180D56C8E000B6F1A0 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "KernelEventMonitor-Embedded"; + productName = KernelEventMonitor; + productReference = 157A85230D56C8E000B6F1A0 /* libKernelEventMonitor.a */; + productType = "com.apple.product-type.library.static"; + }; + 157A85260D56C91100B6F1A0 /* LinkConfiguration-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 157A852A0D56C91100B6F1A0 /* Build configuration list for PBXNativeTarget "LinkConfiguration-Embedded" */; + buildPhases = ( + 157A85270D56C91100B6F1A0 /* Headers */, + 157A85280D56C91100B6F1A0 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "LinkConfiguration-Embedded"; + productName = LinkConfiguration; + productReference = 157A852E0D56C91100B6F1A0 /* libLinkConfiguration.a */; + productType = "com.apple.product-type.library.static"; + }; + 157A85310D56C94F00B6F1A0 /* NetworkIdentification-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 157A85350D56C94F00B6F1A0 /* Build configuration list for PBXNativeTarget "NetworkIdentification-Embedded" */; + buildPhases = ( + 157A85320D56C94F00B6F1A0 /* Headers */, + 157A85330D56C94F00B6F1A0 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "NetworkIdentification-Embedded"; + productName = NetworkIdentification; + productReference = 157A85390D56C94F00B6F1A0 /* libNetworkIdentification.a */; + productType = "com.apple.product-type.library.static"; + }; + 157A853C0D56C96F00B6F1A0 /* PreferencesMonitor-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 157A85400D56C96F00B6F1A0 /* Build configuration list for PBXNativeTarget "PreferencesMonitor-Embedded" */; + buildPhases = ( + 157A853D0D56C96F00B6F1A0 /* Headers */, + 157A853E0D56C96F00B6F1A0 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "PreferencesMonitor-Embedded"; + productName = PreferencesMonitor; + productReference = 157A85440D56C96F00B6F1A0 /* libPreferencesMonitor.a */; + productType = "com.apple.product-type.library.static"; + }; + 15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */ = { + isa = PBXNativeTarget; + buildConfigurationList = 156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */; + buildPhases = ( + 15828AE30753B5F900AD4710 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = KernelEventMonitor.bundle; + productName = KernelEventMonitor.bundle; + productReference = 15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */; + productType = "com.apple.product-type.bundle"; + }; + 158317230CFB80A1006F62B9 /* configd-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1583175D0CFB80A1006F62B9 /* Build configuration list for PBXNativeTarget "configd-Embedded" */; + buildPhases = ( + 158317240CFB80A1006F62B9 /* Headers */, + 1583172C0CFB80A1006F62B9 /* Sources */, + 1583174B0CFB80A1006F62B9 /* Frameworks */, + 1583175B0CFB80A1006F62B9 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "configd-Embedded"; + productInstallPath = /usr/sbin; + productName = "configd (Tool)"; + productReference = 1559C44C0D349A4E0098FD59 /* configd */; + productType = "com.apple.product-type.tool"; + }; + 1583177D0CFB85C8006F62B9 /* IPMonitor.bundle-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 158317800CFB85C8006F62B9 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle-Embedded" */; + buildPhases = ( + 1583177E0CFB85C8006F62B9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "IPMonitor.bundle-Embedded"; + productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; + productName = IPMonitor.bundle; + productReference = 1559C4500D349A4E0098FD59 /* IPMonitor.bundle */; + productType = "com.apple.product-type.bundle"; + }; + 158317870CFB85DD006F62B9 /* InterfaceNamer.bundle-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 158317890CFB85DD006F62B9 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle-Embedded" */; + buildPhases = ( + 158317880CFB85DD006F62B9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "InterfaceNamer.bundle-Embedded"; + productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; + productName = InterfaceNamer.bundle; + productReference = 1559C4510D349A4E0098FD59 /* InterfaceNamer.bundle */; + productType = "com.apple.product-type.bundle"; + }; + 158317900CFB85F7006F62B9 /* KernelEventMonitor.bundle-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 158317920CFB85F7006F62B9 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle-Embedded" */; + buildPhases = ( + 158317910CFB85F7006F62B9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "KernelEventMonitor.bundle-Embedded"; + productName = KernelEventMonitor.bundle; + productReference = 1559C4520D349A4E0098FD59 /* KernelEventMonitor.bundle */; + productType = "com.apple.product-type.bundle"; + }; + 158317980CFB860C006F62B9 /* LinkConfiguration.bundle-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1583179A0CFB860C006F62B9 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle-Embedded" */; + buildPhases = ( + 158317990CFB860C006F62B9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "LinkConfiguration.bundle-Embedded"; + productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; + productName = LinkConfiguration.bundle; + productReference = 1559C4530D349A4E0098FD59 /* LinkConfiguration.bundle */; + productType = "com.apple.product-type.bundle"; + }; + 158317A00CFB8626006F62B9 /* NetworkIdentification.bundle-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 158317A20CFB8626006F62B9 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle-Embedded" */; + buildPhases = ( + 158317A10CFB8626006F62B9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "NetworkIdentification.bundle-Embedded"; + productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; + productName = NetworkIdentification.bundle; + productReference = 1559C4550D349A4E0098FD59 /* NetworkIdentification.bundle */; + productType = "com.apple.product-type.bundle"; + }; + 158317A80CFB8639006F62B9 /* PreferencesMonitor.bundle-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 158317AA0CFB8639006F62B9 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle-Embedded" */; + buildPhases = ( + 158317A90CFB8639006F62B9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "PreferencesMonitor.bundle-Embedded"; + productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; + productName = PreferencesMonitor.bundle; + productReference = 1559C4540D349A4E0098FD59 /* PreferencesMonitor.bundle */; + productType = "com.apple.product-type.bundle"; + }; + 158337990CFB6B9E0033AB93 /* SCHelper-Embedded */ = { + isa = PBXNativeTarget; + buildConfigurationList = 158337A60CFB6B9E0033AB93 /* Build configuration list for PBXNativeTarget "SCHelper-Embedded" */; + buildPhases = ( + 1583379A0CFB6B9E0033AB93 /* Headers */, + 1583379D0CFB6B9E0033AB93 /* Sources */, + 1583379F0CFB6B9E0033AB93 /* Frameworks */, + 158337A40CFB6B9E0033AB93 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SCHelper-Embedded"; + productInstallPath = /usr/local/bin; + productName = SCPreferencesHelper; + productReference = 1559C4470D349A4E0098FD59 /* SCHelper */; + productType = "com.apple.product-type.tool"; + }; + 159D53D307528BDA004F8947 /* KernelEventMonitor */ = { + isa = PBXNativeTarget; + buildConfigurationList = 156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */; + buildPhases = ( + 159D53D007528BDA004F8947 /* Headers */, + 159D53D107528BDA004F8947 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = KernelEventMonitor; + productName = KernelEventMonitor; + productReference = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */; + productType = "com.apple.product-type.library.static"; + }; + 159D53E407528C4A004F8947 /* InterfaceNamer */ = { + isa = PBXNativeTarget; + buildConfigurationList = 156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */; + buildPhases = ( + 159D53E107528C4A004F8947 /* Headers */, + 159D53E207528C4A004F8947 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = InterfaceNamer; + productName = InterfaceNamer; + productReference = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */; + productType = "com.apple.product-type.library.static"; + }; + 159D53EB07528C61004F8947 /* IPMonitor */ = { + isa = PBXNativeTarget; + buildConfigurationList = 156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */; + buildPhases = ( + 159D53E807528C61004F8947 /* Headers */, + 159D53E907528C61004F8947 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = IPMonitor; + productName = IPMonitor; + productReference = 159D53EC07528C61004F8947 /* libIPMonitor.a */; + productType = "com.apple.product-type.library.static"; + }; + 159D53F207528C79004F8947 /* LinkConfiguration */ = { + isa = PBXNativeTarget; + buildConfigurationList = 156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */; + buildPhases = ( + 159D53EF07528C79004F8947 /* Headers */, + 159D53F007528C79004F8947 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LinkConfiguration; + productName = LinkConfiguration; + productReference = 159D53F307528C79004F8947 /* libLinkConfiguration.a */; + productType = "com.apple.product-type.library.static"; + }; + 159D53F907528C95004F8947 /* PreferencesMonitor */ = { + isa = PBXNativeTarget; + buildConfigurationList = 156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */; + buildPhases = ( + 159D53F607528C95004F8947 /* Headers */, + 159D53F707528C95004F8947 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PreferencesMonitor; + productName = PreferencesMonitor; productReference = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */; productType = "com.apple.product-type.library.static"; }; @@ -1949,7 +3272,6 @@ 159D54A307529FFF004F8947 /* Headers */, 159D54AB07529FFF004F8947 /* Sources */, 159D54CA07529FFF004F8947 /* Frameworks */, - 159D54D407529FFF004F8947 /* Rez */, 159D54D507529FFF004F8947 /* CopyFiles */, 159D54D707529FFF004F8947 /* CopyFiles */, ); @@ -1963,6 +3285,26 @@ productReference = 159D54D907529FFF004F8947 /* configd */; productType = "com.apple.product-type.tool"; }; + 15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */ = { + isa = PBXNativeTarget; + buildConfigurationList = 15A5A2660D5B94190087BDA0 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-EmbeddedSimulator" */; + buildPhases = ( + 15A5A1E60D5B94190087BDA0 /* Headers */, + 15A5A2170D5B94190087BDA0 /* Update Headers */, + 15A5A2180D5B94190087BDA0 /* Resources */, + 15A5A21D0D5B94190087BDA0 /* Sources */, + 15A5A2620D5B94190087BDA0 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SystemConfiguration.framework-EmbeddedSimulator"; + productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; + productName = "SystemConfiguration (Framework)"; + productReference = 15A5A26A0D5B94190087BDA0 /* SystemConfiguration.framework */; + productType = "com.apple.product-type.framework"; + }; 15DAD5DF075913CE0084A6ED /* DNSConfiguration */ = { isa = PBXNativeTarget; buildConfigurationList = 156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */; @@ -1970,14 +3312,13 @@ 15DAD5E0075913CE0084A6ED /* Headers */, 15DAD5E4075913CE0084A6ED /* Sources */, 15DAD5E9075913CE0084A6ED /* Frameworks */, - 15DAD5EA075913CE0084A6ED /* Rez */, ); buildRules = ( ); dependencies = ( ); name = DNSConfiguration; - productInstallPath = /usr/local/lib; + productInstallPath = /usr/local/lib/system; productName = DNSConfiguration; productReference = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */; productType = "com.apple.product-type.library.static"; @@ -1988,12 +3329,11 @@ buildPhases = ( 15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */, 15DAD64107591A1A0084A6ED /* Headers */, + 15AC82480D376E2400A579D0 /* Update Headers */, 15DAD66807591A1A0084A6ED /* Resources */, 15DAD66C07591A1A0084A6ED /* Sources */, 15DAD6AD07591A1A0084A6ED /* Frameworks */, - 15DAD6AF07591A1A0084A6ED /* Rez */, 15DAD6B007591A1A0084A6ED /* get-mobility-info */, - 15DAD6B107591A1A0084A6ED /* preferences.plist */, ); buildRules = ( ); @@ -2002,13 +3342,16 @@ name = SystemConfiguration.framework; productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; productName = "SystemConfiguration (Framework)"; - productReference = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; + productReference = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; productType = "com.apple.product-type.framework"; }; 15FD70FF0754D627001CC321 /* Kicker.bundle */ = { isa = PBXNativeTarget; buildConfigurationList = 156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */; buildPhases = ( + 159C9B830DB68F0300BEEF10 /* Headers */, + 159C9B840DB68F0300BEEF10 /* Sources */, + 159C9B850DB68F0300BEEF10 /* Frameworks */, 15FD71010754D627001CC321 /* Resources */, ); buildRules = ( @@ -2033,7 +3376,7 @@ ); name = InterfaceNamer.bundle; productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; - productName = Kicker.bundle; + productName = InterfaceNamer.bundle; productReference = 15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */; productType = "com.apple.product-type.bundle"; }; @@ -2049,7 +3392,7 @@ ); name = IPMonitor.bundle; productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; - productName = Kicker.bundle; + productName = IPMonitor.bundle; productReference = 15FD72A50754DA4C001CC321 /* IPMonitor.bundle */; productType = "com.apple.product-type.bundle"; }; @@ -2065,7 +3408,7 @@ ); name = LinkConfiguration.bundle; productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; - productName = Kicker.bundle; + productName = LinkConfiguration.bundle; productReference = 15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */; productType = "com.apple.product-type.bundle"; }; @@ -2081,7 +3424,7 @@ ); name = PreferencesMonitor.bundle; productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; - productName = Kicker.bundle; + productName = PreferencesMonitor.bundle; productReference = 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */; productType = "com.apple.product-type.bundle"; }; @@ -2089,6 +3432,9 @@ isa = PBXNativeTarget; buildConfigurationList = 156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */; buildPhases = ( + 159C9B2B0DB68E2600BEEF10 /* Headers */, + 159C9B2C0DB68E2600BEEF10 /* Sources */, + 159C9B2F0DB68E8300BEEF10 /* Frameworks */, 15FD731F0754DB9F001CC321 /* Resources */, ); buildRules = ( @@ -2097,34 +3443,16 @@ ); name = ATconfig.bundle; productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; - productName = Kicker.bundle; + productName = ATconfig.bundle; productReference = 15FD73220754DB9F001CC321 /* ATconfig.bundle */; productType = "com.apple.product-type.bundle"; }; - 15FD733A0754DBDA001CC321 /* ATconfig */ = { - isa = PBXNativeTarget; - buildConfigurationList = 156EB63A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig" */; - buildPhases = ( - 15FD733C0754DBDA001CC321 /* Headers */, - 15FD733D0754DBDA001CC321 /* Sources */, - 15FD733F0754DBDA001CC321 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ATconfig; - productName = InterfaceNamer; - productReference = 15FD73400754DBDA001CC321 /* libATconfig.a */; - productType = "com.apple.product-type.library.static"; - }; F95B8A5E0B03F81400993BA3 /* NetworkIdentification */ = { isa = PBXNativeTarget; buildConfigurationList = F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */; buildPhases = ( F95B8A5B0B03F81400993BA3 /* Headers */, F95B8A5C0B03F81400993BA3 /* Sources */, - F95B8A5D0B03F81400993BA3 /* Frameworks */, ); buildRules = ( ); @@ -2147,7 +3475,7 @@ ); name = NetworkIdentification.bundle; productInstallPath = "$(USER_LIBRARY_DIR)/Bundles"; - productName = Kicker.bundle; + productName = NetworkIdentification.bundle; productReference = F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */; productType = "com.apple.product-type.bundle"; }; @@ -2157,7 +3485,7 @@ 15CB6A7705C0722B0099E85F /* Project object */ = { isa = PBXProject; buildConfigurationList = 156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */; - compatibilityVersion = "Xcode 2.4"; + compatibilityVersion = "Xcode 3.1"; hasScannedForEncodings = 1; mainGroup = 15CB68FC05C072220099E85F /* configd */; productRefGroup = 15CB690F05C0722B0099E85F /* Products */; @@ -2165,18 +3493,12 @@ projectRoot = ""; targets = ( 15CB690005C0722A0099E85F /* All */, - 157BB8AE075924360025DA7A /* configd_base */, - 159D542007528E7C004F8947 /* configd_plugins */, - 155847FA07550D210046C2E9 /* configd_executables */, + 15C64A1E0F684C3300D78394 /* configd_libSystem */, 15DAD5DF075913CE0084A6ED /* DNSConfiguration */, - 151F63DA09328A3C0096DCC9 /* Schema */, + 157BB8AE075924360025DA7A /* configd_base */, 15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */, 1547001808455B98006787CE /* SCHelper */, - 151F5D990CCE98E50093AC3B /* SCMonitor */, - 159D549F07529FFF004F8947 /* configd */, - 1558481207550EC10046C2E9 /* scselect */, - 155847430754FDCD0046C2E9 /* scutil */, - 15FD733A0754DBDA001CC321 /* ATconfig */, + 159D542007528E7C004F8947 /* configd_plugins */, 15FD731E0754DB9F001CC321 /* ATconfig.bundle */, 159D53EB07528C61004F8947 /* IPMonitor */, 15FD72A10754DA4C001CC321 /* IPMonitor.bundle */, @@ -2184,15 +3506,48 @@ 15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */, 159D53D307528BDA004F8947 /* KernelEventMonitor */, 15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */, - 159D53DD07528C2E004F8947 /* Kicker */, 15FD70FF0754D627001CC321 /* Kicker.bundle */, 159D53F207528C79004F8947 /* LinkConfiguration */, 15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */, + 15213FF90E93E9F500DACD2C /* Logger.bundle */, F95B8A5E0B03F81400993BA3 /* NetworkIdentification */, F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */, 159D53F907528C95004F8947 /* PreferencesMonitor */, 15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */, - ); + 155847FA07550D210046C2E9 /* configd_executables */, + 159D549F07529FFF004F8947 /* configd */, + 1558481207550EC10046C2E9 /* scselect */, + 155847430754FDCD0046C2E9 /* scutil */, + 151F5D990CCE98E50093AC3B /* SCMonitor */, + 151C1CC60CFB487000C5AFD6 /* All-Embedded */, + 15C64A280F684C6B00D78394 /* configd_libSystem-Embedded */, + 157A84D80D56C63900B6F1A0 /* DNSConfiguration-Embedded */, + 158316CF0CFB774B006F62B9 /* configd_base-Embedded */, + 1572C4A60CFB55B400E2776E /* SystemConfiguration.framework-Embedded */, + 158337990CFB6B9E0033AB93 /* SCHelper-Embedded */, + 158316E30CFB7761006F62B9 /* configd_plugins-Embedded */, + 157A84F40D56C7E800B6F1A0 /* IPMonitor-Embedded */, + 1583177D0CFB85C8006F62B9 /* IPMonitor.bundle-Embedded */, + 157A85050D56C8AA00B6F1A0 /* InterfaceNamer-Embedded */, + 158317870CFB85DD006F62B9 /* InterfaceNamer.bundle-Embedded */, + 157A85100D56C8E000B6F1A0 /* KernelEventMonitor-Embedded */, + 158317900CFB85F7006F62B9 /* KernelEventMonitor.bundle-Embedded */, + 157A85260D56C91100B6F1A0 /* LinkConfiguration-Embedded */, + 158317980CFB860C006F62B9 /* LinkConfiguration.bundle-Embedded */, + 156CA4790EF853BB00C59A18 /* Logger.bundle-Embedded */, + 157A85310D56C94F00B6F1A0 /* NetworkIdentification-Embedded */, + 158317A00CFB8626006F62B9 /* NetworkIdentification.bundle-Embedded */, + 157A853C0D56C96F00B6F1A0 /* PreferencesMonitor-Embedded */, + 158317A80CFB8639006F62B9 /* PreferencesMonitor.bundle-Embedded */, + 158317040CFB7782006F62B9 /* configd_executables-Embedded */, + 158317230CFB80A1006F62B9 /* configd-Embedded */, + 157433DD0D4A8122002ACA73 /* scselect-Embedded */, + 157433F00D4A8137002ACA73 /* scutil-Embedded */, + 15FD13BF0D59485000F9409C /* All-EmbeddedSimulator */, + 151FE2DD0D5B7046000D6DB1 /* configd_base-EmbeddedSimulator */, + 15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */, + 151F63DA09328A3C0096DCC9 /* Schema */, + ); }; /* End PBXProject section */ @@ -2205,6 +3560,31 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15213FF60E93E9F500DACD2C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 156CA4810EF853BB00C59A18 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1572C4D90CFB55B400E2776E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1572C4DA0CFB55B400E2776E /* Localizable.strings in Resources */, + 1572C4DB0CFB55B400E2776E /* NetworkInterface.strings in Resources */, + 1572C4DC0CFB55B400E2776E /* NetworkConfiguration.plist in Resources */, + 1572C4DD0CFB55B400E2776E /* get-mobility-info in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15828AE30753B5F900AD4710 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2212,115 +3592,121 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 15DAD66807591A1A0084A6ED /* Resources */ = { + 1583177E0CFB85C8006F62B9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */, - 15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */, - 15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */, - 15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD71010754D627001CC321 /* Resources */ = { + 158317880CFB85DD006F62B9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 158ADD190754F1F100124717 /* Kicker.xml in Resources */, - 158ADD1B0754F1F400124717 /* enable-network in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD72940754DA2B001CC321 /* Resources */ = { + 158317910CFB85F7006F62B9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD72A20754DA4C001CC321 /* Resources */ = { + 158317990CFB860C006F62B9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 158ADD0E0754F1A000124717 /* Resolvers.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD72B20754DA69001CC321 /* Resources */ = { + 158317A10CFB8626006F62B9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD72C60754DA7E001CC321 /* Resources */ = { + 158317A90CFB8639006F62B9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD731F0754DB9F001CC321 /* Resources */ = { + 15A5A2180D5B94190087BDA0 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 15A5A2190D5B94190087BDA0 /* Localizable.strings in Resources */, + 15A5A21A0D5B94190087BDA0 /* NetworkInterface.strings in Resources */, + 15A5A21B0D5B94190087BDA0 /* NetworkConfiguration.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - F95B8A6B0B03F9D100993BA3 /* Resources */ = { + 15DAD66807591A1A0084A6ED /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */, + 15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */, + 15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */, + 15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 1547001C08455B98006787CE /* Rez */ = { - isa = PBXRezBuildPhase; + 15FD71010754D627001CC321 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 158ADD190754F1F100124717 /* Kicker.xml in Resources */, + 158ADD1B0754F1F400124717 /* enable-network in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 15FD72940754DA2B001CC321 /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 155847670754FDCD0046C2E9 /* Rez */ = { - isa = PBXRezBuildPhase; + 15FD72A20754DA4C001CC321 /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 1558481A07550EC10046C2E9 /* Rez */ = { - isa = PBXRezBuildPhase; + 15FD72B20754DA69001CC321 /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 159D54D407529FFF004F8947 /* Rez */ = { - isa = PBXRezBuildPhase; + 15FD72C60754DA7E001CC321 /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 15DAD5EA075913CE0084A6ED /* Rez */ = { - isa = PBXRezBuildPhase; + 15FD731F0754DB9F001CC321 /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 15DAD6AF07591A1A0084A6ED /* Rez */ = { - isa = PBXRezBuildPhase; + F95B8A6B0B03F9D100993BA3 /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; -/* End PBXRezBuildPhase section */ +/* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 151F63DB09328A3C0096DCC9 /* ShellScript */ = { @@ -2340,23 +3726,23 @@ shellPath = /bin/sh; shellScript = "echo ${BUILT_PRODUCTS_DIR}\ncc -o ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} ${SRCROOT}/SystemConfiguration.fproj/genSCPreferences.c || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} header > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} private > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitionsPrivate.h || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} cfile > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c || exit 1\nexit 0"; }; - 15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */ = { + 153393E40D34999D00FE74E7 /* Update Headers */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - /usr/local/lib/OrderFiles/SystemConfiguration.order, + "$(SRCROOT)/SystemConfiguration.fproj/update-headers", ); - name = SystemConfiguration.order; + name = "Update Headers"; outputPaths = ( - "${OBJROOT}/SystemConfiguration.order", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ -r /usr/local/lib/OrderFiles/SystemConfiguration.order ]; then\n\tcp /usr/local/lib/OrderFiles/SystemConfiguration.order ${OBJROOT}/SystemConfiguration.order\nelse\n\ttouch ${OBJROOT}/SystemConfiguration.order\nfi"; + shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi\n"; + showEnvVarsInLog = 0; }; - 15DAD6B007591A1A0084A6ED /* get-mobility-info */ = { + 1572C5270CFB55B400E2776E /* get-mobility-info */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 8; files = ( @@ -2368,22 +3754,102 @@ ); runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; - shellScript = "mkdir -p \"${DSTROOT}/usr/local/bin\"\nln -fs \"${INSTALL_PATH}/${TARGET_NAME}/Resources/get-mobility-info\" \"${DSTROOT}/usr/local/bin/\"\n"; + shellScript = "mkdir -p \"${DSTROOT}/usr/local/bin\"\nln -fs \"${INSTALL_PATH}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/get-mobility-info\" \"${DSTROOT}/usr/local/bin/\"\n"; + showEnvVarsInLog = 0; + }; + 15A5A2170D5B94190087BDA0 /* Update Headers */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/SystemConfiguration.fproj/update-headers", + ); + name = "Update Headers"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi\n"; + showEnvVarsInLog = 0; + }; + 15AC82480D376E2400A579D0 /* Update Headers */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/SystemConfiguration.fproj/update-headers", + ); + name = "Update Headers"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} clean\nfi\n"; + showEnvVarsInLog = 0; + }; + 15BED7930F6853F800016614 /* OLD libdnsinfo.a */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + ); + name = "OLD libdnsinfo.a"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "if [ -f \"${INSTALL_DIR}/libdnsinfo.a\" ]; then\n\tln -f \"${INSTALL_DIR}/libdnsinfo.a\" \"${INSTALL_DIR}/../libdnsinfo.a\"\nfi"; + showEnvVarsInLog = 0; + }; + 15BED7A20F68551200016614 /* OLD libdnsinfo.a */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + ); + name = "OLD libdnsinfo.a"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "if [ -f \"${INSTALL_DIR}/libdnsinfo.a\" ]; then\n\tln -f \"${INSTALL_DIR}/libdnsinfo.a\" \"${INSTALL_DIR}/../libdnsinfo.a\"\nfi"; + showEnvVarsInLog = 0; + }; + 15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + /usr/local/lib/OrderFiles/SystemConfiguration.order, + ); + name = SystemConfiguration.order; + outputPaths = ( + "${OBJROOT}/SystemConfiguration.order", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if [ -r /usr/local/lib/OrderFiles/SystemConfiguration.order ]; then\n\tcp /usr/local/lib/OrderFiles/SystemConfiguration.order ${OBJROOT}/SystemConfiguration.order\nelse\n\ttouch ${OBJROOT}/SystemConfiguration.order\nfi"; + showEnvVarsInLog = 0; }; - 15DAD6B107591A1A0084A6ED /* preferences.plist */ = { + 15DAD6B007591A1A0084A6ED /* get-mobility-info */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 8; files = ( ); inputPaths = ( - preferences.xml, ); - name = preferences.plist; + name = "get-mobility-info"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; - shellScript = "PREFS_DIR=\"/Library/Preferences/SystemConfiguration\"\nmkdir -p ${DSTROOT}${PREFS_DIR}\nchmod 755 ${DSTROOT}${PREFS_DIR}\n#install -c -m 644 preferences.xml ${DSTROOT}${PREFS_DIR}/preferences.plist"; + shellScript = "mkdir -p \"${DSTROOT}/usr/local/bin\"\nln -fs \"${INSTALL_PATH}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/get-mobility-info\" \"${DSTROOT}/usr/local/bin/\"\n"; + showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -2396,6 +3862,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15213FF70E93E9F500DACD2C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 152140020E93EC6500DACD2C /* logger.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 1547001A08455B98006787CE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2432,24 +3906,252 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53D107528BDA004F8947 /* Sources */ = { + 156CA47A0EF853BB00C59A18 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 159D540907528D3A004F8947 /* cache.c in Sources */, - 159D540B07528DA9004F8947 /* ev_appletalk.c in Sources */, - 159D540D07528DAE004F8947 /* ev_dlil.c in Sources */, - 159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */, - 159D541107528DB2004F8947 /* ev_ipv6.c in Sources */, - 159D541307528DB5004F8947 /* eventmon.c in Sources */, + 156CA47B0EF853BB00C59A18 /* logger.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1572C4DE0CFB55B400E2776E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1572C4DF0CFB55B400E2776E /* SCSchemaDefinitions.c in Sources */, + 1572C4E00CFB55B400E2776E /* SCD.c in Sources */, + 1572C4E10CFB55B400E2776E /* SCDKeys.c in Sources */, + 1572C4E20CFB55B400E2776E /* SCDPrivate.c in Sources */, + 1572C4E30CFB55B400E2776E /* SCDPlugin.c in Sources */, + 1572C4E40CFB55B400E2776E /* SCDOpen.c in Sources */, + 1572C4E50CFB55B400E2776E /* SCDLock.c in Sources */, + 1572C4E60CFB55B400E2776E /* SCDUnlock.c in Sources */, + 1572C4E70CFB55B400E2776E /* SCDList.c in Sources */, + 1572C4E80CFB55B400E2776E /* SCDAdd.c in Sources */, + 1572C4E90CFB55B400E2776E /* SCDGet.c in Sources */, + 1572C4EA0CFB55B400E2776E /* SCDSet.c in Sources */, + 1572C4EB0CFB55B400E2776E /* SCDRemove.c in Sources */, + 1572C4EC0CFB55B400E2776E /* SCDTouch.c in Sources */, + 1572C4ED0CFB55B400E2776E /* SCDNotify.c in Sources */, + 1572C4EE0CFB55B400E2776E /* SCDNotifierSetKeys.c in Sources */, + 1572C4EF0CFB55B400E2776E /* SCDNotifierAdd.c in Sources */, + 1572C4F00CFB55B400E2776E /* SCDNotifierRemove.c in Sources */, + 1572C4F10CFB55B400E2776E /* SCDNotifierGetChanges.c in Sources */, + 1572C4F20CFB55B400E2776E /* SCDNotifierWait.c in Sources */, + 1572C4F30CFB55B400E2776E /* SCDNotifierInformViaCallback.c in Sources */, + 1572C4F40CFB55B400E2776E /* SCDNotifierInformViaMachPort.c in Sources */, + 1572C4F50CFB55B400E2776E /* SCDNotifierInformViaFD.c in Sources */, + 1572C4F60CFB55B400E2776E /* SCDNotifierInformViaSignal.c in Sources */, + 1572C4F70CFB55B400E2776E /* SCDNotifierCancel.c in Sources */, + 1572C4F80CFB55B400E2776E /* SCDSnapshot.c in Sources */, + 1572C4F90CFB55B400E2776E /* SCP.c in Sources */, + 1572C4FA0CFB55B400E2776E /* SCPOpen.c in Sources */, + 1572C4FB0CFB55B400E2776E /* SCPLock.c in Sources */, + 1572C4FC0CFB55B400E2776E /* SCPUnlock.c in Sources */, + 1572C4FD0CFB55B400E2776E /* SCPList.c in Sources */, + 1572C4FE0CFB55B400E2776E /* SCPGet.c in Sources */, + 1572C4FF0CFB55B400E2776E /* SCPAdd.c in Sources */, + 1572C5000CFB55B400E2776E /* SCPSet.c in Sources */, + 1572C5010CFB55B400E2776E /* SCPRemove.c in Sources */, + 1572C5020CFB55B400E2776E /* SCPCommit.c in Sources */, + 1572C5030CFB55B400E2776E /* SCPApply.c in Sources */, + 1572C5040CFB55B400E2776E /* SCPPath.c in Sources */, + 1572C5060CFB55B400E2776E /* SCDHostName.c in Sources */, + 1572C5070CFB55B400E2776E /* SCLocation.c in Sources */, + 1572C5080CFB55B400E2776E /* SCNetwork.c in Sources */, + 1572C5090CFB55B400E2776E /* pppcontroller.defs in Sources */, + 1572C50A0CFB55B400E2776E /* SCNetworkConnection.c in Sources */, + 1572C50B0CFB55B400E2776E /* SCNetworkConnectionPrivate.c in Sources */, + 1572C50C0CFB55B400E2776E /* SCNetworkReachability.c in Sources */, + 1572C50D0CFB55B400E2776E /* SCProxies.c in Sources */, + 1572C50E0CFB55B400E2776E /* DHCP.c in Sources */, + 1572C50F0CFB55B400E2776E /* moh.c in Sources */, + 1572C5100CFB55B400E2776E /* DeviceOnHold.c in Sources */, + 1572C5110CFB55B400E2776E /* LinkConfiguration.c in Sources */, + 1572C5120CFB55B400E2776E /* dy_framework.c in Sources */, + 1572C5140CFB55B400E2776E /* config.defs in Sources */, + 1572C5150CFB55B400E2776E /* SCPreferencesPathKey.c in Sources */, + 1572C5160CFB55B400E2776E /* dnsinfo_private.c in Sources */, + 1572C5170CFB55B400E2776E /* dnsinfo_copy.c in Sources */, + 1572C5180CFB55B400E2776E /* shared_dns_info.defs in Sources */, + 1572C5190CFB55B400E2776E /* SCNetworkConfigurationInternal.c in Sources */, + 1572C51A0CFB55B400E2776E /* SCNetworkInterface.c in Sources */, + 1572C51B0CFB55B400E2776E /* SCNetworkProtocol.c in Sources */, + 1572C51C0CFB55B400E2776E /* SCNetworkService.c in Sources */, + 1572C51D0CFB55B400E2776E /* SCNetworkSet.c in Sources */, + 1572C51F0CFB55B400E2776E /* helper_comm.c in Sources */, + 1572C5200CFB55B400E2776E /* SCHelper_client.c in Sources */, + 1572C5210CFB55B400E2776E /* SCPreferencesKeychainPrivate.c in Sources */, + 1572C5220CFB55B400E2776E /* SCNetworkSignature.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157433DF0D4A8122002ACA73 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 157433E00D4A8122002ACA73 /* scselect.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157433FF0D4A8137002ACA73 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 157434000D4A8137002ACA73 /* scutil.c in Sources */, + 157434010D4A8137002ACA73 /* commands.c in Sources */, + 157434020D4A8137002ACA73 /* dictionary.c in Sources */, + 157434030D4A8137002ACA73 /* session.c in Sources */, + 157434040D4A8137002ACA73 /* cache.c in Sources */, + 157434050D4A8137002ACA73 /* notifications.c in Sources */, + 157434060D4A8137002ACA73 /* tests.c in Sources */, + 157434070D4A8137002ACA73 /* prefs.c in Sources */, + 157434080D4A8137002ACA73 /* net.c in Sources */, + 157434090D4A8137002ACA73 /* net_interface.c in Sources */, + 1574340A0D4A8137002ACA73 /* net_protocol.c in Sources */, + 1574340B0D4A8137002ACA73 /* net_service.c in Sources */, + 1574340C0D4A8137002ACA73 /* net_set.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A84DD0D56C63900B6F1A0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A84DE0D56C63900B6F1A0 /* shared_dns_info.defs in Sources */, + 157A84DF0D56C63900B6F1A0 /* dnsinfo_copy.c in Sources */, + 157A84E00D56C63900B6F1A0 /* dnsinfo_private.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A84F90D56C7E800B6F1A0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 155281020E3E4A0F00C54315 /* ip_plugin.c in Sources */, + 157A84FB0D56C7E800B6F1A0 /* dns-configuration.c in Sources */, + 157A84FC0D56C7E800B6F1A0 /* set-hostname.c in Sources */, + 15D48EC10F67061F00B4711E /* dnsinfo_create.c in Sources */, + 15D48ED40F6707A600B4711E /* shared_dns_info.defs in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A85070D56C8AA00B6F1A0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A85080D56C8AA00B6F1A0 /* ifnamer.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A85180D56C8E000B6F1A0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A85190D56C8E000B6F1A0 /* cache.c in Sources */, + 157A851B0D56C8E000B6F1A0 /* ev_dlil.c in Sources */, + 157A851C0D56C8E000B6F1A0 /* ev_ipv4.c in Sources */, + 157A851D0D56C8E000B6F1A0 /* ev_ipv6.c in Sources */, + 157A851E0D56C8E000B6F1A0 /* eventmon.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A85280D56C91100B6F1A0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A85290D56C91100B6F1A0 /* linkconfig.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A85330D56C94F00B6F1A0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A85340D56C94F00B6F1A0 /* NetworkIdentification.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 157A853E0D56C96F00B6F1A0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 157A853F0D56C96F00B6F1A0 /* prefsmon.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1583172C0CFB80A1006F62B9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1583172D0CFB80A1006F62B9 /* configd.m in Sources */, + 1583172E0CFB80A1006F62B9 /* _SCD.c in Sources */, + 1583172F0CFB80A1006F62B9 /* configd_server.c in Sources */, + 158317300CFB80A1006F62B9 /* notify_server.c in Sources */, + 158317310CFB80A1006F62B9 /* plugin_support.c in Sources */, + 158317320CFB80A1006F62B9 /* session.c in Sources */, + 158317330CFB80A1006F62B9 /* pattern.c in Sources */, + 158317340CFB80A1006F62B9 /* _configopen.c in Sources */, + 158317350CFB80A1006F62B9 /* _configclose.c in Sources */, + 158317360CFB80A1006F62B9 /* _configlock.c in Sources */, + 158317370CFB80A1006F62B9 /* _configunlock.c in Sources */, + 158317380CFB80A1006F62B9 /* _configlist.c in Sources */, + 158317390CFB80A1006F62B9 /* _configadd.c in Sources */, + 1583173A0CFB80A1006F62B9 /* _configget.c in Sources */, + 1583173B0CFB80A1006F62B9 /* _configset.c in Sources */, + 1583173C0CFB80A1006F62B9 /* _configremove.c in Sources */, + 1583173D0CFB80A1006F62B9 /* _configtouch.c in Sources */, + 1583173E0CFB80A1006F62B9 /* _confignotify.c in Sources */, + 1583173F0CFB80A1006F62B9 /* _notifyadd.c in Sources */, + 158317400CFB80A1006F62B9 /* _notifyremove.c in Sources */, + 158317410CFB80A1006F62B9 /* _notifychanges.c in Sources */, + 158317420CFB80A1006F62B9 /* _notifyviaport.c in Sources */, + 158317430CFB80A1006F62B9 /* _notifyviafd.c in Sources */, + 158317440CFB80A1006F62B9 /* _notifyviasignal.c in Sources */, + 158317450CFB80A1006F62B9 /* _notifycancel.c in Sources */, + 158317460CFB80A1006F62B9 /* _snapshot.c in Sources */, + 158317470CFB80A1006F62B9 /* config.defs in Sources */, + 158317480CFB80A1006F62B9 /* dnsinfo_private.c in Sources */, + 158317490CFB80A1006F62B9 /* dnsinfo_server.c in Sources */, + 1583174A0CFB80A1006F62B9 /* shared_dns_info.defs in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1583379D0CFB6B9E0033AB93 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1583379E0CFB6B9E0033AB93 /* SCHelper_server.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 159C9B2C0DB68E2600BEEF10 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 159C9B290DB68E0700BEEF10 /* atconfig.c in Sources */, + 159C9B2A0DB68E0800BEEF10 /* cfManager.c in Sources */, + 159C9B2D0DB68E3D00BEEF10 /* cache.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 159C9B840DB68F0300BEEF10 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 159C9B820DB68EE500BEEF10 /* kicker.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 159D53DB07528C2E004F8947 /* Sources */ = { + 159D53D107528BDA004F8947 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 159D541507528DDE004F8947 /* kicker.c in Sources */, + 159D540907528D3A004F8947 /* cache.c in Sources */, + 159D540D07528DAE004F8947 /* ev_dlil.c in Sources */, + 159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */, + 159D541107528DB2004F8947 /* ev_ipv6.c in Sources */, + 159D541307528DB5004F8947 /* eventmon.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2469,6 +4171,9 @@ 159D541807528E09004F8947 /* dns-configuration.c in Sources */, 154361E00752C81800A8EC6C /* set-hostname.c in Sources */, 1572EB7B0A506D3B00D02459 /* smb-configuration.c in Sources */, + 15D48EBF0F67061600B4711E /* dnsinfo_create.c in Sources */, + 15D48ED30F67079B00B4711E /* shared_dns_info.defs in Sources */, + 1522FCFB0FA7FE4B00B24128 /* dnsinfo_flatfile.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2525,6 +4230,78 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 15A5A21D0D5B94190087BDA0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15A5A21E0D5B94190087BDA0 /* SCSchemaDefinitions.c in Sources */, + 15A5A21F0D5B94190087BDA0 /* SCD.c in Sources */, + 15A5A2200D5B94190087BDA0 /* SCDKeys.c in Sources */, + 15A5A2210D5B94190087BDA0 /* SCDPrivate.c in Sources */, + 15A5A2220D5B94190087BDA0 /* SCDPlugin.c in Sources */, + 15A5A2230D5B94190087BDA0 /* SCDOpen.c in Sources */, + 15A5A2240D5B94190087BDA0 /* SCDLock.c in Sources */, + 15A5A2250D5B94190087BDA0 /* SCDUnlock.c in Sources */, + 15A5A2260D5B94190087BDA0 /* SCDList.c in Sources */, + 15A5A2270D5B94190087BDA0 /* SCDAdd.c in Sources */, + 15A5A2280D5B94190087BDA0 /* SCDGet.c in Sources */, + 15A5A2290D5B94190087BDA0 /* SCDSet.c in Sources */, + 15A5A22A0D5B94190087BDA0 /* SCDRemove.c in Sources */, + 15A5A22B0D5B94190087BDA0 /* SCDTouch.c in Sources */, + 15A5A22C0D5B94190087BDA0 /* SCDNotify.c in Sources */, + 15A5A22D0D5B94190087BDA0 /* SCDNotifierSetKeys.c in Sources */, + 15A5A22E0D5B94190087BDA0 /* SCDNotifierAdd.c in Sources */, + 15A5A22F0D5B94190087BDA0 /* SCDNotifierRemove.c in Sources */, + 15A5A2300D5B94190087BDA0 /* SCDNotifierGetChanges.c in Sources */, + 15A5A2310D5B94190087BDA0 /* SCDNotifierWait.c in Sources */, + 15A5A2320D5B94190087BDA0 /* SCDNotifierInformViaCallback.c in Sources */, + 15A5A2330D5B94190087BDA0 /* SCDNotifierInformViaMachPort.c in Sources */, + 15A5A2340D5B94190087BDA0 /* SCDNotifierInformViaFD.c in Sources */, + 15A5A2350D5B94190087BDA0 /* SCDNotifierInformViaSignal.c in Sources */, + 15A5A2360D5B94190087BDA0 /* SCDNotifierCancel.c in Sources */, + 15A5A2370D5B94190087BDA0 /* SCDSnapshot.c in Sources */, + 15A5A2380D5B94190087BDA0 /* SCP.c in Sources */, + 15A5A2390D5B94190087BDA0 /* SCPOpen.c in Sources */, + 15A5A23A0D5B94190087BDA0 /* SCPLock.c in Sources */, + 15A5A23B0D5B94190087BDA0 /* SCPUnlock.c in Sources */, + 15A5A23C0D5B94190087BDA0 /* SCPList.c in Sources */, + 15A5A23D0D5B94190087BDA0 /* SCPGet.c in Sources */, + 15A5A23E0D5B94190087BDA0 /* SCPAdd.c in Sources */, + 15A5A23F0D5B94190087BDA0 /* SCPSet.c in Sources */, + 15A5A2400D5B94190087BDA0 /* SCPRemove.c in Sources */, + 15A5A2410D5B94190087BDA0 /* SCPCommit.c in Sources */, + 15A5A2420D5B94190087BDA0 /* SCPApply.c in Sources */, + 15A5A2430D5B94190087BDA0 /* SCPPath.c in Sources */, + 15A5A2450D5B94190087BDA0 /* SCDHostName.c in Sources */, + 15A5A2460D5B94190087BDA0 /* SCLocation.c in Sources */, + 15A5A2470D5B94190087BDA0 /* SCNetwork.c in Sources */, + 15A5A2480D5B94190087BDA0 /* pppcontroller.defs in Sources */, + 15A5A2490D5B94190087BDA0 /* SCNetworkConnection.c in Sources */, + 15A5A24A0D5B94190087BDA0 /* SCNetworkConnectionPrivate.c in Sources */, + 15A5A24B0D5B94190087BDA0 /* SCNetworkReachability.c in Sources */, + 15A5A24C0D5B94190087BDA0 /* SCProxies.c in Sources */, + 15A5A24D0D5B94190087BDA0 /* DHCP.c in Sources */, + 15A5A24E0D5B94190087BDA0 /* moh.c in Sources */, + 15A5A24F0D5B94190087BDA0 /* DeviceOnHold.c in Sources */, + 15A5A2500D5B94190087BDA0 /* LinkConfiguration.c in Sources */, + 15A5A2510D5B94190087BDA0 /* dy_framework.c in Sources */, + 15A5A2530D5B94190087BDA0 /* config.defs in Sources */, + 15A5A2540D5B94190087BDA0 /* SCPreferencesPathKey.c in Sources */, + 15A5A2550D5B94190087BDA0 /* dnsinfo_private.c in Sources */, + 15A5A2560D5B94190087BDA0 /* dnsinfo_copy.c in Sources */, + 15A5A2570D5B94190087BDA0 /* shared_dns_info.defs in Sources */, + 15A5A2580D5B94190087BDA0 /* SCNetworkConfigurationInternal.c in Sources */, + 15A5A2590D5B94190087BDA0 /* SCNetworkInterface.c in Sources */, + 15A5A25A0D5B94190087BDA0 /* SCNetworkProtocol.c in Sources */, + 15A5A25B0D5B94190087BDA0 /* SCNetworkService.c in Sources */, + 15A5A25C0D5B94190087BDA0 /* SCNetworkSet.c in Sources */, + 15A5A25E0D5B94190087BDA0 /* helper_comm.c in Sources */, + 15A5A25F0D5B94190087BDA0 /* SCHelper_client.c in Sources */, + 15A5A2600D5B94190087BDA0 /* SCPreferencesKeychainPrivate.c in Sources */, + 15A5A2610D5B94190087BDA0 /* SCNetworkSignature.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 15DAD5E4075913CE0084A6ED /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2532,7 +4309,6 @@ 15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */, 15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */, 15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */, - 15DAD5E8075913CE0084A6ED /* dnsinfo_create.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2611,16 +4387,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 15FD733D0754DBDA001CC321 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1508E39F07552B6A0062B350 /* atconfig.c in Sources */, - 1508E3A007552B6B0062B350 /* cfManager.c in Sources */, - 1508E3A107552B720062B350 /* cache.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; F95B8A5C0B03F81400993BA3 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2632,20 +4398,25 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 150ECB3C0D0079280065E94D /* PBXTargetDependency */ = { + 150ECB300D0042DA0065E94D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 151F5D990CCE98E50093AC3B /* SCMonitor */; - targetProxy = 150ECB3B0D0079280065E94D /* PBXContainerItemProxy */; + targetProxy = 150ECB2F0D0042DA0065E94D /* PBXContainerItemProxy */; + }; + 151FE37A0D5B713C000D6DB1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 151FE2DD0D5B7046000D6DB1 /* configd_base-EmbeddedSimulator */; + targetProxy = 151FE3790D5B713C000D6DB1 /* PBXContainerItemProxy */; }; 1520A386084681350010B584 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 1547001808455B98006787CE /* SCHelper */; targetProxy = 1520A385084681350010B584 /* PBXContainerItemProxy */; }; - 1533B94109731A9600F2B34A /* PBXTargetDependency */ = { + 1521405B0E9400BF00DACD2C /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 15FD733A0754DBDA001CC321 /* ATconfig */; - targetProxy = 1533B94009731A9600F2B34A /* PBXContainerItemProxy */; + target = 15213FF90E93E9F500DACD2C /* Logger.bundle */; + targetProxy = 1521405A0E9400BF00DACD2C /* PBXContainerItemProxy */; }; 1558480607550D470046C2E9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -2667,15 +4438,60 @@ target = 155847FA07550D210046C2E9 /* configd_executables */; targetProxy = 1558480E07550DD00046C2E9 /* PBXContainerItemProxy */; }; - 157BB8C0075924460025DA7A /* PBXTargetDependency */ = { + 156CA4A80EF8550800C59A18 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */; - targetProxy = 157BB8BF075924460025DA7A /* PBXContainerItemProxy */; + target = 156CA4790EF853BB00C59A18 /* Logger.bundle-Embedded */; + targetProxy = 156CA4A70EF8550800C59A18 /* PBXContainerItemProxy */; }; - 157BB8C2075924470025DA7A /* PBXTargetDependency */ = { + 1574341F0D4A815E002ACA73 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 15DAD5DF075913CE0084A6ED /* DNSConfiguration */; - targetProxy = 157BB8C1075924470025DA7A /* PBXContainerItemProxy */; + target = 157433F00D4A8137002ACA73 /* scutil-Embedded */; + targetProxy = 1574341E0D4A815E002ACA73 /* PBXContainerItemProxy */; + }; + 157434210D4A8166002ACA73 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 157433DD0D4A8122002ACA73 /* scselect-Embedded */; + targetProxy = 157434200D4A8166002ACA73 /* PBXContainerItemProxy */; + }; + 157A85480D56CA0B00B6F1A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 157A84F40D56C7E800B6F1A0 /* IPMonitor-Embedded */; + targetProxy = 157A85470D56CA0B00B6F1A0 /* PBXContainerItemProxy */; + }; + 157A854A0D56CA2300B6F1A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 157A85050D56C8AA00B6F1A0 /* InterfaceNamer-Embedded */; + targetProxy = 157A85490D56CA2300B6F1A0 /* PBXContainerItemProxy */; + }; + 157A854C0D56CA5100B6F1A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 157A85100D56C8E000B6F1A0 /* KernelEventMonitor-Embedded */; + targetProxy = 157A854B0D56CA5100B6F1A0 /* PBXContainerItemProxy */; + }; + 157A854E0D56CA6F00B6F1A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 157A85260D56C91100B6F1A0 /* LinkConfiguration-Embedded */; + targetProxy = 157A854D0D56CA6F00B6F1A0 /* PBXContainerItemProxy */; + }; + 157A85500D56CA8800B6F1A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 157A85310D56C94F00B6F1A0 /* NetworkIdentification-Embedded */; + targetProxy = 157A854F0D56CA8800B6F1A0 /* PBXContainerItemProxy */; + }; + 157A85520D56CA9E00B6F1A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 157A853C0D56C96F00B6F1A0 /* PreferencesMonitor-Embedded */; + targetProxy = 157A85510D56CA9E00B6F1A0 /* PBXContainerItemProxy */; + }; + 157A85540D56CACA00B6F1A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158317A80CFB8639006F62B9 /* PreferencesMonitor.bundle-Embedded */; + targetProxy = 157A85530D56CACA00B6F1A0 /* PBXContainerItemProxy */; + }; + 157BB8C0075924460025DA7A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */; + targetProxy = 157BB8BF075924460025DA7A /* PBXContainerItemProxy */; }; 157BB8C40759244B0025DA7A /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -2687,6 +4503,61 @@ target = 15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */; targetProxy = 15828B060753B77E00AD4710 /* PBXContainerItemProxy */; }; + 158317100CFB77D1006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158316CF0CFB774B006F62B9 /* configd_base-Embedded */; + targetProxy = 1583170F0CFB77D1006F62B9 /* PBXContainerItemProxy */; + }; + 158317120CFB77E1006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1572C4A60CFB55B400E2776E /* SystemConfiguration.framework-Embedded */; + targetProxy = 158317110CFB77E1006F62B9 /* PBXContainerItemProxy */; + }; + 158317140CFB77E8006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158337990CFB6B9E0033AB93 /* SCHelper-Embedded */; + targetProxy = 158317130CFB77E8006F62B9 /* PBXContainerItemProxy */; + }; + 158317160CFB783B006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158316E30CFB7761006F62B9 /* configd_plugins-Embedded */; + targetProxy = 158317150CFB783B006F62B9 /* PBXContainerItemProxy */; + }; + 158317180CFB784D006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158317040CFB7782006F62B9 /* configd_executables-Embedded */; + targetProxy = 158317170CFB784D006F62B9 /* PBXContainerItemProxy */; + }; + 158317660CFB80D5006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158317230CFB80A1006F62B9 /* configd-Embedded */; + targetProxy = 158317650CFB80D5006F62B9 /* PBXContainerItemProxy */; + }; + 158317B30CFB8660006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158317A00CFB8626006F62B9 /* NetworkIdentification.bundle-Embedded */; + targetProxy = 158317B20CFB8660006F62B9 /* PBXContainerItemProxy */; + }; + 158317B50CFB8660006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158317980CFB860C006F62B9 /* LinkConfiguration.bundle-Embedded */; + targetProxy = 158317B40CFB8660006F62B9 /* PBXContainerItemProxy */; + }; + 158317B70CFB8660006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158317900CFB85F7006F62B9 /* KernelEventMonitor.bundle-Embedded */; + targetProxy = 158317B60CFB8660006F62B9 /* PBXContainerItemProxy */; + }; + 158317B90CFB8660006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 158317870CFB85DD006F62B9 /* InterfaceNamer.bundle-Embedded */; + targetProxy = 158317B80CFB8660006F62B9 /* PBXContainerItemProxy */; + }; + 158317BB0CFB8660006F62B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1583177D0CFB85C8006F62B9 /* IPMonitor.bundle-Embedded */; + targetProxy = 158317BA0CFB8660006F62B9 /* PBXContainerItemProxy */; + }; 158AD9860754E72500124717 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 15FD72A10754DA4C001CC321 /* IPMonitor.bundle */; @@ -2737,10 +4608,30 @@ target = 159D542007528E7C004F8947 /* configd_plugins */; targetProxy = 159D542D07529008004F8947 /* PBXContainerItemProxy */; }; - 15DAD5740759115F0084A6ED /* PBXTargetDependency */ = { + 15A5A2710D5B942D0087BDA0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */; + targetProxy = 15A5A2700D5B942D0087BDA0 /* PBXContainerItemProxy */; + }; + 15C64A220F684C4900D78394 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 15DAD5DF075913CE0084A6ED /* DNSConfiguration */; + targetProxy = 15C64A210F684C4900D78394 /* PBXContainerItemProxy */; + }; + 15C64A240F684C5700D78394 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 15FD731E0754DB9F001CC321 /* ATconfig.bundle */; - targetProxy = 15DAD5730759115F0084A6ED /* PBXContainerItemProxy */; + target = 15C64A1E0F684C3300D78394 /* configd_libSystem */; + targetProxy = 15C64A230F684C5700D78394 /* PBXContainerItemProxy */; + }; + 15C64A2F0F684C8300D78394 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 15C64A280F684C6B00D78394 /* configd_libSystem-Embedded */; + targetProxy = 15C64A2E0F684C8300D78394 /* PBXContainerItemProxy */; + }; + 15C64A310F684C8F00D78394 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 157A84D80D56C63900B6F1A0 /* DNSConfiguration-Embedded */; + targetProxy = 15C64A300F684C8F00D78394 /* PBXContainerItemProxy */; }; F95B8A770B03FB9100993BA3 /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -2782,219 +4673,196 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 151F5D9C0CCE98E60093AC3B /* Development */ = { + 151C1CC70CFB487000C5AFD6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist"; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /System/Library/UserEventPlugins; - PRODUCT_NAME = SCMonitor; - WRAPPER_EXTENSION = plugin; - ZERO_LINK = YES; + PRODUCT_NAME = "configd (Aggregate/Embedded)"; }; - name = Development; + name = Debug; }; - 151F5D9D0CCE98E60093AC3B /* Deployment */ = { + 151C1CC80CFB487000C5AFD6 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + PRODUCT_NAME = "configd (Aggregate/Embedded)"; + }; + name = Release; + }; + 151F5D9C0CCE98E60093AC3B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)"; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist"; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + INFOPLIST_FILE = SCMonitor/Info.plist; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /System/Library/UserEventPlugins; PRODUCT_NAME = SCMonitor; WRAPPER_EXTENSION = plugin; - ZERO_LINK = NO; }; - name = Deployment; + name = Debug; }; - 151F5D9E0CCE98E60093AC3B /* Default */ = { + 151F5D9D0CCE98E60093AC3B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)"; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + INFOPLIST_FILE = SCMonitor/Info.plist; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /System/Library/UserEventPlugins; PRODUCT_NAME = SCMonitor; - VALID_ARCHS = "i386 ppc"; WRAPPER_EXTENSION = plugin; - ZERO_LINK = YES; }; - name = Default; + name = Release; }; - 151F63DD09328A3C0096DCC9 /* Development */ = { + 151F63DD09328A3C0096DCC9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; INSTALLHDRS_SCRIPT_PHASE = YES; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; PRODUCT_NAME = genSCPreferences; - SECTORDER_FLAGS = ""; WARNING_CFLAGS = ( "-Wall", "-Wno-four-char-constants", "-Wno-unknown-pragmas", ); }; - name = Development; + name = Debug; }; - 151F63DE09328A3C0096DCC9 /* Deployment */ = { + 151F63DE09328A3C0096DCC9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; INSTALLHDRS_SCRIPT_PHASE = YES; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; PRODUCT_NAME = genSCPreferences; - SECTORDER_FLAGS = ""; WARNING_CFLAGS = ( "-Wall", "-Wno-four-char-constants", "-Wno-unknown-pragmas", ); }; - name = Deployment; + name = Release; }; - 151F63DF09328A3C0096DCC9 /* Default */ = { + 151FE2E50D5B7046000D6DB1 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */; buildSettings = { - INSTALLHDRS_SCRIPT_PHASE = YES; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - PRODUCT_NAME = genSCPreferences; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); + PRODUCT_NAME = "configd_base (EmbeddedSimulator)"; }; - name = Default; + name = Debug; }; - 156EB5DB0905594A00EEF749 /* Development */ = { + 151FE2E60D5B7046000D6DB1 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */; buildSettings = { - COPY_PHASE_STRIP = NO; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 212.2; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - INSTALLHDRS_COPY_PHASE = YES; + PRODUCT_NAME = "configd_base (EmbeddedSimulator)"; + }; + name = Release; + }; + 15213FFC0E93E9F600DACD2C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = Plugins/Logger/Info.plist; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib; - LIBRARY_STYLE = STATIC; - PRODUCT_NAME = dnsinfo; - SECTORDER_FLAGS = ""; - UNSTRIPPED_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = Logger; }; - name = Development; + name = Debug; }; - 156EB5DC0905594A00EEF749 /* Deployment */ = { + 15213FFD0E93E9F600DACD2C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 212.2; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - INSTALLHDRS_COPY_PHASE = YES; + INFOPLIST_FILE = Plugins/Logger/Info.plist; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib; - LIBRARY_STYLE = STATIC; - PRODUCT_NAME = dnsinfo; - SECTORDER_FLAGS = ""; - UNSTRIPPED_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = Logger; }; - name = Deployment; + name = Release; }; - 156EB5DD0905594A00EEF749 /* Default */ = { + 156CA4830EF853BB00C59A18 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 212.2; + INFOPLIST_FILE = "Plugins/Logger/Info-Embedded.plist"; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = Logger; + }; + name = Debug; + }; + 156CA4840EF853BB00C59A18 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = "Plugins/Logger/Info-Embedded.plist"; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = Logger; + }; + name = Release; + }; + 156EB5DB0905594A00EEF749 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUILD_VARIANTS = ( + normal, + debug, + profile, + ); + COPY_PHASE_STRIP = NO; + GENERATE_PROFILING_CODE_profile = YES; INSTALLHDRS_COPY_PHASE = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib; + INSTALL_PATH = /usr/local/lib/system; LIBRARY_STYLE = STATIC; + OTHER_CFLAGS_debug = "-O0"; + OTHER_MIGFLAGS = "-DLIBDNSINFO"; PRODUCT_NAME = dnsinfo; - SECTORDER_FLAGS = ""; - UNSTRIPPED_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + STRIPFLAGS = ""; + STRIP_INSTALLED_PRODUCT_debug = NO; + STRIP_INSTALLED_PRODUCT_normal = YES; + STRIP_INSTALLED_PRODUCT_profile = NO; }; - name = Default; + name = Debug; }; - 156EB5DF0905594A00EEF749 /* Development */ = { + 156EB5DC0905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = NO; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 212.2; - FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks"; - HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; - INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(SYMROOT)"; - OTHER_CFLAGS = "-fconstant-cfstrings"; - OTHER_LDFLAGS = ( - "-seg_addr_table", - "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table", - ); - PRODUCT_NAME = SystemConfiguration; - SECTORDER_FLAGS = ( - "-sectorder", - __TEXT, - __text, - "$(OBJROOT)/SystemConfiguration.order", - ); - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", + BUILD_VARIANTS = ( + normal, + debug, + profile, ); - WRAPPER_EXTENSION = framework; + GENERATE_PROFILING_CODE_profile = YES; + INSTALLHDRS_COPY_PHASE = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/system; + LIBRARY_STYLE = STATIC; + OTHER_CFLAGS_debug = "-O0"; + OTHER_CFLAGS_normal = ""; + OTHER_CFLAGS_profile = ""; + OTHER_MIGFLAGS = "-DLIBDNSINFO"; + PRODUCT_NAME = dnsinfo; + STRIPFLAGS = ""; + STRIP_INSTALLED_PRODUCT_debug = NO; + STRIP_INSTALLED_PRODUCT_normal = YES; + STRIP_INSTALLED_PRODUCT_profile = NO; }; - name = Development; + name = Release; }; - 156EB5E00905594A00EEF749 /* Deployment */ = { + 156EB5DF0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 212.2; + COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks"; HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist; + INSTALLHDRS_SCRIPT_PHASE = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; LIBRARY_SEARCH_PATHS = "$(SYMROOT)"; - OTHER_CFLAGS = "-fconstant-cfstrings"; - OTHER_LDFLAGS = ( - "-seg_addr_table", - "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table", - ); PRODUCT_NAME = SystemConfiguration; SECTORDER_FLAGS = ( "-sectorder", @@ -3002,30 +4870,21 @@ __text, "$(OBJROOT)/SystemConfiguration.order", ); - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); WRAPPER_EXTENSION = framework; }; - name = Deployment; + name = Debug; }; - 156EB5E10905594A00EEF749 /* Default */ = { + 156EB5E00905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 212.2; + COPY_PHASE_STRIP = YES; FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks"; HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist; + INSTALLHDRS_SCRIPT_PHASE = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; LIBRARY_SEARCH_PATHS = "$(SYMROOT)"; - OTHER_CFLAGS = "-fconstant-cfstrings"; - OTHER_LDFLAGS = ( - "-seg_addr_table", - "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table", - ); PRODUCT_NAME = SystemConfiguration; SECTORDER_FLAGS = ( "-sectorder", @@ -3033,138 +4892,77 @@ __text, "$(OBJROOT)/SystemConfiguration.order", ); - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); WRAPPER_EXTENSION = framework; }; - name = Default; + name = Release; }; - 156EB5E30905594A00EEF749 /* Development */ = { + 156EB5E30905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - INSTALL_MODE_FLAG = "a-w,a+rX,u+s"; + INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources"; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = SCHelper; STRIPFLAGS = "-S"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Debug; }; - 156EB5E40905594A00EEF749 /* Deployment */ = { + 156EB5E40905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - INSTALL_MODE_FLAG = "a-w,a+rX,u+s"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources"; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = SCHelper; - STRIPFLAGS = "-S"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; - 156EB5E50905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEAD_CODE_STRIPPING = YES; - FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; - INSTALL_MODE_FLAG = "a-w,a+rX,u+s"; + INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources"; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = SCHelper; STRIPFLAGS = "-S"; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Default; - }; - 156EB5E70905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - PRODUCT_NAME = Frameworks; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-unknown-pragmas", - ); - }; - name = Development; - }; - 156EB5E80905594A00EEF749 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - PRODUCT_NAME = Frameworks; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-unknown-pragmas", - ); }; - name = Deployment; + name = Release; }; - 156EB5E90905594A00EEF749 /* Default */ = { + 156EB5E70905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = Frameworks; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-unknown-pragmas", - ); + PRODUCT_NAME = configd_base; }; - name = Default; + name = Debug; }; - 156EB5EB0905594A00EEF749 /* Development */ = { + 156EB5E80905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - INFOPLIST_FILE = Plugins/ATconfig/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; - PRODUCT_NAME = ATconfig; + PRODUCT_NAME = configd_base; }; - name = Development; + name = Release; }; - 156EB5EC0905594A00EEF749 /* Deployment */ = { + 156EB5EB0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; INFOPLIST_FILE = Plugins/ATconfig/Info.plist; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = ATconfig; }; - name = Deployment; + name = Debug; }; - 156EB5ED0905594A00EEF749 /* Default */ = { + 156EB5EC0905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; INFOPLIST_FILE = Plugins/ATconfig/Info.plist; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = ATconfig; }; - name = Default; + name = Release; }; - 156EB5EF0905594A00EEF749 /* Development */ = { + 156EB5EF0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; @@ -3172,17 +4970,11 @@ INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = IPMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Debug; }; - 156EB5F00905594A00EEF749 /* Deployment */ = { + 156EB5F00905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; @@ -3190,43 +4982,11 @@ INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = IPMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; - 156EB5F10905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = IPMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Default; - }; - 156EB5F30905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Plugins/IPMonitor/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = IPMonitor; }; - name = Development; + name = Release; }; - 156EB5F40905594A00EEF749 /* Deployment */ = { + 156EB5F30905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/IPMonitor/Info.plist; @@ -3234,9 +4994,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = IPMonitor; }; - name = Deployment; + name = Debug; }; - 156EB5F50905594A00EEF749 /* Default */ = { + 156EB5F40905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/IPMonitor/Info.plist; @@ -3244,9 +5004,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = IPMonitor; }; - name = Default; + name = Release; }; - 156EB5F70905594A00EEF749 /* Development */ = { + 156EB5F70905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; @@ -3254,17 +5014,15 @@ INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = InterfaceNamer; - VALID_ARCHS = "ppc i386"; WARNING_CFLAGS = ( "-Wall", "-Wno-unknown-pragmas", ); }; - name = Development; + name = Debug; }; - 156EB5F80905594A00EEF749 /* Deployment */ = { + 156EB5F80905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; @@ -3272,53 +5030,25 @@ INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = InterfaceNamer; - VALID_ARCHS = "ppc i386"; WARNING_CFLAGS = ( "-Wall", "-Wno-unknown-pragmas", ); }; - name = Deployment; + name = Release; }; - 156EB5F90905594A00EEF749 /* Default */ = { + 156EB5FB0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = InterfaceNamer; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Default; - }; - 156EB5FB0905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; - PRODUCT_NAME = InterfaceNamer; - }; - name = Development; - }; - 156EB5FC0905594A00EEF749 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = InterfaceNamer; }; - name = Deployment; + name = Debug; }; - 156EB5FD0905594A00EEF749 /* Default */ = { + 156EB5FC0905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist; @@ -3326,19 +5056,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = InterfaceNamer; }; - name = Default; - }; - 156EB5FF0905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; - PRODUCT_NAME = KernelEventMonitor; - }; - name = Development; + name = Release; }; - 156EB6000905594A00EEF749 /* Deployment */ = { + 156EB5FF0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist; @@ -3346,9 +5066,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = KernelEventMonitor; }; - name = Deployment; + name = Debug; }; - 156EB6010905594A00EEF749 /* Default */ = { + 156EB6000905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist; @@ -3356,9 +5076,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = KernelEventMonitor; }; - name = Default; + name = Release; }; - 156EB6030905594A00EEF749 /* Development */ = { + 156EB6030905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; @@ -3367,17 +5087,11 @@ INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = KernelEventMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Debug; }; - 156EB6040905594A00EEF749 /* Deployment */ = { + 156EB6040905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; @@ -3386,96 +5100,11 @@ INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = KernelEventMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; - 156EB6050905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = KernelEventMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Default; - }; - 156EB6070905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = Kicker; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Development; - }; - 156EB6080905594A00EEF749 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = Kicker; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; - 156EB6090905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = Kicker; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Default; - }; - 156EB60B0905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Plugins/Kicker/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; - PRODUCT_NAME = Kicker; }; - name = Development; + name = Release; }; - 156EB60C0905594A00EEF749 /* Deployment */ = { + 156EB60B0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/Kicker/Info.plist; @@ -3483,9 +5112,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = Kicker; }; - name = Deployment; + name = Debug; }; - 156EB60D0905594A00EEF749 /* Default */ = { + 156EB60C0905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/Kicker/Info.plist; @@ -3493,9 +5122,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = Kicker; }; - name = Default; + name = Release; }; - 156EB60F0905594A00EEF749 /* Development */ = { + 156EB60F0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; @@ -3503,17 +5132,11 @@ INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = LinkConfiguration; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Debug; }; - 156EB6100905594A00EEF749 /* Deployment */ = { + 156EB6100905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; @@ -3521,43 +5144,11 @@ INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = LinkConfiguration; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; - 156EB6110905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = LinkConfiguration; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Default; - }; - 156EB6130905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = LinkConfiguration; }; - name = Development; + name = Release; }; - 156EB6140905594A00EEF749 /* Deployment */ = { + 156EB6130905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist; @@ -3565,9 +5156,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = LinkConfiguration; }; - name = Deployment; + name = Debug; }; - 156EB6150905594A00EEF749 /* Default */ = { + 156EB6140905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist; @@ -3575,69 +5166,31 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = LinkConfiguration; }; - name = Default; + name = Release; }; - 156EB6170905594A00EEF749 /* Development */ = { + 156EB6170905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = PreferencesMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Debug; }; - 156EB6180905594A00EEF749 /* Deployment */ = { + 156EB6180905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = PreferencesMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; - 156EB6190905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = PreferencesMonitor; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Default; - }; - 156EB61B0905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = PreferencesMonitor; }; - name = Development; + name = Release; }; - 156EB61C0905594A00EEF749 /* Deployment */ = { + 156EB61B0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist; @@ -3645,9 +5198,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = PreferencesMonitor; }; - name = Deployment; + name = Debug; }; - 156EB61D0905594A00EEF749 /* Default */ = { + 156EB61C0905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist; @@ -3655,176 +5208,91 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = PreferencesMonitor; }; - name = Default; - }; - 156EB61F0905594A00EEF749 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - PRODUCT_NAME = Plugins; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Development; + name = Release; }; - 156EB6200905594A00EEF749 /* Deployment */ = { + 156EB61F0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - PRODUCT_NAME = Plugins; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + PRODUCT_NAME = configd_plugins; }; - name = Deployment; + name = Debug; }; - 156EB6210905594A00EEF749 /* Default */ = { + 156EB6200905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - PRODUCT_NAME = Plugins; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + PRODUCT_NAME = configd_plugins; }; - name = Default; + name = Release; }; - 156EB6230905594A00EEF749 /* Development */ = { + 156EB6230905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/sbin; + INSTALL_PATH = /usr/libexec; LIBRARY_SEARCH_PATHS = ( "$(SYMROOT)", /usr/local/lib/SystemConfiguration, ); - OTHER_CFLAGS = "-fconstant-cfstrings"; - OTHER_LDFLAGS = "-prebind_all_twolevel_modules"; PRODUCT_NAME = configd; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Debug; }; - 156EB6240905594A00EEF749 /* Deployment */ = { + 156EB6240905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/sbin; - LIBRARY_SEARCH_PATHS = ( - "$(SYMROOT)", - /usr/local/lib/SystemConfiguration, - ); - OTHER_CFLAGS = "-fconstant-cfstrings"; - OTHER_LDFLAGS = "-prebind_all_twolevel_modules"; - PRODUCT_NAME = configd; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; - 156EB6250905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEAD_CODE_STRIPPING = YES; - FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/sbin; + INSTALL_PATH = /usr/libexec; LIBRARY_SEARCH_PATHS = ( "$(SYMROOT)", /usr/local/lib/SystemConfiguration, ); - OTHER_CFLAGS = "-fconstant-cfstrings"; - OTHER_LDFLAGS = "-prebind_all_twolevel_modules"; PRODUCT_NAME = configd; - STRIPFLAGS = "-S"; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Default; + name = Release; }; - 156EB6270905594A00EEF749 /* Development */ = { + 156EB6270905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; INSTALL_MODE_FLAG = "a-w,a+rX,u+s"; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = scselect; STRIPFLAGS = "-S"; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Debug; }; - 156EB6280905594A00EEF749 /* Deployment */ = { + 156EB6280905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; INSTALL_MODE_FLAG = "a-w,a+rX,u+s"; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = scselect; - STRIPFLAGS = "-S"; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; - 156EB6290905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEAD_CODE_STRIPPING = YES; - FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; - INSTALL_MODE_FLAG = "a-w,a+rX,u+s"; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = scselect; STRIPFLAGS = "-S"; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Default; + name = Release; }; - 156EB62B0905594A00EEF749 /* Development */ = { + 156EB62B0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; @@ -3834,22 +5302,16 @@ "$(SYMROOT)", /usr/local/lib/SystemConfiguration, ); - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_CFLAGS = "-fconstant-cfstrings"; PREBINDING = NO; PRODUCT_NAME = scutil; STRIPFLAGS = "-S"; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Debug; }; - 156EB62C0905594A00EEF749 /* Deployment */ = { + 156EB62C0905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; @@ -3859,288 +5321,752 @@ "$(SYMROOT)", /usr/local/lib/SystemConfiguration, ); - OTHER_CFLAGS = "-fconstant-cfstrings"; PREBINDING = YES; PRODUCT_NAME = scutil; STRIPFLAGS = "-S"; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Deployment; + name = Release; }; - 156EB62D0905594A00EEF749 /* Default */ = { + 156EB62F0905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DEAD_CODE_STRIPPING = YES; - FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/sbin; - LIBRARY_SEARCH_PATHS = ( - "$(SYMROOT)", - /usr/local/lib/SystemConfiguration, - ); - OTHER_CFLAGS = "-fconstant-cfstrings"; - PREBINDING = YES; - PRODUCT_NAME = scutil; - STRIPFLAGS = "-S"; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + PRODUCT_NAME = configd_executables; }; - name = Default; + name = Debug; }; - 156EB62F0905594A00EEF749 /* Development */ = { + 156EB6300905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; PRODUCT_NAME = configd_executables; - STRIPFLAGS = "-S"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Development; + name = Release; }; - 156EB6300905594A00EEF749 /* Deployment */ = { + 156EB6330905594A00EEF749 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = YES; - DEAD_CODE_STRIPPING = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - PRODUCT_NAME = configd_executables; + PRODUCT_NAME = "configd (Aggregate)"; + }; + name = Debug; + }; + 156EB6340905594A00EEF749 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "configd (Aggregate)"; + }; + name = Release; + }; + 156EB63F0905594A00EEF749 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)"; + DEAD_CODE_STRIPPING = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)"; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX"; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + OTHER_CFLAGS = ( + "-fconstant-cfstrings", + "-fstack-protector", + "-D_FORTIFY_SOURCE=2", + ); STRIPFLAGS = "-S"; + VERSIONING_SYSTEM = "apple-generic"; WARNING_CFLAGS = ( "-Wall", + "-Wno-four-char-constants", "-Wno-unknown-pragmas", + "-Wformat-security", ); }; - name = Deployment; + name = Debug; }; - 156EB6310905594A00EEF749 /* Default */ = { + 156EB6400905594A00EEF749 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)"; DEAD_CODE_STRIPPING = YES; - PRODUCT_NAME = configd_executables; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)"; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX"; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + OTHER_CFLAGS = ( + "-fconstant-cfstrings", + "-fstack-protector", + "-D_FORTIFY_SOURCE=2", + ); STRIPFLAGS = "-S"; + VERSIONING_SYSTEM = "apple-generic"; WARNING_CFLAGS = ( "-Wall", + "-Wno-four-char-constants", "-Wno-unknown-pragmas", + "-Wformat-security", ); }; - name = Default; + name = Release; + }; + 1572C52A0CFB55B400E2776E /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; + INFOPLIST_FILE = "SystemConfiguration.fproj/Info-Embedded.plist"; + INSTALLHDRS_SCRIPT_PHASE = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; + LIBRARY_SEARCH_PATHS = "$(SYMROOT)"; + PRODUCT_NAME = SystemConfiguration; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + 1572C52B0CFB55B400E2776E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; + INFOPLIST_FILE = "SystemConfiguration.fproj/Info-Embedded.plist"; + INSTALLHDRS_SCRIPT_PHASE = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; + LIBRARY_SEARCH_PATHS = "$(SYMROOT)"; + PRODUCT_NAME = SystemConfiguration; + WRAPPER_EXTENSION = framework; + }; + name = Release; }; - 156EB6330905594A00EEF749 /* Development */ = { + 157433E90D4A8122002ACA73 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; buildSettings = { COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - PRODUCT_NAME = "configd (Aggregate)"; + INSTALL_MODE_FLAG = "a-w,a+rX,u+s"; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = scselect; + STRIPFLAGS = "-S"; + }; + name = Debug; + }; + 157433EA0D4A8122002ACA73 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX,u+s"; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = scselect; + STRIPFLAGS = "-S"; + }; + name = Release; + }; + 157434170D4A8137002ACA73 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/sbin; + LIBRARY_SEARCH_PATHS = ( + "$(SYMROOT)", + "$(SDKROOT)/usr/local/lib/SystemConfiguration", + ); + PREBINDING = NO; + PRODUCT_NAME = scutil; + STRIPFLAGS = "-S"; + }; + name = Debug; + }; + 157434180D4A8137002ACA73 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/sbin; + LIBRARY_SEARCH_PATHS = ( + "$(SYMROOT)", + "$(SDKROOT)/usr/local/lib/SystemConfiguration", + ); + PREBINDING = YES; + PRODUCT_NAME = scutil; + STRIPFLAGS = "-S"; + }; + name = Release; + }; + 157A84E50D56C63900B6F1A0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + BUILD_VARIANTS = ( + normal, + debug, + profile, + ); + COPY_PHASE_STRIP = NO; + GENERATE_PROFILING_CODE_profile = YES; + INSTALLHDRS_COPY_PHASE = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/system; + LIBRARY_STYLE = STATIC; + OTHER_CFLAGS_debug = "-O0"; + OTHER_CFLAGS_normal = ""; + OTHER_CFLAGS_profile = ""; + OTHER_MIGFLAGS = "-DLIBDNSINFO"; + PRODUCT_NAME = dnsinfo; + STRIPFLAGS = ""; + STRIP_INSTALLED_PRODUCT_debug = NO; + STRIP_INSTALLED_PRODUCT_normal = YES; + STRIP_INSTALLED_PRODUCT_profile = NO; + }; + name = Debug; + }; + 157A84E60D56C63900B6F1A0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + BUILD_VARIANTS = ( + normal, + debug, + profile, + ); + COPY_PHASE_STRIP = YES; + GENERATE_PROFILING_CODE_profile = YES; + INSTALLHDRS_COPY_PHASE = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/system; + LIBRARY_STYLE = STATIC; + OTHER_CFLAGS_debug = "-O0"; + OTHER_CFLAGS_normal = ""; + OTHER_CFLAGS_profile = ""; + OTHER_MIGFLAGS = "-DLIBDNSINFO"; + PRODUCT_NAME = dnsinfo; + STRIPFLAGS = ""; + STRIP_INSTALLED_PRODUCT_debug = NO; + STRIP_INSTALLED_PRODUCT_normal = YES; + STRIP_INSTALLED_PRODUCT_profile = NO; + }; + name = Release; + }; + 157A84FF0D56C7E800B6F1A0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = IPMonitor; + }; + name = Debug; + }; + 157A85000D56C7E800B6F1A0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = IPMonitor; + }; + name = Release; + }; + 157A850A0D56C8AA00B6F1A0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = InterfaceNamer; + }; + name = Debug; + }; + 157A850B0D56C8AA00B6F1A0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = InterfaceNamer; + }; + name = Release; + }; + 157A85200D56C8E000B6F1A0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = KernelEventMonitor; + }; + name = Debug; + }; + 157A85210D56C8E000B6F1A0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = KernelEventMonitor; + }; + name = Release; + }; + 157A852B0D56C91100B6F1A0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = LinkConfiguration; + }; + name = Debug; + }; + 157A852C0D56C91100B6F1A0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = LinkConfiguration; + }; + name = Release; + }; + 157A85360D56C94F00B6F1A0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = NetworkIdentification; + }; + name = Debug; + }; + 157A85370D56C94F00B6F1A0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = NetworkIdentification; + }; + name = Release; + }; + 157A85410D56C96F00B6F1A0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = PreferencesMonitor; + }; + name = Debug; + }; + 157A85420D56C96F00B6F1A0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = PreferencesMonitor; + }; + name = Release; + }; + 158316D90CFB774B006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "configd_base (Embedded)"; + }; + name = Debug; + }; + 158316DA0CFB774B006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "configd_base (Embedded)"; + }; + name = Release; + }; + 158317010CFB7761006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "configd_plugins (Embedded)"; + }; + name = Debug; + }; + 158317020CFB7761006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "configd_plugins (Embedded)"; + }; + name = Release; + }; + 1583170C0CFB7782006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "configd_executables (Embedded)"; + }; + name = Debug; + }; + 1583170D0CFB7782006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "configd_executables (Embedded)"; + }; + name = Release; + }; + 1583175E0CFB80A1006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + APPLY_RULES_IN_COPY_FILES = YES; + CODE_SIGN_ENTITLEMENTS = configd.tproj/entitlements.plist; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/libexec; + LIBRARY_SEARCH_PATHS = ( + "$(SYMROOT)", + "$(SDKROOT)/usr/local/lib/SystemConfiguration", + ); + PRODUCT_NAME = configd; + }; + name = Debug; + }; + 1583175F0CFB80A1006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + APPLY_RULES_IN_COPY_FILES = YES; + CODE_SIGN_ENTITLEMENTS = configd.tproj/entitlements.plist; + DEAD_CODE_STRIPPING = YES; + FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = /usr/libexec; + LIBRARY_SEARCH_PATHS = ( + "$(SYMROOT)", + "$(SDKROOT)/usr/local/lib/SystemConfiguration", + ); + PRODUCT_NAME = configd; + }; + name = Release; + }; + 158317810CFB85C8006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/IPMonitor/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = IPMonitor; + }; + name = Debug; + }; + 158317820CFB85C8006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/IPMonitor/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = IPMonitor; + }; + name = Release; + }; + 1583178A0CFB85DD006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = InterfaceNamer; + }; + name = Debug; + }; + 1583178B0CFB85DD006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = InterfaceNamer; + }; + name = Release; + }; + 158317930CFB85F7006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = KernelEventMonitor; + }; + name = Debug; + }; + 158317940CFB85F7006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = KernelEventMonitor; + }; + name = Release; + }; + 1583179B0CFB860C006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = LinkConfiguration; + }; + name = Debug; + }; + 1583179C0CFB860C006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = LinkConfiguration; + }; + name = Release; + }; + 158317A30CFB8626006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = NetworkIdentification; + }; + name = Debug; + }; + 158317A40CFB8626006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = NetworkIdentification; + }; + name = Release; + }; + 158317AB0CFB8639006F62B9 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = PreferencesMonitor; + }; + name = Debug; + }; + 158317AC0CFB8639006F62B9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + PRODUCT_NAME = PreferencesMonitor; + }; + name = Release; + }; + 158337A70CFB6B9E0033AB93 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; + buildSettings = { + APPLY_RULES_IN_COPY_FILES = YES; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework"; + PRODUCT_NAME = SCHelper; + STRIPFLAGS = "-S"; }; - name = Development; + name = Debug; }; - 156EB6340905594A00EEF749 /* Deployment */ = { + 158337A80CFB6B9E0033AB93 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */; buildSettings = { + APPLY_RULES_IN_COPY_FILES = YES; COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)"; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; - PRODUCT_NAME = "configd (Aggregate)"; - }; - name = Deployment; - }; - 156EB6350905594A00EEF749 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "configd (Aggregate)"; + INSTALL_MODE_FLAG = "a-w,a+rX"; + INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework"; + PRODUCT_NAME = SCHelper; + STRIPFLAGS = "-S"; }; - name = Default; + name = Release; }; - 156EB63B0905594A00EEF749 /* Development */ = { + 15A5A2670D5B94190087BDA0 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */; buildSettings = { COPY_PHASE_STRIP = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; + INFOPLIST_FILE = "SystemConfiguration.fproj/Info-Embedded.plist"; + INSTALLHDRS_SCRIPT_PHASE = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = ATconfig; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + INSTALL_PATH_ACTUAL = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; + LIBRARY_SEARCH_PATHS = "$(SYMROOT)"; + PRODUCT_NAME = SystemConfiguration; + WRAPPER_EXTENSION = framework; }; - name = Development; + name = Debug; }; - 156EB63C0905594A00EEF749 /* Deployment */ = { + 15A5A2680D5B94190087BDA0 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */; buildSettings = { COPY_PHASE_STRIP = YES; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; + INFOPLIST_FILE = "SystemConfiguration.fproj/Info-Embedded.plist"; + INSTALLHDRS_SCRIPT_PHASE = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = ATconfig; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + INSTALL_PATH_ACTUAL = "$(SYSTEM_LIBRARY_DIR)/Frameworks"; + LIBRARY_SEARCH_PATHS = "$(SYMROOT)"; + PRODUCT_NAME = SystemConfiguration; + WRAPPER_EXTENSION = framework; }; - name = Deployment; + name = Release; }; - 156EB63D0905594A00EEF749 /* Default */ = { + 15C64A1F0F684C3300D78394 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders"; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = ATconfig; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + INSTALL_PATH = /usr/local/lib/system; + PRODUCT_NAME = configd_libSystem; }; - name = Default; + name = Debug; }; - 156EB63F0905594A00EEF749 /* Development */ = { + 15C64A200F684C3300D78394 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 212.2; - DEAD_CODE_STRIPPING = YES; - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX"; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_CFLAGS = "-fconstant-cfstrings"; - STRIPFLAGS = "-S"; - VERSIONING_SYSTEM = "apple-generic"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); + INSTALL_PATH = /usr/local/lib/system; + PRODUCT_NAME = configd_libSystem; }; - name = Development; + name = Release; }; - 156EB6400905594A00EEF749 /* Deployment */ = { + 15C64A2C0F684C6B00D78394 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 212.2; - DEAD_CODE_STRIPPING = YES; - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX"; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_CFLAGS = "-fconstant-cfstrings"; - STRIPFLAGS = "-S"; - VERSIONING_SYSTEM = "apple-generic"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); + INSTALL_PATH = /usr/local/lib/system; + PRODUCT_NAME = "configd_libSystem (Embedded)"; }; - name = Deployment; + name = Debug; }; - 156EB6410905594A00EEF749 /* Default */ = { + 15C64A2D0F684C6B00D78394 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 212.2; - DEAD_CODE_STRIPPING = YES; - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX"; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_CFLAGS = "-fconstant-cfstrings"; - STRIPFLAGS = "-S"; - VERSIONING_SYSTEM = "apple-generic"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); + INSTALL_PATH = /usr/local/lib/system; + PRODUCT_NAME = "configd_libSystem (Embedded)"; }; - name = Default; + name = Release; }; - F95B8A620B03F83200993BA3 /* Development */ = { + 15FD13C70D59485000F9409C /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */; buildSettings = { - COPY_PHASE_STRIP = NO; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = NetworkIdentification; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + PRODUCT_NAME = "configd (Aggregate/EmbeddedSimulator)"; }; - name = Development; + name = Debug; }; - F95B8A630B03F83200993BA3 /* Deployment */ = { + 15FD13C80D59485000F9409C /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */; buildSettings = { - COPY_PHASE_STRIP = YES; - INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = /usr/local/lib/SystemConfiguration; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; - PRODUCT_NAME = NetworkIdentification; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); + PRODUCT_NAME = "configd (Aggregate/EmbeddedSimulator)"; }; - name = Deployment; + name = Release; }; - F95B8A640B03F83200993BA3 /* Default */ = { + F95B8A620B03F83200993BA3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COPY_PHASE_STRIP = NO; INSTALL_MODE_FLAG = "a-w,a+rX"; INSTALL_PATH = /usr/local/lib/SystemConfiguration; LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = "-fconstant-cfstrings"; PRODUCT_NAME = NetworkIdentification; - VALID_ARCHS = "ppc i386"; - WARNING_CFLAGS = ( - "-Wall", - "-Wno-unknown-pragmas", - ); }; - name = Default; + name = Debug; }; - F95B8A6D0B03F9D100993BA3 /* Development */ = { + F95B8A630B03F83200993BA3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist; + COPY_PHASE_STRIP = YES; INSTALL_MODE_FLAG = "a-w,a+rX"; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; + INSTALL_PATH = /usr/local/lib/SystemConfiguration; + LIBRARY_STYLE = STATIC; PRODUCT_NAME = NetworkIdentification; }; - name = Development; + name = Release; }; - F95B8A6E0B03F9D100993BA3 /* Deployment */ = { + F95B8A6D0B03F9D100993BA3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist; @@ -4148,9 +6074,9 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = NetworkIdentification; }; - name = Deployment; + name = Debug; }; - F95B8A6F0B03F9D100993BA3 /* Default */ = { + F95B8A6E0B03F9D100993BA3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist; @@ -4158,300 +6084,514 @@ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration"; PRODUCT_NAME = NetworkIdentification; }; - name = Default; + name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 151C1CD60CFB48E300C5AFD6 /* Build configuration list for PBXAggregateTarget "All-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 151C1CC70CFB487000C5AFD6 /* Debug */, + 151C1CC80CFB487000C5AFD6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 151F5D9F0CCE98E60093AC3B /* Build configuration list for PBXNativeTarget "SCMonitor" */ = { isa = XCConfigurationList; buildConfigurations = ( - 151F5D9C0CCE98E60093AC3B /* Development */, - 151F5D9D0CCE98E60093AC3B /* Deployment */, - 151F5D9E0CCE98E60093AC3B /* Default */, + 151F5D9C0CCE98E60093AC3B /* Debug */, + 151F5D9D0CCE98E60093AC3B /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 151F63DC09328A3C0096DCC9 /* Build configuration list for PBXNativeTarget "Schema" */ = { isa = XCConfigurationList; buildConfigurations = ( - 151F63DD09328A3C0096DCC9 /* Development */, - 151F63DE09328A3C0096DCC9 /* Deployment */, - 151F63DF09328A3C0096DCC9 /* Default */, + 151F63DD09328A3C0096DCC9 /* Debug */, + 151F63DE09328A3C0096DCC9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 151FE2E40D5B7046000D6DB1 /* Build configuration list for PBXAggregateTarget "configd_base-EmbeddedSimulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 151FE2E50D5B7046000D6DB1 /* Debug */, + 151FE2E60D5B7046000D6DB1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 15213FFF0E93E9F600DACD2C /* Build configuration list for PBXNativeTarget "Logger.bundle" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15213FFC0E93E9F600DACD2C /* Debug */, + 15213FFD0E93E9F600DACD2C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 156CA4820EF853BB00C59A18 /* Build configuration list for PBXNativeTarget "Logger.bundle-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 156CA4830EF853BB00C59A18 /* Debug */, + 156CA4840EF853BB00C59A18 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5DB0905594A00EEF749 /* Development */, - 156EB5DC0905594A00EEF749 /* Deployment */, - 156EB5DD0905594A00EEF749 /* Default */, + 156EB5DB0905594A00EEF749 /* Debug */, + 156EB5DC0905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5DE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5DF0905594A00EEF749 /* Development */, - 156EB5E00905594A00EEF749 /* Deployment */, - 156EB5E10905594A00EEF749 /* Default */, + 156EB5DF0905594A00EEF749 /* Debug */, + 156EB5E00905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5E20905594A00EEF749 /* Build configuration list for PBXNativeTarget "SCHelper" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5E30905594A00EEF749 /* Development */, - 156EB5E40905594A00EEF749 /* Deployment */, - 156EB5E50905594A00EEF749 /* Default */, + 156EB5E30905594A00EEF749 /* Debug */, + 156EB5E40905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5E60905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_base" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5E70905594A00EEF749 /* Development */, - 156EB5E80905594A00EEF749 /* Deployment */, - 156EB5E90905594A00EEF749 /* Default */, + 156EB5E70905594A00EEF749 /* Debug */, + 156EB5E80905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5EB0905594A00EEF749 /* Development */, - 156EB5EC0905594A00EEF749 /* Deployment */, - 156EB5ED0905594A00EEF749 /* Default */, + 156EB5EB0905594A00EEF749 /* Debug */, + 156EB5EC0905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5EF0905594A00EEF749 /* Development */, - 156EB5F00905594A00EEF749 /* Deployment */, - 156EB5F10905594A00EEF749 /* Default */, + 156EB5EF0905594A00EEF749 /* Debug */, + 156EB5F00905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5F20905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5F30905594A00EEF749 /* Development */, - 156EB5F40905594A00EEF749 /* Deployment */, - 156EB5F50905594A00EEF749 /* Default */, + 156EB5F30905594A00EEF749 /* Debug */, + 156EB5F40905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5F70905594A00EEF749 /* Development */, - 156EB5F80905594A00EEF749 /* Deployment */, - 156EB5F90905594A00EEF749 /* Default */, + 156EB5F70905594A00EEF749 /* Debug */, + 156EB5F80905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5FA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5FB0905594A00EEF749 /* Development */, - 156EB5FC0905594A00EEF749 /* Deployment */, - 156EB5FD0905594A00EEF749 /* Default */, + 156EB5FB0905594A00EEF749 /* Debug */, + 156EB5FC0905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB5FF0905594A00EEF749 /* Development */, - 156EB6000905594A00EEF749 /* Deployment */, - 156EB6010905594A00EEF749 /* Default */, + 156EB5FF0905594A00EEF749 /* Debug */, + 156EB6000905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB6030905594A00EEF749 /* Development */, - 156EB6040905594A00EEF749 /* Deployment */, - 156EB6050905594A00EEF749 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; - 156EB6060905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 156EB6070905594A00EEF749 /* Development */, - 156EB6080905594A00EEF749 /* Deployment */, - 156EB6090905594A00EEF749 /* Default */, + 156EB6030905594A00EEF749 /* Debug */, + 156EB6040905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB60B0905594A00EEF749 /* Development */, - 156EB60C0905594A00EEF749 /* Deployment */, - 156EB60D0905594A00EEF749 /* Default */, + 156EB60B0905594A00EEF749 /* Debug */, + 156EB60C0905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB60F0905594A00EEF749 /* Development */, - 156EB6100905594A00EEF749 /* Deployment */, - 156EB6110905594A00EEF749 /* Default */, + 156EB60F0905594A00EEF749 /* Debug */, + 156EB6100905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB6120905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB6130905594A00EEF749 /* Development */, - 156EB6140905594A00EEF749 /* Deployment */, - 156EB6150905594A00EEF749 /* Default */, + 156EB6130905594A00EEF749 /* Debug */, + 156EB6140905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB6170905594A00EEF749 /* Development */, - 156EB6180905594A00EEF749 /* Deployment */, - 156EB6190905594A00EEF749 /* Default */, + 156EB6170905594A00EEF749 /* Debug */, + 156EB6180905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB61A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB61B0905594A00EEF749 /* Development */, - 156EB61C0905594A00EEF749 /* Deployment */, - 156EB61D0905594A00EEF749 /* Default */, + 156EB61B0905594A00EEF749 /* Debug */, + 156EB61C0905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB61F0905594A00EEF749 /* Development */, - 156EB6200905594A00EEF749 /* Deployment */, - 156EB6210905594A00EEF749 /* Default */, + 156EB61F0905594A00EEF749 /* Debug */, + 156EB6200905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB6220905594A00EEF749 /* Build configuration list for PBXNativeTarget "configd" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB6230905594A00EEF749 /* Development */, - 156EB6240905594A00EEF749 /* Deployment */, - 156EB6250905594A00EEF749 /* Default */, + 156EB6230905594A00EEF749 /* Debug */, + 156EB6240905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB6260905594A00EEF749 /* Build configuration list for PBXNativeTarget "scselect" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB6270905594A00EEF749 /* Development */, - 156EB6280905594A00EEF749 /* Deployment */, - 156EB6290905594A00EEF749 /* Default */, + 156EB6270905594A00EEF749 /* Debug */, + 156EB6280905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB62A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "scutil" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB62B0905594A00EEF749 /* Development */, - 156EB62C0905594A00EEF749 /* Deployment */, - 156EB62D0905594A00EEF749 /* Default */, + 156EB62B0905594A00EEF749 /* Debug */, + 156EB62C0905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB62E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_executables" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB62F0905594A00EEF749 /* Development */, - 156EB6300905594A00EEF749 /* Deployment */, - 156EB6310905594A00EEF749 /* Default */, + 156EB62F0905594A00EEF749 /* Debug */, + 156EB6300905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; 156EB6320905594A00EEF749 /* Build configuration list for PBXAggregateTarget "All" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB6330905594A00EEF749 /* Development */, - 156EB6340905594A00EEF749 /* Deployment */, - 156EB6350905594A00EEF749 /* Default */, + 156EB6330905594A00EEF749 /* Debug */, + 156EB6340905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; - 156EB63A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig" */ = { + 156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB63B0905594A00EEF749 /* Development */, - 156EB63C0905594A00EEF749 /* Deployment */, - 156EB63D0905594A00EEF749 /* Default */, + 156EB63F0905594A00EEF749 /* Debug */, + 156EB6400905594A00EEF749 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; - 156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */ = { + 1572C5290CFB55B400E2776E /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1572C52A0CFB55B400E2776E /* Debug */, + 1572C52B0CFB55B400E2776E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157433E80D4A8122002ACA73 /* Build configuration list for PBXNativeTarget "scselect-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157433E90D4A8122002ACA73 /* Debug */, + 157433EA0D4A8122002ACA73 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157434160D4A8137002ACA73 /* Build configuration list for PBXNativeTarget "scutil-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157434170D4A8137002ACA73 /* Debug */, + 157434180D4A8137002ACA73 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157A84E40D56C63900B6F1A0 /* Build configuration list for PBXNativeTarget "DNSConfiguration-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157A84E50D56C63900B6F1A0 /* Debug */, + 157A84E60D56C63900B6F1A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157A84FE0D56C7E800B6F1A0 /* Build configuration list for PBXNativeTarget "IPMonitor-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157A84FF0D56C7E800B6F1A0 /* Debug */, + 157A85000D56C7E800B6F1A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157A85090D56C8AA00B6F1A0 /* Build configuration list for PBXNativeTarget "InterfaceNamer-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157A850A0D56C8AA00B6F1A0 /* Debug */, + 157A850B0D56C8AA00B6F1A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157A851F0D56C8E000B6F1A0 /* Build configuration list for PBXNativeTarget "KernelEventMonitor-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157A85200D56C8E000B6F1A0 /* Debug */, + 157A85210D56C8E000B6F1A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157A852A0D56C91100B6F1A0 /* Build configuration list for PBXNativeTarget "LinkConfiguration-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157A852B0D56C91100B6F1A0 /* Debug */, + 157A852C0D56C91100B6F1A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157A85350D56C94F00B6F1A0 /* Build configuration list for PBXNativeTarget "NetworkIdentification-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157A85360D56C94F00B6F1A0 /* Debug */, + 157A85370D56C94F00B6F1A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 157A85400D56C96F00B6F1A0 /* Build configuration list for PBXNativeTarget "PreferencesMonitor-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 157A85410D56C96F00B6F1A0 /* Debug */, + 157A85420D56C96F00B6F1A0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 158316D80CFB774B006F62B9 /* Build configuration list for PBXAggregateTarget "configd_base-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 158316D90CFB774B006F62B9 /* Debug */, + 158316DA0CFB774B006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 158317000CFB7761006F62B9 /* Build configuration list for PBXAggregateTarget "configd_plugins-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 158317010CFB7761006F62B9 /* Debug */, + 158317020CFB7761006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1583170B0CFB7782006F62B9 /* Build configuration list for PBXAggregateTarget "configd_executables-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1583170C0CFB7782006F62B9 /* Debug */, + 1583170D0CFB7782006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1583175D0CFB80A1006F62B9 /* Build configuration list for PBXNativeTarget "configd-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1583175E0CFB80A1006F62B9 /* Debug */, + 1583175F0CFB80A1006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 158317800CFB85C8006F62B9 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 158317810CFB85C8006F62B9 /* Debug */, + 158317820CFB85C8006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 158317890CFB85DD006F62B9 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1583178A0CFB85DD006F62B9 /* Debug */, + 1583178B0CFB85DD006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 158317920CFB85F7006F62B9 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 158317930CFB85F7006F62B9 /* Debug */, + 158317940CFB85F7006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1583179A0CFB860C006F62B9 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1583179B0CFB860C006F62B9 /* Debug */, + 1583179C0CFB860C006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 158317A20CFB8626006F62B9 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 158317A30CFB8626006F62B9 /* Debug */, + 158317A40CFB8626006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 158317AA0CFB8639006F62B9 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 158317AB0CFB8639006F62B9 /* Debug */, + 158317AC0CFB8639006F62B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 158337A60CFB6B9E0033AB93 /* Build configuration list for PBXNativeTarget "SCHelper-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 158337A70CFB6B9E0033AB93 /* Debug */, + 158337A80CFB6B9E0033AB93 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 15A5A2660D5B94190087BDA0 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-EmbeddedSimulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15A5A2670D5B94190087BDA0 /* Debug */, + 15A5A2680D5B94190087BDA0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 15C64A270F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15C64A1F0F684C3300D78394 /* Debug */, + 15C64A200F684C3300D78394 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 15C64A2B0F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem-Embedded" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15C64A2C0F684C6B00D78394 /* Debug */, + 15C64A2D0F684C6B00D78394 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 15FD13C60D59485000F9409C /* Build configuration list for PBXAggregateTarget "All-EmbeddedSimulator" */ = { isa = XCConfigurationList; buildConfigurations = ( - 156EB63F0905594A00EEF749 /* Development */, - 156EB6400905594A00EEF749 /* Deployment */, - 156EB6410905594A00EEF749 /* Default */, + 15FD13C70D59485000F9409C /* Debug */, + 15FD13C80D59485000F9409C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */ = { isa = XCConfigurationList; buildConfigurations = ( - F95B8A620B03F83200993BA3 /* Development */, - F95B8A630B03F83200993BA3 /* Deployment */, - F95B8A640B03F83200993BA3 /* Default */, + F95B8A620B03F83200993BA3 /* Debug */, + F95B8A630B03F83200993BA3 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; F95B8A6C0B03F9D100993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle" */ = { isa = XCConfigurationList; buildConfigurations = ( - F95B8A6D0B03F9D100993BA3 /* Development */, - F95B8A6E0B03F9D100993BA3 /* Deployment */, - F95B8A6F0B03F9D100993BA3 /* Default */, + F95B8A6D0B03F9D100993BA3 /* Debug */, + F95B8A6E0B03F9D100993BA3 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/dnsinfo/dnsinfo.h b/dnsinfo/dnsinfo.h index 82e0c30..792591e 100644 --- a/dnsinfo/dnsinfo.h +++ b/dnsinfo/dnsinfo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004-2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -28,15 +28,13 @@ * These routines provide access to the systems DNS configuration */ -#include +#include #include #include #include #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - #define DEFAULT_SEARCH_ORDER 200000 /* search order for the "default" resolver domain name */ #define DNS_PTR(type, name) \ @@ -89,12 +87,15 @@ __BEGIN_DECLS /* * DNS configuration access APIs */ -const char * dns_configuration_notify_key (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; -dns_config_t * dns_configuration_copy (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; -void dns_configuration_free (dns_config_t *config) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +const char * +dns_configuration_notify_key () __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); -__END_DECLS +dns_config_t * +dns_configuration_copy () __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ +void +dns_configuration_free (dns_config_t *config) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); + +__END_DECLS #endif /* __DNSINFO_H__ */ diff --git a/dnsinfo/dnsinfo_copy.c b/dnsinfo/dnsinfo_copy.c index b5ed70d..ab536e7 100644 --- a/dnsinfo/dnsinfo_copy.c +++ b/dnsinfo/dnsinfo_copy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -28,7 +28,9 @@ * - initial revision */ +#include #include +#include #include #include @@ -37,6 +39,30 @@ #include "shared_dns_info.h" +static pthread_once_t _dns_initialized = PTHREAD_ONCE_INIT; +static pthread_mutex_t _dns_lock = PTHREAD_MUTEX_INITIALIZER; +static mach_port_t _dns_server = MACH_PORT_NULL; + + +static void +__dns_fork_handler() +{ + // the process has forked (and we are the child process) + _dns_server = MACH_PORT_NULL; + return; +} + + +static void +__dns_initialize(void) +{ + // add handler to cleanup after fork() + (void) pthread_atfork(NULL, NULL, __dns_fork_handler); + + return; +} + + static boolean_t add_list(void **padding, uint32_t *n_padding, int32_t count, int32_t size, void **list) { @@ -63,16 +89,47 @@ copy_dns_info() mach_port_t server; kern_return_t status; - server = _dns_configuration_server_port(); - if (server == MACH_PORT_NULL) { - return NULL; - } + // initialize runtime + pthread_once(&_dns_initialized, __dns_initialize); - status = shared_dns_infoGet(server, &dataRef, &dataLen); - (void)mach_port_deallocate(mach_task_self(), server); - if (status != KERN_SUCCESS) { - mach_error("shared_dns_infoGet():", status); - return NULL; + // open a new session with the DNS configuration server + server = _dns_server; + while (TRUE) { + if (server != MACH_PORT_NULL) { + status = shared_dns_infoGet(server, &dataRef, &dataLen); + if (status == KERN_SUCCESS) { + break; + } + + // our [cached] server port is not valid + if (status != MACH_SEND_INVALID_DEST) { + // if we got an unexpected error, don't retry + fprintf(stderr, + "dns_configuration_copy shared_dns_infoGet(): %s\n", + mach_error_string(status)); + break; + } + } + + pthread_mutex_lock(&_dns_lock); + if (_dns_server != MACH_PORT_NULL) { + if (server == _dns_server) { + // if the server we tried returned the error + (void)mach_port_deallocate(mach_task_self(), server); + _dns_server = _dns_configuration_server_port(); + } else { + // another thread has refreshed the DNS server port + } + } else { + _dns_server = _dns_configuration_server_port(); + } + server = _dns_server; + pthread_mutex_unlock(&_dns_lock); + + if (server == MACH_PORT_NULL) { + // if server not available + break; + } } if (dataRef != NULL) { @@ -295,7 +352,6 @@ expand_config(_dns_config_buf_t *buf) } -__private_extern__ const char * dns_configuration_notify_key() { @@ -303,7 +359,6 @@ dns_configuration_notify_key() } -__private_extern__ dns_config_t * dns_configuration_copy() { @@ -325,7 +380,6 @@ dns_configuration_copy() } -__private_extern__ void dns_configuration_free(dns_config_t *config) { diff --git a/dnsinfo/dnsinfo_create.c b/dnsinfo/dnsinfo_create.c index f26efaf..6cd07e0 100644 --- a/dnsinfo/dnsinfo_create.c +++ b/dnsinfo/dnsinfo_create.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004, 2006, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -49,7 +49,6 @@ */ -__private_extern__ dns_create_config_t _dns_configuration_create() { @@ -109,7 +108,6 @@ config_add_attribute(dns_create_config_t *_config, } -__private_extern__ void _dns_configuration_add_resolver(dns_create_config_t *_config, dns_create_resolver_t _resolver) @@ -146,7 +144,6 @@ _dns_configuration_add_resolver(dns_create_config_t *_config, } -__private_extern__ _Bool _dns_configuration_store(dns_create_config_t *_config) { @@ -180,7 +177,6 @@ _dns_configuration_store(dns_create_config_t *_config) } -__private_extern__ void _dns_configuration_free(dns_create_config_t *_config) { @@ -196,7 +192,6 @@ _dns_configuration_free(dns_create_config_t *_config) * DNS resolver configuration functions */ -__private_extern__ dns_create_resolver_t _dns_resolver_create() { @@ -251,7 +246,6 @@ _dns_resolver_add_attribute(dns_create_resolver_t *_resolver, } -__private_extern__ void _dns_resolver_set_domain(dns_create_resolver_t *_resolver, const char *domain) { @@ -260,7 +254,6 @@ _dns_resolver_set_domain(dns_create_resolver_t *_resolver, const char *domain) } -__private_extern__ void _dns_resolver_add_nameserver(dns_create_resolver_t *_resolver, struct sockaddr *nameserver) { @@ -272,7 +265,6 @@ _dns_resolver_add_nameserver(dns_create_resolver_t *_resolver, struct sockaddr * } -__private_extern__ void _dns_resolver_set_port(dns_create_resolver_t *_resolver, uint16_t port) { @@ -283,7 +275,6 @@ _dns_resolver_set_port(dns_create_resolver_t *_resolver, uint16_t port) } -__private_extern__ void _dns_resolver_add_search(dns_create_resolver_t *_resolver, const char *search) { @@ -295,7 +286,6 @@ _dns_resolver_add_search(dns_create_resolver_t *_resolver, const char *search) } -__private_extern__ void _dns_resolver_add_sortaddr(dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr) { @@ -307,7 +297,6 @@ _dns_resolver_add_sortaddr(dns_create_resolver_t *_resolver, dns_sortaddr_t *sor } -__private_extern__ void _dns_resolver_set_options(dns_create_resolver_t *_resolver, const char *options) { @@ -316,7 +305,6 @@ _dns_resolver_set_options(dns_create_resolver_t *_resolver, const char *options) } -__private_extern__ void _dns_resolver_set_timeout(dns_create_resolver_t *_resolver, uint32_t timeout) { @@ -327,7 +315,6 @@ _dns_resolver_set_timeout(dns_create_resolver_t *_resolver, uint32_t timeout) } -__private_extern__ void _dns_resolver_set_order(dns_create_resolver_t *_resolver, uint32_t order) { @@ -338,7 +325,6 @@ _dns_resolver_set_order(dns_create_resolver_t *_resolver, uint32_t order) } -__private_extern__ void _dns_resolver_free(dns_create_resolver_t *_resolver) { diff --git a/dnsinfo/dnsinfo_create.h b/dnsinfo/dnsinfo_create.h index 77840db..2e01860 100644 --- a/dnsinfo/dnsinfo_create.h +++ b/dnsinfo/dnsinfo_create.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004-2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -28,7 +28,8 @@ * These routines provide access to the systems DNS configuration */ -#include +#include +#include #include #include #include @@ -37,37 +38,102 @@ #include -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - typedef const struct __dns_create_config * dns_create_config_t; typedef const struct __dns_create_resolver * dns_create_resolver_t; +#if !TARGET_OS_IPHONE +#ifndef _PATH_RESOLVER_DIR +#define _PATH_RESOLVER_DIR "/etc/resolver" +#endif +#endif /* !TARGET_OS_IPHONE */ + __BEGIN_DECLS +/* + * NOTE: __private_extern__ and __OSX_AVAILABLE_STARTING() cannot be mixed + * due to a "visibility" conflict + */ + /* * DNS configuration creation APIs */ -dns_create_config_t _dns_configuration_create (void); -void _dns_configuration_add_resolver (dns_create_config_t *_config, dns_create_resolver_t _resolver); -_Bool _dns_configuration_store (dns_create_config_t *_config); -void _dns_configuration_free (dns_create_config_t *_config); +__private_extern__ +dns_create_config_t +_dns_configuration_create (void) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_configuration_add_resolver (dns_create_config_t *_config, + dns_create_resolver_t _resolver) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +_Bool +_dns_configuration_store (dns_create_config_t *_config) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_configuration_free (dns_create_config_t *_config) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; /* * DNS [resolver] configuration creation APIs */ -dns_create_resolver_t _dns_resolver_create (void); -void _dns_resolver_set_domain (dns_create_resolver_t *_resolver, const char *domain); -void _dns_resolver_add_nameserver (dns_create_resolver_t *_resolver, struct sockaddr *nameserver); -void _dns_resolver_set_port (dns_create_resolver_t *_resolver, uint16_t port); // host byte order -void _dns_resolver_add_search (dns_create_resolver_t *_resolver, const char *search); -void _dns_resolver_add_sortaddr (dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr); -void _dns_resolver_set_options (dns_create_resolver_t *_resolver, const char *options); -void _dns_resolver_set_timeout (dns_create_resolver_t *_resolver, uint32_t timeout); -void _dns_resolver_set_order (dns_create_resolver_t *_resolver, uint32_t order); -void _dns_resolver_free (dns_create_resolver_t *_resolver); +__private_extern__ +dns_create_resolver_t +_dns_resolver_create (void) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; -__END_DECLS +__private_extern__ +void +_dns_resolver_set_domain (dns_create_resolver_t *_resolver, + const char *domain) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_resolver_add_nameserver (dns_create_resolver_t *_resolver, + struct sockaddr *nameserver) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_resolver_set_port (dns_create_resolver_t *_resolver, + uint16_t port) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; // host byte order -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ +__private_extern__ +void +_dns_resolver_add_search (dns_create_resolver_t *_resolver, + const char *search) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_resolver_add_sortaddr (dns_create_resolver_t *_resolver, + dns_sortaddr_t *sortaddr) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_resolver_set_options (dns_create_resolver_t *_resolver, + const char *options) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_resolver_set_timeout (dns_create_resolver_t *_resolver, + uint32_t timeout) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_resolver_set_order (dns_create_resolver_t *_resolver, + uint32_t order) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +__private_extern__ +void +_dns_resolver_free (dns_create_resolver_t *_resolver) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; + +#if !TARGET_OS_IPHONE +/* + * DNS [resolver] flat-file configuration creation APIs + */ +__private_extern__ +void +_dnsinfo_flatfile_add_resolvers (dns_create_config_t *config) /*__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)*/; +#endif // !TARGET_OS_IPHONE + +__END_DECLS #endif /* __DNSINFO_CREATE_H__ */ diff --git a/dnsinfo/dnsinfo_flatfile.c b/dnsinfo/dnsinfo_flatfile.c new file mode 100644 index 0000000..378be84 --- /dev/null +++ b/dnsinfo/dnsinfo_flatfile.c @@ -0,0 +1,475 @@ +/* + * Copyright (c) 2009 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dnsinfo.h" +#include "dnsinfo_private.h" +#include "dnsinfo_create.h" + +enum { + TOKEN_NAMESERVER, + TOKEN_PORT, + TOKEN_DOMAIN, + TOKEN_SEARCH, + TOKEN_SEARCH_ORDER, + TOKEN_SORTLIST, + TOKEN_TIMEOUT, + TOKEN_OPTIONS, + TOKEN_MAX +}; + +/* + * tokens + * The supported configuration token strings and enumerated values. + */ +static const struct { + const char *name; + int token; + int max_count; +} tokens [] = { + { "nameserver", TOKEN_NAMESERVER, MAXNS }, + { "port", TOKEN_PORT, 1 }, + { "domain", TOKEN_DOMAIN, 1 }, + { "search", TOKEN_SEARCH, 1 }, + { "search_order", TOKEN_SEARCH_ORDER, 1 }, + { "sortlist", TOKEN_SORTLIST, 1 }, + { "timeout", TOKEN_TIMEOUT, 1 }, + { "options", TOKEN_OPTIONS, 1 }, +}; + + +/* + * _dnsinfo_parse_address + * + * Parse IP address + */ +static struct sockaddr * +_dnsinfo_parse_address(char *nameserver) +{ + struct addrinfo *ai; + struct addrinfo hints; + int res; + struct sockaddr *sa = NULL; + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_NUMERICHOST; + + res = getaddrinfo(nameserver, NULL, &hints, &ai); + if (res == 0) { + if ((ai->ai_family == AF_INET) || (ai->ai_family == AF_INET6)) { + sa = malloc(ai->ai_addrlen); + memcpy(sa, ai->ai_addr, ai->ai_addrlen); + } + freeaddrinfo(ai); + } + + return sa; +} + + +/* + * _dnsinfo_parse_nameserver + * + * Parse arguments to the nameserver token. This is essentially a getaddrinfo(3) + * with AI_NUMERICHOST. However, if the conversion fails, check if the address + * contains an optional trailing '.' followed by a numeric port number. If found, + * remove the port number and retry the conversion (e.g. 127.0.0.1.55 or ::1.55). + */ +static struct sockaddr * +_dnsinfo_parse_nameserver(char *token) +{ + char *dot; + long number; + struct sockaddr *sa; + + sa = _dnsinfo_parse_address(token); + if (sa != NULL) { + return sa; + } + + // if we could not parse address, attempt to remove + // an optional trailing port number + dot = strrchr(token, '.'); + if (dot == NULL) { + return NULL; + } + + number = strtol(dot + 1, NULL, 10); + if ((number < 0) || (number > UINT16_MAX)) { + return NULL; + } + + *dot = '\0'; + sa = _dnsinfo_parse_address(token); + if (sa != NULL) { + in_port_t port = htons(number); + + switch (sa->sa_family) { + case AF_INET : + ((struct sockaddr_in *)sa)->sin_port = port; + break; + case AF_INET6 : + ((struct sockaddr_in6 *)sa)->sin6_port = port; + break; + } + } + + return sa; +} + + +/* + * _dnsinfo_parse_sortaddr + * + * Parse arguments to the sortlist token. + */ +static dns_sortaddr_t * +_dnsinfo_parse_sortaddr(char *token) +{ + struct in_addr addr; + struct in_addr mask; + struct sockaddr *sa; + char *slash; + dns_sortaddr_t *sortaddr = NULL; + + slash = strchr(token, '/'); + if (slash != NULL) { + *slash = '\0'; + } + + sa = _dnsinfo_parse_address(token); + if (sa == NULL) { + // if we could not parse the address + goto done; + } else if (sa->sa_family != AF_INET) { + // if not AF_INET + goto done; + } else { + addr = ((struct sockaddr_in *)sa)->sin_addr; + free(sa); + sa = NULL; + } + + if (slash != NULL) { + sa = _dnsinfo_parse_address(slash + 1); + if (sa == NULL) { + // if we could not parse the provided mask + goto done; + } else if (sa->sa_family != AF_INET) { + // if mask not AF_INET + goto done; + } else { + mask = ((struct sockaddr_in *)sa)->sin_addr; + free(sa); + sa = NULL; + } + } else { + in_addr_t a; + in_addr_t m; + + a = ntohl(addr.s_addr); + if (IN_CLASSA(a)) { + m = IN_CLASSA_NET; + } else if (IN_CLASSB(a)) { + m = IN_CLASSB_NET; + } else if (IN_CLASSC(a)) { + m = IN_CLASSC_NET; + } else { + goto done; + } + + mask.s_addr = htonl(m); + } + + sortaddr = malloc(sizeof(*sortaddr)); + sortaddr->address = addr; + sortaddr->mask = mask; + + done : + + if (sa != NULL) free(sa); + return sortaddr; +} + + +/* + * _dnsinfo_flatfile_create_resolver + * + * Create a new dns resolver configuration from the configuration file at the + * specified path. (e.g. /etc/resolv.conf or /etc/resolver/apple.com) + */ +static dns_create_resolver_t +_dnsinfo_flatfile_create_resolver(const char *dir, const char *path) +{ + char *buf; + FILE *f; + char filename[FILENAME_MAX]; + size_t len = 0; + char *line = NULL; + dns_create_resolver_t res = NULL; + const char *sep = " \t"; + int token_count[TOKEN_MAX] = { 0 }; + + filename[0] = 0; + if (dir != NULL) { + strlcpy(filename, dir, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + } + strlcat(filename, path, sizeof(filename)); + + f = fopen(filename, "r"); + if (f == NULL) return NULL; + + while ((buf = fgetln(f, &len)) != NULL) { + int i; + char *lineptr; + int max_count; + int token; + char *word; + + if (len == 0) continue; + if (buf[len-1] == '\n') buf[len-1] = '\0'; + + line = reallocf(line, len+1); + if (line == NULL) continue; + + strncpy(line, buf, len); + line[len] = '\0'; + + // parse the first word of the line (the config token) + lineptr = line; + word = strsep(&lineptr, sep); + if (word == NULL) { + // if empty line + continue; + } + if (word[0] == ';' || word[0] == '#') { + // if comment + continue; + } + + // translate config token to enumerated value + token = -1; + for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) { + if (strcasecmp(word, tokens[i].name) == 0) { + token = tokens[i].token; + max_count = tokens[i].max_count; + break; + } + } + if (token == -1) { + // if not a recognized token + continue; + } + + // parse the next word of the line (the config option) + word = strsep(&lineptr, sep); + if (word == NULL) { + // if no option + continue; + } + if (++token_count[token] > max_count) { + // if too many options + continue; + } + + // create resolver + if (res == NULL) { + res = _dns_resolver_create(); + if (res == NULL) { + // if we could not create a resolver + goto done; + } + } + + switch (token) { + case TOKEN_DOMAIN: + _dns_resolver_set_domain(&res, word); + break; + + case TOKEN_NAMESERVER: { + struct sockaddr *sa; + + sa = _dnsinfo_parse_nameserver(word); + if (sa != NULL) { + _dns_resolver_add_nameserver(&res, sa); + free(sa); + } + break; + } + + case TOKEN_PORT: { + long number = -1; + + number = strtol(word, NULL, 0); + if (number < 0 || number > UINT16_MAX) break; + _dns_resolver_set_port(&res, number); + break; + } + + case TOKEN_SEARCH: { + int n = 0; + + // multiple search domains are supported + while ((word != NULL) && (n++ < MAXDNSRCH)) { + _dns_resolver_add_search(&res, word); + word = strsep(&lineptr, sep); + } + break; + } + + case TOKEN_SORTLIST: { + int n = 0; + + while ((word != NULL) && (n++ < MAXRESOLVSORT)) { + dns_sortaddr_t *sortaddr; + + sortaddr = _dnsinfo_parse_sortaddr(word); + if (sortaddr == NULL) break; + _dns_resolver_add_sortaddr(&res, sortaddr); + free(sortaddr); + word = strsep(&lineptr, sep); + } + break; + } + + case TOKEN_OPTIONS: + _dns_resolver_set_options(&res, lineptr); + break; + + case TOKEN_TIMEOUT: { + long number = -1; + + number = strtol(word, NULL, 0); + if (number < 0 || number > UINT32_MAX) break; + _dns_resolver_set_timeout(&res, number); + break; + } + + case TOKEN_SEARCH_ORDER: { + long number = -1; + + number = strtol(word, NULL, 0); + if (number < 0 || number > UINT32_MAX) break; + _dns_resolver_set_order(&res, number); + break; + } + } + } + if (line != NULL) free(line); + + // set the domain to the basename of the path if not specified + if ((res != NULL) && (token_count[TOKEN_DOMAIN] == 0)) { + const char *domain; + + domain = strrchr(path, '/'); + if (domain == NULL) { + domain = path; + } else { + domain = domain + 1; + } + _dns_resolver_set_domain(&res, domain); + } + + done : + + fclose(f); + return res; +} + + +/* + * _dnsinfo_flatfile_add_resolvers + * + * Parse the files in the resolver config directory (/etc/resolver) and add each + * resolver to the dns config. + */ +void +_dnsinfo_flatfile_add_resolvers(dns_create_config_t *config) +{ + struct dirent *de; + DIR *dp; + dns_create_resolver_t res; + + dp = opendir(_PATH_RESOLVER_DIR); + if (dp == NULL) { + return; + } + + while ((de = readdir(dp)) != NULL) { + if (strcmp(de->d_name, ".") == 0 || + strcmp(de->d_name, "..") == 0) continue; + + res = _dnsinfo_flatfile_create_resolver(_PATH_RESOLVER_DIR, de->d_name); + if (res != NULL) { + _dns_configuration_add_resolver(config, res); + _dns_resolver_free(&res); + } + } + + closedir(dp); + return; +} + + +#ifdef MAIN + +#include "dnsinfo_copy.c" + +int +main(int argc, char **argv) +{ + uint8_t *buf; + dns_config_t *config; + dns_create_config_t create_config; + _dns_config_buf_t *config_buf; + uint32_t n_config; + uint32_t n_padding; + dns_create_resolver_t resolver; + + resolver = _dnsinfo_flatfile_create_resolver(NULL, _PATH_RESCONF); + + create_config = _dns_configuration_create(); + _dnsinfo_flatfile_add_resolvers(&create_config); + + config_buf = (_dns_config_buf_t *)create_config; + n_config = sizeof(_dns_config_buf_t) + ntohl(config_buf->n_attribute); + n_padding = ntohl(config_buf->n_padding); + buf = malloc(n_config + n_padding); + bcopy((void *)config_buf, buf, n_config); + bzero(&buf[n_config], n_padding); + config = expand_config((_dns_config_buf_t *)buf); + + return 0; +} +#endif diff --git a/dnsinfo/dnsinfo_private.c b/dnsinfo/dnsinfo_private.c index d215652..4d7c2dd 100644 --- a/dnsinfo/dnsinfo_private.c +++ b/dnsinfo/dnsinfo_private.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005, 2007 Apple Inc. All rights reserved. + * Copyright (c) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * diff --git a/dnsinfo/dnsinfo_private.h b/dnsinfo/dnsinfo_private.h index 03d50f3..52b885e 100644 --- a/dnsinfo/dnsinfo_private.h +++ b/dnsinfo/dnsinfo_private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004-2006, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -25,7 +25,7 @@ #define __DNSINFO_PRIVATE_H__ -#include +#include #include #include #include @@ -35,8 +35,6 @@ #include "dnsinfo.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - /* * What's all of this stuff about??? * @@ -189,11 +187,19 @@ typedef struct { __BEGIN_DECLS -const char * _dns_configuration_notify_key (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; -mach_port_t _dns_configuration_server_port (void) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +/* + * NOTE: __private_extern__ and __OSX_AVAILABLE_STARTING() cannot be mixed + * due to a "visibility" conflict + */ + +__private_extern__ +const char * +_dns_configuration_notify_key () /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; -__END_DECLS +__private_extern__ +mach_port_t +_dns_configuration_server_port () /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ +__END_DECLS #endif /* __DNSINFO_PRIVATE_H__ */ diff --git a/dnsinfo/dnsinfo_server.c b/dnsinfo/dnsinfo_server.c index 17c5560..9613311 100644 --- a/dnsinfo/dnsinfo_server.c +++ b/dnsinfo/dnsinfo_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -70,9 +70,9 @@ _shared_dns_infoSet(mach_port_t server, mach_msg_type_number_t dataLen, audit_token_t audit_token) { - uid_t euid = 0; - CFDataRef new_dns_info = NULL; - const char *notify_key; + uid_t euid = 0; + CFDataRef new_dns_info = NULL; + const char *notify_key; if ((dataRef != NULL) && (dataLen > 0)) { if (!_SCUnserializeData(&new_dns_info, (void *)dataRef, dataLen)) { diff --git a/dnsinfo/dnsinfo_server.h b/dnsinfo/dnsinfo_server.h index d3f1283..44350a8 100644 --- a/dnsinfo/dnsinfo_server.h +++ b/dnsinfo/dnsinfo_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004, 2005, 2009 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -32,10 +32,12 @@ __BEGIN_DECLS +__private_extern__ kern_return_t _shared_dns_infoGet (mach_port_t server, dnsDataOut_t *dataRef, mach_msg_type_number_t *dataLen); +__private_extern__ kern_return_t _shared_dns_infoSet (mach_port_t server, dnsData_t dataRef, mach_msg_type_number_t dataLen, diff --git a/dnsinfo/shared_dns_info.defs b/dnsinfo/shared_dns_info.defs index fa22f5d..bbb1e84 100644 --- a/dnsinfo/shared_dns_info.defs +++ b/dnsinfo/shared_dns_info.defs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004, 2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -55,6 +55,10 @@ type dnsDataOut = ^ array [] of MACH_MSG_TYPE_BYTE routine shared_dns_infoGet ( server : mach_port_t; out data : dnsDataOut, dealloc); +#ifndef LIBDNSINFO_A routine shared_dns_infoSet ( server : mach_port_t; data : dnsData; ServerAuditToken audit_token : audit_token_t); +#else // LIBDNSINFO_A + skip; /* shared_dns_infoSet */ +#endif LIBDNSINFO_A diff --git a/dnsinfo/shared_dns_info_types.h b/dnsinfo/shared_dns_info_types.h index f28f2c3..780cf77 100644 --- a/dnsinfo/shared_dns_info_types.h +++ b/dnsinfo/shared_dns_info_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004, 2007 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -33,6 +33,9 @@ #define mig_external __private_extern__ /* Turn MIG type checking on by default */ +#ifdef __MigTypeCheck +#undef __MigTypeCheck +#endif #define __MigTypeCheck 1 /* diff --git a/get-mobility-info b/get-mobility-info index c7e1596..d0fcbff 100755 --- a/get-mobility-info +++ b/get-mobility-info @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2004-2007 Apple Inc. +# Copyright (c) 2004-2009 Apple Inc. # # get-mobility-info # @@ -17,6 +17,9 @@ OUT="mobility-info-`date +'%m.%d.%Y.%H%M%S'`" OUTDIR="/var/tmp" if [ -d ~/Desktop ]; then OUTDIR=~/Desktop +elif [ "`readlink /tmp`" = "private/var/tmp" ]; then + OUTDIR=/Library/Logs/CrashReporter/SystemConfiguration + mkdir -p ${OUTDIR} fi umask 077 @@ -27,7 +30,14 @@ if [ $? -ne 0 ]; then exit 1 fi -ARCHIVE=`mktemp -q "${OUTDIR}/${OUT}.tar.gz"` +GZ_EXT="" +GZ_OPT="" +if [ -x /usr/bin/gzip ]; then + GZ_EXT=".gz" + GZ_OPT="-z" +fi + +ARCHIVE=`mktemp -q "${OUTDIR}/${OUT}.tar${GZ_EXT}"` if [ $? -ne 0 ]; then echo "Could not create snapshot archive" rm -rf "${WORKDIR}" @@ -86,7 +96,8 @@ fi # # IOKit info # -ioreg -i -l -w 0 > ioreg 2>&1 +ioreg -i -l -w 0 > ioreg 2>&1 +ioreg -i -l -p IODeviceTree -w 0 >> ioreg 2>&1 # # Host name @@ -127,7 +138,9 @@ for f in \ /Library/Preferences/SystemConfiguration/com.apple.nat.plist \ /Library/Preferences/SystemConfiguration/com.apple.network.identification.plist \ /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist \ + /Library/Preferences/SystemConfiguration/com.apple.wifi.plist \ /Library/Preferences/SystemConfiguration/preferences.plist \ + /Library/Preferences/com.apple.alf.plist \ /Library/Preferences/com.apple.sharing.firewall.plist \ do @@ -162,8 +175,8 @@ fi # network reachability # scutil -d -v -r www.apple.com > reachability-info 2>&1 -if [ -x /usr/bin/dig ]; then - dig -t any -c any www.apple.com > dig-results 2>&1 +if [ -x /usr/bin/dig -a -f /etc/resolv.conf ]; then + /usr/bin/dig -t any -c any www.apple.com > dig-results 2>/dev/null fi # @@ -179,10 +192,33 @@ if [ -f /var/run/mDNSResponder.pid ]; then fi # -# system log, early boot log messages +# system log, kernel.log, early boot log messages +# +if [ -x /usr/bin/syslog ]; then + ${PRIV} syslog | tail -n 25000 > syslog + if [ -d /var/log/DiagnosticMessages ]; then + ${PRIV} syslog -d /var/log/DiagnosticMessages \ + -F raw \ + -T local \ + | tail -n 25000 > DiagnosticMessages + fi +else + if [ -f /var/log/system.log ]; then + ${PRIV} tail -n 25000 /var/log/system.log > system.log + fi + if [ -f /var/log/kernel.log ]; then + ${PRIV} tail -n 25000 /var/log/kernel.log > kernel.log + fi +fi +${PRIV} dmesg > dmesg + +# +# IPConfiguration log # -${PRIV} tail -n 2000 /var/log/system.log > system.log -${PRIV} dmesg > dmesg +if [ -f /var/log/com.apple.IPConfiguration.bootp ]; then + ${PRIV} tail -n 2000 /var/log/com.apple.IPConfiguration.bootp \ + > com.apple.IPConfiguration.bootp +fi # # ppp log file(s) @@ -208,7 +244,7 @@ do if [ -f "${logFile}" ]; then b="`basename ${logFile}`" cat "${logFile}" > "${b}" 2>&1 - fi + fi done # @@ -231,14 +267,21 @@ fi # network statistics # echo "#" > network-statistics -echo "# netstat -n -a -A -f inet" >> network-statistics +echo "# arp -n -a" >> network-statistics echo "#" >> network-statistics -netstat -n -a -A -f inet >> network-statistics 2>&1 +arp -n -a >> network-statistics 2>&1 echo "#" >> network-statistics -echo "# lsof -i -n -P" >> network-statistics +echo "# netstat -n -a -A" >> network-statistics echo "#" >> network-statistics -${PRIV} lsof -i -n -P >> network-statistics 2>&1 +netstat -n -a -A >> network-statistics 2>&1 + +if [ -x /usr/sbin/lsof ]; then + echo "#" >> network-statistics + echo "# lsof -i -n -P" >> network-statistics + echo "#" >> network-statistics + ${PRIV} lsof -i -n -P >> network-statistics 2>&1 +fi echo "#" >> network-statistics echo "# netstat -s" >> network-statistics @@ -255,15 +298,19 @@ echo "# netstat -i -n -d" >> network-statistics echo "#" >> network-statistics netstat -i -n -d >> network-statistics 2>&1 -echo "#" >> network-statistics -echo "# ipfw -at show" >> network-statistics -echo "#" >> network-statistics -ipfw -at show >> network-statistics 2>&1 +if [ -x /sbin/ipfw ]; then + echo "#" >> network-statistics + echo "# ipfw -at show" >> network-statistics + echo "#" >> network-statistics + ipfw -at show >> network-statistics 2>&1 +fi -echo "#" >> network-statistics -echo "# appletalk -s" >> network-statistics -echo "#" >> network-statistics -appletalk -s >> network-statistics 2>&1 +if [ -x /usr/sbin/appletalk ]; then + echo "#" >> network-statistics + echo "# appletalk -s" >> network-statistics + echo "#" >> network-statistics + appletalk -s >> network-statistics 2>&1 +fi # # system usage statistics @@ -333,8 +380,12 @@ echo "# setkey -Pp -D" >> ipsec echo "#" >> ipsec ${PRIV} setkey -Pp -D >> ipsec -for CF in /etc/racoon/remote/*.conf +for CF in /var/run/racoon/*.conf do + if [ ! -r "${CF}" ]; then + continue + fi + echo "" >> ipsec echo "#" >> ipsec echo "# ${CF}" >> ipsec @@ -353,22 +404,24 @@ done # # Kerberos configuration # -echo "#" > kerberos -echo "# klist -e -c -A -f -a -n" >> kerberos -echo "#" >> kerberos -${PRIV} klist -e -c -A -f -a -n >> kerberos +if [ -x /usr/bin/klist ]; then + echo "#" > kerberos + echo "# klist -e -c -A -f -a -n" >> kerberos + echo "#" >> kerberos + ${PRIV} klist -e -c -A -f -a -n >> kerberos 2>&1 -echo "#" >> kerberos -echo "# klist -e -k -t -K" >> kerberos -echo "#" >> kerberos -${PRIV} klist -e -k -t -K >> kerberos + echo "#" >> kerberos + echo "# klist -e -k -t -K" >> kerberos + echo "#" >> kerberos + ${PRIV} klist -e -k -t -K >> kerberos 2>&1 +fi # # BTMM configuration # DIG() { - /usr/bin/dig @pm-members.mac.com -y "${DOMAIN}:${TSIG}" +short "${1}" "${2}" + /usr/bin/dig @pm-members.mac.com -y "${DOMAIN}:${TSIG}" +short "${1}" "${2}" 2>/dev/null } scutil <<_END_OF_INPUT \ @@ -386,7 +439,7 @@ do # lookup TSIG in base64 format TSIG=` \ ${PRIV} security find-generic-password \ - -a ${DOMAIN} \ + -s dns:${DOMAIN} \ -g /Library/Keychains/System.keychain 2>&1 \ | grep "^password: " \ | cut -d '"' -f 2 \ @@ -401,10 +454,15 @@ do continue fi + KEYHASH="[SHA-1:`echo ${TSIG} | openssl sha1`]" + echo "" >> btmm + echo " KEY: ${KEYHASH}" >> btmm + for TYPE in \ _afpovertcp._tcp \ _airport._tcp \ _adisk._tcp \ + _http._tcp \ _rfb._tcp \ _smb._tcp \ _ssh._tcp @@ -440,30 +498,38 @@ do fi HOST=`/bin/echo "${SRV}" | cut -d ' ' -f 4-` + if [ -n "${HOST}" ]; then V4=`DIG ${HOST} a` + V6=`DIG ${HOST} aaaa` + KRB=`DIG _kerberos.${HOST} txt` + TUN=`DIG _autotunnel._udp.${HOST} srv` + else + V4="" + V6="" + KRB="" + TUN="" + fi if [ -n "${V4}" ]; then echo " v4: ${V4}" >> btmm fi - V6=`DIG ${HOST} aaaa` if [ -n "${V6}" ]; then echo " v6: ${V6}" >> btmm fi - - KRB=`DIG _kerberos.${HOST} txt` echo " KRB: ${KRB}" >> btmm - - TUN=`DIG _autotunnel._udp.${HOST} srv` echo " TUN: ${TUN}" >> btmm - + if [ -n "${TUN}" ]; then HOST=`/bin/echo "${TUN}" | cut -d ' ' -f 4-` + if [ -n "${HOST}" ]; then V4=`DIG ${HOST} a` + V6=`DIG ${HOST} aaaa` + fi if [ -n "${V4}" ]; then echo " v4: ${V4}" >> btmm fi - V6=`DIG ${HOST} aaaa` if [ -n "${V6}" ]; then echo " v6: ${V6}" >> btmm fi + fi done done done @@ -471,10 +537,22 @@ done # # collect crash reports # -CRASH_DIR=/Library/Logs/CrashReporter -for daemon in bootpd configd pppd +for daemon in \ + bootpd \ + configd \ + eapolclient \ + mDNSResponder \ + mDNSResponderHelper \ + pppd \ + racoon \ + socketfilterfw \ + SCHelper \ + SCMonitor \ + do - /bin/ls -1 ${CRASH_DIR}/${daemon}_*.crash 2>/dev/null \ + /bin/ls -1 /Library/Logs/CrashReporter/${daemon}_*.crash \ + /Library/Logs/DiagnosticReports/${daemon}/*.crash \ + 2>/dev/null \ | while read log do b="`basename ${log}`" @@ -486,7 +564,7 @@ done # collect everything into a single archive # cd "${WORKDIR}/.." -tar cfz "${ARCHIVE}" "${OUT}" +pax -w ${GZ_OPT} -f "${ARCHIVE}" "${OUT}" rm -rf "${WORKDIR}" if [ ${UID} -eq 0 ]; then @@ -498,3 +576,11 @@ if [ ${UID} -eq 0 ]; then fi echo "Network data collected to \"${ARCHIVE}\"" + +# +# if requested, generate a crash report +# +if [ "${OUTDIR}" = "/Library/Logs/CrashReporter/SystemConfiguration" -a "${1}" = "CRASH" ]; then + kill -ABRT $$ +fi + diff --git a/preferences.xml b/preferences.xml deleted file mode 100644 index 11d7d02..0000000 --- a/preferences.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - CurrentSet - /Sets/0 - NetworkServices - - 0 - - AppleTalk - - ConfigMethod - Node - __INACTIVE__ - 1 - - DNS - - Ethernet - - IPv4 - - ConfigMethod - DHCP - - IPv6 - - ConfigMethod - Automatic - - Interface - - DeviceName - en0 - Hardware - Ethernet - Type - Ethernet - UserDefinedName - Built-in Ethernet - - PPP - - CommDisplayTerminalWindow - 0 - CommRedialCount - 1 - CommRedialEnabled - 1 - CommRedialInterval - 30 - DialOnDemand - 0 - DisconnectOnIdle - 1 - DisconnectOnIdleTimer - 600 - DisconnectOnLogout - 0 - IPCPCompressionVJ - 1 - IdleReminder - 1 - IdleReminderTimer - 900 - LCPEchoEnabled - 1 - LCPEchoFailure - 4 - LCPEchoInterval - 10 - Logfile - /var/log/ppp.log - VerboseLogging - 0 - __INACTIVE__ - 1 - - Proxies - - FTPEnable - 0 - FTPPassive - 1 - GopherEnable - 0 - HTTPEnable - 0 - HTTPSEnable - 0 - RTSPEnable - 0 - SOCKSEnable - 0 - - UserDefinedName - Built-in Ethernet - - - Sets - - 0 - - Network - - Global - - IPv4 - - PPPOverridePrimary - 0 - ServiceOrder - - 0 - - - - Service - - 0 - - __LINK__ - /NetworkServices/0 - - - - UserDefinedName - Automatic - - - System - - - diff --git a/scselect.tproj/scselect.c b/scselect.tproj/scselect.c index e490e83..5c42fb3 100644 --- a/scselect.tproj/scselect.c +++ b/scselect.tproj/scselect.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -48,8 +48,9 @@ #include #include -#include +#if !TARGET_OS_IPHONE #include +#endif /* !TARGET_OS_IPHONE */ static Boolean apply = TRUE; @@ -103,6 +104,7 @@ isAdmin() } +#if !TARGET_OS_IPHONE static void * __loadSecurity(void) { static void *image = NULL; @@ -136,11 +138,12 @@ _SessionGetInfo(SecuritySessionId session, SecuritySessionId *sessionId, Session return dyfunc ? dyfunc(session, sessionId, attributes) : -1; } #define SessionGetInfo _SessionGetInfo - +#endif /* !TARGET_OS_IPHONE */ static Boolean hasLocalConsoleAccess() { +#if !TARGET_OS_IPHONE OSStatus error; SecuritySessionId sessionID = 0; SessionAttributeBits attributeBits = 0; @@ -152,6 +155,9 @@ hasLocalConsoleAccess() } return (attributeBits & (sessionHasGraphicAccess|sessionIsRemote)) == sessionHasGraphicAccess; +#else /* !TARGET_OS_IPHONE */ + return TRUE; +#endif /* !TARGET_OS_IPHONE */ } @@ -198,7 +204,7 @@ main(int argc, char **argv) newSet = (argc == 1) ? CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingMacRoman) - : CFSTR(""); + : CFRetain(CFSTR("")); prefs = SCPreferencesCreate(NULL, CFSTR("Select Set Command"), NULL); if (prefs == NULL) { @@ -239,10 +245,11 @@ main(int argc, char **argv) CFStringDelete(tmp, CFRangeMake(0, CFStringGetLength(prefix))); current = tmp; } else { + CFRetain(current); currentMatched = -1; /* not prefixed */ } } else { - current = CFSTR(""); + current = CFRetain(CFSTR("")); currentMatched = -2; /* not defined */ } @@ -265,7 +272,6 @@ main(int argc, char **argv) if (CFEqual(newSet, key)) { newSetUDN = CFDictionaryGetValue(dict, kSCPropUserDefinedName); if (newSetUDN != NULL) CFRetain(newSetUDN); - current = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@%@"), prefix, newSet); goto found; } } @@ -280,7 +286,6 @@ main(int argc, char **argv) CFRelease(newSet); newSet = CFRetain(key); CFRetain(newSetUDN); - current = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@%@"), prefix, newSet); goto found; } } @@ -329,6 +334,9 @@ main(int argc, char **argv) exit (EX_NOPERM); } + CFRelease(current); + current = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@%@"), prefix, newSet); + if (!SCPreferencesSetValue(prefs, kSCPrefCurrentSet, current)) { SCPrint(TRUE, stderr, CFSTR("SCPreferencesSetValue(...,%@,%@) failed\n"), @@ -349,14 +357,18 @@ main(int argc, char **argv) } } - CFRelease(prefs); - SCPrint(TRUE, stdout, CFSTR("%@ updated to %@ (%@)\n"), kSCPrefCurrentSet, newSet, newSetUDN ? newSetUDN : CFSTR("")); + CFRelease(current); + CFRelease(newSet); + if (newSetUDN != NULL) CFRelease(newSetUDN); + CFRelease(prefix); + CFRelease(prefs); + exit (0); return 0; } diff --git a/scutil.tproj/commands.c b/scutil.tproj/commands.c index e50043a..c7c8d70 100644 --- a/scutil.tproj/commands.c +++ b/scutil.tproj/commands.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -45,8 +45,6 @@ #include "net.h" #include "prefs.h" -#include "SCDynamicStoreInternal.h" - __private_extern__ const cmdInfo commands_store[] = { @@ -133,8 +131,8 @@ const cmdInfo commands_store[] = { { "n.changes", 0, 0, do_notify_changes, 5, 0, " n.changes : list changed keys" }, - { "n.watch", 0, 1, do_notify_watch, 5, 0, - " n.watch [verbose] : watch for changes" }, + { "n.watch", 0, 0, do_notify_watch, 5, 0, + " n.watch : watch for changes" }, { "n.wait", 0, 0, do_notify_wait, 5, 2, " n.wait : wait for changes" }, @@ -211,8 +209,8 @@ const cmdInfo commands_net[] = { " remove service [ | ]\n" " remove set [ | ]" }, - { "select", 2, 2, do_net_select, 7, 0, - " select interface | | $child | $service\n" + { "select", 2, 3, do_net_select, 7, 0, + " select interface | | $child | $service | $vlan | $bond \n" " select protocol \n" " select service | \n" " select set | " }, @@ -220,7 +218,7 @@ const cmdInfo commands_net[] = { { "set", 2, 101, do_net_set, 8, 0, " set interface context-sensitive-arguments (or ? for help)\n" " set protocol context-sensitive-arguments (or ? for help)\n" - " set service [ name ] [ order new-order ]\n" + " set service [ name ] [ order new-order ] [ rank ("" | First | Last | Never) [temp] ]\n" " set set [ name setName ]" }, { "show", 1, 2, do_net_show, 9, 0, @@ -282,7 +280,7 @@ const cmdInfo commands_prefs[] = { /* data store manipulation commands */ { "open", 0, 1, do_prefs_open, 2, 1, - " open [\"prefsID\"] : open a \"preferences\" session" }, + " open [\"prefsID\"] : open a \"preferences\" session" }, { "lock", 0, 1, do_prefs_lock, 3, 1, " lock [wait] : locks write access to preferences" }, @@ -301,7 +299,7 @@ const cmdInfo commands_prefs[] = { { "synchronize",0, 1, do_prefs_synchronize, 2, 0, " synchronize : synchronize a \"preferences\" session" }, - + { "list", 0, 1, do_prefs_list, 4, 0, " list [path] : list preference paths" }, @@ -410,9 +408,13 @@ do_readFile(int argc, char **argv) SCPrint(TRUE, stdout, CFSTR("f.read: reading file (%s).\n"), argv[0]); nesting++; - while (process_line(src) == TRUE) { - /* debug information, diagnostics */ - __showMachPortStatus(); + while (TRUE) { + Boolean ok; + + ok = process_line(src); + if (!ok) { + break; + } } (void)fclose(src->fp); diff --git a/scutil.tproj/dictionary.c b/scutil.tproj/dictionary.c index ec17cd8..032c591 100644 --- a/scutil.tproj/dictionary.c +++ b/scutil.tproj/dictionary.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -76,12 +76,13 @@ __private_extern__ void do_dictSetKey(int argc, char **argv) { - CFMutableArrayRef array = NULL; - Boolean doArray = FALSE; - Boolean doBoolean = FALSE; - Boolean doNumeric = FALSE; + CFMutableArrayRef array = NULL; + Boolean doArray = FALSE; + Boolean doBoolean = FALSE; + Boolean doNumeric = FALSE; CFStringRef key; - CFTypeRef val; + CFMutableDictionaryRef newValue; + CFTypeRef val = NULL; if (value == NULL) { SCPrint(TRUE, stdout, CFSTR("d.add: dictionary must be initialized.\n")); @@ -93,10 +94,6 @@ do_dictSetKey(int argc, char **argv) return; } - val = CFDictionaryCreateMutableCopy(NULL, 0, value); - CFRelease(value); - value = val; - key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); argv++; argc--; @@ -123,6 +120,7 @@ do_dictSetKey(int argc, char **argv) doArray = TRUE; } else if (!doArray && (argc == 0)) { SCPrint(TRUE, stdout, CFSTR("d.add: no values.\n")); + CFRelease(key); return; } @@ -146,9 +144,8 @@ do_dictSetKey(int argc, char **argv) val = CFRetain(kCFBooleanFalse); } else { SCPrint(TRUE, stdout, CFSTR("d.add: invalid data.\n")); - if (doArray) { - CFRelease(array); - } + if (doArray) CFRelease(array); + CFRelease(key); return; } } else if (doNumeric) { @@ -158,9 +155,8 @@ do_dictSetKey(int argc, char **argv) val = CFNumberCreate(NULL, kCFNumberIntType, &intValue); } else { SCPrint(TRUE, stdout, CFSTR("d.add: invalid data.\n")); - if (doArray) { - CFRelease(array); - } + if (doArray) CFRelease(array); + CFRelease(key); return; } } else { @@ -169,18 +165,24 @@ do_dictSetKey(int argc, char **argv) if (doArray) { CFArrayAppendValue(array, val); + CFRelease(val); + argv++; argc--; + } else { + break; } - - argv++; argc--; } + newValue = CFDictionaryCreateMutableCopy(NULL, 0, value); if (doArray) { - val = array; + CFDictionarySetValue(newValue, key, array); + CFRelease(array); + } else { + CFDictionarySetValue(newValue, key, val); + CFRelease(val); } - - CFDictionarySetValue((CFMutableDictionaryRef)value, key, val); - CFRelease(val); CFRelease(key); + CFRelease(value); + value = newValue; return; } diff --git a/scutil.tproj/net.c b/scutil.tproj/net.c index 31ff831..c7825b9 100644 --- a/scutil.tproj/net.c +++ b/scutil.tproj/net.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -401,11 +401,20 @@ _show_entity(CFDictionaryRef entity, CFStringRef prefix) key = CFArrayGetValueAtIndex(sorted, i); value = CFDictionaryGetValue(entity, key); if (isA_CFArray(value)) { - CFStringRef str; + CFIndex i; + CFIndex n = CFArrayGetCount(value); - str = CFStringCreateByCombiningStrings(NULL, value, CFSTR(", ")); - SCPrint(TRUE, stdout, CFSTR("%@ %@ = (%@)\n"), prefix, key, str); - CFRelease(str); + SCPrint(TRUE, stdout, CFSTR("%@ %@ = ("), prefix, key); + for (i = 0; i < n; i++) { + CFTypeRef val; + + val = CFArrayGetValueAtIndex(value, i); + SCPrint(TRUE, stdout, + CFSTR("%s%@"), + (i > 0) ? ", " : "", + val); + } + SCPrint(TRUE, stdout, CFSTR(")\n")); } else { SCPrint(TRUE, stdout, CFSTR("%@ %@ = %@\n"), prefix, key, value); } @@ -913,7 +922,6 @@ do_net_update(int argc, char **argv) net_set = set; setCreated = TRUE; - setUpdated = TRUE; CFRelease(setName); CFRetain(set); diff --git a/scutil.tproj/net_interface.c b/scutil.tproj/net_interface.c index c42c4b8..9cd9f38 100644 --- a/scutil.tproj/net_interface.c +++ b/scutil.tproj/net_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -36,7 +36,8 @@ #include -/* -------------------- */ +#pragma mark - +#pragma mark Interface management static CFArrayRef @@ -75,15 +76,23 @@ _copy_interfaces() __private_extern__ SCNetworkInterfaceRef -_find_interface(char *match) +_find_interface(int argc, char **argv, int *nArgs) { Boolean allowIndex = TRUE; CFIndex i; + CFArrayRef myInterfaces = interfaces; CFIndex n; CFStringRef select_name = NULL; SCNetworkInterfaceRef selected = NULL; - if (strcasecmp(match, "$child") == 0) { + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("no interface specified\n")); + return NULL; + } + + if (nArgs != NULL) *nArgs = 1; + + if (strcasecmp(argv[0], "$child") == 0) { if (net_interface == NULL) { SCPrint(TRUE, stdout, CFSTR("interface not selected\n")); goto done; @@ -95,7 +104,7 @@ _find_interface(char *match) } goto done; - } else if (strcasecmp(match, "$service") == 0) { + } else if (strcasecmp(argv[0], "$service") == 0) { if (net_service == NULL) { SCPrint(TRUE, stdout, CFSTR("service not selected\n")); goto done; @@ -107,26 +116,77 @@ _find_interface(char *match) } goto done; +#if !TARGET_OS_IPHONE + } else if (strcasecmp(argv[0], "$bond") == 0) { + CFStringRef interfaceType; + + if (net_interface == NULL) { + SCPrint(TRUE, stdout, CFSTR("interface not selected\n")); + goto done; + } + + interfaceType = SCNetworkInterfaceGetInterfaceType(net_interface); + if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) { + SCPrint(TRUE, stdout, CFSTR("interface not Bond\n")); + goto done; + } + + if (argc < 2) { + SCPrint(TRUE, stdout, CFSTR("no member interface specified\n")); + return NULL; + } + argv++; + argc--; + if (nArgs != NULL) *nArgs += 1; + + myInterfaces = SCBondInterfaceGetMemberInterfaces(net_interface); + if (myInterfaces == NULL) { + SCPrint(TRUE, stdout, CFSTR("no member interfaces\n")); + goto done; + } + allowIndex = FALSE; + } else if (strcasecmp(argv[0], "$vlan") == 0) { + CFStringRef interfaceType; + + if (net_interface == NULL) { + SCPrint(TRUE, stdout, CFSTR("interface not selected\n")); + goto done; + } + + interfaceType = SCNetworkInterfaceGetInterfaceType(net_interface); + if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) { + SCPrint(TRUE, stdout, CFSTR("interface not VLAN\n")); + goto done; + } + + selected = SCVLANInterfaceGetPhysicalInterface(net_interface); + if(selected == NULL) { + SCPrint(TRUE, stdout, CFSTR("no physical interface\n")); + } + + goto done; +#endif // !TARGET_OS_IPHONE } - if (interfaces == NULL) { + if ((myInterfaces == NULL) && (interfaces == NULL)) { interfaces = _copy_interfaces(); if (interfaces == NULL) { return NULL; } + myInterfaces = interfaces; allowIndex = FALSE; } // try to select the interface by its display name - select_name = CFStringCreateWithCString(NULL, match, kCFStringEncodingUTF8); + select_name = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); - n = CFArrayGetCount(interfaces); + n = (myInterfaces != NULL) ? CFArrayGetCount(myInterfaces) : 0; for (i = 0; i < n; i++) { SCNetworkInterfaceRef interface; CFStringRef interfaceName; - interface = CFArrayGetValueAtIndex(interfaces, i); + interface = CFArrayGetValueAtIndex(myInterfaces, i); interfaceName = SCNetworkInterfaceGetLocalizedDisplayName(interface); if ((interfaceName != NULL) && CFEqual(select_name, interfaceName)) { if (selected == NULL) { @@ -150,7 +210,7 @@ _find_interface(char *match) SCNetworkInterfaceRef interface; CFStringRef bsd_name = NULL; - interface = CFArrayGetValueAtIndex(interfaces, i); + interface = CFArrayGetValueAtIndex(myInterfaces, i); while ((interface != NULL) && (bsd_name == NULL)) { bsd_name = SCNetworkInterfaceGetBSDName(interface); if (bsd_name == NULL) { @@ -180,7 +240,7 @@ _find_interface(char *match) SCNetworkInterfaceRef interface; CFStringRef interfaceType; - interface = CFArrayGetValueAtIndex(interfaces, i); + interface = CFArrayGetValueAtIndex(myInterfaces, i); interfaceType = SCNetworkInterfaceGetInterfaceType(interface); if (CFEqual(select_name, interfaceType)) { if (selected == NULL) { @@ -200,7 +260,7 @@ _find_interface(char *match) if (allowIndex) { char *end; - char *str = match; + char *str = argv[0]; long val; // try to select the interface by its index @@ -211,7 +271,7 @@ _find_interface(char *match) ((*end == '\0') || (*end == '.')) && (errno == 0)) { if ((val > 0) && (val <= n)) { - selected = CFArrayGetValueAtIndex(interfaces, val - 1); + selected = CFArrayGetValueAtIndex(myInterfaces, val - 1); if (*end == '.') { str = end + 1; @@ -260,36 +320,39 @@ create_interface(int argc, char **argv) } interfaceType = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); + argv++; + argc--; +#if !TARGET_OS_IPHONE + if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) { + SCPrint(TRUE, stdout, CFSTR("bond creation not yet supported\n")); + goto done; + } if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) { -// xxxxx -SCPrint(TRUE, stdout, CFSTR("vlan creation not yet supported\n")); -goto done; - } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) { -// xxxxx -SCPrint(TRUE, stdout, CFSTR("bond creation not yet supported\n")); -goto done; - } else { - if (argc < 2) { - if (net_interface == NULL) { - SCPrint(TRUE, stdout, CFSTR("no network interface selected\n")); - goto done; - } + SCPrint(TRUE, stdout, CFSTR("vlan creation not yet supported\n")); + goto done; + } +#endif // !TARGET_OS_IPHONE - interface = net_interface; - } else { - interface = _find_interface(argv[1]); + if (argc < 1) { + if (net_interface == NULL) { + SCPrint(TRUE, stdout, CFSTR("no network interface selected\n")); + goto done; } - if (interface == NULL) { - return; - } + interface = net_interface; + } else { + interface = _find_interface(argc, argv, NULL); + } - new_interface = SCNetworkInterfaceCreateWithInterface(interface, interfaceType); - if (new_interface == NULL) { - SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError())); - goto done; - } + if (interface == NULL) { + goto done; + } + + new_interface = SCNetworkInterfaceCreateWithInterface(interface, interfaceType); + if (new_interface == NULL) { + SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError())); + goto done; } if (new_interfaces == NULL) { @@ -325,8 +388,7 @@ select_interface(int argc, char **argv) { SCNetworkInterfaceRef interface; - interface = _find_interface(argv[0]); - + interface = _find_interface(argc, argv, NULL); if (interface != NULL) { CFStringRef interfaceName; @@ -410,7 +472,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho } } - SCPrint(TRUE, stdout, CFSTR("%@ mtu %c = %ld (%ld < n < %ld)\n"), + SCPrint(TRUE, stdout, CFSTR("%@ mtu %c = %d (%d < n < %d)\n"), prefix, isCurrent, mtu_cur, @@ -527,6 +589,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho } CFRelease(subtype_options); } + if (subtypes != NULL) CFRelease(subtypes); } } else { SCPrint(TRUE, stdout, CFSTR("\n")); @@ -582,6 +645,27 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho CFRelease(effective); } + if (CFEqual(if_type, kSCNetworkInterfaceTypePPP)) { + SCNetworkInterfaceRef childInterface; + + childInterface = SCNetworkInterfaceGetInterface(interface); + if (childInterface != NULL) { + CFStringRef childInterfaceType; + + childInterfaceType = SCNetworkInterfaceGetInterfaceType(childInterface); + if (CFEqual(childInterfaceType, kSCNetworkInterfaceTypeL2TP)) { + CFDictionaryRef ipsec_configuration; + + ipsec_configuration = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec); + if (isA_CFDictionary(ipsec_configuration) && + (CFDictionaryGetCount(ipsec_configuration) > 0)) { + SCPrint(TRUE, stdout, CFSTR("\n%@ per-interface IPSec configuration\n"), prefix); + _show_entity(ipsec_configuration, prefix); + } + } + } + } + if (_sc_debug) { SCPrint(TRUE, stdout, CFSTR("\n%@\n"), interface); } @@ -756,7 +840,11 @@ show_interfaces(int argc, char **argv) } -/* -------------------- */ +#pragma mark - +#pragma mark Bond options + + +#if !TARGET_OS_IPHONE static options bondOptions[] = { @@ -796,7 +884,11 @@ set_interface_bond(int argc, char **argv, CFMutableDictionaryRef newConfiguratio } -/* -------------------- */ +#endif // !TARGET_OS_IPHONE + + +#pragma mark - +#pragma mark AirPort options static options airportOptions[] = { @@ -836,7 +928,8 @@ set_interface_airport(int argc, char **argv, CFMutableDictionaryRef newConfigura } -/* -------------------- */ +#pragma mark - +#pragma mark Ethernet options static options ethernetOptions[] = { @@ -876,7 +969,376 @@ set_interface_ethernet(int argc, char **argv, CFMutableDictionaryRef newConfigur } -/* -------------------- */ +#pragma mark - +#pragma mark IPSec options + + +static void +replaceOne(const void *key, const void *value, void *context) +{ + CFMutableDictionaryRef newConfiguration = (CFMutableDictionaryRef)context; + + CFDictionarySetValue(newConfiguration, key, value); + return; +} + + +static void +updateInterfaceConfiguration(CFMutableDictionaryRef newConfiguration) +{ + CFDictionaryRef configuration; + + CFDictionaryRemoveAllValues(newConfiguration); + + configuration = SCNetworkInterfaceGetConfiguration(net_interface); + if (configuration != NULL) { + CFDictionaryApplyFunction(configuration, replaceOne, (void *)newConfiguration); + } + + return; +} + + +static int +__doIPSecSharedSecret(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration) +{ + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("IPSec shared secret not specified\n")); + return -1; + } + + if (strlen(argv[0]) > 0) { + CFStringRef encryptionType; + + encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetIPSecSharedSecretEncryption); + if (encryptionType == NULL) { + CFIndex n; + CFMutableDataRef pw; + CFStringRef str; + + str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); + n = CFStringGetLength(str); + pw = CFDataCreateMutable(NULL, n * sizeof(UniChar)); + CFDataSetLength(pw, n * sizeof(UniChar)); + CFStringGetCharacters(str, + CFRangeMake(0, n), + (UniChar *)CFDataGetMutableBytePtr(pw)); + CFRelease(str); + + CFDictionarySetValue(newConfiguration, key, pw); + CFRelease(pw); + } else if (CFEqual(encryptionType, kSCValNetIPSecSharedSecretEncryptionKeychain)) { + Boolean ok; + CFDataRef pw; + CFStringRef str; + + str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); + pw = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingUTF8, 0); + ok = SCNetworkInterfaceSetPassword(net_interface, + kSCNetworkInterfacePasswordTypeIPSecSharedSecret, + pw, + NULL); + CFRelease(pw); + CFRelease(str); + if (ok) { + updateInterfaceConfiguration(newConfiguration); + } else { + return -1; + } + } else { + SCPrint(TRUE, stdout, CFSTR("IPSec shared secret type \"%@\" not supported\n"), encryptionType); + return -1; + } + } else { + CFDictionaryRemoveValue(newConfiguration, key); + } + + return 1; +} + + +static int +__doIPSecSharedSecretType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration) +{ + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("IPSec shared secret type mode not specified\n")); + return -1; + } + + if (strlen(argv[0]) > 0) { + if (strcasecmp(argv[0], "keychain") == 0) { + CFDictionarySetValue(newConfiguration, key, kSCValNetIPSecSharedSecretEncryptionKeychain); + } else { + SCPrint(TRUE, stdout, CFSTR("invalid shared secret type\n")); + return -1; + } + } else { + CFDictionaryRemoveValue(newConfiguration, key); + } + + // encryption type changed, reset shared secret + CFDictionaryRemoveValue(newConfiguration, kSCPropNetIPSecSharedSecret); + + return 1; +} + + +static int +__doIPSecXAuthPassword(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration) +{ + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("IPSec XAuth password not specified\n")); + return -1; + } + + if (strlen(argv[0]) > 0) { + CFStringRef encryptionType; + + encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetIPSecXAuthPasswordEncryption); + if (encryptionType == NULL) { + CFIndex n; + CFMutableDataRef pw; + CFStringRef str; + + str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); + n = CFStringGetLength(str); + pw = CFDataCreateMutable(NULL, n * sizeof(UniChar)); + CFDataSetLength(pw, n * sizeof(UniChar)); + CFStringGetCharacters(str, + CFRangeMake(0, n), + (UniChar *)CFDataGetMutableBytePtr(pw)); + CFRelease(str); + + CFDictionarySetValue(newConfiguration, key, pw); + CFRelease(pw); + } else if (CFEqual(encryptionType, kSCValNetIPSecXAuthPasswordEncryptionKeychain)) { + Boolean ok; + CFDataRef pw; + CFStringRef str; + + str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); + pw = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingUTF8, 0); + ok = SCNetworkInterfaceSetPassword(net_interface, + kSCNetworkInterfacePasswordTypeIPSecXAuth, + pw, + NULL); + CFRelease(pw); + CFRelease(str); + if (ok) { + updateInterfaceConfiguration(newConfiguration); + } else { + return -1; + } + } else { + SCPrint(TRUE, stdout, CFSTR("IPSec XAuthPassword type \"%@\" not supported\n"), encryptionType); + return -1; + } + } else { + CFDictionaryRemoveValue(newConfiguration, key); + } + + return 1; +} + + +static int +__doIPSecXAuthPasswordType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration) +{ + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("IPSec XAuth password type mode not specified\n")); + return -1; + } + + if (strlen(argv[0]) > 0) { + if (strcasecmp(argv[0], "keychain") == 0) { + CFDictionarySetValue(newConfiguration, key, kSCValNetIPSecXAuthPasswordEncryptionKeychain); + } else { + SCPrint(TRUE, stdout, CFSTR("invalid XAuth password type\n")); + return -1; + } + } else { + CFDictionaryRemoveValue(newConfiguration, key); + } + + // encryption type changed, reset XAuthPassword + CFDictionaryRemoveValue(newConfiguration, kSCPropNetIPSecXAuthPassword); + + return 1; +} + + +static CFStringRef +__cleanupDomainName(CFStringRef domain) +{ + CFMutableStringRef newDomain; + + newDomain = CFStringCreateMutableCopy(NULL, 0, domain); + CFStringTrimWhitespace(newDomain); + CFStringTrim(newDomain, CFSTR(".")); + if (CFStringGetLength(newDomain) == 0) { + CFRelease(newDomain); + newDomain = NULL; + } + + return newDomain; +} + + +static int +__doOnDemandDomains(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration) +{ + CFMutableArrayRef domains; + + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("OnDemand domain name(s) not specified\n")); + return -1; + } + + domains = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + + if (strlen(argv[0]) > 0) { + CFArrayRef array; + CFStringRef str; + + str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); + array = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR(",")); + CFRelease(str); + + if (array != NULL) { + CFIndex i; + CFIndex n = CFArrayGetCount(array); + + for (i = 0; i < n; i++) { + CFStringRef domain; + + domain = __cleanupDomainName(CFArrayGetValueAtIndex(array, i)); + if (domain != NULL) { + CFArrayAppendValue(domains, domain); + CFRelease(domain); + } else { + CFRelease(array); + CFRelease(domains); + SCPrint(TRUE, stdout, CFSTR("invalid OnDemand domain name\n")); + return -1; + } + } + CFRelease(array); + } + } + + if (CFArrayGetCount(domains) > 0) { + CFDictionarySetValue(newConfiguration, key, domains); + } else { + CFDictionaryRemoveValue(newConfiguration, key); + } + + CFRelease(domains); + return 1; +} + + +static options ipsecOnDemandOptions[] = { + { "OnDemandMatchDomainsAlways" , "domain", isOther , &kSCPropNetIPSecOnDemandMatchDomainsAlways , __doOnDemandDomains, NULL }, + { "always" , "domain", isOther , &kSCPropNetIPSecOnDemandMatchDomainsAlways , __doOnDemandDomains, NULL }, + { "OnDemandMatchDomainsOnRetry", "domain", isOther , &kSCPropNetIPSecOnDemandMatchDomainsOnRetry, __doOnDemandDomains, NULL }, + { "retry" , "domain", isOther , &kSCPropNetIPSecOnDemandMatchDomainsOnRetry, __doOnDemandDomains, NULL }, + { "OnDemandMatchDomainsNever" , "domain", isOther , &kSCPropNetIPSecOnDemandMatchDomainsNever , __doOnDemandDomains, NULL }, + { "never" , "domain", isOther , &kSCPropNetIPSecOnDemandMatchDomainsNever , __doOnDemandDomains, NULL }, + + { "?" , NULL , isHelp , NULL , NULL , + "\nOnDemandMatch configuration commands\n\n" + " set interface OnDemandMatch always domain-name[,domain-name]\n" + " set interface OnDemandMatch retry domain-name[,domain-name]\n" + " set interface OnDemandMatch never domain-name[,domain-name]\n" + } +}; +#define N_IPSEC_ONDEMAND_OPTIONS (sizeof(ipsecOnDemandOptions) / sizeof(ipsecOnDemandOptions[0])) + + +static int +__doIPSecOnDemandMatch(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration) +{ + Boolean ok; + + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("set what?\n")); + return -1; + } + + ok = _process_options(ipsecOnDemandOptions, N_IPSEC_ONDEMAND_OPTIONS, argc, argv, newConfiguration); + if (!ok) { + goto done; + } + + done : + + return argc; +} + + +static selections ipsecAuthenticationMethodSelections[] = { + { CFSTR("SharedSecret"), &kSCValNetIPSecAuthenticationMethodSharedSecret, 0 }, + { CFSTR("Certificate") , &kSCValNetIPSecAuthenticationMethodCertificate , 0 }, + { CFSTR("Hybrid") , &kSCValNetIPSecAuthenticationMethodHybrid , 0 }, + { NULL , NULL , 0 } +}; + + +static selections ipsecLocalIdentifierTypeSelections[] = { + { CFSTR("KeyID") , &kSCValNetIPSecLocalIdentifierTypeKeyID , 0 }, + { NULL , NULL , 0 } +}; + + +static options ipsecOptions[] = { + { "AuthenticationMethod" , NULL, isChooseOne , &kSCPropNetIPSecAuthenticationMethod , NULL , (void *)ipsecAuthenticationMethodSelections }, + { "LocalIdentifier" , NULL, isString , &kSCPropNetIPSecLocalIdentifier , NULL , NULL }, + { "group" , NULL, isString , &kSCPropNetIPSecLocalIdentifier , NULL , NULL }, + { "LocalIdentifierType" , NULL, isChooseOne , &kSCPropNetIPSecLocalIdentifierType , NULL , (void *)ipsecLocalIdentifierTypeSelections }, + { "RemoteAddress" , NULL, isString , &kSCPropNetIPSecRemoteAddress , NULL , NULL }, + { "SharedSecret" , NULL, isOther , &kSCPropNetIPSecSharedSecret , __doIPSecSharedSecret , NULL }, + { "SharedSecretEncryption" , NULL, isOther , &kSCPropNetIPSecSharedSecretEncryption , __doIPSecSharedSecretType , NULL }, + + // --- XAuth: --- + { "XAuthEnabled" , NULL, isBoolean , &kSCPropNetIPSecXAuthEnabled , NULL , NULL }, + { "XAuthName" , NULL, isString , &kSCPropNetIPSecXAuthName , NULL , NULL }, + { "XAuthPassword" , NULL, isOther , &kSCPropNetIPSecXAuthPassword , __doIPSecXAuthPassword , NULL }, + { "XAuthPasswordEncryption", NULL, isOther , &kSCPropNetIPSecXAuthPasswordEncryption, __doIPSecXAuthPasswordType, NULL }, + + // --- OnDemand: --- + { "OnDemandEnabled" , NULL, isBoolean , &kSCPropNetIPSecOnDemandEnabled , NULL , NULL }, + { "OnDemandMatch" , NULL, isOther , NULL , __doIPSecOnDemandMatch , NULL }, + + { "?" , NULL , isHelp , NULL , NULL, + "\nIPSec configuration commands\n\n" + " set interface [AuthenticationMethod {SharedSecret|Certificate|Hybrid}]\n" + " set interface [LocalIdentifier group]\n" + " set interface [LocalIdentifierType {KeyID}]\n" + " set interface [RemoteAddress name-or-address]\n" + " set interface [SharedSecret secret]\n" + " set interface [SharedSecretEncryption {Keychain}]\n" + " set interface [XAuthEnabled {enable|disable}]\n" + " set interface [XAuthPassword password]\n" + " set interface [XAuthPasswordEncryption {Keychain}]\n" + " set interface [OnDemandEnabled {enable|disable}]\n" + " set interface [OnDemandMatch ]\n" + } +}; +#define N_IPSEC_OPTIONS (sizeof(ipsecOptions) / sizeof(ipsecOptions[0])) + + +static Boolean +set_interface_ipsec(int argc, char **argv, CFMutableDictionaryRef newConfiguration) +{ + Boolean ok; + + ok = _process_options(ipsecOptions, N_IPSEC_OPTIONS, argc, argv, newConfiguration); + return ok; +} + + +#pragma mark - +#pragma mark FireWire options static options firewireOptions[] = { @@ -916,7 +1378,8 @@ set_interface_firewire(int argc, char **argv, CFMutableDictionaryRef newConfigur } -/* -------------------- */ +#pragma mark - +#pragma mark Modem options static selections modemDialSelections[] = { @@ -951,7 +1414,7 @@ static options modemOptions[] = { " set interface [HoldReminder {enable|disable}]\n" " set interface [HoldReminderTime n]\n" " set interface [PulseDial {enable|disable}]\n" - " set interface [Speaker {enable|disable}]" + " set interface [Speaker {enable|disable}]\n" } }; #define N_MODEM_OPTIONS (sizeof(modemOptions) / sizeof(modemOptions[0])) @@ -967,7 +1430,8 @@ set_interface_modem(int argc, char **argv, CFMutableDictionaryRef newConfigurati } -/* -------------------- */ +#pragma mark - +#pragma mark PPP options static int @@ -1036,6 +1500,123 @@ __doPPPAuthPWType(CFStringRef key, const char *description, void *info, int argc } +static options l2tp_ipsecOptions[] = { + { "SharedSecret" , NULL, isOther , &kSCPropNetIPSecSharedSecret , __doIPSecSharedSecret , NULL }, + { "SharedSecretEncryption", NULL, isOther , &kSCPropNetIPSecSharedSecretEncryption, __doIPSecSharedSecretType, NULL }, + + { "?" , NULL , isHelp , NULL , NULL, + "\nIPSec configuration commands\n\n" + " set interface ipsec [SharedSecret secret]\n" + " set interface ipsec [SharedSecretEncryption {Keychain}]\n" + } +}; +#define N_L2TP_IPSEC_OPTIONS (sizeof(l2tp_ipsecOptions) / sizeof(l2tp_ipsecOptions[0])) + + +static int +__doPPPIPSec(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newPPPConfiguration) +{ + SCNetworkInterfaceRef childInterface; + CFStringRef childInterfaceType; + CFDictionaryRef configuration; + CFMutableDictionaryRef newConfiguration; + Boolean ok; + + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("set what?\n")); + return -1; + } + + childInterface = SCNetworkInterfaceGetInterface(net_interface); + if (childInterface == NULL) { + SCPrint(TRUE, stdout, CFSTR("this interfaces configuration cannot be changed\n")); + return -1; + } + + childInterfaceType = SCNetworkInterfaceGetInterfaceType(childInterface); + if (!CFEqual(childInterfaceType, kSCNetworkInterfaceTypeL2TP)) { + SCPrint(TRUE, stdout, CFSTR("this interfaces configuration cannot be changed\n")); + return -1; + } + + configuration = SCNetworkInterfaceGetExtendedConfiguration(net_interface, kSCEntNetIPSec); + if (configuration == NULL) { + newConfiguration = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + } else { + newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration); + CFDictionaryRemoveValue(newConfiguration, kSCResvInactive); + } + + ok = _process_options(l2tp_ipsecOptions, N_L2TP_IPSEC_OPTIONS, argc, argv, newConfiguration); + if (!ok) { + goto done; + } + + if (((configuration == NULL) && (CFDictionaryGetCount(newConfiguration) > 0)) || + ((configuration != NULL) && !CFEqual(configuration, newConfiguration))) { + if (!SCNetworkInterfaceSetExtendedConfiguration(net_interface, kSCEntNetIPSec, newConfiguration)) { + if (SCError() == kSCStatusNoKey) { + SCPrint(TRUE, stdout, CFSTR("could not update per-service interface configuration\n")); + } else { + SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError())); + } + goto done; + } + + _prefs_changed = TRUE; + } + + done : + + if (newConfiguration != NULL) CFRelease(newConfiguration); + return argc; +} + + +#ifdef NOTYET +static options pppOnDemandOptions[] = { + { "OnDemandMatchDomainsAlways" , "domain", isOther , &kSCPropNetPPPOnDemandMatchDomainsAlways , __doOnDemandDomains, NULL }, + { "always" , "domain", isOther , &kSCPropNetPPPOnDemandMatchDomainsAlways , __doOnDemandDomains, NULL }, + { "OnDemandMatchDomainsOnRetry", "domain", isOther , &kSCPropNetPPPOnDemandMatchDomainsOnRetry, __doOnDemandDomains, NULL }, + { "retry" , "domain", isOther , &kSCPropNetPPPOnDemandMatchDomainsOnRetry, __doOnDemandDomains, NULL }, + { "OnDemandMatchDomainsNever" , "domain", isOther , &kSCPropNetPPPOnDemandMatchDomainsNever , __doOnDemandDomains, NULL }, + { "never" , "domain", isOther , &kSCPropNetPPPOnDemandMatchDomainsNever , __doOnDemandDomains, NULL }, + + { "?" , NULL , isHelp , NULL , NULL , + "\nOnDemandMatch configuration commands\n\n" + " set interface OnDemand always domain-name[,domain-name]\n" + " set interface OnDemand retry domain-name[,domain-name]\n" + " set interface OnDemand never domain-name[,domain-name]\n" + } +}; +#define N_PPP_ONDEMAND_OPTIONS (sizeof(pppOnDemandOptions) / sizeof(pppOnDemandOptions[0])) + + +static int +__doPPPOnDemandMatch(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration) +{ + Boolean ok; + + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("set what?\n")); + return -1; + } + + ok = _process_options(pppOnDemandOptions, N_PPP_ONDEMAND_OPTIONS, argc, argv, newConfiguration); + if (!ok) { + goto done; + } + + done : + + return argc; +} +#endif // NOTYET + + static selections authPromptSelections[] = { { CFSTR("before"), &kSCValNetPPPAuthPromptBefore, 0 }, { CFSTR("after") , &kSCValNetPPPAuthPromptAfter , 0 }, @@ -1054,67 +1635,76 @@ static selections authProtocolSelections[] = { static options pppOptions[] = { - { "ACSP" , NULL , isBoolean , &kSCPropNetPPPACSPEnabled , NULL , NULL }, - { "ConnectTime" , "?time" , isNumber , &kSCPropNetPPPConnectTime , NULL , NULL }, - { "DialOnDemand" , NULL , isBoolean , &kSCPropNetPPPDialOnDemand , NULL , NULL }, - { "DisconnectOnFastUserSwitch", NULL , isBoolean , &kSCPropNetPPPDisconnectOnFastUserSwitch, NULL , NULL }, - { "DisconnectOnIdle" , NULL , isBoolean , &kSCPropNetPPPDisconnectOnIdle , NULL , NULL }, - { "DisconnectOnIdleTimer" , "timeout" , isNumber , &kSCPropNetPPPDisconnectOnIdleTimer , NULL , NULL }, - { "DisconnectOnLogout" , NULL , isBoolean , &kSCPropNetPPPDisconnectOnLogout , NULL , NULL }, - { "DisconnectOnSleep" , NULL , isBoolean , &kSCPropNetPPPDisconnectOnSleep , NULL , NULL }, - { "DisconnectTime" , "?time" , isNumber , &kSCPropNetPPPDisconnectTime , NULL , NULL }, - { "IdleReminder" , NULL , isBoolean , &kSCPropNetPPPIdleReminder , NULL , NULL }, - { "IdleReminderTimer" , "time" , isNumber , &kSCPropNetPPPIdleReminderTimer , NULL , NULL }, - { "Logfile" , "path" , isString , &kSCPropNetPPPLogfile , NULL , NULL }, - { "Plugins" , "plugin" , isStringArray , &kSCPropNetPPPPlugins , NULL , NULL }, - { "RetryConnectTime" , "time" , isNumber , &kSCPropNetPPPRetryConnectTime , NULL , NULL }, - { "SessionTimer" , "time" , isNumber , &kSCPropNetPPPSessionTimer , NULL , NULL }, - { "UseSessionTimer" , NULL , isBoolean , &kSCPropNetPPPUseSessionTimer , NULL , NULL }, - { "VerboseLogging" , NULL , isBoolean , &kSCPropNetPPPVerboseLogging , NULL , NULL }, + { "ACSP" , NULL , isBoolean , &kSCPropNetPPPACSPEnabled , NULL , NULL }, + { "ConnectTime" , "?time" , isNumber , &kSCPropNetPPPConnectTime , NULL , NULL }, + { "DialOnDemand" , NULL , isBoolean , &kSCPropNetPPPDialOnDemand , NULL , NULL }, + { "DisconnectOnFastUserSwitch", NULL , isBoolean , &kSCPropNetPPPDisconnectOnFastUserSwitch, NULL , NULL }, + { "DisconnectOnIdle" , NULL , isBoolean , &kSCPropNetPPPDisconnectOnIdle , NULL , NULL }, + { "DisconnectOnIdleTimer" , "timeout" , isNumber , &kSCPropNetPPPDisconnectOnIdleTimer , NULL , NULL }, + { "DisconnectOnLogout" , NULL , isBoolean , &kSCPropNetPPPDisconnectOnLogout , NULL , NULL }, + { "DisconnectOnSleep" , NULL , isBoolean , &kSCPropNetPPPDisconnectOnSleep , NULL , NULL }, + { "DisconnectTime" , "?time" , isNumber , &kSCPropNetPPPDisconnectTime , NULL , NULL }, + { "IdleReminder" , NULL , isBoolean , &kSCPropNetPPPIdleReminder , NULL , NULL }, + { "IdleReminderTimer" , "time" , isNumber , &kSCPropNetPPPIdleReminderTimer , NULL , NULL }, + { "Logfile" , "path" , isString , &kSCPropNetPPPLogfile , NULL , NULL }, + { "Plugins" , "plugin" , isStringArray , &kSCPropNetPPPPlugins , NULL , NULL }, + { "RetryConnectTime" , "time" , isNumber , &kSCPropNetPPPRetryConnectTime , NULL , NULL }, + { "SessionTimer" , "time" , isNumber , &kSCPropNetPPPSessionTimer , NULL , NULL }, + { "UseSessionTimer" , NULL , isBoolean , &kSCPropNetPPPUseSessionTimer , NULL , NULL }, + { "VerboseLogging" , NULL , isBoolean , &kSCPropNetPPPVerboseLogging , NULL , NULL }, // --- Auth: --- - { "AuthEAPPlugins" , "plugin" , isStringArray , &kSCPropNetPPPAuthEAPPlugins , NULL , NULL }, - { "AuthName" , "account" , isString , &kSCPropNetPPPAuthName , NULL , NULL }, - { "Account" , "account" , isString , &kSCPropNetPPPAuthName , NULL , NULL }, - { "AuthPassword" , "password" , isOther , &kSCPropNetPPPAuthPassword , __doPPPAuthPW , NULL }, - { "Password" , "password" , isOther , &kSCPropNetPPPAuthPassword , __doPPPAuthPW , NULL }, - { "AuthPasswordEncryption" , "type" , isOther , &kSCPropNetPPPAuthPasswordEncryption , __doPPPAuthPWType, NULL }, - { "AuthPrompt" , "before/after", isChooseOne , &kSCPropNetPPPAuthPrompt , NULL , (void *)authPromptSelections }, - { "AuthProtocol" , "protocol" , isChooseMultiple , &kSCPropNetPPPAuthProtocol , NULL , (void *)authProtocolSelections }, + { "AuthEAPPlugins" , "plugin" , isStringArray , &kSCPropNetPPPAuthEAPPlugins , NULL , NULL }, + { "AuthName" , "account" , isString , &kSCPropNetPPPAuthName , NULL , NULL }, + { "Account" , "account" , isString , &kSCPropNetPPPAuthName , NULL , NULL }, + { "AuthPassword" , "password" , isOther , &kSCPropNetPPPAuthPassword , __doPPPAuthPW , NULL }, + { "Password" , "password" , isOther , &kSCPropNetPPPAuthPassword , __doPPPAuthPW , NULL }, + { "AuthPasswordEncryption" , "type" , isOther , &kSCPropNetPPPAuthPasswordEncryption , __doPPPAuthPWType , NULL }, + { "AuthPrompt" , "before/after", isChooseOne , &kSCPropNetPPPAuthPrompt , NULL , (void *)authPromptSelections }, + { "AuthProtocol" , "protocol" , isChooseMultiple , &kSCPropNetPPPAuthProtocol , NULL , (void *)authProtocolSelections }, // --- Comm: --- - { "CommRemoteAddress" , "phone#" , isString , &kSCPropNetPPPCommRemoteAddress , NULL , NULL }, - { "CommAlternateRemoteAddress", "phone#" , isString , &kSCPropNetPPPCommAlternateRemoteAddress, NULL , NULL }, - { "CommConnectDelay" , "time" , isNumber , &kSCPropNetPPPCommConnectDelay , NULL , NULL }, - { "CommDisplayTerminalWindow" , NULL , isBoolean , &kSCPropNetPPPCommDisplayTerminalWindow , NULL , NULL }, - { "CommRedialCount" , "retry count" , isNumber , &kSCPropNetPPPCommRedialCount , NULL , NULL }, - { "CommRedialEnabled" , NULL , isBoolean , &kSCPropNetPPPCommRedialEnabled , NULL , NULL }, - { "CommRedialInterval" , "retry delay" , isNumber , &kSCPropNetPPPCommRedialInterval , NULL , NULL }, - { "CommTerminalScript" , "script" , isString , &kSCPropNetPPPCommTerminalScript , NULL , NULL }, - { "CommUseTerminalScript" , NULL , isBoolean , &kSCPropNetPPPCommUseTerminalScript , NULL , NULL }, + { "CommRemoteAddress" , "phone#" , isString , &kSCPropNetPPPCommRemoteAddress , NULL , NULL }, + { "CommAlternateRemoteAddress", "phone#" , isString , &kSCPropNetPPPCommAlternateRemoteAddress, NULL , NULL }, + { "CommConnectDelay" , "time" , isNumber , &kSCPropNetPPPCommConnectDelay , NULL , NULL }, + { "CommDisplayTerminalWindow" , NULL , isBoolean , &kSCPropNetPPPCommDisplayTerminalWindow , NULL , NULL }, + { "CommRedialCount" , "retry count" , isNumber , &kSCPropNetPPPCommRedialCount , NULL , NULL }, + { "CommRedialEnabled" , NULL , isBoolean , &kSCPropNetPPPCommRedialEnabled , NULL , NULL }, + { "CommRedialInterval" , "retry delay" , isNumber , &kSCPropNetPPPCommRedialInterval , NULL , NULL }, + { "CommTerminalScript" , "script" , isString , &kSCPropNetPPPCommTerminalScript , NULL , NULL }, + { "CommUseTerminalScript" , NULL , isBoolean , &kSCPropNetPPPCommUseTerminalScript , NULL , NULL }, // --- CCP: --- - { "CCPEnabled" , NULL , isBoolean , &kSCPropNetPPPCCPEnabled , NULL , NULL }, - { "CCPMPPE40Enabled" , NULL , isBoolean , &kSCPropNetPPPCCPMPPE40Enabled , NULL , NULL }, - { "CCPMPPE128Enabled" , NULL , isBoolean , &kSCPropNetPPPCCPMPPE128Enabled , NULL , NULL }, + { "CCPEnabled" , NULL , isBoolean , &kSCPropNetPPPCCPEnabled , NULL , NULL }, + { "CCPMPPE40Enabled" , NULL , isBoolean , &kSCPropNetPPPCCPMPPE40Enabled , NULL , NULL }, + { "CCPMPPE128Enabled" , NULL , isBoolean , &kSCPropNetPPPCCPMPPE128Enabled , NULL , NULL }, // --- IPCP: --- - { "IPCPCompressionVJ" , NULL , isBoolean , &kSCPropNetPPPIPCPCompressionVJ , NULL , NULL }, - { "IPCPUsePeerDNS" , NULL , isBoolean , &kSCPropNetPPPIPCPUsePeerDNS , NULL , NULL }, + { "IPCPCompressionVJ" , NULL , isBoolean , &kSCPropNetPPPIPCPCompressionVJ , NULL , NULL }, + { "IPCPUsePeerDNS" , NULL , isBoolean , &kSCPropNetPPPIPCPUsePeerDNS , NULL , NULL }, // --- LCP: --- - { "LCPEchoEnabled" , NULL , isBoolean , &kSCPropNetPPPLCPEchoEnabled , NULL , NULL }, - { "LCPEchoFailure" , NULL , isNumber , &kSCPropNetPPPLCPEchoFailure , NULL , NULL }, - { "LCPEchoInterval" , NULL , isNumber , &kSCPropNetPPPLCPEchoInterval , NULL , NULL }, - { "LCPCompressionACField" , NULL , isBoolean , &kSCPropNetPPPLCPCompressionACField , NULL , NULL }, - { "LCPCompressionPField" , NULL , isBoolean , &kSCPropNetPPPLCPCompressionPField , NULL , NULL }, - { "LCPMRU" , NULL , isNumber , &kSCPropNetPPPLCPMRU , NULL , NULL }, - { "LCPMTU" , NULL , isNumber , &kSCPropNetPPPLCPMTU , NULL , NULL }, - { "LCPReceiveACCM" , NULL , isNumber , &kSCPropNetPPPLCPReceiveACCM , NULL , NULL }, - { "LCPTransmitACCM" , NULL , isNumber , &kSCPropNetPPPLCPTransmitACCM , NULL , NULL }, + { "LCPEchoEnabled" , NULL , isBoolean , &kSCPropNetPPPLCPEchoEnabled , NULL , NULL }, + { "LCPEchoFailure" , NULL , isNumber , &kSCPropNetPPPLCPEchoFailure , NULL , NULL }, + { "LCPEchoInterval" , NULL , isNumber , &kSCPropNetPPPLCPEchoInterval , NULL , NULL }, + { "LCPCompressionACField" , NULL , isBoolean , &kSCPropNetPPPLCPCompressionACField , NULL , NULL }, + { "LCPCompressionPField" , NULL , isBoolean , &kSCPropNetPPPLCPCompressionPField , NULL , NULL }, + { "LCPMRU" , NULL , isNumber , &kSCPropNetPPPLCPMRU , NULL , NULL }, + { "LCPMTU" , NULL , isNumber , &kSCPropNetPPPLCPMTU , NULL , NULL }, + { "LCPReceiveACCM" , NULL , isNumber , &kSCPropNetPPPLCPReceiveACCM , NULL , NULL }, + { "LCPTransmitACCM" , NULL , isNumber , &kSCPropNetPPPLCPTransmitACCM , NULL , NULL }, + + // --- IPSec: --- + { "IPSec" , NULL , isOther , NULL , __doPPPIPSec , NULL }, + +#ifdef NOTYET + // --- OnDemand: --- + { "OnDemandEnabled" , NULL , isBoolean , &kSCPropNetPPPOnDemandEnabled , NULL , NULL }, + { "OnDemandMatch" , NULL , isOther , NULL , __doPPPOnDemandMatch, NULL }, +#endif // NOTYET // --- Help --- - { "?" , NULL , isHelp , NULL , NULL , + { "?" , NULL , isHelp , NULL , NULL , "\nPPP configuration commands\n\n" " set interface [Account account]\n" " set interface [Password password]\n" @@ -1124,7 +1714,12 @@ static options pppOptions[] = { " set interface [IdleReminderTimer time-in-seconds]\n" " set interface [DisconnectOnIdle {enable|disable}]\n" " set interface [DisconnectOnIdleTimer time-in-seconds]\n" - " set interface [DisconnectOnLogout {enable|disable}]" + " set interface [DisconnectOnLogout {enable|disable}]\n" + " set interface [IPSec ]\n" +#ifdef NOTYET + " set interface [OnDemandEnabled {enable|disable}]\n" + " set interface [OnDemandMatch ]\n" +#endif // NOTYET } }; #define N_PPP_OPTIONS (sizeof(pppOptions) / sizeof(pppOptions[0])) @@ -1140,7 +1735,11 @@ set_interface_ppp(int argc, char **argv, CFMutableDictionaryRef newConfiguration } -/* -------------------- */ +#pragma mark - +#pragma mark VLAN options + + +#if !TARGET_OS_IPHONE static Boolean @@ -1152,7 +1751,11 @@ SCPrint(TRUE, stdout, CFSTR("vlan interface management not yet supported\n")); } -/* -------------------- */ +#endif // !TARGET_OS_IPHONE + + +#pragma mark - +#pragma mark [more] Interface management __private_extern__ @@ -1175,32 +1778,37 @@ set_interface(int argc, char **argv) } configuration = SCNetworkInterfaceGetConfiguration(net_interface); - if (configuration == NULL) { + if (configuration != NULL) { + configuration = CFDictionaryCreateCopy(NULL, configuration); + newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration); + CFDictionaryRemoveValue(newConfiguration, kSCResvInactive); + } else { newConfiguration = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - } else { - newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration); - CFDictionaryRemoveValue(newConfiguration, kSCResvInactive); } interfaceType = SCNetworkInterfaceGetInterfaceType(net_interface); - if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) { - ok = set_interface_bond(argc, argv, newConfiguration); - } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeEthernet)) { + if (CFEqual(interfaceType, kSCNetworkInterfaceTypeEthernet)) { ok = set_interface_ethernet(argc, argv, newConfiguration); } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeFireWire)) { ok = set_interface_firewire(argc, argv, newConfiguration); + } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) { + ok = set_interface_ipsec(argc, argv, newConfiguration); } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeModem)) { ok = set_interface_modem(argc, argv, newConfiguration); } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIEEE80211)) { ok = set_interface_airport(argc, argv, newConfiguration); } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) { ok = set_interface_ppp(argc, argv, newConfiguration); +#if !TARGET_OS_IPHONE + } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) { + ok = set_interface_bond(argc, argv, newConfiguration); } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) { ok = set_interface_vlan(argc, argv, newConfiguration); +#endif // !TARGET_OS_IPHONE } else { SCPrint(TRUE, stdout, CFSTR("this interfaces configuration cannot be changed\n")); } @@ -1225,6 +1833,7 @@ set_interface(int argc, char **argv) done : + if (configuration != NULL) CFRelease(configuration); if (newConfiguration != NULL) CFRelease(newConfiguration); return; } @@ -1239,8 +1848,8 @@ show_interface(int argc, char **argv) { SCNetworkInterfaceRef interface; - if (argc == 1) { - interface = _find_interface(argv[0]); + if (argc >= 1) { + interface = _find_interface(argc, argv, NULL); } else { if (net_interface != NULL) { interface = net_interface; diff --git a/scutil.tproj/net_interface.h b/scutil.tproj/net_interface.h index 780a84c..af42956 100644 --- a/scutil.tproj/net_interface.h +++ b/scutil.tproj/net_interface.h @@ -36,7 +36,7 @@ __BEGIN_DECLS CFStringRef _interface_description (SCNetworkInterfaceRef interface); -SCNetworkInterfaceRef _find_interface (char *match); +SCNetworkInterfaceRef _find_interface (int argc, char **argv, int *nArgs); void create_interface (int argc, char **argv); void select_interface (int argc, char **argv); diff --git a/scutil.tproj/net_protocol.c b/scutil.tproj/net_protocol.c index 77e2752..0272c11 100644 --- a/scutil.tproj/net_protocol.c +++ b/scutil.tproj/net_protocol.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -421,6 +421,9 @@ select_protocol(int argc, char **argv) #pragma mark AppleTalk +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK + + static selections appletalkConfigMethods[] = { { CFSTR("node") , &kSCValNetAppleTalkConfigMethodNode , 0 }, { CFSTR("router") , &kSCValNetAppleTalkConfigMethodRouter , 0 }, @@ -533,6 +536,9 @@ set_protocol_appletalk(int argc, char **argv, CFMutableDictionaryRef newConfigur } +#endif // !TARGET_OS_IPHONE && INCLUDE_APPLETALK + + #pragma mark - #pragma mark DNS @@ -712,7 +718,7 @@ static options dnsOptions[] = { { "?" , NULL , isHelp , NULL , NULL, "\nDNS configuration commands\n\n" " set protocol search domain-name[,domain-name-2]\n" - " set protocol nameserver x1.x1.x1.x1[,x2.x2.x2.x2]" + " set protocol nameserver x1.x1.x1.x1[,x2.x2.x2.x2]\n" } }; #define N_DNS_OPTIONS (sizeof(dnsOptions) / sizeof(dnsOptions[0])) @@ -968,23 +974,6 @@ __doIPv6Addresses(CFStringRef key, const char *description, void *info, int argc } -static int -__doIPv6PrefixLength(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration) -{ - CFNumberRef num; - int prefixLength; - - num = CFDictionaryGetValue(newConfiguration, kSCPropNetPPPAuthPasswordEncryption); - if (isA_CFNumber(num) && - CFNumberGetValue(num, kCFNumberIntType, &prefixLength) && - (prefixLength >= 0) && (prefixLength <= (sizeof(struct in6_addr) * 8))) { - return 0; - } - - return -1; -} - - static options ipv6Options[] = { { "ConfigMethod", "configuration method" , isChooseOne, &kSCPropNetIPv6ConfigMethod, __doIPv6ConfigMethod, (void *)ipv6ConfigMethods }, @@ -992,7 +981,7 @@ static options ipv6Options[] = { , isChooseOne, &kSCPropNetIPv6ConfigMethod, __doIPv6ConfigMethod, (void *)ipv6ConfigMethods }, { "Addresses" , "address" , isOther , &kSCPropNetIPv6Addresses , __doIPv6Addresses , (void *)TRUE }, { "address" , "address" , isOther , &kSCPropNetIPv6Addresses , __doIPv6Addresses , (void *)TRUE }, - { "PrefixLength", "prefix length", isNumber , &kSCPropNetIPv6PrefixLength, __doIPv6PrefixLength, NULL }, + { "PrefixLength", "prefix length", isNumber , &kSCPropNetIPv6PrefixLength, NULL , NULL }, { "Router" , "address" , isOther , &kSCPropNetIPv6Router , __doIPv6Addresses , (void *)FALSE }, { "?" , NULL , isHelp , NULL , NULL , @@ -1191,7 +1180,7 @@ __doProxyEnable(CFStringRef key, const char *description, void *info, int argc, if (enabled) { CFDictionarySetValue(newConfiguration, *(currentProxy->keyEnable), CFNumberRef_1); } else { - CFDictionarySetValue(newConfiguration, *(currentProxy->keyEnable), CFNumberRef_0); + CFDictionaryRemoveValue(newConfiguration, *(currentProxy->keyEnable)); if (currentProxy->keyProxy != NULL) { CFDictionaryRemoveValue(newConfiguration, *(currentProxy->keyProxy)); @@ -1381,6 +1370,9 @@ set_protocol_proxies(int argc, char **argv, CFMutableDictionaryRef newConfigurat #pragma mark SMB +#if !TARGET_OS_IPHONE + + static CFStringRef __cleanupName(CFStringRef name) { @@ -1544,7 +1536,7 @@ static options smbOptions[] = { " set protocol name NetBIOS-name\n" " set protocol type (Broadcast|Peer|Mixed|Hybrid)\n" " set protocol workgroup SMB-workgroup\n" - " set protocol wins x1.x1.x1.x1[,x2.x2.x2.x2]" + " set protocol wins x1.x1.x1.x1[,x2.x2.x2.x2]\n" } }; #define N_SMB_OPTIONS (sizeof(smbOptions) / sizeof(smbOptions[0])) @@ -1560,6 +1552,9 @@ set_protocol_smb(int argc, char **argv, CFMutableDictionaryRef newConfiguration) } +#endif // !TARGET_OS_IPHONE + + #pragma mark - #pragma mark *Protocol* @@ -1595,9 +1590,7 @@ set_protocol(int argc, char **argv) } protocolType = SCNetworkProtocolGetProtocolType(net_protocol); - if (CFEqual(protocolType, kSCNetworkProtocolTypeAppleTalk)) { - ok = set_protocol_appletalk(argc, argv, newConfiguration); - } else if (CFEqual(protocolType, kSCNetworkProtocolTypeDNS)) { + if (CFEqual(protocolType, kSCNetworkProtocolTypeDNS)) { ok = set_protocol_dns(argc, argv, newConfiguration); } else if (CFEqual(protocolType, kSCNetworkProtocolTypeIPv4)) { ok = set_protocol_ipv4(argc, argv, newConfiguration); @@ -1605,8 +1598,14 @@ set_protocol(int argc, char **argv) ok = set_protocol_ipv6(argc, argv, newConfiguration); } else if (CFEqual(protocolType, kSCNetworkProtocolTypeProxies)) { ok = set_protocol_proxies(argc, argv, newConfiguration); +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK + } else if (CFEqual(protocolType, kSCNetworkProtocolTypeAppleTalk)) { + ok = set_protocol_appletalk(argc, argv, newConfiguration); +#endif // !TARGET_OS_IPHONE && INCLUDE_APPLETALK +#if !TARGET_OS_IPHONE } else if (CFEqual(protocolType, kSCNetworkProtocolTypeSMB)) { ok = set_protocol_smb(argc, argv, newConfiguration); +#endif // !TARGET_OS_IPHONE } else { SCPrint(TRUE, stdout, CFSTR("this protocols configuration cannot be changed\n")); } @@ -1768,17 +1767,7 @@ _protocol_description(SCNetworkProtocolRef protocol, Boolean skipEmpty) } protocolType = SCNetworkProtocolGetProtocolType(protocol); - if (CFEqual(protocolType, kSCNetworkProtocolTypeAppleTalk)) { - CFStringRef method; - - method = CFDictionaryGetValue(configuration, kSCPropNetAppleTalkConfigMethod); - if (isA_CFString(method)) { - CFStringAppendFormat(description, - NULL, - CFSTR("%@"), - method); - } - } else if (CFEqual(protocolType, kSCNetworkProtocolTypeDNS)) { + if (CFEqual(protocolType, kSCNetworkProtocolTypeDNS)) { CFStringRef domain; CFArrayRef search; CFArrayRef servers; @@ -1880,6 +1869,19 @@ _protocol_description(SCNetworkProtocolRef protocol, Boolean skipEmpty) CFStringGetLength(description) > 0 ? ", " : "", currentProxy->proxy); } +#if !TARGET_OS_IPHONE && INCLUDE_APPLETALK + } else if (CFEqual(protocolType, kSCNetworkProtocolTypeAppleTalk)) { + CFStringRef method; + + method = CFDictionaryGetValue(configuration, kSCPropNetAppleTalkConfigMethod); + if (isA_CFString(method)) { + CFStringAppendFormat(description, + NULL, + CFSTR("%@"), + method); + } +#endif // !TARGET_OS_IPHONE && INCLUDE_APPLETALK +#if !TARGET_OS_IPHONE } else if (CFEqual(protocolType, kSCNetworkProtocolTypeSMB)) { CFStringRef name; CFArrayRef servers; @@ -1913,6 +1915,7 @@ _protocol_description(SCNetworkProtocolRef protocol, Boolean skipEmpty) str); CFRelease(str); } +#endif // !TARGET_OS_IPHONE } done : diff --git a/scutil.tproj/net_service.c b/scutil.tproj/net_service.c index af198bb..507ccff 100644 --- a/scutil.tproj/net_service.c +++ b/scutil.tproj/net_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -266,9 +266,11 @@ create_service(int argc, char **argv) interface = net_interface; } else { - interface = _find_interface(argv[0]); - argv++; - argc--; + int nArgs; + + interface = _find_interface(argc, argv, &nArgs); + argv += nArgs; + argc -= nArgs; } if (interface == NULL) { @@ -291,8 +293,8 @@ create_service(int argc, char **argv) Boolean ok; serviceName = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); - argv++; - argc--; +// argv++; +// argc--; ok = SCNetworkServiceSetName(service, serviceName); CFRelease(serviceName); @@ -303,6 +305,13 @@ create_service(int argc, char **argv) } } + ok = SCNetworkServiceEstablishDefaultConfiguration(service); + if (!ok) { + SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError())); + (void)SCNetworkServiceRemove(service); + goto done; + } + ok = SCNetworkSetAddService(net_set, service); if (!ok) { SCPrint(TRUE, stdout, CFSTR("service not created: %s\n"), SCErrorString(SCError())); @@ -336,7 +345,8 @@ create_service(int argc, char **argv) } if (net_interface != NULL) CFRelease(net_interface); - net_interface = CFRetain(interface); + net_interface = SCNetworkServiceGetInterface(net_service); + CFRetain(net_interface); interfaceName = SCNetworkInterfaceGetLocalizedDisplayName(interface); if (interfaceName == NULL) { @@ -690,6 +700,54 @@ set_service(int argc, char **argv) SCPrint(TRUE, stdout, CFSTR("set what?\n")); return; } + } else if (strcmp(command, "rank") == 0) { + SCNetworkServicePrimaryRank rank = kSCNetworkServicePrimaryRankDefault; + SCNetworkServiceRef service = (argc < 2) ? net_service : NULL; + + if (argc < 1) { + SCPrint(TRUE, stdout, CFSTR("rank not specified\n")); + return; + } + + if (strlen(argv[0]) > 0) { + if (strcasecmp(argv[0], "Never") == 0) { + rank = kSCNetworkServicePrimaryRankNever; + } else if ((service != net_service) && (strcasecmp(argv[0], "First") == 0)) { + rank = kSCNetworkServicePrimaryRankFirst; + } else if ((service != net_service) && (strcasecmp(argv[0], "Last") == 0)) { + rank = kSCNetworkServicePrimaryRankLast; + } else { + SCPrint(TRUE, stdout, CFSTR("rank not valid\n")); + return; + } + } + argv++; + argc--; + + if (service == NULL) { + CFStringRef serviceID; + SCDynamicStoreRef store; + + store = SCDynamicStoreCreate(NULL, + CFSTR("scutil (set primary rank)"), + NULL, + NULL); + serviceID = SCNetworkServiceGetServiceID(net_service); + service = _SCNetworkServiceCopyActive(store, serviceID); + CFRelease(store); + + argv++; + argc--; + } + + ok = SCNetworkServiceSetPrimaryRank(service, rank); + if (service != net_service) CFRelease(service); + if (ok) { + if (service == net_service) _prefs_changed = TRUE; + } else { + SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError())); + return; + } } else { SCPrint(TRUE, stdout, CFSTR("set what?\n")); } @@ -772,10 +830,11 @@ __private_extern__ void show_service(int argc, char **argv) { - SCNetworkInterfaceRef interface; - CFArrayRef protocols; - SCNetworkServiceRef service; - CFStringRef serviceName; + SCNetworkInterfaceRef interface; + CFArrayRef protocols; + SCNetworkServiceRef service; + CFStringRef serviceName; + SCNetworkServicePrimaryRank serviceRank; if (argc == 1) { service = _find_service(argv[0]); @@ -798,6 +857,25 @@ show_service(int argc, char **argv) SCPrint(TRUE, stdout, CFSTR("name = %@\n"), (serviceName != NULL) ? serviceName : CFSTR("")); + serviceRank = SCNetworkServiceGetPrimaryRank(service); + switch (serviceRank) { + case kSCNetworkServicePrimaryRankDefault : + // nothing to report + break; + case kSCNetworkServicePrimaryRankFirst : + SCPrint(TRUE, stdout, CFSTR("primary rank = FIRST\n")); + break; + case kSCNetworkServicePrimaryRankLast : + SCPrint(TRUE, stdout, CFSTR("primary rank = LAST\n")); + break; + case kSCNetworkServicePrimaryRankNever : + SCPrint(TRUE, stdout, CFSTR("primary rank = NEVER\n")); + break; + default : + SCPrint(TRUE, stdout, CFSTR("primary rank = %d\n"), serviceRank); + break; + } + interface = SCNetworkServiceGetInterface(service); if (interface != NULL) { CFStringRef interfaceName; diff --git a/scutil.tproj/net_set.c b/scutil.tproj/net_set.c index 7677279..fa528f4 100644 --- a/scutil.tproj/net_set.c +++ b/scutil.tproj/net_set.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004, 2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -242,8 +242,8 @@ create_set(int argc, char **argv) Boolean ok; setName = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); - argv++; - argc--; +// argv++; +// argc--; ok = SCNetworkSetSetName(set, setName); CFRelease(setName); @@ -529,7 +529,6 @@ show_set(int argc, char **argv) CFIndex n; CFIndex nOrder = 0; CFArrayRef order; - CFMutableArrayRef sorted = (CFMutableArrayRef)services; order = SCNetworkSetGetServiceOrder(set); if (order != NULL) { @@ -538,11 +537,15 @@ show_set(int argc, char **argv) n = CFArrayGetCount(services); if (n > 1) { + CFMutableArrayRef sorted; + sorted = CFArrayCreateMutableCopy(NULL, 0, services); CFArraySortValues(sorted, CFRangeMake(0, CFArrayGetCount(sorted)), _compare_services, (void *)order); + CFRelease(services); + services = sorted; } SCPrint(TRUE, stdout, CFSTR("services =\n")); @@ -553,7 +556,7 @@ show_set(int argc, char **argv) CFStringRef serviceName; CFStringRef serviceID; - service = CFArrayGetValueAtIndex(sorted, i); + service = CFArrayGetValueAtIndex(services, i); serviceID = SCNetworkServiceGetServiceID(service); serviceName = SCNetworkServiceGetName(service); if (serviceName == NULL) serviceName = CFSTR(""); @@ -582,8 +585,6 @@ show_set(int argc, char **argv) } CFRelease(services); - - if (sorted != services) CFRelease(sorted); } if (_sc_debug) { diff --git a/scutil.tproj/notifications.c b/scutil.tproj/notifications.c index 8cb779f..8bf91c2 100644 --- a/scutil.tproj/notifications.c +++ b/scutil.tproj/notifications.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004, 2008, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -309,7 +309,7 @@ notificationWatcherVerbose(SCDynamicStoreRef store, void *arg) { SCPrint(TRUE, stdout, CFSTR("notification callback (store address = %p).\n"), store); SCPrint(TRUE, stdout, CFSTR(" arg = %s.\n"), (char *)arg); - do_notify_changes(0, NULL); /* report the keys which changed */ + do_notify_changes(0, NULL); /* report the keys that changed */ return TRUE; } @@ -386,6 +386,9 @@ do_notify_file(int argc, char **argv) SCPrint(TRUE, stdout, CFSTR(" Received notification, identifier = %d.\n"), buf.gotID); } + /* report the keys that changed */ + do_notify_changes(0, NULL); + /* this utility only allows processes one notification per "n.file" request */ (void) SCDynamicStoreNotifyCancel(store); @@ -412,7 +415,6 @@ do_notify_signal(int argc, char **argv) int sig; pid_t pid; struct sigaction nact; - int ret; if (isdigit(*argv[0])) { if ((sscanf(argv[0], "%d", &sig) != 1) || (sig <= 0) || (sig >= NSIG)) { @@ -451,7 +453,7 @@ do_notify_signal(int argc, char **argv) } if (oact != NULL) { - ret = sigaction(osig, oact, NULL); /* restore original signal handler */ + (void) sigaction(osig, oact, NULL); /* restore original signal handler */ } else { oact = malloc(sizeof(struct sigaction)); } @@ -459,7 +461,7 @@ do_notify_signal(int argc, char **argv) nact.sa_handler = signalCatcher; sigemptyset(&nact.sa_mask); nact.sa_flags = SA_RESTART; - ret = sigaction(sig, &nact, oact); + (void) sigaction(sig, &nact, oact); osig = sig; SCPrint(TRUE, stdout, CFSTR("signal handler started.\n")); @@ -476,8 +478,6 @@ __private_extern__ void do_notify_cancel(int argc, char **argv) { - int ret; - if (notifyRls) { CFRunLoopSourceInvalidate(notifyRls); CFRelease(notifyRls); @@ -495,7 +495,7 @@ do_notify_cancel(int argc, char **argv) } if (oact != NULL) { - ret = sigaction(osig, oact, NULL); /* restore original signal handler */ + (void) sigaction(osig, oact, NULL); /* restore original signal handler */ free(oact); oact = NULL; } diff --git a/scutil.tproj/prefs.c b/scutil.tproj/prefs.c index 7137e0c..1ecf86e 100644 --- a/scutil.tproj/prefs.c +++ b/scutil.tproj/prefs.c @@ -35,7 +35,9 @@ #include #include +#if !TARGET_OS_IPHONE #include +#endif /* !TARGET_OS_IPHONE */ #include "scutil.h" #include "commands.h" @@ -45,6 +47,7 @@ /* -------------------- */ +#if !TARGET_OS_IPHONE static void * __loadSecurity(void) { static void *image = NULL; @@ -118,7 +121,7 @@ _createAuthorization() return authorization; } - +#endif /* !TARGET_OS_IPHONE */ /* -------------------- */ @@ -133,7 +136,11 @@ _prefs_open(CFStringRef name, CFStringRef prefsID) if (geteuid() == 0) { prefs = SCPreferencesCreate(NULL, name, prefsID); } else { +#if !TARGET_OS_IPHONE authorization = _createAuthorization(); +#else /* !TARGET_OS_IPHONE */ + authorization = NULL; +#endif /* !TARGET_OS_IPHONE */ prefs = SCPreferencesCreateWithAuthorization(NULL, name, prefsID, authorization); } @@ -190,8 +197,12 @@ _prefs_close() } if (authorization != NULL) { +#if !TARGET_OS_IPHONE AuthorizationFree(authorization, kAuthorizationFlagDefaults); // AuthorizationFree(authorization, kAuthorizationFlagDestroyRights); +#else /* !TARGET_OS_IPHONE */ + // Uh...if authorization isn't NULL, something went horribly wrong. +#endif /* !TARGET_OS_IPHONE */ authorization = NULL; } @@ -287,7 +298,6 @@ get_ComputerName(int argc, char **argv) static void set_ComputerName(int argc, char **argv) { - CFStringEncoding encoding; CFStringRef hostname; Boolean ok; @@ -302,13 +312,11 @@ set_ComputerName(int argc, char **argv) if (argc == 0) { hostname = _copyStringFromSTDIN(); - encoding = kCFStringEncodingUTF8; } else { - hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII); - encoding = kCFStringEncodingASCII; + hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); } - ok = SCPreferencesSetComputerName(prefs, hostname, encoding); + ok = SCPreferencesSetComputerName(prefs, hostname, kCFStringEncodingUTF8); if (hostname != NULL) CFRelease(hostname); if (!ok) { SCPrint(TRUE, @@ -385,7 +393,7 @@ set_HostName(int argc, char **argv) if (argc == 0) { hostname = _copyStringFromSTDIN(); } else { - hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII); + hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); } ok = SCPreferencesSetHostName(prefs, hostname); @@ -455,7 +463,7 @@ set_LocalHostName(int argc, char **argv) if (argc == 0) { hostname = _copyStringFromSTDIN(); } else { - hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII); + hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); } ok = SCPreferencesSetLocalHostName(prefs, hostname); diff --git a/scutil.tproj/scutil.8 b/scutil.tproj/scutil.8 index 3db9c7c..3350639 100644 --- a/scutil.tproj/scutil.8 +++ b/scutil.tproj/scutil.8 @@ -1,7 +1,7 @@ .\" .\" @(#)scutil.8 .\" -.Dd November 4, 2003 +.Dd January 23, 2008 .Dt SCUTIL 8 .Os "Mac OS X" .Sh NAME @@ -14,7 +14,9 @@ .Fl -prefs Op preference-file .Br .Nm -.Fl r Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc +.Fl r +.Op Fl W +.Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc .Br .Nm .Fl w Ar dynamic-store-key Op Fl t Ar timeout @@ -70,7 +72,7 @@ the current host and the specified host. The .Fl w option provides a means of checking for (and optionally waiting for the -creation of) a dynamic store key. +creation of or posting of a notification to) a dynamic store key. .Pp The .Fl -get @@ -105,7 +107,7 @@ option reports the current system proxy configuration. .\"option provides a means of managing the system's network configuration. .Sh OPTIONS .Bl -tag -width xx -.It Fl r Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc +.It Fl r Oo Fl W Oc Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc Check the network reachability of the specified host name, IP address, or a pair of local and remote IP addresses. One or more of the following strings will be reported to standard output. @@ -139,6 +141,12 @@ Network traffic to the specified nodename/address will not go through a gateway but is routed directly to one of the interfaces on the system. .El .Pp +The reachability can also be monitored by specifying the +.Fl W +(watch) option. +This will result in the current status being reported as well as the +status when/if the network configuration changes. +.Pp A zero exit status will be returned when the reachability status is reported correctly. A non-zero exit status will be returned if errors are detected with an error reported to standard error. .It Fl w Ar dynamic-store-key Op Fl t Ar timeout @@ -151,8 +159,10 @@ If present, will return with a zero exit status. If not present, .Nm -will wait for the specified time for the key to be established. -A non-zero exit status will be returned if the key was not created within the specified time. +will wait for the specified time for data to be associated with or a notification +to be posted using the key. +A non-zero exit status will be returned if the key was not created/posted +within the specified time. .Pp .Nm will wait indefinitely if a timeout of 0 seconds is specified. diff --git a/scutil.tproj/scutil.c b/scutil.tproj/scutil.c index 9776c29..4e7f3a1 100644 --- a/scutil.tproj/scutil.c +++ b/scutil.tproj/scutil.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -67,8 +67,6 @@ #include "session.h" #include "tests.h" -#include "SCDynamicStoreInternal.h" - #define LINE_LENGTH 256 @@ -252,10 +250,10 @@ usage(const char *command) SCPrint(TRUE, stderr, CFSTR(" or: %s --prefs\n"), command); SCPrint(TRUE, stderr, CFSTR("\tinteractive access to the [raw] stored preferences.\n")); SCPrint(TRUE, stderr, CFSTR("\n")); - SCPrint(TRUE, stderr, CFSTR(" or: %s -r nodename\n"), command); - SCPrint(TRUE, stderr, CFSTR(" or: %s -r address\n"), command); - SCPrint(TRUE, stderr, CFSTR(" or: %s -r local-address remote-address\n"), command); - SCPrint(TRUE, stderr, CFSTR("\tcheck reachability of node, address, or address pair.\n")); + SCPrint(TRUE, stderr, CFSTR(" or: %s [-W] -r nodename\n"), command); + SCPrint(TRUE, stderr, CFSTR(" or: %s [-W] -r address\n"), command); + SCPrint(TRUE, stderr, CFSTR(" or: %s [-W] -r local-address remote-address\n"), command); + SCPrint(TRUE, stderr, CFSTR("\tcheck reachability of node, address, or address pair (-W to \"watch\").\n")); SCPrint(TRUE, stderr, CFSTR("\n")); SCPrint(TRUE, stderr, CFSTR(" or: %s -w dynamic-store-key [ -t timeout ]\n"), command); SCPrint(TRUE, stderr, CFSTR("\t-w\twait for presense of dynamic store key\n")); @@ -309,11 +307,12 @@ main(int argc, char * const argv[]) InputRef src; int timeout = 15; /* default timeout (in seconds) */ char *wait = NULL; + Boolean watch = FALSE; int xStore = 0; /* non dynamic store command line options */ /* process any arguments */ - while ((opt = getopt_long(argc, argv, "dvprt:w:", longopts, &opti)) != -1) + while ((opt = getopt_long(argc, argv, "dvprt:w:W", longopts, &opti)) != -1) switch(opt) { case 'd': _sc_debug = TRUE; @@ -337,6 +336,9 @@ main(int argc, char * const argv[]) wait = optarg; xStore++; break; + case 'W': + watch = TRUE; + break; case 0: if (strcmp(longopts[opti].name, "dns") == 0) { doDNS = TRUE; @@ -370,12 +372,16 @@ main(int argc, char * const argv[]) usage(prog); } - /* are we checking the reachability of a host/address */ + /* are we checking (or watching) the reachability of a host/address */ if (doReach) { - if ((argc < 1) || (argc > 2)) { + if (argc < 1) { usage(prog); } - do_checkReachability(argc, (char **)argv); + if (watch) { + do_watchReachability(argc, (char **)argv); + } else { + do_checkReachability(argc, (char **)argv); + } /* NOT REACHED */ } @@ -484,9 +490,13 @@ main(int argc, char * const argv[]) } } - while (process_line(src) == TRUE) { - /* debug information, diagnostics */ - __showMachPortStatus(); + while (TRUE) { + Boolean ok; + + ok = process_line(src); + if (!ok) { + break; + } } /* close the socket, free resources */ diff --git a/scutil.tproj/tests.c b/scutil.tproj/tests.c index 333d207..d9d316a 100644 --- a/scutil.tproj/tests.c +++ b/scutil.tproj/tests.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -39,6 +39,8 @@ #include "scutil.h" #include "tests.h" +#include +#include #include #include #include @@ -46,112 +48,234 @@ #include -__private_extern__ -void -do_checkReachability(int argc, char **argv) +static SCNetworkReachabilityRef +_setupReachability(int argc, char **argv, SCNetworkReachabilityContext *context) { - SCNetworkConnectionFlags flags = 0; + struct sockaddr_in sin; + struct sockaddr_in6 sin6; SCNetworkReachabilityRef target = NULL; - if (argc == 1) { - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; + bzero(&sin, sizeof(sin)); + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; - bzero(&sin6, sizeof(sin6)); - sin6.sin6_len = sizeof(sin6); - sin6.sin6_family = AF_INET6; + bzero(&sin6, sizeof(sin6)); + sin6.sin6_len = sizeof(sin6); + sin6.sin6_family = AF_INET6; - if (inet_aton(argv[0], &sin.sin_addr) == 1) { + if (inet_aton(argv[0], &sin.sin_addr) == 1) { + if (argc == 1) { target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin); - } else if (inet_pton(AF_INET6, argv[0], &sin6.sin6_addr) == 1) { - char *p; + if (context != NULL) { + context->info = "by address"; + } + } else { + struct sockaddr_in r_sin; + + bzero(&r_sin, sizeof(r_sin)); + r_sin.sin_len = sizeof(r_sin); + r_sin.sin_family = AF_INET; + if (inet_aton(argv[1], &r_sin.sin_addr) == 0) { + SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), argv[1]); + exit(1); + } - p = strchr(argv[0], '%'); - if (p != NULL) { - sin6.sin6_scope_id = if_nametoindex(p + 1); + target = SCNetworkReachabilityCreateWithAddressPair(NULL, + (struct sockaddr *)&sin, + (struct sockaddr *)&r_sin); + if (context != NULL) { + context->info = "by address pair"; } + } + } else if (inet_pton(AF_INET6, argv[0], &sin6.sin6_addr) == 1) { + char *p; + + p = strchr(argv[0], '%'); + if (p != NULL) { + sin6.sin6_scope_id = if_nametoindex(p + 1); + } + if (argc == 1) { target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin6); + if (context != NULL) { + context->info = "by (v6) address"; + } } else { - target = SCNetworkReachabilityCreateWithName(NULL, argv[0]); - } - } else /* if (argc == 2) */ { - struct sockaddr_in l_sin; - struct sockaddr_in r_sin; - - bzero(&l_sin, sizeof(l_sin)); - l_sin.sin_len = sizeof(l_sin); - l_sin.sin_family = AF_INET; - if (inet_aton(argv[0], &l_sin.sin_addr) == 0) { - SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), argv[0]); - exit(1); - } + struct sockaddr_in6 r_sin6; + + bzero(&r_sin6, sizeof(r_sin6)); + r_sin6.sin6_len = sizeof(r_sin6); + r_sin6.sin6_family = AF_INET6; + if (inet_pton(AF_INET6, argv[1], &r_sin6.sin6_addr) == 0) { + SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), argv[1]); + exit(1); + } - bzero(&r_sin, sizeof(r_sin)); - r_sin.sin_len = sizeof(r_sin); - r_sin.sin_family = AF_INET; - if (inet_aton(argv[1], &r_sin.sin_addr) == 0) { - SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), argv[1]); - exit(1); - } + p = strchr(argv[1], '%'); + if (p != NULL) { + r_sin6.sin6_scope_id = if_nametoindex(p + 1); + } - target = SCNetworkReachabilityCreateWithAddressPair(NULL, - (struct sockaddr *)&l_sin, - (struct sockaddr *)&r_sin); + target = SCNetworkReachabilityCreateWithAddressPair(NULL, + (struct sockaddr *)&sin6, + (struct sockaddr *)&r_sin6); + if (context != NULL) { + context->info = "by (v6) address pair"; + } + } + } else { + if (argc == 1) { + target = SCNetworkReachabilityCreateWithName(NULL, argv[0]); + if (context != NULL) { + context->info = "by name"; + } + } else { + CFStringRef str; + CFMutableDictionaryRef options; + + options = CFDictionaryCreateMutable(NULL, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + if (strlen(argv[0]) > 0) { + str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); + CFDictionarySetValue(options, kSCNetworkReachabilityOptionNodeName, str); + CFRelease(str); + } + if (strlen(argv[1]) > 0) { + str = CFStringCreateWithCString(NULL, argv[1], kCFStringEncodingUTF8); + CFDictionarySetValue(options, kSCNetworkReachabilityOptionServName, str); + CFRelease(str); + } + if (argc > 2) { + CFDataRef data; + struct addrinfo hints = { 0 }; + int i; + + for (i = 2; i < argc; i++) { + if (strcasecmp(argv[i], "AI_ADDRCONFIG") == 0) { + hints.ai_flags |= AI_ADDRCONFIG; + } else if (strcasecmp(argv[i], "AI_ALL") == 0) { + hints.ai_flags |= AI_ALL; + } else if (strcasecmp(argv[i], "AI_V4MAPPED") == 0) { + hints.ai_flags |= AI_V4MAPPED; + } else if (strcasecmp(argv[i], "AI_V4MAPPED_CFG") == 0) { + hints.ai_flags |= AI_V4MAPPED_CFG; + } else if (strcasecmp(argv[i], "AI_ADDRCONFIG") == 0) { + hints.ai_flags |= AI_ADDRCONFIG; + } else if (strcasecmp(argv[i], "AI_V4MAPPED") == 0) { + hints.ai_flags |= AI_V4MAPPED; + } else if (strcasecmp(argv[i], "AI_DEFAULT") == 0) { + hints.ai_flags |= AI_DEFAULT; +#ifdef AI_PARALLEL + } else if (strcasecmp(argv[i], "AI_PARALLEL") == 0) { + hints.ai_flags |= AI_PARALLEL; +#endif // AI_PARALLEL + } else if (strcasecmp(argv[i], "PF_INET") == 0) { + hints.ai_family = PF_INET; + } else if (strcasecmp(argv[i], "PF_INET6") == 0) { + hints.ai_family = PF_INET6; + } else if (strcasecmp(argv[i], "SOCK_STREAM") == 0) { + hints.ai_socktype = SOCK_STREAM; + } else if (strcasecmp(argv[i], "SOCK_DGRAM") == 0) { + hints.ai_socktype = SOCK_DGRAM; + } else if (strcasecmp(argv[i], "SOCK_RAW") == 0) { + hints.ai_socktype = SOCK_RAW; + } else if (strcasecmp(argv[i], "IPPROTO_TCP") == 0) { + hints.ai_protocol = IPPROTO_TCP; + } else if (strcasecmp(argv[i], "IPPROTO_UDP") == 0) { + hints.ai_protocol = IPPROTO_UDP; + } else { + SCPrint(TRUE, stderr, CFSTR("Unrecognized hint: %s\n"), argv[i]); + exit(1); + } + } + + data = CFDataCreate(NULL, (const UInt8 *)&hints, sizeof(hints)); + CFDictionarySetValue(options, kSCNetworkReachabilityOptionHints, data); + CFRelease(data); + } + if (CFDictionaryGetCount(options) > 0) { + target = SCNetworkReachabilityCreateWithOptions(NULL, options); + if (context != NULL) { + context->info = "by (node and/or serv) name"; + } + } else { + SCPrint(TRUE, stderr, CFSTR("Must specify nodename or servname\n")); + exit(1); + } + CFRelease(options); + } } - if (!target) { - SCPrint(TRUE, stderr, CFSTR(" Could not determine status: %s\n"), SCErrorString(SCError())); - exit(1); - } + return target; +} - if (!SCNetworkReachabilityGetFlags(target, &flags)) { - SCPrint(TRUE, stderr, CFSTR(" Could not determine status: %s\n"), SCErrorString(SCError())); - exit(1); +static void +_printReachability(SCNetworkReachabilityRef target) +{ + SCNetworkReachabilityFlags flags; + Boolean ok; + + ok = SCNetworkReachabilityGetFlags(target, &flags); + if (!ok) { + printf(" could not determine reachability, %s\n", SCErrorString(SCError())); + return; } - SCPrint(_sc_debug, stdout, CFSTR("flags = 0x%x"), flags); + SCPrint(_sc_debug, stdout, CFSTR("flags = 0x%08x"), flags); if (flags != 0) { SCPrint(_sc_debug, stdout, CFSTR(" (")); - if (flags & kSCNetworkFlagsReachable) { + if (flags & kSCNetworkReachabilityFlagsReachable) { SCPrint(TRUE, stdout, CFSTR("Reachable")); - flags &= ~kSCNetworkFlagsReachable; + flags &= ~kSCNetworkReachabilityFlagsReachable; SCPrint(flags != 0, stdout, CFSTR(",")); } - if (flags & kSCNetworkFlagsTransientConnection) { + if (flags & kSCNetworkReachabilityFlagsTransientConnection) { SCPrint(TRUE, stdout, CFSTR("Transient Connection")); - flags &= ~kSCNetworkFlagsTransientConnection; + flags &= ~kSCNetworkReachabilityFlagsTransientConnection; SCPrint(flags != 0, stdout, CFSTR(",")); } - if (flags & kSCNetworkFlagsConnectionRequired) { + if (flags & kSCNetworkReachabilityFlagsConnectionRequired) { SCPrint(TRUE, stdout, CFSTR("Connection Required")); - flags &= ~kSCNetworkFlagsConnectionRequired; + flags &= ~kSCNetworkReachabilityFlagsConnectionRequired; + SCPrint(flags != 0, stdout, CFSTR(",")); + } + if (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) { + SCPrint(TRUE, stdout, CFSTR("Automatic Connection On Traffic")); + flags &= ~kSCNetworkReachabilityFlagsConnectionOnTraffic; SCPrint(flags != 0, stdout, CFSTR(",")); } - if (flags & kSCNetworkFlagsConnectionAutomatic) { - SCPrint(TRUE, stdout, CFSTR("Connection Automatic")); - flags &= ~kSCNetworkFlagsConnectionAutomatic; + if (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) { + SCPrint(TRUE, stdout, CFSTR("Automatic Connection On Demand")); + flags &= ~kSCNetworkReachabilityFlagsConnectionOnDemand; SCPrint(flags != 0, stdout, CFSTR(",")); } - if (flags & kSCNetworkFlagsInterventionRequired) { + if (flags & kSCNetworkReachabilityFlagsInterventionRequired) { SCPrint(TRUE, stdout, CFSTR("Intervention Required")); - flags &= ~kSCNetworkFlagsInterventionRequired; + flags &= ~kSCNetworkReachabilityFlagsInterventionRequired; SCPrint(flags != 0, stdout, CFSTR(",")); } - if (flags & kSCNetworkFlagsIsLocalAddress) { + if (flags & kSCNetworkReachabilityFlagsIsLocalAddress) { SCPrint(TRUE, stdout, CFSTR("Local Address")); - flags &= ~kSCNetworkFlagsIsLocalAddress; + flags &= ~kSCNetworkReachabilityFlagsIsLocalAddress; SCPrint(flags != 0, stdout, CFSTR(",")); } - if (flags & kSCNetworkFlagsIsDirect) { + if (flags & kSCNetworkReachabilityFlagsIsDirect) { SCPrint(TRUE, stdout, CFSTR("Directly Reachable Address")); - flags &= ~kSCNetworkFlagsIsDirect; + flags &= ~kSCNetworkReachabilityFlagsIsDirect; SCPrint(flags != 0, stdout, CFSTR(",")); } +#if TARGET_OS_IPHONE + if (flags & kSCNetworkReachabilityFlagsIsWWAN) { + SCPrint(TRUE, stdout, CFSTR("WWAN")); + flags &= ~kSCNetworkReachabilityFlagsIsWWAN; + SCPrint(flags != 0, stdout, CFSTR(",")); + } +#endif // TARGET_OS_IPHONE + if (flags != 0) { + SCPrint(TRUE, stdout, CFSTR("0x%08x"), flags); + } SCPrint(_sc_debug, stdout, CFSTR(")")); } else { SCPrint(_sc_debug, stdout, CFSTR(" (")); @@ -159,6 +283,114 @@ do_checkReachability(int argc, char **argv) SCPrint(_sc_debug, stdout, CFSTR(")")); } SCPrint(TRUE, stdout, CFSTR("\n")); + + return; +} + + +__private_extern__ +void +do_checkReachability(int argc, char **argv) +{ + SCNetworkReachabilityRef target; + + target = _setupReachability(argc, argv, NULL); + if (target == NULL) { + SCPrint(TRUE, stderr, CFSTR(" Could not determine status: %s\n"), SCErrorString(SCError())); + exit(1); + } + + _printReachability(target); + CFRelease(target); + exit(0); +} + + +static void +callout(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info) +{ + static int n = 3; + struct tm tm_now; + struct timeval tv_now; + + (void)gettimeofday(&tv_now, NULL); + (void)localtime_r(&tv_now.tv_sec, &tm_now); + + SCPrint(TRUE, stdout, CFSTR("\n*** %2d:%02d:%02d.%03d\n\n"), + tm_now.tm_hour, + tm_now.tm_min, + tm_now.tm_sec, + tv_now.tv_usec / 1000); + SCPrint(TRUE, stdout, CFSTR("%2d: callback w/flags=0x%08x (info=\"%s\")\n"), n++, flags, (char *)info); + SCPrint(TRUE, stdout, CFSTR(" %@\n"), target); + _printReachability(target); + SCPrint(TRUE, stdout, CFSTR("\n")); + return; +} + + +__private_extern__ +void +do_watchReachability(int argc, char **argv) +{ + SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL }; + SCNetworkReachabilityRef target; + SCNetworkReachabilityRef target_async; + + target = _setupReachability(argc, argv, NULL); + if (target == NULL) { + SCPrint(TRUE, stderr, CFSTR(" Could not determine status: %s\n"), SCErrorString(SCError())); + exit(1); + } + + target_async = _setupReachability(argc, argv, &context); + if (target_async == NULL) { + SCPrint(TRUE, stderr, CFSTR(" Could not determine status: %s\n"), SCErrorString(SCError())); + exit(1); + } + + // Normally, we don't want to make any calls to SCNetworkReachabilityGetFlags() + // until after the "target" has been scheduled on a run loop. Otherwise, we'll + // end up making a synchronous DNS request and that's not what we want. + // + // But, to test the case were an application call SCNetworkReachabilityGetFlags() + // we provide the "CHECK_REACHABILITY_BEFORE_SCHEDULING" environment variable. + if (getenv("CHECK_REACHABILITY_BEFORE_SCHEDULING") != NULL) { + CFRelease(target_async); + target_async = CFRetain(target); + } + + // Direct check of reachability + SCPrint(TRUE, stdout, CFSTR(" 0: direct\n")); + SCPrint(TRUE, stdout, CFSTR(" %@\n"), target); + _printReachability(target); + CFRelease(target); + SCPrint(TRUE, stdout, CFSTR("\n")); + + // schedule the target + SCPrint(TRUE, stdout, CFSTR(" 1: start\n")); + SCPrint(TRUE, stdout, CFSTR(" %@\n"), target_async); + //_printReachability(target_async); + SCPrint(TRUE, stdout, CFSTR("\n")); + + if (!SCNetworkReachabilitySetCallback(target_async, callout, &context)) { + printf("SCNetworkReachabilitySetCallback() failed: %s\n", SCErrorString(SCError())); + exit(1); + } + + if (!SCNetworkReachabilityScheduleWithRunLoop(target_async, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) { + printf("SCNetworkReachabilityScheduleWithRunLoop() failed: %s\n", SCErrorString(SCError())); + exit(1); + } + + // Note: now that we are scheduled on a run loop we can call SCNetworkReachabilityGetFlags() + // to get the current status. For "names", a DNS lookup has already been initiated. + SCPrint(TRUE, stdout, CFSTR(" 2: on runloop\n")); + SCPrint(TRUE, stdout, CFSTR(" %@\n"), target_async); + _printReachability(target_async); + SCPrint(TRUE, stdout, CFSTR("\n")); + + CFRunLoopRun(); exit(0); } @@ -197,10 +429,12 @@ do_showDNSConfiguration(int argc, char **argv) } for (i = 0; i < resolver->n_sortaddr; i++) { - SCPrint(TRUE, stdout, CFSTR(" sortaddr[%d] : %s/%s\n"), - i, - inet_ntoa(resolver->sortaddr[i]->address), - inet_ntoa(resolver->sortaddr[i]->mask)); + char abuf[32]; + char mbuf[32]; + + (void)inet_ntop(AF_INET, &resolver->sortaddr[i]->address, abuf, sizeof(abuf)); + (void)inet_ntop(AF_INET, &resolver->sortaddr[i]->mask, mbuf, sizeof(mbuf)); + SCPrint(TRUE, stdout, CFSTR(" sortaddr[%d] : %s/%s\n"), i, abuf, mbuf); } if (resolver->options != NULL) { @@ -238,6 +472,7 @@ do_showProxyConfiguration(int argc, char **argv) proxies = SCDynamicStoreCopyProxies(NULL); if (proxies != NULL) { SCPrint(TRUE, stdout, CFSTR("%@\n"), proxies); + CFRelease(proxies); } else { SCPrint(TRUE, stdout, CFSTR("No proxy configuration available\n")); } @@ -278,6 +513,7 @@ do_wait(char *waitKey, int timeout) struct itimerval itv; CFStringRef key; CFMutableArrayRef keys; + Boolean ok; store = SCDynamicStoreCreate(NULL, CFSTR("scutil (wait)"), waitKeyFound, NULL); if (store == NULL) { @@ -286,11 +522,13 @@ do_wait(char *waitKey, int timeout) exit(1); } - keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); key = CFStringCreateWithCString(NULL, waitKey, kCFStringEncodingUTF8); - CFArrayAppendValue(keys, key); - if (!SCDynamicStoreSetNotificationKeys(store, keys, NULL)) { + keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); + CFArrayAppendValue(keys, key); + ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL); + CFRelease(keys); + if (!ok) { SCPrint(TRUE, stderr, CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s\n"), SCErrorString(SCError())); exit(1); @@ -331,7 +569,7 @@ do_wait(char *waitKey, int timeout) CFRunLoopSourceRef notifyRls = NULL; SCDynamicStoreRef store = NULL; CFPropertyListRef value = NULL; - + int main(int argc, char **argv) { diff --git a/scutil.tproj/tests.h b/scutil.tproj/tests.h index f1ea819..6de629b 100644 --- a/scutil.tproj/tests.h +++ b/scutil.tproj/tests.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2001, 2004, 2007 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -41,6 +41,7 @@ __BEGIN_DECLS void do_checkReachability (int argc, char **argv); +void do_watchReachability (int argc, char **argv); void do_showDNSConfiguration (int argc, char **argv); void do_showProxyConfiguration (int argc, char **argv); void do_snapshot (int argc, char **argv); -- 2.45.2